Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
6b21a48b
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6b21a48b
编写于
9月 24, 2013
作者:
L
leonidr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8022555: [macosx] AppleScriptEngine.jar MUST call java.awt.Toolkit.getDefaultToolkit() lazily
Reviewed-by: anthony, serb
上级
194349ff
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
30 addition
and
11 deletion
+30
-11
src/macosx/classes/apple/applescript/AppleScriptEngineFactory.java
...x/classes/apple/applescript/AppleScriptEngineFactory.java
+30
-11
未找到文件。
src/macosx/classes/apple/applescript/AppleScriptEngineFactory.java
浏览文件 @
6b21a48b
/*
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -30,14 +30,9 @@ import java.util.*;
...
@@ -30,14 +30,9 @@ import java.util.*;
import
javax.script.*
;
import
javax.script.*
;
public
class
AppleScriptEngineFactory
implements
ScriptEngineFactory
{
public
class
AppleScriptEngineFactory
implements
ScriptEngineFactory
{
private
static
native
void
initNative
()
;
private
static
volatile
boolean
initialized
=
false
;
static
{
private
static
native
void
initNative
();
java
.
awt
.
Toolkit
.
getDefaultToolkit
();
System
.
loadLibrary
(
"AppleScriptEngine"
);
initNative
();
TRACE
(
"<static-init>"
);
}
static
void
TRACE
(
final
String
str
)
{
static
void
TRACE
(
final
String
str
)
{
// System.out.println(AppleScriptEngineFactory.class.getName() + "." + str);
// System.out.println(AppleScriptEngineFactory.class.getName() + "." + str);
...
@@ -80,6 +75,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
...
@@ -80,6 +75,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
*
*
* @return full name of the ScriptEngine
* @return full name of the ScriptEngine
*/
*/
@Override
public
String
getEngineName
()
{
public
String
getEngineName
()
{
TRACE
(
"getEngineName()"
);
TRACE
(
"getEngineName()"
);
return
ENGINE_NAME
;
return
ENGINE_NAME
;
...
@@ -90,6 +86,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
...
@@ -90,6 +86,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
*
*
* @return version of the ScriptEngine
* @return version of the ScriptEngine
*/
*/
@Override
public
String
getEngineVersion
()
{
public
String
getEngineVersion
()
{
TRACE
(
"getEngineVersion()"
);
TRACE
(
"getEngineVersion()"
);
return
ENGINE_VERSION
;
return
ENGINE_VERSION
;
...
@@ -100,6 +97,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
...
@@ -100,6 +97,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
*
*
* @return name of the language supported by the ScriptEngine(Factory)
* @return name of the language supported by the ScriptEngine(Factory)
*/
*/
@Override
public
String
getLanguageName
()
{
public
String
getLanguageName
()
{
TRACE
(
"getLanguageName()"
);
TRACE
(
"getLanguageName()"
);
return
LANGUAGE
;
return
LANGUAGE
;
...
@@ -110,11 +108,12 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
...
@@ -110,11 +108,12 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
*
*
* @return language version supported by the ScriptEngine(Factory)
* @return language version supported by the ScriptEngine(Factory)
*/
*/
@Override
public
String
getLanguageVersion
()
{
public
String
getLanguageVersion
()
{
TRACE
(
"getLanguageVersion()"
);
TRACE
(
"getLanguageVersion()"
);
return
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
String
>()
{
return
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
String
>()
{
public
String
run
()
{
public
String
run
()
{
final
AppleScriptEngine
engine
=
new
AppleScriptEngine
(
AppleScriptEngineFactory
.
this
);
final
AppleScriptEngine
engine
=
getScriptEngine
(
);
return
engine
.
getLanguageVersion
();
return
engine
.
getLanguageVersion
();
}
}
});
});
...
@@ -126,6 +125,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
...
@@ -126,6 +125,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
*
*
* @return ArrayList of file extensions AppleScript associates with
* @return ArrayList of file extensions AppleScript associates with
*/
*/
@Override
public
List
<
String
>
getExtensions
()
{
public
List
<
String
>
getExtensions
()
{
TRACE
(
"getExtensions()"
);
TRACE
(
"getExtensions()"
);
return
Arrays
.
asList
(
"scpt"
,
"applescript"
,
"app"
);
return
Arrays
.
asList
(
"scpt"
,
"applescript"
,
"app"
);
...
@@ -137,6 +137,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
...
@@ -137,6 +137,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
*
*
* @return ArrayList of mimetypes that AppleScript associates with
* @return ArrayList of mimetypes that AppleScript associates with
*/
*/
@Override
public
List
<
String
>
getMimeTypes
()
{
public
List
<
String
>
getMimeTypes
()
{
TRACE
(
"getMimeTypes()"
);
TRACE
(
"getMimeTypes()"
);
return
Arrays
.
asList
(
"application/x-applescript"
,
"text/plain"
,
"text/applescript"
);
return
Arrays
.
asList
(
"application/x-applescript"
,
"text/plain"
,
"text/applescript"
);
...
@@ -148,6 +149,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
...
@@ -148,6 +149,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
*
*
* @return
* @return
*/
*/
@Override
public
List
<
String
>
getNames
()
{
public
List
<
String
>
getNames
()
{
TRACE
(
"getNames()"
);
TRACE
(
"getNames()"
);
return
Arrays
.
asList
(
"AppleScriptEngine"
,
"AppleScript"
,
"OSA"
);
return
Arrays
.
asList
(
"AppleScriptEngine"
,
"AppleScript"
,
"OSA"
);
...
@@ -165,6 +167,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
...
@@ -165,6 +167,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
* arguments to the function
* arguments to the function
* @return the AppleScript string calling the method
* @return the AppleScript string calling the method
*/
*/
@Override
public
String
getMethodCallSyntax
(
final
String
obj
,
final
String
fname
,
final
String
...
args
)
{
public
String
getMethodCallSyntax
(
final
String
obj
,
final
String
fname
,
final
String
...
args
)
{
// StringBuilder builder = new StringBuilder();
// StringBuilder builder = new StringBuilder();
// builder.append("my " + fname + "(");
// builder.append("my " + fname + "(");
...
@@ -181,6 +184,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
...
@@ -181,6 +184,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
* @param toDisplay
* @param toDisplay
* @return
* @return
*/
*/
@Override
public
String
getOutputStatement
(
final
String
toDisplay
)
{
public
String
getOutputStatement
(
final
String
toDisplay
)
{
// TODO -- this might even be good enough? XD
// TODO -- this might even be good enough? XD
return
getMethodCallSyntax
(
null
,
"print"
,
toDisplay
);
return
getMethodCallSyntax
(
null
,
"print"
,
toDisplay
);
...
@@ -193,8 +197,9 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
...
@@ -193,8 +197,9 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
* the key to look up
* the key to look up
* @return the static preseeded value for the key in the ScriptEngine, if it exists, otherwise <code>null</code>
* @return the static preseeded value for the key in the ScriptEngine, if it exists, otherwise <code>null</code>
*/
*/
@Override
public
Object
getParameter
(
final
String
key
)
{
public
Object
getParameter
(
final
String
key
)
{
final
AppleScriptEngine
engine
=
new
AppleScriptEngine
(
this
);
final
AppleScriptEngine
engine
=
getScriptEngine
(
);
if
(!
engine
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
).
containsKey
(
key
))
return
null
;
if
(!
engine
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
).
containsKey
(
key
))
return
null
;
return
engine
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
).
get
(
key
);
return
engine
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
).
get
(
key
);
}
}
...
@@ -205,6 +210,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
...
@@ -205,6 +210,7 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
* @param statements
* @param statements
* @return
* @return
*/
*/
@Override
public
String
getProgram
(
final
String
...
statements
)
{
public
String
getProgram
(
final
String
...
statements
)
{
final
StringBuilder
program
=
new
StringBuilder
();
final
StringBuilder
program
=
new
StringBuilder
();
for
(
final
String
statement
:
statements
)
{
for
(
final
String
statement
:
statements
)
{
...
@@ -218,8 +224,21 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
...
@@ -218,8 +224,21 @@ public class AppleScriptEngineFactory implements ScriptEngineFactory {
*
*
* @return new AppleScriptEngine with this factory as it's parent
* @return new AppleScriptEngine with this factory as it's parent
*/
*/
public
ScriptEngine
getScriptEngine
()
{
@Override
public
AppleScriptEngine
getScriptEngine
()
{
AppleScriptEngine
.
checkSecurity
();
AppleScriptEngine
.
checkSecurity
();
ensureInitialized
();
return
new
AppleScriptEngine
(
this
);
return
new
AppleScriptEngine
(
this
);
}
}
private
static
synchronized
void
ensureInitialized
()
{
if
(!
initialized
)
{
initialized
=
true
;
java
.
awt
.
Toolkit
.
getDefaultToolkit
();
System
.
loadLibrary
(
"AppleScriptEngine"
);
initNative
();
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录