Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
16ad8cc6
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
16ad8cc6
编写于
11月 18, 2011
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
27fe9c73
171f9d3c
变更
109
展开全部
隐藏空白更改
内联
并排
Showing
109 changed file
with
3096 addition
and
1812 deletion
+3096
-1812
.hgtags
.hgtags
+2
-0
.hgtags-top-repo
.hgtags-top-repo
+2
-0
corba/.hgtags
corba/.hgtags
+2
-0
corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
...are/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
+9
-1
hotspot/.hgtags
hotspot/.hgtags
+3
-0
hotspot/make/bsd/makefiles/buildtree.make
hotspot/make/bsd/makefiles/buildtree.make
+2
-0
hotspot/make/bsd/makefiles/gcc.make
hotspot/make/bsd/makefiles/gcc.make
+1
-1
hotspot/make/hotspot_version
hotspot/make/hotspot_version
+1
-1
hotspot/make/linux/makefiles/buildtree.make
hotspot/make/linux/makefiles/buildtree.make
+2
-0
hotspot/make/linux/makefiles/gcc.make
hotspot/make/linux/makefiles/gcc.make
+1
-1
hotspot/make/solaris/makefiles/buildtree.make
hotspot/make/solaris/makefiles/buildtree.make
+2
-0
hotspot/make/solaris/makefiles/gcc.make
hotspot/make/solaris/makefiles/gcc.make
+2
-2
hotspot/make/windows/makefiles/vm.make
hotspot/make/windows/makefiles/vm.make
+1
-0
hotspot/src/share/vm/precompiled/precompiled.hpp
hotspot/src/share/vm/precompiled/precompiled.hpp
+0
-0
hotspot/src/share/vm/runtime/globals.hpp
hotspot/src/share/vm/runtime/globals.hpp
+1
-1
jaxp/.hgtags
jaxp/.hgtags
+2
-0
jaxws/.hgtags
jaxws/.hgtags
+2
-0
jaxws/jaxws.properties
jaxws/jaxws.properties
+6
-6
jdk/.hgtags
jdk/.hgtags
+2
-0
jdk/make/common/Demo.gmk
jdk/make/common/Demo.gmk
+12
-0
jdk/src/share/classes/com/sun/net/ssl/HttpsURLConnection.java
...src/share/classes/com/sun/net/ssl/HttpsURLConnection.java
+7
-1
jdk/src/share/classes/java/awt/AWTKeyStroke.java
jdk/src/share/classes/java/awt/AWTKeyStroke.java
+38
-13
jdk/src/share/classes/java/io/InputStream.java
jdk/src/share/classes/java/io/InputStream.java
+6
-10
jdk/src/share/classes/java/util/CurrencyData.properties
jdk/src/share/classes/java/util/CurrencyData.properties
+6
-6
jdk/src/share/classes/javax/net/ssl/HttpsURLConnection.java
jdk/src/share/classes/javax/net/ssl/HttpsURLConnection.java
+8
-1
jdk/src/share/classes/javax/net/ssl/SSLEngine.java
jdk/src/share/classes/javax/net/ssl/SSLEngine.java
+2
-2
jdk/src/share/classes/javax/swing/JTable.java
jdk/src/share/classes/javax/swing/JTable.java
+2
-0
jdk/src/share/classes/javax/swing/JTree.java
jdk/src/share/classes/javax/swing/JTree.java
+3
-1
jdk/src/share/classes/javax/swing/text/DefaultCaret.java
jdk/src/share/classes/javax/swing/text/DefaultCaret.java
+1
-1
jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java
...src/share/classes/javax/swing/text/html/HTMLDocument.java
+6
-1
jdk/src/share/classes/sun/awt/image/OffScreenImageSource.java
...src/share/classes/sun/awt/image/OffScreenImageSource.java
+2
-2
jdk/src/share/classes/sun/net/ResourceManager.java
jdk/src/share/classes/sun/net/ResourceManager.java
+5
-4
jdk/src/share/classes/sun/print/PSPrinterJob.java
jdk/src/share/classes/sun/print/PSPrinterJob.java
+37
-6
jdk/src/share/classes/sun/rmi/registry/RegistryImpl.java
jdk/src/share/classes/sun/rmi/registry/RegistryImpl.java
+79
-4
jdk/src/share/classes/sun/rmi/server/LoaderHandler.java
jdk/src/share/classes/sun/rmi/server/LoaderHandler.java
+3
-3
jdk/src/share/classes/sun/rmi/server/UnicastServerRef.java
jdk/src/share/classes/sun/rmi/server/UnicastServerRef.java
+6
-0
jdk/src/share/classes/sun/security/ssl/AppOutputStream.java
jdk/src/share/classes/sun/security/ssl/AppOutputStream.java
+28
-2
jdk/src/share/classes/sun/security/ssl/CipherBox.java
jdk/src/share/classes/sun/security/ssl/CipherBox.java
+15
-0
jdk/src/share/classes/sun/security/ssl/CipherSuite.java
jdk/src/share/classes/sun/security/ssl/CipherSuite.java
+11
-2
jdk/src/share/classes/sun/security/ssl/EngineOutputRecord.java
...rc/share/classes/sun/security/ssl/EngineOutputRecord.java
+44
-3
jdk/src/share/classes/sun/security/ssl/Record.java
jdk/src/share/classes/sun/security/ssl/Record.java
+18
-1
jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java
jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java
+34
-0
jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java
jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java
+35
-0
jdk/src/share/classes/sun/swing/SwingUtilities2.java
jdk/src/share/classes/sun/swing/SwingUtilities2.java
+44
-33
jdk/src/share/classes/sun/text/resources/CollationData_th.java
...rc/share/classes/sun/text/resources/CollationData_th.java
+46
-55
jdk/src/share/classes/sun/util/resources/CalendarData_lv.properties
...are/classes/sun/util/resources/CalendarData_lv.properties
+40
-16
jdk/src/share/demo/jfc/TransparentRuler/README.txt
jdk/src/share/demo/jfc/TransparentRuler/README.txt
+1
-5
jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
+5
-0
jdk/src/share/native/com/sun/java/util/jar/pack/utils.cpp
jdk/src/share/native/com/sun/java/util/jar/pack/utils.cpp
+2
-2
jdk/src/share/native/com/sun/java/util/jar/pack/utils.h
jdk/src/share/native/com/sun/java/util/jar/pack/utils.h
+2
-2
jdk/src/share/native/sun/java2d/loops/TransformHelper.c
jdk/src/share/native/sun/java2d/loops/TransformHelper.c
+41
-16
jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
+12
-4
jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java
...laris/classes/sun/awt/X11/generator/WrapperGenerator.java
+9
-9
jdk/src/solaris/classes/sun/print/UnixPrintJob.java
jdk/src/solaris/classes/sun/print/UnixPrintJob.java
+35
-6
jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_config.h
...solaris/native/sun/awt/splashscreen/splashscreen_config.h
+1
-1
jdk/src/windows/classes/java/lang/ProcessImpl.java
jdk/src/windows/classes/java/lang/ProcessImpl.java
+3
-2
jdk/src/windows/native/sun/windows/awt_Window.cpp
jdk/src/windows/native/sun/windows/awt_Window.cpp
+2
-2
jdk/test/java/util/Currency/CurrencyTest.java
jdk/test/java/util/Currency/CurrencyTest.java
+14
-12
jdk/test/java/util/Currency/ValidateISO4217.java
jdk/test/java/util/Currency/ValidateISO4217.java
+1
-1
jdk/test/java/util/Currency/tablea1.txt
jdk/test/java/util/Currency/tablea1.txt
+5
-5
jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java
jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java
+111
-0
jdk/test/javax/swing/JEditorPane/4492274/test.html
jdk/test/javax/swing/JEditorPane/4492274/test.html
+7
-0
jdk/test/javax/swing/JSlider/6348946/bug6348946.java
jdk/test/javax/swing/JSlider/6348946/bug6348946.java
+172
-0
jdk/test/javax/swing/JTextArea/7049024/bug7049024.java
jdk/test/javax/swing/JTextArea/7049024/bug7049024.java
+134
-0
jdk/test/javax/swing/ToolTipManager/Test6256140.java
jdk/test/javax/swing/ToolTipManager/Test6256140.java
+143
-0
jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java
.../ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java
+1
-4
jdk/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/CheckStatus.java
...rity/ssl/javax/net/ssl/NewAPIs/SSLEngine/CheckStatus.java
+3
-1
jdk/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargeBufs.java
...curity/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargeBufs.java
+3
-1
jdk/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargePacket.java
...rity/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargePacket.java
+2
-5
jdk/test/sun/text/resources/Collator/Bug6755060.java
jdk/test/sun/text/resources/Collator/Bug6755060.java
+100
-0
jdk/test/sun/text/resources/LocaleData
jdk/test/sun/text/resources/LocaleData
+4
-0
jdk/test/sun/text/resources/LocaleDataTest.java
jdk/test/sun/text/resources/LocaleDataTest.java
+1
-1
jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh
jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh
+1
-1
langtools/.hgtags
langtools/.hgtags
+2
-0
langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
.../share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
+3
-3
langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
...src/share/classes/com/sun/tools/javac/api/JavacTrees.java
+1
-1
langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
.../src/share/classes/com/sun/tools/javac/comp/Annotate.java
+8
-6
langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
...ools/src/share/classes/com/sun/tools/javac/comp/Attr.java
+50
-45
langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
...ols/src/share/classes/com/sun/tools/javac/comp/Check.java
+14
-9
langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java
...ols/src/share/classes/com/sun/tools/javac/comp/Enter.java
+1
-1
langtools/src/share/classes/com/sun/tools/javac/comp/Env.java
...tools/src/share/classes/com/sun/tools/javac/comp/Env.java
+3
-3
langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
...ools/src/share/classes/com/sun/tools/javac/comp/Flow.java
+21
-19
langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
...ols/src/share/classes/com/sun/tools/javac/comp/Infer.java
+2
-2
langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
...ols/src/share/classes/com/sun/tools/javac/comp/Lower.java
+104
-68
langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
...c/share/classes/com/sun/tools/javac/comp/MemberEnter.java
+4
-2
langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
...s/src/share/classes/com/sun/tools/javac/comp/Resolve.java
+7
-4
langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java
...ls/src/share/classes/com/sun/tools/javac/jvm/CRTable.java
+1
-1
langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
+29
-27
langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
.../share/classes/com/sun/tools/javac/main/JavaCompiler.java
+3
-3
langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java
...hare/classes/com/sun/tools/javac/model/JavacElements.java
+4
-3
langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java
...are/classes/com/sun/tools/javac/parser/JavaTokenizer.java
+200
-222
langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
...share/classes/com/sun/tools/javac/parser/JavacParser.java
+86
-77
langtools/src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java
.../classes/com/sun/tools/javac/parser/JavadocTokenizer.java
+275
-332
langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java
.../src/share/classes/com/sun/tools/javac/parser/Tokens.java
+66
-17
langtools/src/share/classes/com/sun/tools/javac/parser/UnicodeReader.java
...are/classes/com/sun/tools/javac/parser/UnicodeReader.java
+54
-1
langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
...un/tools/javac/processing/JavacProcessingEnvironment.java
+1
-1
langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
...ls/src/share/classes/com/sun/tools/javac/tree/JCTree.java
+313
-270
langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java
...ls/src/share/classes/com/sun/tools/javac/tree/Pretty.java
+46
-44
langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java
...rc/share/classes/com/sun/tools/javac/tree/TreeCopier.java
+1
-1
langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
.../src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
+309
-299
langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
...src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
+3
-3
langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
...src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
+3
-2
langtools/src/share/classes/com/sun/tools/javadoc/JavadocTool.java
.../src/share/classes/com/sun/tools/javadoc/JavadocTool.java
+1
-1
langtools/test/Makefile
langtools/test/Makefile
+22
-9
langtools/test/tools/javac/depDocComment/DeprecatedDocComment4.java
...test/tools/javac/depDocComment/DeprecatedDocComment4.java
+20
-0
langtools/test/tools/javac/depDocComment/DeprecatedDocComment4.out
.../test/tools/javac/depDocComment/DeprecatedDocComment4.out
+6
-0
langtools/test/tools/javac/failover/CheckAttributedTree.java
langtools/test/tools/javac/failover/CheckAttributedTree.java
+11
-28
langtools/test/tools/javac/tree/AbstractTreeScannerTest.java
langtools/test/tools/javac/tree/AbstractTreeScannerTest.java
+2
-2
langtools/test/tools/javac/tree/TreePosTest.java
langtools/test/tools/javac/tree/TreePosTest.java
+24
-46
未找到文件。
.hgtags
浏览文件 @
16ad8cc6
...
@@ -133,3 +133,5 @@ bc5710332b294676661103bb20d47d2ea3ba8def jdk8-b07
...
@@ -133,3 +133,5 @@ bc5710332b294676661103bb20d47d2ea3ba8def jdk8-b07
fbf3cabc9e3bb1fcf710941d777cb0400505fbe6 jdk8-b09
fbf3cabc9e3bb1fcf710941d777cb0400505fbe6 jdk8-b09
f651ce87127980c58e3599daba964eba2f3b4026 jdk8-b10
f651ce87127980c58e3599daba964eba2f3b4026 jdk8-b10
cc1f5ce8e504d350e0b0c28c5f84333f8d540132 jdk8-b11
cc1f5ce8e504d350e0b0c28c5f84333f8d540132 jdk8-b11
86db042b3385c338e17f7664447fdc7d406dd19e jdk8-b12
4cc0ef72c812943743ef4765f1100e2fbe2b1a08 jdk8-b13
.hgtags-top-repo
浏览文件 @
16ad8cc6
...
@@ -133,3 +133,5 @@ fb1bc13260d76447e269e843859eb593fe2a8ab2 jdk8-b08
...
@@ -133,3 +133,5 @@ fb1bc13260d76447e269e843859eb593fe2a8ab2 jdk8-b08
8adb70647b5af5273dfe6a540f07be667cd50216 jdk8-b09
8adb70647b5af5273dfe6a540f07be667cd50216 jdk8-b09
a6c4c248e8fa350c35014fa94bab5ac1a1ac3299 jdk8-b10
a6c4c248e8fa350c35014fa94bab5ac1a1ac3299 jdk8-b10
1defbc57940a56f0aa41e9dee87b71e8c8b71103 jdk8-b11
1defbc57940a56f0aa41e9dee87b71e8c8b71103 jdk8-b11
8e2104d565baee473895d5eba20e39f85ab4bf9f jdk8-b12
26fb81a1e9ceb9baffba216acd9ded62e9e9d5ab jdk8-b13
corba/.hgtags
浏览文件 @
16ad8cc6
...
@@ -133,3 +133,5 @@ cc1b599b986a37cb57de4584c5e58169766ca535 jdk8-b05
...
@@ -133,3 +133,5 @@ cc1b599b986a37cb57de4584c5e58169766ca535 jdk8-b05
a891732c1a83082177ff7a4cf1506068d9cc0a47 jdk8-b09
a891732c1a83082177ff7a4cf1506068d9cc0a47 jdk8-b09
cda87f7fefcee3b89742a57ce5ad9b03a54c210d jdk8-b10
cda87f7fefcee3b89742a57ce5ad9b03a54c210d jdk8-b10
0199e4fef5cc2bd234c65b93220459ef7a3bb3b1 jdk8-b11
0199e4fef5cc2bd234c65b93220459ef7a3bb3b1 jdk8-b11
31d70911b712c6b4e580a3110363d5f044cfed7a jdk8-b12
5b9d9b839d3d7fe02347827221c97c6d242a6f96 jdk8-b13
corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 1998, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 201
1
, 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
...
@@ -2243,6 +2243,10 @@ public class IIOPInputStream
...
@@ -2243,6 +2243,10 @@ public class IIOPInputStream
}
}
try
{
try
{
Class
fieldCl
=
fields
[
i
].
getClazz
();
if
(
objectValue
!=
null
&&
!
fieldCl
.
isInstance
(
objectValue
))
{
throw
new
IllegalArgumentException
();
}
bridge
.
putObject
(
o
,
fields
[
i
].
getFieldID
(),
objectValue
)
;
bridge
.
putObject
(
o
,
fields
[
i
].
getFieldID
(),
objectValue
)
;
// reflective code: fields[i].getField().set( o, objectValue ) ;
// reflective code: fields[i].getField().set( o, objectValue ) ;
}
catch
(
IllegalArgumentException
e
)
{
}
catch
(
IllegalArgumentException
e
)
{
...
@@ -2553,6 +2557,10 @@ public class IIOPInputStream
...
@@ -2553,6 +2557,10 @@ public class IIOPInputStream
{
{
try
{
try
{
Field
fld
=
c
.
getDeclaredField
(
fieldName
)
;
Field
fld
=
c
.
getDeclaredField
(
fieldName
)
;
Class
fieldCl
=
fld
.
getType
();
if
(
v
!=
null
&&
!
fieldCl
.
isInstance
(
v
))
{
throw
new
Exception
();
}
long
key
=
bridge
.
objectFieldOffset
(
fld
)
;
long
key
=
bridge
.
objectFieldOffset
(
fld
)
;
bridge
.
putObject
(
o
,
key
,
v
)
;
bridge
.
putObject
(
o
,
key
,
v
)
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
hotspot/.hgtags
浏览文件 @
16ad8cc6
...
@@ -195,3 +195,6 @@ d815de2e85e511b7deab2a83cf80c0224d011da9 jdk8-b10
...
@@ -195,3 +195,6 @@ d815de2e85e511b7deab2a83cf80c0224d011da9 jdk8-b10
4d3850d9d326ac3a9bee2d867727e954322d014e hs23-b03
4d3850d9d326ac3a9bee2d867727e954322d014e hs23-b03
4538caeef7b6cbd4302bebced805d65e68ccf301 jdk8-b11
4538caeef7b6cbd4302bebced805d65e68ccf301 jdk8-b11
6534482ff68ad79066dfe15dfb6d8905f09681bd hs23-b04
6534482ff68ad79066dfe15dfb6d8905f09681bd hs23-b04
1d3900713a67a0a39faf4e12c9c158d55aebef87 jdk8-b12
3e609627e780736f372eb14d29bb9b5e53b21fbf hs23-b05
b92ca8e229d29004f840c67e620833d23a346761 jdk8-b13
hotspot/make/bsd/makefiles/buildtree.make
浏览文件 @
16ad8cc6
...
@@ -234,6 +234,8 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
...
@@ -234,6 +234,8 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
echo
"
$(
call
gamma-path,commonsrc,share/vm/prims
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,share/vm/prims
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,share/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,share/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,share/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,share/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,share/vm/precompiled
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,share/vm/precompiled
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,cpu/
$(SRCARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,cpu/
$(SRCARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,cpu/
$(SRCARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,cpu/
$(SRCARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,os_cpu/
$(OS_FAMILY)
_
$(SRCARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,os_cpu/
$(OS_FAMILY)
_
$(SRCARCH)
/vm
)
\\
"
;
\
...
...
hotspot/make/bsd/makefiles/gcc.make
浏览文件 @
16ad8cc6
...
@@ -88,7 +88,7 @@ ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \
...
@@ -88,7 +88,7 @@ ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \
ifneq
($(USE_PRECOMPILED_HEADER),0)
ifneq
($(USE_PRECOMPILED_HEADER),0)
USE_PRECOMPILED_HEADER
=
1
USE_PRECOMPILED_HEADER
=
1
PRECOMPILED_HEADER_DIR
=
.
PRECOMPILED_HEADER_DIR
=
.
PRECOMPILED_HEADER_SRC
=
$(GAMMADIR)
/src/share/vm/precompiled.hpp
PRECOMPILED_HEADER_SRC
=
$(GAMMADIR)
/src/share/vm/precompiled
/precompiled
.hpp
PRECOMPILED_HEADER
=
$(PRECOMPILED_HEADER_DIR)
/precompiled.hpp.gch
PRECOMPILED_HEADER
=
$(PRECOMPILED_HEADER_DIR)
/precompiled.hpp.gch
endif
endif
endif
endif
...
...
hotspot/make/hotspot_version
浏览文件 @
16ad8cc6
...
@@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2011
...
@@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2011
HS_MAJOR_VER=23
HS_MAJOR_VER=23
HS_MINOR_VER=0
HS_MINOR_VER=0
HS_BUILD_NUMBER=0
4
HS_BUILD_NUMBER=0
5
JDK_MAJOR_VER=1
JDK_MAJOR_VER=1
JDK_MINOR_VER=8
JDK_MINOR_VER=8
...
...
hotspot/make/linux/makefiles/buildtree.make
浏览文件 @
16ad8cc6
...
@@ -223,6 +223,8 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
...
@@ -223,6 +223,8 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
echo
"
$(
call
gamma-path,commonsrc,share/vm/prims
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,share/vm/prims
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,share/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,share/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,share/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,share/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,share/vm/precompiled
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,share/vm/precompiled
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,cpu/
$(SRCARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,cpu/
$(SRCARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,cpu/
$(SRCARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,cpu/
$(SRCARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,os_cpu/
$(OS_FAMILY)
_
$(SRCARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,os_cpu/
$(OS_FAMILY)
_
$(SRCARCH)
/vm
)
\\
"
;
\
...
...
hotspot/make/linux/makefiles/gcc.make
浏览文件 @
16ad8cc6
...
@@ -52,7 +52,7 @@ ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \
...
@@ -52,7 +52,7 @@ ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \
ifneq
($(USE_PRECOMPILED_HEADER),0)
ifneq
($(USE_PRECOMPILED_HEADER),0)
USE_PRECOMPILED_HEADER
=
1
USE_PRECOMPILED_HEADER
=
1
PRECOMPILED_HEADER_DIR
=
.
PRECOMPILED_HEADER_DIR
=
.
PRECOMPILED_HEADER_SRC
=
$(GAMMADIR)
/src/share/vm/precompiled.hpp
PRECOMPILED_HEADER_SRC
=
$(GAMMADIR)
/src/share/vm/precompiled
/precompiled
.hpp
PRECOMPILED_HEADER
=
$(PRECOMPILED_HEADER_DIR)
/precompiled.hpp.gch
PRECOMPILED_HEADER
=
$(PRECOMPILED_HEADER_DIR)
/precompiled.hpp.gch
endif
endif
endif
endif
...
...
hotspot/make/solaris/makefiles/buildtree.make
浏览文件 @
16ad8cc6
...
@@ -216,6 +216,8 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
...
@@ -216,6 +216,8 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
echo
"
$(
call
gamma-path,commonsrc,share/vm/prims
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,share/vm/prims
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,share/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,share/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,share/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,share/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,share/vm/precompiled
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,share/vm/precompiled
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,cpu/
$(ARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,cpu/
$(ARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,cpu/
$(ARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,commonsrc,cpu/
$(ARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,os_cpu/
$(OS_FAMILY)
_
$(ARCH)
/vm
)
\\
"
;
\
echo
"
$(
call
gamma-path,altsrc,os_cpu/
$(OS_FAMILY)
_
$(ARCH)
/vm
)
\\
"
;
\
...
...
hotspot/make/solaris/makefiles/gcc.make
浏览文件 @
16ad8cc6
#
#
# Copyright (c) 1998, 201
0
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1998, 201
1
, 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
...
@@ -51,7 +51,7 @@ ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \
...
@@ -51,7 +51,7 @@ ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \
ifneq
($(USE_PRECOMPILED_HEADER),0)
ifneq
($(USE_PRECOMPILED_HEADER),0)
USE_PRECOMPILED_HEADER
=
1
USE_PRECOMPILED_HEADER
=
1
PRECOMPILED_HEADER_DIR
=
.
PRECOMPILED_HEADER_DIR
=
.
PRECOMPILED_HEADER_SRC
=
$(GAMMADIR)
/src/share/vm/precompiled.hpp
PRECOMPILED_HEADER_SRC
=
$(GAMMADIR)
/src/share/vm/precompiled
/precompiled
.hpp
PRECOMPILED_HEADER
=
$(PRECOMPILED_HEADER_DIR)
/precompiled.hpp.gch
PRECOMPILED_HEADER
=
$(PRECOMPILED_HEADER_DIR)
/precompiled.hpp.gch
endif
endif
endif
endif
...
...
hotspot/make/windows/makefiles/vm.make
浏览文件 @
16ad8cc6
...
@@ -134,6 +134,7 @@ CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\cpu\$(Platform_arch)\vm"
...
@@ -134,6 +134,7 @@ CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\cpu\$(Platform_arch)\vm"
CPP_INCLUDE_DIRS
=
$(CPP_INCLUDE_DIRS)
\
CPP_INCLUDE_DIRS
=
$(CPP_INCLUDE_DIRS)
\
/I
"
$(COMMONSRC)
\s
hare
\v
m"
\
/I
"
$(COMMONSRC)
\s
hare
\v
m"
\
/I
"
$(COMMONSRC)
\s
hare
\v
m
\p
recompiled"
\
/I
"
$(COMMONSRC)
\s
hare
\v
m
\p
rims"
\
/I
"
$(COMMONSRC)
\s
hare
\v
m
\p
rims"
\
/I
"
$(COMMONSRC)
\o
s
\w
indows
\v
m"
\
/I
"
$(COMMONSRC)
\o
s
\w
indows
\v
m"
\
/I
"
$(COMMONSRC)
\o
s_cpu
\w
indows_
$(Platform_arch)
\v
m"
\
/I
"
$(COMMONSRC)
\o
s_cpu
\w
indows_
$(Platform_arch)
\v
m"
\
...
...
hotspot/src/share/vm/precompiled.hpp
→
hotspot/src/share/vm/precompiled
/precompiled
.hpp
浏览文件 @
16ad8cc6
文件已移动
hotspot/src/share/vm/runtime/globals.hpp
浏览文件 @
16ad8cc6
...
@@ -2580,7 +2580,7 @@ class CommandLineFlags {
...
@@ -2580,7 +2580,7 @@ class CommandLineFlags {
diagnostic(bool, DebugInlinedCalls, true, \
diagnostic(bool, DebugInlinedCalls, true, \
"If false, restricts profiled locations to the root method only") \
"If false, restricts profiled locations to the root method only") \
\
\
product(bool, PrintVMOptions,
trueInDebug,
\
product(bool, PrintVMOptions,
NOT_EMBEDDED(trueInDebug) EMBEDDED_ONLY(false),
\
"Print flags that appeared on the command line") \
"Print flags that appeared on the command line") \
\
\
product(bool, IgnoreUnrecognizedVMOptions, false, \
product(bool, IgnoreUnrecognizedVMOptions, false, \
...
...
jaxp/.hgtags
浏览文件 @
16ad8cc6
...
@@ -133,3 +133,5 @@ de4794dd69c48b08029d158a972993ff9d5627df jdk8-b08
...
@@ -133,3 +133,5 @@ de4794dd69c48b08029d158a972993ff9d5627df jdk8-b08
93554324c014282571aeeb48552ad00d3fedb089 jdk8-b09
93554324c014282571aeeb48552ad00d3fedb089 jdk8-b09
d21a4d5141c04bc9e88f2c0253121d449b66d667 jdk8-b10
d21a4d5141c04bc9e88f2c0253121d449b66d667 jdk8-b10
d1b7a4f6dd2065fdeafbcdfd9dcc0072da8c6881 jdk8-b11
d1b7a4f6dd2065fdeafbcdfd9dcc0072da8c6881 jdk8-b11
ca977d167697a561c04894187fc1c4d927582ffa jdk8-b12
bcc739229f6384786c7ac0b52c1822c85674dcf1 jdk8-b13
jaxws/.hgtags
浏览文件 @
16ad8cc6
...
@@ -133,3 +133,5 @@ acffff22a9465005e8eb206224fae9f2ea4fd469 jdk8-b06
...
@@ -133,3 +133,5 @@ acffff22a9465005e8eb206224fae9f2ea4fd469 jdk8-b06
70172e57cf29efe271b068987eefb601c2a77780 jdk8-b09
70172e57cf29efe271b068987eefb601c2a77780 jdk8-b09
8e7fdc8e3c758644ca6d0fd70bb255e9d2e64cda jdk8-b10
8e7fdc8e3c758644ca6d0fd70bb255e9d2e64cda jdk8-b10
a12ab897a249feb7859a6e6cd84b49411f4c06ac jdk8-b11
a12ab897a249feb7859a6e6cd84b49411f4c06ac jdk8-b11
e6eed2ff5d5f62bdc815beb5276d23347600c760 jdk8-b12
adf2a6b5fde14090beb9ebc40c4114132ddee731 jdk8-b13
jaxws/jaxws.properties
浏览文件 @
16ad8cc6
#
#
# Copyright (c) 2007, 201
0
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2007, 201
1
, 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
...
@@ -25,15 +25,15 @@
...
@@ -25,15 +25,15 @@
drops.master.copy.base
=
${drops.dir}
drops.master.copy.base
=
${drops.dir}
jaxws_src.bundle.name
=
jdk
7-jaxws2_2_4-b03-2011_05_27
.zip
jaxws_src.bundle.name
=
jdk
8-jaxws2_2_4-b01-2011_07_22
.zip
jaxws_src.bundle.md5.checksum
=
2f5b829ade70f67fe272d0b322e3e702
jaxws_src.bundle.md5.checksum
=
f64bedd3c512e6b1ca265fda2feb0905
jaxws_src.master.bundle.dir
=
${drops.master.copy.base}
jaxws_src.master.bundle.dir
=
${drops.master.copy.base}
jaxws_src.master.bundle.url.base
=
http://download.java.net/glassfish/components/jax-ws/openjdk/jdk
7
jaxws_src.master.bundle.url.base
=
http://download.java.net/glassfish/components/jax-ws/openjdk/jdk
8
jaf_src.bundle.name
=
jdk
7-jaf-2010_08_19
.zip
jaf_src.bundle.name
=
jdk
8-jaf-2011_07_22
.zip
jaf_src.bundle.md5.checksum
=
18d15dfd71117daadb332af003d08212
jaf_src.bundle.md5.checksum
=
18d15dfd71117daadb332af003d08212
jaf_src.master.bundle.dir
=
${drops.master.copy.base}
jaf_src.master.bundle.dir
=
${drops.master.copy.base}
jaf_src.master.bundle.url.base
=
http
s://java.net/downloads/jax-ws/JDK7
jaf_src.master.bundle.url.base
=
http
://download.java.net/glassfish/components/jax-ws/openjdk/jdk8
#jaxws_tests.bundle.name=jdk7-jaxws-tests-2009_08_28.zip
#jaxws_tests.bundle.name=jdk7-jaxws-tests-2009_08_28.zip
#jaxws_tests.master.bundle.dir=${drops.master.copy.base}
#jaxws_tests.master.bundle.dir=${drops.master.copy.base}
...
...
jdk/.hgtags
浏览文件 @
16ad8cc6
...
@@ -134,3 +134,5 @@ f1ec21b8142168ff40f3278d2f6b5fe4bd5f3b26 jdk8-b09
...
@@ -134,3 +134,5 @@ f1ec21b8142168ff40f3278d2f6b5fe4bd5f3b26 jdk8-b09
4788745572ef2bde34924ef34e7e4d55ba07e979 jdk8-b10
4788745572ef2bde34924ef34e7e4d55ba07e979 jdk8-b10
7ab0d613cd1a271a9763ffb894dc1f0a5b95a7e4 jdk8-b11
7ab0d613cd1a271a9763ffb894dc1f0a5b95a7e4 jdk8-b11
09fd2067f715e4505c44b01c301258a4e8f8964e jdk8-b12
09fd2067f715e4505c44b01c301258a4e8f8964e jdk8-b12
4cb2e8679b27432854690cb688ea06d3b2d8e008 jdk8-b13
99632935785e2038b2fc836da9f2ede69dea294b jdk8-b14
jdk/make/common/Demo.gmk
浏览文件 @
16ad8cc6
...
@@ -158,6 +158,8 @@ ifneq ($(strip $(DEMO_ALL_NATIVE_SOURCES)),)
...
@@ -158,6 +158,8 @@ ifneq ($(strip $(DEMO_ALL_NATIVE_SOURCES)),)
# bit between them.
# bit between them.
LINK.demo = $(LINK.c)
LINK.demo = $(LINK.c)
LDLIBS.demo = $(EXTRA_LIBS) $(LFLAGS_$(COMPILER_VERSION))
LDLIBS.demo = $(EXTRA_LIBS) $(LFLAGS_$(COMPILER_VERSION))
DEMO_VERSION_INFO = $(OBJDIR)/$(LIBRARY).res
LDLIBS.demo += $(DEMO_VERSION_INFO)
else
else
ifneq ($(DEMO_NEEDS_CPP),)
ifneq ($(DEMO_NEEDS_CPP),)
LINK.demo = $(LINK.cpp)
LINK.demo = $(LINK.cpp)
...
@@ -288,6 +290,13 @@ ifndef DEMO_SKIP_SRCZIP
...
@@ -288,6 +290,13 @@ ifndef DEMO_SKIP_SRCZIP
$(install-file)
$(install-file)
endif
endif
ifeq ($(PLATFORM),windows)
# JDK name required here
RC_FLAGS += /D "JDK_FNAME=$(LIBRARY).dll" \
/D "JDK_INTERNAL_NAME=$(LIBRARY)" \
/D "JDK_FTYPE=0x2L"
endif
# Native library building
# Native library building
ifdef DEMO_LIBRARY
ifdef DEMO_LIBRARY
...
@@ -308,6 +317,9 @@ $(OBJDIR)/%.$(OBJECT_SUFFIX): $(DEMO_BUILD_SRCDIR)/%.cpp
...
@@ -308,6 +317,9 @@ $(OBJDIR)/%.$(OBJECT_SUFFIX): $(DEMO_BUILD_SRCDIR)/%.cpp
# Actual creation of the native shared library (C++ and C are different)
# Actual creation of the native shared library (C++ and C are different)
$(DEMO_LIBRARY): $(DEMO_FULL_OBJECTS)
$(DEMO_LIBRARY): $(DEMO_FULL_OBJECTS)
@$(prep-target)
@$(prep-target)
ifeq ($(PLATFORM),windows)
$(RC) $(RC_FLAGS) $(CC_OBJECT_OUTPUT_FLAG)$(DEMO_VERSION_INFO) $(VERSIONINFO_RESOURCE)
endif
$(LINK.demo) $(SHARED_LIBRARY_FLAG) $(CC_PROGRAM_OUTPUT_FLAG)$@ \
$(LINK.demo) $(SHARED_LIBRARY_FLAG) $(CC_PROGRAM_OUTPUT_FLAG)$@ \
$(DEMO_FULL_OBJECTS) $(LDLIBS.demo)
$(DEMO_FULL_OBJECTS) $(LDLIBS.demo)
@$(call binary_file_verification,$@)
@$(call binary_file_verification,$@)
...
...
jdk/src/share/classes/com/sun/net/ssl/HttpsURLConnection.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 2000, 20
04
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
11
, 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
...
@@ -179,6 +179,12 @@ class HttpsURLConnection extends HttpURLConnection
...
@@ -179,6 +179,12 @@ class HttpsURLConnection extends HttpURLConnection
throw
new
IllegalArgumentException
(
throw
new
IllegalArgumentException
(
"no SSLSocketFactory specified"
);
"no SSLSocketFactory specified"
);
}
}
SecurityManager
sm
=
System
.
getSecurityManager
();
if
(
sm
!=
null
)
{
sm
.
checkSetFactory
();
}
sslSocketFactory
=
sf
;
sslSocketFactory
=
sf
;
}
}
...
...
jdk/src/share/classes/java/awt/AWTKeyStroke.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 2000, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
11
, 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
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
package
java.awt
;
package
java.awt
;
import
java.awt.event.KeyEvent
;
import
java.awt.event.KeyEvent
;
import
sun.awt.AppContext
;
import
java.awt.event.InputEvent
;
import
java.awt.event.InputEvent
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -66,9 +67,6 @@ import java.lang.reflect.Field;
...
@@ -66,9 +67,6 @@ import java.lang.reflect.Field;
public
class
AWTKeyStroke
implements
Serializable
{
public
class
AWTKeyStroke
implements
Serializable
{
static
final
long
serialVersionUID
=
-
6430539691155161871L
;
static
final
long
serialVersionUID
=
-
6430539691155161871L
;
private
static
Map
cache
;
private
static
AWTKeyStroke
cacheKey
;
private
static
Constructor
ctor
=
getCtor
(
AWTKeyStroke
.
class
);
private
static
Map
modifierKeywords
;
private
static
Map
modifierKeywords
;
/**
/**
* Associates VK_XXX (as a String) with code (as Integer). This is
* Associates VK_XXX (as a String) with code (as Integer). This is
...
@@ -77,6 +75,25 @@ public class AWTKeyStroke implements Serializable {
...
@@ -77,6 +75,25 @@ public class AWTKeyStroke implements Serializable {
*/
*/
private
static
VKCollection
vks
;
private
static
VKCollection
vks
;
//A key for the collection of AWTKeyStrokes within AppContext.
private
static
Object
APP_CONTEXT_CACHE_KEY
=
new
Object
();
//A key withing the cache
private
static
AWTKeyStroke
APP_CONTEXT_KEYSTROKE_KEY
=
new
AWTKeyStroke
();
/*
* Reads keystroke class from AppContext and if null, puts there the
* AWTKeyStroke class.
* Must be called under locked AWTKeyStro
*/
private
static
Class
getAWTKeyStrokeClass
()
{
Class
clazz
=
(
Class
)
AppContext
.
getAppContext
().
get
(
AWTKeyStroke
.
class
);
if
(
clazz
==
null
)
{
clazz
=
AWTKeyStroke
.
class
;
AppContext
.
getAppContext
().
put
(
AWTKeyStroke
.
class
,
AWTKeyStroke
.
class
);
}
return
clazz
;
}
private
char
keyChar
=
KeyEvent
.
CHAR_UNDEFINED
;
private
char
keyChar
=
KeyEvent
.
CHAR_UNDEFINED
;
private
int
keyCode
=
KeyEvent
.
VK_UNDEFINED
;
private
int
keyCode
=
KeyEvent
.
VK_UNDEFINED
;
private
int
modifiers
;
private
int
modifiers
;
...
@@ -164,9 +181,12 @@ public class AWTKeyStroke implements Serializable {
...
@@ -164,9 +181,12 @@ public class AWTKeyStroke implements Serializable {
if
(
subclass
==
null
)
{
if
(
subclass
==
null
)
{
throw
new
IllegalArgumentException
(
"subclass cannot be null"
);
throw
new
IllegalArgumentException
(
"subclass cannot be null"
);
}
}
if
(
AWTKeyStroke
.
ctor
.
getDeclaringClass
().
equals
(
subclass
))
{
synchronized
(
AWTKeyStroke
.
class
)
{
// Already registered
Class
keyStrokeClass
=
(
Class
)
AppContext
.
getAppContext
().
get
(
AWTKeyStroke
.
class
);
return
;
if
(
keyStrokeClass
!=
null
&&
keyStrokeClass
.
equals
(
subclass
)){
// Already registered
return
;
}
}
}
if
(!
AWTKeyStroke
.
class
.
isAssignableFrom
(
subclass
))
{
if
(!
AWTKeyStroke
.
class
.
isAssignableFrom
(
subclass
))
{
throw
new
ClassCastException
(
"subclass is not derived from AWTKeyStroke"
);
throw
new
ClassCastException
(
"subclass is not derived from AWTKeyStroke"
);
...
@@ -197,9 +217,9 @@ public class AWTKeyStroke implements Serializable {
...
@@ -197,9 +217,9 @@ public class AWTKeyStroke implements Serializable {
}
}
synchronized
(
AWTKeyStroke
.
class
)
{
synchronized
(
AWTKeyStroke
.
class
)
{
A
WTKeyStroke
.
ctor
=
ctor
;
A
ppContext
.
getAppContext
().
put
(
AWTKeyStroke
.
class
,
subclass
)
;
cache
=
null
;
AppContext
.
getAppContext
().
remove
(
APP_CONTEXT_CACHE_KEY
)
;
cacheKey
=
null
;
AppContext
.
getAppContext
().
remove
(
APP_CONTEXT_KEYSTROKE_KEY
)
;
}
}
}
}
...
@@ -229,13 +249,19 @@ public class AWTKeyStroke implements Serializable {
...
@@ -229,13 +249,19 @@ public class AWTKeyStroke implements Serializable {
private
static
synchronized
AWTKeyStroke
getCachedStroke
private
static
synchronized
AWTKeyStroke
getCachedStroke
(
char
keyChar
,
int
keyCode
,
int
modifiers
,
boolean
onKeyRelease
)
(
char
keyChar
,
int
keyCode
,
int
modifiers
,
boolean
onKeyRelease
)
{
{
Map
cache
=
(
Map
)
AppContext
.
getAppContext
().
get
(
APP_CONTEXT_CACHE_KEY
);
AWTKeyStroke
cacheKey
=
(
AWTKeyStroke
)
AppContext
.
getAppContext
().
get
(
APP_CONTEXT_KEYSTROKE_KEY
);
if
(
cache
==
null
)
{
if
(
cache
==
null
)
{
cache
=
new
HashMap
();
cache
=
new
HashMap
();
AppContext
.
getAppContext
().
put
(
APP_CONTEXT_CACHE_KEY
,
cache
);
}
}
if
(
cacheKey
==
null
)
{
if
(
cacheKey
==
null
)
{
try
{
try
{
cacheKey
=
(
AWTKeyStroke
)
ctor
.
newInstance
((
Object
[])
null
);
Class
clazz
=
getAWTKeyStrokeClass
();
cacheKey
=
(
AWTKeyStroke
)
getCtor
(
clazz
).
newInstance
((
Object
[])
null
);
AppContext
.
getAppContext
().
put
(
APP_CONTEXT_KEYSTROKE_KEY
,
cacheKey
);
}
catch
(
InstantiationException
e
)
{
}
catch
(
InstantiationException
e
)
{
assert
(
false
);
assert
(
false
);
}
catch
(
IllegalAccessException
e
)
{
}
catch
(
IllegalAccessException
e
)
{
...
@@ -253,9 +279,8 @@ public class AWTKeyStroke implements Serializable {
...
@@ -253,9 +279,8 @@ public class AWTKeyStroke implements Serializable {
if
(
stroke
==
null
)
{
if
(
stroke
==
null
)
{
stroke
=
cacheKey
;
stroke
=
cacheKey
;
cache
.
put
(
stroke
,
stroke
);
cache
.
put
(
stroke
,
stroke
);
cacheKey
=
null
;
AppContext
.
getAppContext
().
remove
(
APP_CONTEXT_KEYSTROKE_KEY
)
;
}
}
return
stroke
;
return
stroke
;
}
}
...
...
jdk/src/share/classes/java/io/InputStream.java
浏览文件 @
16ad8cc6
...
@@ -44,10 +44,9 @@ package java.io;
...
@@ -44,10 +44,9 @@ package java.io;
*/
*/
public
abstract
class
InputStream
implements
Closeable
{
public
abstract
class
InputStream
implements
Closeable
{
// SKIP_BUFFER_SIZE is used to determine the size of skipBuffer
// MAX_SKIP_BUFFER_SIZE is used to determine the maximum buffer size to
private
static
final
int
SKIP_BUFFER_SIZE
=
2048
;
// use when skipping.
// skipBuffer is initialized in skip(long), if needed.
private
static
final
int
MAX_SKIP_BUFFER_SIZE
=
2048
;
private
static
byte
[]
skipBuffer
;
/**
/**
* Reads the next byte of data from the input stream. The value byte is
* Reads the next byte of data from the input stream. The value byte is
...
@@ -212,18 +211,15 @@ public abstract class InputStream implements Closeable {
...
@@ -212,18 +211,15 @@ public abstract class InputStream implements Closeable {
long
remaining
=
n
;
long
remaining
=
n
;
int
nr
;
int
nr
;
if
(
skipBuffer
==
null
)
skipBuffer
=
new
byte
[
SKIP_BUFFER_SIZE
];
byte
[]
localSkipBuffer
=
skipBuffer
;
if
(
n
<=
0
)
{
if
(
n
<=
0
)
{
return
0
;
return
0
;
}
}
int
size
=
(
int
)
Math
.
min
(
MAX_SKIP_BUFFER_SIZE
,
remaining
);
byte
[]
skipBuffer
=
new
byte
[
size
];
while
(
remaining
>
0
)
{
while
(
remaining
>
0
)
{
nr
=
read
(
localSkipBuffer
,
0
,
nr
=
read
(
skipBuffer
,
0
,
(
int
)
Math
.
min
(
size
,
remaining
));
(
int
)
Math
.
min
(
SKIP_BUFFER_SIZE
,
remaining
));
if
(
nr
<
0
)
{
if
(
nr
<
0
)
{
break
;
break
;
}
}
...
...
jdk/src/share/classes/java/util/CurrencyData.properties
浏览文件 @
16ad8cc6
...
@@ -71,7 +71,7 @@ all=ADP020-AED784-AFA004-AFN971-ALL008-AMD051-ANG532-AOA973-ARS032-ATS040-AUD036
...
@@ -71,7 +71,7 @@ all=ADP020-AED784-AFA004-AFN971-ALL008-AMD051-ANG532-AOA973-ARS032-ATS040-AUD036
#
#
# The table is based on the following web sites:
# The table is based on the following web sites:
# http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/db_en.html
# http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/db_en.html
# http://www.
bsi-global.com/iso4217currency
# http://www.
currency-iso.org/iso_index/iso_tables.htm
# http://www.cia.gov/cia/publications/factbook/indexgeo.html
# http://www.cia.gov/cia/publications/factbook/indexgeo.html
# AFGHANISTAN
# AFGHANISTAN
...
@@ -105,7 +105,7 @@ AU=AUD
...
@@ -105,7 +105,7 @@ AU=AUD
# AUSTRIA
# AUSTRIA
AT
=
EUR
AT
=
EUR
# AZERBAIJAN
# AZERBAIJAN
AZ
=
AZ
M;2005-12-31-20-00-00;AZ
N
AZ
=
AZN
# BAHAMAS
# BAHAMAS
BS
=
BSD
BS
=
BSD
# BAHRAIN
# BAHRAIN
...
@@ -378,7 +378,7 @@ MS=XCD
...
@@ -378,7 +378,7 @@ MS=XCD
# MOROCCO
# MOROCCO
MA
=
MAD
MA
=
MAD
# MOZAMBIQUE
# MOZAMBIQUE
MZ
=
MZ
M;2006-06-30-22-00-00;MZ
N
MZ
=
MZN
# MYANMAR
# MYANMAR
MM
=
MMK
MM
=
MMK
# NAMIBIA
# NAMIBIA
...
@@ -440,7 +440,7 @@ QA=QAR
...
@@ -440,7 +440,7 @@ QA=QAR
# REUNION
# REUNION
RE
=
EUR
RE
=
EUR
# ROMANIA
# ROMANIA
RO
=
RO
L;2005-06-30-21-00-00;RO
N
RO
=
RON
# RUSSIAN FEDERATION
# RUSSIAN FEDERATION
RU
=
RUB
RU
=
RUB
# RWANDA
# RWANDA
...
@@ -532,7 +532,7 @@ TT=TTD
...
@@ -532,7 +532,7 @@ TT=TTD
# TUNISIA
# TUNISIA
TN
=
TND
TN
=
TND
# TURKEY
# TURKEY
TR
=
TR
L;2004-12-31-22-00-00;TR
Y
TR
=
TRY
# TURKMENISTAN
# TURKMENISTAN
TM
=
TMT
TM
=
TMT
# TURKS AND CAICOS ISLANDS
# TURKS AND CAICOS ISLANDS
...
@@ -558,7 +558,7 @@ UZ=UZS
...
@@ -558,7 +558,7 @@ UZ=UZS
# VANUATU
# VANUATU
VU
=
VUV
VU
=
VUV
# VENEZUELA
# VENEZUELA
VE
=
VE
B;2008-01-01-04-00-00;VE
F
VE
=
VEF
# VIET NAM
# VIET NAM
VN
=
VND
VN
=
VND
# VIRGIN ISLANDS, BRITISH
# VIRGIN ISLANDS, BRITISH
...
...
jdk/src/share/classes/javax/net/ssl/HttpsURLConnection.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 1999, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
1
, 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
...
@@ -347,6 +347,9 @@ class HttpsURLConnection extends HttpURLConnection
...
@@ -347,6 +347,9 @@ class HttpsURLConnection extends HttpURLConnection
* @param sf the SSL socket factory
* @param sf the SSL socket factory
* @throws IllegalArgumentException if the <code>SSLSocketFactory</code>
* @throws IllegalArgumentException if the <code>SSLSocketFactory</code>
* parameter is null.
* parameter is null.
* @throws SecurityException if a security manager exists and its
* <code>checkSetFactory</code> method does not allow
* a socket factory to be specified.
* @see #getSSLSocketFactory()
* @see #getSSLSocketFactory()
*/
*/
public
void
setSSLSocketFactory
(
SSLSocketFactory
sf
)
{
public
void
setSSLSocketFactory
(
SSLSocketFactory
sf
)
{
...
@@ -355,6 +358,10 @@ class HttpsURLConnection extends HttpURLConnection
...
@@ -355,6 +358,10 @@ class HttpsURLConnection extends HttpURLConnection
"no SSLSocketFactory specified"
);
"no SSLSocketFactory specified"
);
}
}
SecurityManager
sm
=
System
.
getSecurityManager
();
if
(
sm
!=
null
)
{
sm
.
checkSetFactory
();
}
sslSocketFactory
=
sf
;
sslSocketFactory
=
sf
;
}
}
...
...
jdk/src/share/classes/javax/net/ssl/SSLEngine.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 2003, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
1
, 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
...
@@ -538,7 +538,7 @@ public abstract class SSLEngine {
...
@@ -538,7 +538,7 @@ public abstract class SSLEngine {
* If this <code>SSLEngine</code> has not yet started its initial
* If this <code>SSLEngine</code> has not yet started its initial
* handshake, this method will automatically start the handshake.
* handshake, this method will automatically start the handshake.
* <P>
* <P>
* This method will attempt to produce
one SSL/TLS packet
, and will
* This method will attempt to produce
SSL/TLS records
, and will
* consume as much source data as possible, but will never consume
* consume as much source data as possible, but will never consume
* more than the sum of the bytes remaining in each buffer. Each
* more than the sum of the bytes remaining in each buffer. Each
* <code>ByteBuffer</code>'s position is updated to reflect the
* <code>ByteBuffer</code>'s position is updated to reflect the
...
...
jdk/src/share/classes/javax/swing/JTable.java
浏览文件 @
16ad8cc6
...
@@ -1828,6 +1828,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
...
@@ -1828,6 +1828,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* table. While the {@code autoCreateRowSorter} property remains
* table. While the {@code autoCreateRowSorter} property remains
* {@code true}, every time the model is changed, a new {@code
* {@code true}, every time the model is changed, a new {@code
* TableRowSorter} is created and set as the table's row sorter.
* TableRowSorter} is created and set as the table's row sorter.
* The default value for the {@code autoCreateRowSorter}
* property is {@code false}.
*
*
* @param autoCreateRowSorter whether or not a {@code RowSorter}
* @param autoCreateRowSorter whether or not a {@code RowSorter}
* should be automatically created
* should be automatically created
...
...
jdk/src/share/classes/javax/swing/JTree.java
浏览文件 @
16ad8cc6
...
@@ -1838,7 +1838,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
...
@@ -1838,7 +1838,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
* nodes, or <code>null</code> if nothing is currently selected
* nodes, or <code>null</code> if nothing is currently selected
*/
*/
public
TreePath
[]
getSelectionPaths
()
{
public
TreePath
[]
getSelectionPaths
()
{
return
getSelectionModel
().
getSelectionPaths
();
TreePath
[]
selectionPaths
=
getSelectionModel
().
getSelectionPaths
();
return
(
selectionPaths
!=
null
&&
selectionPaths
.
length
>
0
)
?
selectionPaths
:
null
;
}
}
/**
/**
...
...
jdk/src/share/classes/javax/swing/text/DefaultCaret.java
浏览文件 @
16ad8cc6
...
@@ -1326,7 +1326,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
...
@@ -1326,7 +1326,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
if
(
!
SwingUtilities2
.
canCurrentEventAccessSystemClipboard
()
)
{
if
(
!
SwingUtilities2
.
canCurrentEventAccessSystemClipboard
()
)
{
return
;
return
;
}
}
if
(
this
.
dot
!=
this
.
mark
&&
component
!=
null
)
{
if
(
this
.
dot
!=
this
.
mark
&&
component
!=
null
&&
component
.
hasFocus
()
)
{
Clipboard
clip
=
getSystemSelection
();
Clipboard
clip
=
getSystemSelection
();
if
(
clip
!=
null
)
{
if
(
clip
!=
null
)
{
String
selectedText
;
String
selectedText
;
...
...
jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java
浏览文件 @
16ad8cc6
...
@@ -1181,7 +1181,12 @@ public class HTMLDocument extends DefaultStyledDocument {
...
@@ -1181,7 +1181,12 @@ public class HTMLDocument extends DefaultStyledDocument {
public
void
insertAfterStart
(
Element
elem
,
String
htmlText
)
throws
public
void
insertAfterStart
(
Element
elem
,
String
htmlText
)
throws
BadLocationException
,
IOException
{
BadLocationException
,
IOException
{
verifyParser
();
verifyParser
();
if
(
elem
!=
null
&&
elem
.
isLeaf
())
{
if
(
elem
==
null
||
htmlText
==
null
)
{
return
;
}
if
(
elem
.
isLeaf
())
{
throw
new
IllegalArgumentException
throw
new
IllegalArgumentException
(
"Can not insert HTML after start of a leaf"
);
(
"Can not insert HTML after start of a leaf"
);
}
}
...
...
jdk/src/share/classes/sun/awt/image/OffScreenImageSource.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 1995, 20
03
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 20
11
, 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
...
@@ -185,7 +185,7 @@ public class OffScreenImageSource implements ImageProducer {
...
@@ -185,7 +185,7 @@ public class OffScreenImageSource implements ImageProducer {
theConsumer
.
setDimensions
(
image
.
getWidth
(),
image
.
getHeight
());
theConsumer
.
setDimensions
(
image
.
getWidth
(),
image
.
getHeight
());
theConsumer
.
setProperties
(
properties
);
theConsumer
.
setProperties
(
properties
);
sendPixels
();
sendPixels
();
theConsumer
.
imageComplete
(
ImageConsumer
.
S
INGLEFRAM
EDONE
);
theConsumer
.
imageComplete
(
ImageConsumer
.
S
TATICIMAG
EDONE
);
}
catch
(
NullPointerException
e
)
{
}
catch
(
NullPointerException
e
)
{
if
(
theConsumer
!=
null
)
{
if
(
theConsumer
!=
null
)
{
theConsumer
.
imageComplete
(
ImageConsumer
.
IMAGEERROR
);
theConsumer
.
imageComplete
(
ImageConsumer
.
IMAGEERROR
);
...
...
jdk/src/share/classes/sun/net/ResourceManager.java
浏览文件 @
16ad8cc6
...
@@ -41,13 +41,14 @@ public class ResourceManager {
...
@@ -41,13 +41,14 @@ public class ResourceManager {
/* default maximum number of udp sockets per VM
/* default maximum number of udp sockets per VM
* when a security manager is enabled.
* when a security manager is enabled.
* The default is
1024
which is high enough to be useful
* The default is
25
which is high enough to be useful
* but low enough to be well below the maximum number
* but low enough to be well below the maximum number
* of port numbers actually available on all OSes for
* of port numbers actually available on all OSes
* such sockets (5000 on some versions of windows)
* when multiplied by the maximum feasible number of VM processes
* that could practically be spawned.
*/
*/
private
static
final
int
DEFAULT_MAX_SOCKETS
=
1024
;
private
static
final
int
DEFAULT_MAX_SOCKETS
=
25
;
private
static
final
int
maxSockets
;
private
static
final
int
maxSockets
;
private
static
final
AtomicInteger
numSockets
;
private
static
final
AtomicInteger
numSockets
;
...
...
jdk/src/share/classes/sun/print/PSPrinterJob.java
浏览文件 @
16ad8cc6
...
@@ -68,14 +68,18 @@ import javax.print.attribute.standard.Sides;
...
@@ -68,14 +68,18 @@ import javax.print.attribute.standard.Sides;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.BufferedReader
;
import
java.io.CharConversionException
;
import
java.io.CharConversionException
;
import
java.io.File
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.io.PrintStream
;
import
java.io.PrintStream
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
...
@@ -673,15 +677,38 @@ public class PSPrinterJob extends RasterPrinterJob {
...
@@ -673,15 +677,38 @@ public class PSPrinterJob extends RasterPrinterJob {
private
class
PrinterSpooler
implements
java
.
security
.
PrivilegedAction
{
private
class
PrinterSpooler
implements
java
.
security
.
PrivilegedAction
{
PrinterException
pex
;
PrinterException
pex
;
private
void
handleProcessFailure
(
final
Process
failedProcess
,
final
String
[]
execCmd
,
final
int
result
)
throws
IOException
{
try
(
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
))
{
pw
.
append
(
"error="
).
append
(
Integer
.
toString
(
result
));
pw
.
append
(
" running:"
);
for
(
String
arg:
execCmd
)
{
pw
.
append
(
" '"
).
append
(
arg
).
append
(
"'"
);
}
try
(
InputStream
is
=
failedProcess
.
getErrorStream
();
InputStreamReader
isr
=
new
InputStreamReader
(
is
);
BufferedReader
br
=
new
BufferedReader
(
isr
))
{
while
(
br
.
ready
())
{
pw
.
println
();
pw
.
append
(
"\t\t"
).
append
(
br
.
readLine
());
}
}
finally
{
pw
.
flush
();
throw
new
IOException
(
sw
.
toString
());
}
}
}
public
Object
run
()
{
public
Object
run
()
{
if
(
spoolFile
==
null
||
!
spoolFile
.
exists
())
{
pex
=
new
PrinterException
(
"No spool file"
);
return
null
;
}
try
{
try
{
/**
/**
* Spool to the printer.
* Spool to the printer.
*/
*/
if
(
spoolFile
==
null
||
!
spoolFile
.
exists
())
{
pex
=
new
PrinterException
(
"No spool file"
);
return
null
;
}
String
fileName
=
spoolFile
.
getAbsolutePath
();
String
fileName
=
spoolFile
.
getAbsolutePath
();
String
execCmd
[]
=
printExecCmd
(
mDestination
,
mOptions
,
String
execCmd
[]
=
printExecCmd
(
mDestination
,
mOptions
,
mNoJobSheet
,
getJobNameInt
(),
mNoJobSheet
,
getJobNameInt
(),
...
@@ -689,12 +716,16 @@ public class PSPrinterJob extends RasterPrinterJob {
...
@@ -689,12 +716,16 @@ public class PSPrinterJob extends RasterPrinterJob {
Process
process
=
Runtime
.
getRuntime
().
exec
(
execCmd
);
Process
process
=
Runtime
.
getRuntime
().
exec
(
execCmd
);
process
.
waitFor
();
process
.
waitFor
();
spoolFile
.
delete
();
final
int
result
=
process
.
exitValue
();
if
(
0
!=
result
)
{
handleProcessFailure
(
process
,
execCmd
,
result
);
}
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
pex
=
new
PrinterIOException
(
ex
);
pex
=
new
PrinterIOException
(
ex
);
}
catch
(
InterruptedException
ie
)
{
}
catch
(
InterruptedException
ie
)
{
pex
=
new
PrinterException
(
ie
.
toString
());
pex
=
new
PrinterException
(
ie
.
toString
());
}
finally
{
spoolFile
.
delete
();
}
}
return
null
;
return
null
;
}
}
...
...
jdk/src/share/classes/sun/rmi/registry/RegistryImpl.java
浏览文件 @
16ad8cc6
...
@@ -38,13 +38,23 @@ import java.rmi.server.ServerNotActiveException;
...
@@ -38,13 +38,23 @@ import java.rmi.server.ServerNotActiveException;
import
java.rmi.registry.Registry
;
import
java.rmi.registry.Registry
;
import
java.rmi.server.RMIClientSocketFactory
;
import
java.rmi.server.RMIClientSocketFactory
;
import
java.rmi.server.RMIServerSocketFactory
;
import
java.rmi.server.RMIServerSocketFactory
;
import
java.security.AccessControlContext
;
import
java.security.AccessController
;
import
java.security.CodeSource
;
import
java.security.Policy
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedExceptionAction
;
import
java.security.PermissionCollection
;
import
java.security.Permissions
;
import
java.security.ProtectionDomain
;
import
java.text.MessageFormat
;
import
java.text.MessageFormat
;
import
sun.rmi.server.LoaderHandler
;
import
sun.rmi.server.UnicastServerRef
;
import
sun.rmi.server.UnicastServerRef
;
import
sun.rmi.server.UnicastServerRef2
;
import
sun.rmi.server.UnicastServerRef2
;
import
sun.rmi.transport.LiveRef
;
import
sun.rmi.transport.LiveRef
;
import
sun.rmi.transport.ObjectTable
;
import
sun.rmi.transport.ObjectTable
;
import
sun.rmi.transport.Target
;
import
sun.rmi.transport.Target
;
import
sun.security.action.GetPropertyAction
;
/**
/**
* A "registry" exists on every node that allows RMI connections to
* A "registry" exists on every node that allows RMI connections to
...
@@ -325,6 +335,19 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
...
@@ -325,6 +335,19 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
URL
[]
urls
=
sun
.
misc
.
URLClassPath
.
pathToURLs
(
envcp
);
URL
[]
urls
=
sun
.
misc
.
URLClassPath
.
pathToURLs
(
envcp
);
ClassLoader
cl
=
new
URLClassLoader
(
urls
);
ClassLoader
cl
=
new
URLClassLoader
(
urls
);
String
codebaseProperty
=
null
;
String
prop
=
java
.
security
.
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"java.rmi.server.codebase"
));
if
(
prop
!=
null
&&
prop
.
trim
().
length
()
>
0
)
{
codebaseProperty
=
prop
;
}
URL
[]
codebaseURLs
=
null
;
if
(
codebaseProperty
!=
null
)
{
codebaseURLs
=
sun
.
misc
.
URLClassPath
.
pathToURLs
(
codebaseProperty
);
}
else
{
codebaseURLs
=
new
URL
[
0
];
}
/*
/*
* Fix bugid 4242317: Classes defined by this class loader should
* Fix bugid 4242317: Classes defined by this class loader should
* be annotated with the value of the "java.rmi.server.codebase"
* be annotated with the value of the "java.rmi.server.codebase"
...
@@ -334,11 +357,19 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
...
@@ -334,11 +357,19 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
Thread
.
currentThread
().
setContextClassLoader
(
cl
);
Thread
.
currentThread
().
setContextClassLoader
(
cl
);
int
regPort
=
Registry
.
REGISTRY_PORT
;
final
int
regPort
=
(
args
.
length
>=
1
)
?
Integer
.
parseInt
(
args
[
0
])
if
(
args
.
length
>=
1
)
{
:
Registry
.
REGISTRY_PORT
;
regPort
=
Integer
.
parseInt
(
args
[
0
]);
try
{
registry
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
RegistryImpl
>()
{
public
RegistryImpl
run
()
throws
RemoteException
{
return
new
RegistryImpl
(
regPort
);
}
},
getAccessControlContext
(
codebaseURLs
));
}
catch
(
PrivilegedActionException
ex
)
{
throw
(
RemoteException
)
ex
.
getException
();
}
}
registry
=
new
RegistryImpl
(
regPort
);
// prevent registry from exiting
// prevent registry from exiting
while
(
true
)
{
while
(
true
)
{
try
{
try
{
...
@@ -358,4 +389,48 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
...
@@ -358,4 +389,48 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
}
}
System
.
exit
(
1
);
System
.
exit
(
1
);
}
}
/**
* Generates an AccessControlContext from several URLs.
* The approach used here is taken from the similar method
* getAccessControlContext() in the sun.applet.AppletPanel class.
*/
private
static
AccessControlContext
getAccessControlContext
(
URL
[]
urls
)
{
// begin with permissions granted to all code in current policy
PermissionCollection
perms
=
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
PermissionCollection
>()
{
public
PermissionCollection
run
()
{
CodeSource
codesource
=
new
CodeSource
(
null
,
(
java
.
security
.
cert
.
Certificate
[])
null
);
Policy
p
=
java
.
security
.
Policy
.
getPolicy
();
if
(
p
!=
null
)
{
return
p
.
getPermissions
(
codesource
);
}
else
{
return
new
Permissions
();
}
}
});
/*
* Anyone can connect to the registry and the registry can connect
* to and possibly download stubs from anywhere. Downloaded stubs and
* related classes themselves are more tightly limited by RMI.
*/
perms
.
add
(
new
SocketPermission
(
"*"
,
"connect,accept"
));
perms
.
add
(
new
RuntimePermission
(
"accessClassInPackage.sun.*"
));
// add permissions required to load from codebase URL path
LoaderHandler
.
addPermissionsForURLs
(
urls
,
perms
,
false
);
/*
* Create an AccessControlContext that consists of a single
* protection domain with only the permissions calculated above.
*/
ProtectionDomain
pd
=
new
ProtectionDomain
(
new
CodeSource
((
urls
.
length
>
0
?
urls
[
0
]
:
null
),
(
java
.
security
.
cert
.
Certificate
[])
null
),
perms
);
return
new
AccessControlContext
(
new
ProtectionDomain
[]
{
pd
});
}
}
}
jdk/src/share/classes/sun/rmi/server/LoaderHandler.java
浏览文件 @
16ad8cc6
...
@@ -1031,9 +1031,9 @@ public final class LoaderHandler {
...
@@ -1031,9 +1031,9 @@ public final class LoaderHandler {
* loader. A given permission is only added to the collection if
* loader. A given permission is only added to the collection if
* it is not already implied by the collection.
* it is not already implied by the collection.
*/
*/
p
rivate
static
void
addPermissionsForURLs
(
URL
[]
urls
,
p
ublic
static
void
addPermissionsForURLs
(
URL
[]
urls
,
PermissionCollection
perms
,
PermissionCollection
perms
,
boolean
forLoader
)
boolean
forLoader
)
{
{
for
(
int
i
=
0
;
i
<
urls
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
urls
.
length
;
i
++)
{
URL
url
=
urls
[
i
];
URL
url
=
urls
[
i
];
...
...
jdk/src/share/classes/sun/rmi/server/UnicastServerRef.java
浏览文件 @
16ad8cc6
...
@@ -390,6 +390,12 @@ public class UnicastServerRef extends UnicastRef
...
@@ -390,6 +390,12 @@ public class UnicastServerRef extends UnicastRef
ObjectInput
in
;
ObjectInput
in
;
try
{
try
{
in
=
call
.
getInputStream
();
in
=
call
.
getInputStream
();
try
{
Class
<?>
clazz
=
Class
.
forName
(
"sun.rmi.transport.DGCImpl_Skel"
);
if
(
clazz
.
isAssignableFrom
(
skel
.
getClass
()))
{
((
MarshalInputStream
)
in
).
useCodebaseOnly
();
}
}
catch
(
ClassNotFoundException
ignore
)
{
}
hash
=
in
.
readLong
();
hash
=
in
.
readLong
();
}
catch
(
Exception
readEx
)
{
}
catch
(
Exception
readEx
)
{
throw
new
UnmarshalException
(
"error unmarshalling call header"
,
throw
new
UnmarshalException
(
"error unmarshalling call header"
,
...
...
jdk/src/share/classes/sun/security/ssl/AppOutputStream.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 1996, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 20
11
, 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
...
@@ -69,12 +69,38 @@ class AppOutputStream extends OutputStream {
...
@@ -69,12 +69,38 @@ class AppOutputStream extends OutputStream {
// check if the Socket is invalid (error or closed)
// check if the Socket is invalid (error or closed)
c
.
checkWrite
();
c
.
checkWrite
();
/*
* By default, we counter chosen plaintext issues on CBC mode
* ciphersuites in SSLv3/TLS1.0 by sending one byte of application
* data in the first record of every payload, and the rest in
* subsequent record(s). Note that the issues have been solved in
* TLS 1.1 or later.
*
* It is not necessary to split the very first application record of
* a freshly negotiated TLS session, as there is no previous
* application data to guess. To improve compatibility, we will not
* split such records.
*
* This avoids issues in the outbound direction. For a full fix,
* the peer must have similar protections.
*/
boolean
isFirstRecordOfThePayload
=
true
;
// Always flush at the end of each application level record.
// Always flush at the end of each application level record.
// This lets application synchronize read and write streams
// This lets application synchronize read and write streams
// however they like; if we buffered here, they couldn't.
// however they like; if we buffered here, they couldn't.
try
{
try
{
do
{
do
{
int
howmuch
=
Math
.
min
(
len
,
r
.
availableDataBytes
());
int
howmuch
;
if
(
isFirstRecordOfThePayload
&&
c
.
needToSplitPayload
())
{
howmuch
=
Math
.
min
(
0x01
,
r
.
availableDataBytes
());
}
else
{
howmuch
=
Math
.
min
(
len
,
r
.
availableDataBytes
());
}
if
(
isFirstRecordOfThePayload
&&
howmuch
!=
0
)
{
isFirstRecordOfThePayload
=
false
;
}
// NOTE: *must* call c.writeRecord() even for howmuch == 0
// NOTE: *must* call c.writeRecord() even for howmuch == 0
if
(
howmuch
>
0
)
{
if
(
howmuch
>
0
)
{
...
...
jdk/src/share/classes/sun/security/ssl/CipherBox.java
浏览文件 @
16ad8cc6
...
@@ -112,6 +112,11 @@ final class CipherBox {
...
@@ -112,6 +112,11 @@ final class CipherBox {
*/
*/
private
SecureRandom
random
;
private
SecureRandom
random
;
/**
* Is the cipher of CBC mode?
*/
private
final
boolean
isCBCMode
;
/**
/**
* Fixed masks of various block size, as the initial decryption IVs
* Fixed masks of various block size, as the initial decryption IVs
* for TLS 1.1 or later.
* for TLS 1.1 or later.
...
@@ -128,6 +133,7 @@ final class CipherBox {
...
@@ -128,6 +133,7 @@ final class CipherBox {
private
CipherBox
()
{
private
CipherBox
()
{
this
.
protocolVersion
=
ProtocolVersion
.
DEFAULT
;
this
.
protocolVersion
=
ProtocolVersion
.
DEFAULT
;
this
.
cipher
=
null
;
this
.
cipher
=
null
;
this
.
isCBCMode
=
false
;
}
}
/**
/**
...
@@ -148,6 +154,7 @@ final class CipherBox {
...
@@ -148,6 +154,7 @@ final class CipherBox {
random
=
JsseJce
.
getSecureRandom
();
random
=
JsseJce
.
getSecureRandom
();
}
}
this
.
random
=
random
;
this
.
random
=
random
;
this
.
isCBCMode
=
bulkCipher
.
isCBCMode
;
/*
/*
* RFC 4346 recommends two algorithms used to generated the
* RFC 4346 recommends two algorithms used to generated the
...
@@ -694,4 +701,12 @@ final class CipherBox {
...
@@ -694,4 +701,12 @@ final class CipherBox {
}
}
}
}
/*
* Does the cipher use CBC mode?
*
* @return true if the cipher use CBC mode, false otherwise.
*/
boolean
isCBCMode
()
{
return
isCBCMode
;
}
}
}
jdk/src/share/classes/sun/security/ssl/CipherSuite.java
浏览文件 @
16ad8cc6
...
@@ -420,10 +420,16 @@ final class CipherSuite implements Comparable<CipherSuite> {
...
@@ -420,10 +420,16 @@ final class CipherSuite implements Comparable<CipherSuite> {
// exportable under 512/40 bit rules
// exportable under 512/40 bit rules
final
boolean
exportable
;
final
boolean
exportable
;
// Is the cipher algorithm of Cipher Block Chaining (CBC) mode?
final
boolean
isCBCMode
;
BulkCipher
(
String
transformation
,
int
keySize
,
BulkCipher
(
String
transformation
,
int
keySize
,
int
expandedKeySize
,
int
ivSize
,
boolean
allowed
)
{
int
expandedKeySize
,
int
ivSize
,
boolean
allowed
)
{
this
.
transformation
=
transformation
;
this
.
transformation
=
transformation
;
this
.
algorithm
=
transformation
.
split
(
"/"
)[
0
];
String
[]
splits
=
transformation
.
split
(
"/"
);
this
.
algorithm
=
splits
[
0
];
this
.
isCBCMode
=
splits
.
length
<=
1
?
false
:
"CBC"
.
equalsIgnoreCase
(
splits
[
1
]);
this
.
description
=
this
.
algorithm
+
"/"
+
(
keySize
<<
3
);
this
.
description
=
this
.
algorithm
+
"/"
+
(
keySize
<<
3
);
this
.
keySize
=
keySize
;
this
.
keySize
=
keySize
;
this
.
ivSize
=
ivSize
;
this
.
ivSize
=
ivSize
;
...
@@ -436,7 +442,10 @@ final class CipherSuite implements Comparable<CipherSuite> {
...
@@ -436,7 +442,10 @@ final class CipherSuite implements Comparable<CipherSuite> {
BulkCipher
(
String
transformation
,
int
keySize
,
BulkCipher
(
String
transformation
,
int
keySize
,
int
ivSize
,
boolean
allowed
)
{
int
ivSize
,
boolean
allowed
)
{
this
.
transformation
=
transformation
;
this
.
transformation
=
transformation
;
this
.
algorithm
=
transformation
.
split
(
"/"
)[
0
];
String
[]
splits
=
transformation
.
split
(
"/"
);
this
.
algorithm
=
splits
[
0
];
this
.
isCBCMode
=
splits
.
length
<=
1
?
false
:
"CBC"
.
equalsIgnoreCase
(
splits
[
1
]);
this
.
description
=
this
.
algorithm
+
"/"
+
(
keySize
<<
3
);
this
.
description
=
this
.
algorithm
+
"/"
+
(
keySize
<<
3
);
this
.
keySize
=
keySize
;
this
.
keySize
=
keySize
;
this
.
ivSize
=
ivSize
;
this
.
ivSize
=
ivSize
;
...
...
jdk/src/share/classes/sun/security/ssl/EngineOutputRecord.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 2003, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, 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
...
@@ -46,6 +46,7 @@ import sun.misc.HexDumpEncoder;
...
@@ -46,6 +46,7 @@ import sun.misc.HexDumpEncoder;
*/
*/
final
class
EngineOutputRecord
extends
OutputRecord
{
final
class
EngineOutputRecord
extends
OutputRecord
{
private
SSLEngineImpl
engine
;
private
EngineWriter
writer
;
private
EngineWriter
writer
;
private
boolean
finishedMsg
=
false
;
private
boolean
finishedMsg
=
false
;
...
@@ -62,6 +63,7 @@ final class EngineOutputRecord extends OutputRecord {
...
@@ -62,6 +63,7 @@ final class EngineOutputRecord extends OutputRecord {
*/
*/
EngineOutputRecord
(
byte
type
,
SSLEngineImpl
engine
)
{
EngineOutputRecord
(
byte
type
,
SSLEngineImpl
engine
)
{
super
(
type
,
recordSize
(
type
));
super
(
type
,
recordSize
(
type
));
this
.
engine
=
engine
;
writer
=
engine
.
writer
;
writer
=
engine
.
writer
;
}
}
...
@@ -227,11 +229,50 @@ final class EngineOutputRecord extends OutputRecord {
...
@@ -227,11 +229,50 @@ final class EngineOutputRecord extends OutputRecord {
* implementations are fragile and don't like to see empty
* implementations are fragile and don't like to see empty
* records, so this increases robustness.
* records, so this increases robustness.
*/
*/
int
length
=
Math
.
min
(
ea
.
getAppRemaining
(),
maxDataSize
);
if
(
ea
.
getAppRemaining
()
==
0
)
{
if
(
length
==
0
)
{
return
;
return
;
}
}
/*
* By default, we counter chosen plaintext issues on CBC mode
* ciphersuites in SSLv3/TLS1.0 by sending one byte of application
* data in the first record of every payload, and the rest in
* subsequent record(s). Note that the issues have been solved in
* TLS 1.1 or later.
*
* It is not necessary to split the very first application record of
* a freshly negotiated TLS session, as there is no previous
* application data to guess. To improve compatibility, we will not
* split such records.
*
* Because of the compatibility, we'd better produce no more than
* SSLSession.getPacketBufferSize() net data for each wrap. As we
* need a one-byte record at first, the 2nd record size should be
* equal to or less than Record.maxDataSizeMinusOneByteRecord.
*
* This avoids issues in the outbound direction. For a full fix,
* the peer must have similar protections.
*/
int
length
;
if
(
engine
.
needToSplitPayload
(
writeCipher
,
protocolVersion
))
{
write
(
ea
,
writeMAC
,
writeCipher
,
0x01
);
ea
.
resetLim
();
// reset application data buffer limit
length
=
Math
.
min
(
ea
.
getAppRemaining
(),
maxDataSizeMinusOneByteRecord
);
}
else
{
length
=
Math
.
min
(
ea
.
getAppRemaining
(),
maxDataSize
);
}
// Don't bother to really write empty records.
if
(
length
>
0
)
{
write
(
ea
,
writeMAC
,
writeCipher
,
length
);
}
return
;
}
void
write
(
EngineArgs
ea
,
MAC
writeMAC
,
CipherBox
writeCipher
,
int
length
)
throws
IOException
{
/*
/*
* Copy out existing buffer values.
* Copy out existing buffer values.
*/
*/
...
...
jdk/src/share/classes/sun/security/ssl/Record.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 1996, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
1
, 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
...
@@ -67,6 +67,23 @@ interface Record {
...
@@ -67,6 +67,23 @@ interface Record {
+
maxPadding
// padding
+
maxPadding
// padding
+
trailerSize
;
// MAC
+
trailerSize
;
// MAC
static
final
boolean
enableCBCProtection
=
Debug
.
getBooleanProperty
(
"jsse.enableCBCProtection"
,
true
);
/*
* For CBC protection in SSL3/TLS1, we break some plaintext into two
* packets. Max application data size for the second packet.
*/
static
final
int
maxDataSizeMinusOneByteRecord
=
maxDataSize
// max data size
-
(
// max one byte record size
headerSize
// header
+
maxIVLength
// iv
+
1
// one byte data
+
maxPadding
// padding
+
trailerSize
// MAC
);
/*
/*
* The maximum large record size.
* The maximum large record size.
*
*
...
...
jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java
浏览文件 @
16ad8cc6
...
@@ -308,6 +308,11 @@ final public class SSLEngineImpl extends SSLEngine {
...
@@ -308,6 +308,11 @@ final public class SSLEngineImpl extends SSLEngine {
private
Object
unwrapLock
;
private
Object
unwrapLock
;
Object
writeLock
;
Object
writeLock
;
/*
* Is it the first application record to write?
*/
private
boolean
isFirstAppOutputRecord
=
true
;
/*
/*
* Class and subclass dynamic debugging support
* Class and subclass dynamic debugging support
*/
*/
...
@@ -612,6 +617,9 @@ final public class SSLEngineImpl extends SSLEngine {
...
@@ -612,6 +617,9 @@ final public class SSLEngineImpl extends SSLEngine {
// See comment above.
// See comment above.
oldCipher
.
dispose
();
oldCipher
.
dispose
();
// reset the flag of the first application record
isFirstAppOutputRecord
=
true
;
}
}
/*
/*
...
@@ -1286,9 +1294,35 @@ final public class SSLEngineImpl extends SSLEngine {
...
@@ -1286,9 +1294,35 @@ final public class SSLEngineImpl extends SSLEngine {
}
}
}
}
/*
* turn off the flag of the first application record if we really
* consumed at least byte.
*/
if
(
isFirstAppOutputRecord
&&
ea
.
deltaApp
()
>
0
)
{
isFirstAppOutputRecord
=
false
;
}
return
hsStatus
;
return
hsStatus
;
}
}
/*
* Need to split the payload except the following cases:
*
* 1. protocol version is TLS 1.1 or later;
* 2. bulk cipher does not use CBC mode, including null bulk cipher suites.
* 3. the payload is the first application record of a freshly
* negotiated TLS session.
* 4. the CBC protection is disabled;
*
* More details, please refer to
* EngineOutputRecord.write(EngineArgs, MAC, CipherBox).
*/
boolean
needToSplitPayload
(
CipherBox
cipher
,
ProtocolVersion
protocol
)
{
return
(
protocol
.
v
<=
ProtocolVersion
.
TLS10
.
v
)
&&
cipher
.
isCBCMode
()
&&
!
isFirstAppOutputRecord
&&
Record
.
enableCBCProtection
;
}
/*
/*
* Non-application OutputRecords go through here.
* Non-application OutputRecords go through here.
*/
*/
...
...
jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java
浏览文件 @
16ad8cc6
...
@@ -369,6 +369,11 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
...
@@ -369,6 +369,11 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
/* Class and subclass dynamic debugging support */
/* Class and subclass dynamic debugging support */
private
static
final
Debug
debug
=
Debug
.
getInstance
(
"ssl"
);
private
static
final
Debug
debug
=
Debug
.
getInstance
(
"ssl"
);
/*
* Is it the first application record to write?
*/
private
boolean
isFirstAppOutputRecord
=
true
;
//
//
// CONSTRUCTORS AND INITIALIZATION CODE
// CONSTRUCTORS AND INITIALIZATION CODE
//
//
...
@@ -802,8 +807,35 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
...
@@ -802,8 +807,35 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
if
(
connectionState
<
cs_ERROR
)
{
if
(
connectionState
<
cs_ERROR
)
{
checkSequenceNumber
(
writeMAC
,
r
.
contentType
());
checkSequenceNumber
(
writeMAC
,
r
.
contentType
());
}
}
// turn off the flag of the first application record
if
(
isFirstAppOutputRecord
&&
r
.
contentType
()
==
Record
.
ct_application_data
)
{
isFirstAppOutputRecord
=
false
;
}
}
}
/*
* Need to split the payload except the following cases:
*
* 1. protocol version is TLS 1.1 or later;
* 2. bulk cipher does not use CBC mode, including null bulk cipher suites.
* 3. the payload is the first application record of a freshly
* negotiated TLS session.
* 4. the CBC protection is disabled;
*
* More details, please refer to AppOutputStream.write(byte[], int, int).
*/
boolean
needToSplitPayload
()
{
writeLock
.
lock
();
try
{
return
(
protocolVersion
.
v
<=
ProtocolVersion
.
TLS10
.
v
)
&&
writeCipher
.
isCBCMode
()
&&
!
isFirstAppOutputRecord
&&
Record
.
enableCBCProtection
;
}
finally
{
writeLock
.
unlock
();
}
}
/*
/*
* Read an application data record. Alerts and handshake
* Read an application data record. Alerts and handshake
...
@@ -2031,6 +2063,9 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
...
@@ -2031,6 +2063,9 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
// See comment above.
// See comment above.
oldCipher
.
dispose
();
oldCipher
.
dispose
();
// reset the flag of the first application record
isFirstAppOutputRecord
=
true
;
}
}
/*
/*
...
...
jdk/src/share/classes/sun/swing/SwingUtilities2.java
浏览文件 @
16ad8cc6
...
@@ -524,55 +524,66 @@ public class SwingUtilities2 {
...
@@ -524,55 +524,66 @@ public class SwingUtilities2 {
}
}
// If we get here we're not printing
// If we get here we're not printing
AATextInfo
info
=
drawTextAntialiased
(
c
);
if
(
g
instanceof
Graphics2D
)
{
if
(
info
!=
null
&&
(
g
instanceof
Graphics2D
))
{
AATextInfo
info
=
drawTextAntialiased
(
c
);
Graphics2D
g2
=
(
Graphics2D
)
g
;
Graphics2D
g2
=
(
Graphics2D
)
g
;
Object
oldContrast
=
null
;
Object
oldAAValue
=
g2
.
getRenderingHint
(
KEY_TEXT_ANTIALIASING
);
if
(
info
.
aaHint
!=
oldAAValue
)
{
g2
.
setRenderingHint
(
KEY_TEXT_ANTIALIASING
,
info
.
aaHint
);
}
else
{
oldAAValue
=
null
;
}
if
(
info
.
lcdContrastHint
!=
null
)
{
oldContrast
=
g2
.
getRenderingHint
(
KEY_TEXT_LCD_CONTRAST
);
if
(
info
.
lcdContrastHint
.
equals
(
oldContrast
))
{
oldContrast
=
null
;
}
else
{
g2
.
setRenderingHint
(
KEY_TEXT_LCD_CONTRAST
,
info
.
lcdContrastHint
);
}
}
boolean
needsTextLayout
=
((
c
!=
null
)
&&
boolean
needsTextLayout
=
((
c
!=
null
)
&&
(
c
.
getClientProperty
(
TextAttribute
.
NUMERIC_SHAPING
)
!=
null
));
(
c
.
getClientProperty
(
TextAttribute
.
NUMERIC_SHAPING
)
!=
null
));
if
(
needsTextLayout
)
{
if
(
needsTextLayout
)
{
synchronized
(
charsBufferLock
)
{
synchronized
(
charsBufferLock
)
{
int
length
=
syncCharsBuffer
(
text
);
int
length
=
syncCharsBuffer
(
text
);
needsTextLayout
=
isComplexLayout
(
charsBuffer
,
0
,
length
);
needsTextLayout
=
isComplexLayout
(
charsBuffer
,
0
,
length
);
}
}
}
}
if
(
needsTextLayout
)
{
TextLayout
layout
=
createTextLayout
(
c
,
text
,
g2
.
getFont
(),
if
(
info
!=
null
)
{
Object
oldContrast
=
null
;
Object
oldAAValue
=
g2
.
getRenderingHint
(
KEY_TEXT_ANTIALIASING
);
if
(
info
.
aaHint
!=
oldAAValue
)
{
g2
.
setRenderingHint
(
KEY_TEXT_ANTIALIASING
,
info
.
aaHint
);
}
else
{
oldAAValue
=
null
;
}
if
(
info
.
lcdContrastHint
!=
null
)
{
oldContrast
=
g2
.
getRenderingHint
(
KEY_TEXT_LCD_CONTRAST
);
if
(
info
.
lcdContrastHint
.
equals
(
oldContrast
))
{
oldContrast
=
null
;
}
else
{
g2
.
setRenderingHint
(
KEY_TEXT_LCD_CONTRAST
,
info
.
lcdContrastHint
);
}
}
if
(
needsTextLayout
)
{
TextLayout
layout
=
createTextLayout
(
c
,
text
,
g2
.
getFont
(),
g2
.
getFontRenderContext
());
g2
.
getFontRenderContext
());
layout
.
draw
(
g2
,
x
,
y
);
layout
.
draw
(
g2
,
x
,
y
);
}
else
{
}
else
{
g
.
drawString
(
text
,
x
,
y
);
g
.
drawString
(
text
,
x
,
y
);
}
}
if
(
oldAAValue
!=
null
)
{
if
(
oldAAValue
!=
null
)
{
g2
.
setRenderingHint
(
KEY_TEXT_ANTIALIASING
,
oldAAValue
);
g2
.
setRenderingHint
(
KEY_TEXT_ANTIALIASING
,
oldAAValue
);
}
if
(
oldContrast
!=
null
)
{
g2
.
setRenderingHint
(
KEY_TEXT_LCD_CONTRAST
,
oldContrast
);
}
return
;
}
}
if
(
oldContrast
!=
null
)
{
g2
.
setRenderingHint
(
KEY_TEXT_LCD_CONTRAST
,
oldContrast
);
if
(
needsTextLayout
){
TextLayout
layout
=
createTextLayout
(
c
,
text
,
g2
.
getFont
(),
g2
.
getFontRenderContext
());
layout
.
draw
(
g2
,
x
,
y
);
return
;
}
}
}
}
else
{
g
.
drawString
(
text
,
x
,
y
);
}
}
g
.
drawString
(
text
,
x
,
y
);
}
/**
/**
* Draws the string at the specified location underlining the specified
* Draws the string at the specified location underlining the specified
...
...
jdk/src/share/classes/sun/text/resources/CollationData_th.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 20
11
, 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
...
@@ -103,18 +103,13 @@ public class CollationData_th extends ListResourceBundle {
...
@@ -103,18 +103,13 @@ public class CollationData_th extends ListResourceBundle {
//
//
// Normal vowels
// Normal vowels
//
//
+
"< \u0E4D "
// NIKHAHIT
+
"< \u0E30 "
// SARA A
+
"< \u0E30 "
// SARA A
+
"< \u0E31 "
// MAI HAN-AKAT
+
"< \u0E31 "
// MAI HAN-AKAT
+
"< \u0E32 "
// SARA AA
+
"< \u0E32 "
// SARA AA
// Normalizer will decompose this character to \u0e4d\u0e32. This is
// Normalizer will decompose this character to \u0e4d\u0e32.
// a Bad Thing, because we want the separate characters to sort
+
"< \u0E33 = \u0E4D\u0E32 "
// SARA AM
// differently than this individual one. Since there's no public way to
// set the decomposition to be used when creating a collator, there's
// no way around this right now.
// It's best to go ahead and leave the character in, because it occurs
// this way a lot more often than it occurs as separate characters.
+
"< \u0E33 "
// SARA AM
+
"< \u0E34 "
// SARA I
+
"< \u0E34 "
// SARA I
...
@@ -133,62 +128,58 @@ public class CollationData_th extends ListResourceBundle {
...
@@ -133,62 +128,58 @@ public class CollationData_th extends ListResourceBundle {
+
"< \u0E43 "
// SARA AI MAIMUAN
+
"< \u0E43 "
// SARA AI MAIMUAN
+
"< \u0E44 "
// SARA AI MAIMALAI
+
"< \u0E44 "
// SARA AI MAIMALAI
//
// Digits
//
+
"< \u0E50 "
// DIGIT ZERO
+
"< \u0E51 "
// DIGIT ONE
+
"< \u0E52 "
// DIGIT TWO
+
"< \u0E53 "
// DIGIT THREE
+
"< \u0E54 "
// DIGIT FOUR
+
"< \u0E55 "
// DIGIT FIVE
+
"< \u0E56 "
// DIGIT SIX
+
"< \u0E57 "
// DIGIT SEVEN
+
"< \u0E58 "
// DIGIT EIGHT
+
"< \u0E59 "
// DIGIT NINE
// Sorta tonal marks, but maybe not really
+
"< \u0E4D "
// NIKHAHIT
//
//according to CLDR, it's after 0e44
// Thai symbols are supposed to sort "after white space".
+
"< \u0E3A "
// PHINTHU
// I'm treating this as making them sort just after the normal Latin-1
// symbols, which are in turn after the white space.
//
+
"&'\u007d'"
// right-brace
// This rare symbol comes after all characters.
+
"< \u0E2F "
// PAIYANNOI (ellipsis, abbreviation)
+
"< \u0E46 "
// MAIYAMOK
+
"< \u0E4F "
// FONGMAN
+
"< \u0E5A "
// ANGKHANKHU
+
"< \u0E5B "
// KHOMUT
+
"< \u0E3F "
// CURRENCY SYMBOL BAHT
// These symbols are supposed to be "after all characters"
+
"< \u0E4E "
// YAMAKKAN
// This rare symbol also comes after all characters. But when it is
// used in combination with RU and LU, the combination is treated as
// a separate letter, ala "CH" sorting after "C" in traditional Spanish.
+
"< \u0E45 "
// LAKKHANGYAO
+
"< \u0E45 "
// LAKKHANGYAO
+
"& \u0E
24 < \u0E24\u0E45 "
+
"& \u0E
32 , \0E45 "
// According to CLDR, 0E45 is after 0E32 in tertiary level
+
"& \u0E26 < \u0E26\u0E45 "
// Tonal marks are primary ignorables but are treated as secondary
// differences
// Below are thai puntuation marks and Tonal(Accent) marks. According to CLDR 1.9 and
// ISO/IEC 14651, Annex C, C.2.1 Thai ordering principles, 0E2F to 0E5B are punctuaion marks that need to be ignored
// in the first three leveles. 0E4E to 0E4B are tonal marks to be compared in secondary level.
// In real implmentation, set puncutation marks in tertiary as there is no fourth level in Java.
// Set all these special marks after \u0301, the accute accent.
+
"& \u0301 "
// acute accent
+
"& \u0301 "
// acute accent
//puncutation marks
+
", \u0E2F "
// PAIYANNOI (ellipsis, abbreviation)
+
", \u0E46 "
// MAIYAMOK
+
", \u0E4F "
// FONGMAN
+
", \u0E5A "
// ANGKHANKHU
+
", \u0E5B "
// KHOMUT
//tonal marks
+
"; \u0E4E "
// YAMAKKAN
+
"; \u0E4C "
// THANTHAKHAT
+
"; \u0E47 "
// MAITAIKHU
+
"; \u0E47 "
// MAITAIKHU
+
"; \u0E48 "
// MAI EK
+
"; \u0E48 "
// MAI EK
+
"; \u0E49 "
// MAI THO
+
"; \u0E49 "
// MAI THO
+
"; \u0E4A "
// MAI TRI
+
"; \u0E4A "
// MAI TRI
+
"; \u0E4B "
// MAI CHATTAWA
+
"; \u0E4B "
// MAI CHATTAWA
+
"; \u0E4C "
// THANTHAKHAT
// These are supposed to be ignored, so I'm treating them as controls
//
+
"& \u0001 "
// Digits are equal to their corresponding Arabic digits in the first level
+
"= \u0E3A "
// PHINTHU
//
+
"= '.' "
// period
+
"& 0 = \u0E50 "
// DIGIT ZERO
}
+
"& 1 = \u0E51 "
// DIGIT ONE
+
"& 2 = \u0E52 "
// DIGIT TWO
+
"& 3 = \u0E53 "
// DIGIT THREE
+
"& 4 = \u0E54 "
// DIGIT FOUR
+
"& 5 = \u0E55 "
// DIGIT FIVE
+
"& 6 = \u0E56 "
// DIGIT SIX
+
"& 7 = \u0E57 "
// DIGIT SEVEN
+
"& 8 = \u0E58 "
// DIGIT EIGHT
+
"& 9 = \u0E59 "
// DIGIT NINE
}
};
};
}
}
}
}
jdk/src/share/classes/sun/util/resources/CalendarData_lv.properties
浏览文件 @
16ad8cc6
#
#
# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005,
2011,
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
...
@@ -23,21 +23,45 @@
...
@@ -23,21 +23,45 @@
# questions.
# questions.
#
#
# (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
# (C) Copyright IBM Corp. 1996 - 1999 - All Rights Reserved
#
#
# The original version of this source code and documentation
# COPYRIGHT AND PERMISSION NOTICE
# is copyrighted and owned by Taligent, Inc., a wholly-owned
# subsidiary of IBM. These materials are provided under terms
# of a License Agreement between Taligent and Sun. This technology
# is protected by multiple US and International patents.
#
#
# This notice and attribution to Taligent may not be removed.
# Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
# Taligent is a registered trademark of Taligent, Inc.
# Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of the Unicode data files and any associated documentation (the
# "Data Files") or Unicode software and any associated documentation
# (the "Software") to deal in the Data Files or Software without
# restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, and/or sell copies of the Data
# Files or Software, and to permit persons to whom the Data Files or
# Software are furnished to do so, provided that (a) the above copyright
# notice(s) and this permission notice appear with all copies of the
# Data Files or Software, (b) both the above copyright notice(s) and
# this permission notice appear in associated documentation, and (c)
# there is clear notice in each modified Data File or in the Software as
# well as in the documentation associated with the Data File(s) or
# Software that the data or software has been modified.
#
# THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
# ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
# SOFTWARE.
#
# Except as contained in this notice, the name of a copyright holder
# shall not be used in advertising or otherwise to promote the sale, use
# or other dealings in these Data Files or Software without prior
# written authorization of the copyright holder.
#
This bundle is empty because the data of the base bundle
#
#
is adequate for this locale.
#
Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
#
The bundle is necessary to prevent the resource
#
# bundle lookup from falling back to the default
firstDayOfWeek
=
2
# locale.
minimalDaysInFirstWeek
=
4
jdk/src/share/demo/jfc/TransparentRuler/README.txt
浏览文件 @
16ad8cc6
To run the Ruler demo:
To run the Ruler demo:
java -jar Ruler.jar
java -jar
Transparent
Ruler.jar
These instructions assume that this installation's version of the java
These instructions assume that this installation's version of the java
command is in your path. If it isn't, then you should either
command is in your path. If it isn't, then you should either
specify the complete path to the java command or update your
specify the complete path to the java command or update your
PATH environment variable as described in the installation
PATH environment variable as described in the installation
instructions for the Java(TM) SE Development Kit.
instructions for the Java(TM) SE Development Kit.
KNOWN ISSUES:
Context menu is clipped with the window shape. The issues are:
CR 7027486 JPopupMenu doesn't take window shape into account
jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
浏览文件 @
16ad8cc6
...
@@ -1112,11 +1112,14 @@ void unpacker::read_Utf8_values(entry* cpMap, int len) {
...
@@ -1112,11 +1112,14 @@ void unpacker::read_Utf8_values(entry* cpMap, int len) {
uint
size3
=
suffix
*
3
;
uint
size3
=
suffix
*
3
;
if
(
suffix
==
0
)
continue
;
// done with empty string
if
(
suffix
==
0
)
continue
;
// done with empty string
chars
.
malloc
(
size3
);
chars
.
malloc
(
size3
);
CHECK
;
byte
*
chp
=
chars
.
ptr
;
byte
*
chp
=
chars
.
ptr
;
band
saved_band
=
cp_Utf8_big_chars
;
band
saved_band
=
cp_Utf8_big_chars
;
cp_Utf8_big_chars
.
readData
(
suffix
);
cp_Utf8_big_chars
.
readData
(
suffix
);
CHECK
;
for
(
int
j
=
0
;
j
<
suffix
;
j
++
)
{
for
(
int
j
=
0
;
j
<
suffix
;
j
++
)
{
unsigned
short
ch
=
cp_Utf8_big_chars
.
getInt
();
unsigned
short
ch
=
cp_Utf8_big_chars
.
getInt
();
CHECK
;
chp
=
store_Utf8_char
(
chp
,
ch
);
chp
=
store_Utf8_char
(
chp
,
ch
);
}
}
chars
.
realloc
(
chp
-
chars
.
ptr
);
chars
.
realloc
(
chp
-
chars
.
ptr
);
...
@@ -1134,10 +1137,12 @@ void unpacker::read_Utf8_values(entry* cpMap, int len) {
...
@@ -1134,10 +1137,12 @@ void unpacker::read_Utf8_values(entry* cpMap, int len) {
CHECK
;
CHECK
;
int
prevlen
=
0
;
// previous string length (in chars)
int
prevlen
=
0
;
// previous string length (in chars)
tmallocs
.
add
(
bigbuf
.
ptr
);
// free after this block
tmallocs
.
add
(
bigbuf
.
ptr
);
// free after this block
CHECK
;
cp_Utf8_prefix
.
rewind
();
cp_Utf8_prefix
.
rewind
();
for
(
i
=
0
;
i
<
len
;
i
++
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
bytes
&
chars
=
allsuffixes
[
i
];
bytes
&
chars
=
allsuffixes
[
i
];
int
prefix
=
(
i
<
PREFIX_SKIP_2
)
?
0
:
cp_Utf8_prefix
.
getInt
();
int
prefix
=
(
i
<
PREFIX_SKIP_2
)
?
0
:
cp_Utf8_prefix
.
getInt
();
CHECK
;
int
suffix
=
(
int
)
chars
.
len
;
int
suffix
=
(
int
)
chars
.
len
;
byte
*
fillp
;
byte
*
fillp
;
// by induction, the buffer is already filled with the prefix
// by induction, the buffer is already filled with the prefix
...
...
jdk/src/share/native/com/sun/java/util/jar/pack/utils.cpp
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 2001, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 20
11
, 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
...
@@ -52,7 +52,7 @@ void* must_malloc(size_t size) {
...
@@ -52,7 +52,7 @@ void* must_malloc(size_t size) {
if
(
msize
>=
0
&&
msize
<
sizeof
(
int
))
if
(
msize
>=
0
&&
msize
<
sizeof
(
int
))
msize
=
sizeof
(
int
);
// see 0xbaadf00d below
msize
=
sizeof
(
int
);
// see 0xbaadf00d below
#endif
#endif
void
*
ptr
=
(
msize
>
PSIZE_MAX
)
?
null
:
malloc
(
msize
);
void
*
ptr
=
(
msize
>
PSIZE_MAX
||
msize
<=
0
)
?
null
:
malloc
(
msize
);
if
(
ptr
!=
null
)
{
if
(
ptr
!=
null
)
{
memset
(
ptr
,
0
,
size
);
memset
(
ptr
,
0
,
size
);
}
else
{
}
else
{
...
...
jdk/src/share/native/com/sun/java/util/jar/pack/utils.h
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 2001, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 20
11
, 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
...
@@ -33,7 +33,7 @@ void mtrace(char c, void* ptr, size_t size);
...
@@ -33,7 +33,7 @@ void mtrace(char c, void* ptr, size_t size);
#endif
#endif
// overflow management
// overflow management
#define OVERFLOW ((
size_
t)-1)
#define OVERFLOW ((
uin
t)-1)
#define PSIZE_MAX (OVERFLOW/2)
/* normal size limit */
#define PSIZE_MAX (OVERFLOW/2)
/* normal size limit */
inline
size_t
scale_size
(
size_t
size
,
size_t
scale
)
{
inline
size_t
scale_size
(
size_t
size
,
size_t
scale
)
{
...
...
jdk/src/share/native/sun/java2d/loops/TransformHelper.c
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004,
2011,
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
...
@@ -284,7 +284,7 @@ Java_sun_java2d_loops_TransformHelper_Transform
...
@@ -284,7 +284,7 @@ Java_sun_java2d_loops_TransformHelper_Transform
TransformHelperFunc
*
pHelperFunc
;
TransformHelperFunc
*
pHelperFunc
;
TransformInterpFunc
*
pInterpFunc
;
TransformInterpFunc
*
pInterpFunc
;
jdouble
xorig
,
yorig
;
jdouble
xorig
,
yorig
;
j
int
numedges
;
j
long
numedges
;
jint
*
pEdges
;
jint
*
pEdges
;
jint
edgebuf
[
2
+
MAXEDGES
*
2
];
jint
edgebuf
[
2
+
MAXEDGES
*
2
];
union
{
union
{
...
@@ -379,19 +379,44 @@ Java_sun_java2d_loops_TransformHelper_Transform
...
@@ -379,19 +379,44 @@ Java_sun_java2d_loops_TransformHelper_Transform
}
}
Region_IntersectBounds
(
&
clipInfo
,
&
dstInfo
.
bounds
);
Region_IntersectBounds
(
&
clipInfo
,
&
dstInfo
.
bounds
);
numedges
=
(
dstInfo
.
bounds
.
y2
-
dstInfo
.
bounds
.
y1
);
numedges
=
(((
jlong
)
dstInfo
.
bounds
.
y2
)
-
((
jlong
)
dstInfo
.
bounds
.
y1
));
if
(
numedges
>
MAXEDGES
)
{
if
(
numedges
<=
0
)
{
pEdges
=
malloc
((
2
+
2
*
numedges
)
*
sizeof
(
*
pEdges
));
pEdges
=
NULL
;
if
(
pEdges
==
NULL
)
{
}
else
if
(
!
JNU_IsNull
(
env
,
edgeArray
))
{
SurfaceData_InvokeUnlock
(
env
,
dstOps
,
&
dstInfo
);
/*
SurfaceData_InvokeUnlock
(
env
,
srcOps
,
&
srcInfo
);
* Ideally Java should allocate an array large enough, but if
/* edgeArray should already contain zeros for min/maxy */
* we ever have a miscommunication about the number of edge
return
;
* lines, or if the Java array calculation should overflow to
}
* a positive number and succeed in allocating an array that
* is too small, we need to verify that it can still hold the
* number of integers that we plan to store to be safe.
*/
jsize
edgesize
=
(
*
env
)
->
GetArrayLength
(
env
,
edgeArray
);
/* (edgesize/2 - 1) should avoid any overflow or underflow. */
pEdges
=
(((
edgesize
/
2
)
-
1
)
>=
numedges
)
?
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
edgeArray
,
NULL
)
:
NULL
;
}
else
if
(
numedges
>
MAXEDGES
)
{
/* numedges variable (jlong) can be at most ((1<<32)-1) */
/* memsize can overflow a jint, but not a jlong */
jlong
memsize
=
((
numedges
*
2
)
+
2
)
*
sizeof
(
*
pEdges
);
pEdges
=
(
memsize
==
((
size_t
)
memsize
))
?
malloc
((
size_t
)
memsize
)
:
NULL
;
}
else
{
}
else
{
pEdges
=
edgebuf
;
pEdges
=
edgebuf
;
}
}
if
(
pEdges
==
NULL
)
{
if
(
numedges
>
0
)
{
JNU_ThrowInternalError
(
env
,
"Unable to allocate edge list"
);
}
SurfaceData_InvokeUnlock
(
env
,
dstOps
,
&
dstInfo
);
SurfaceData_InvokeUnlock
(
env
,
srcOps
,
&
srcInfo
);
/* edgeArray should already contain zeros for min/maxy */
return
;
}
Transform_GetInfo
(
env
,
itxform
,
&
itxInfo
);
Transform_GetInfo
(
env
,
itxform
,
&
itxInfo
);
if
(
!
Region_IsEmpty
(
&
clipInfo
))
{
if
(
!
Region_IsEmpty
(
&
clipInfo
))
{
...
@@ -500,14 +525,14 @@ Java_sun_java2d_loops_TransformHelper_Transform
...
@@ -500,14 +525,14 @@ Java_sun_java2d_loops_TransformHelper_Transform
}
else
{
}
else
{
pEdges
[
0
]
=
pEdges
[
1
]
=
0
;
pEdges
[
0
]
=
pEdges
[
1
]
=
0
;
}
}
SurfaceData_InvokeUnlock
(
env
,
dstOps
,
&
dstInfo
);
SurfaceData_InvokeUnlock
(
env
,
srcOps
,
&
srcInfo
);
if
(
!
JNU_IsNull
(
env
,
edgeArray
))
{
if
(
!
JNU_IsNull
(
env
,
edgeArray
))
{
(
*
env
)
->
SetIntArrayRegion
(
env
,
edgeArray
,
0
,
2
+
numedges
*
2
,
pEdges
);
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
edgeArray
,
pEdges
,
0
);
}
}
else
if
(
pEdges
!=
edgebuf
)
{
if
(
pEdges
!=
edgebuf
)
{
free
(
pEdges
);
free
(
pEdges
);
}
}
SurfaceData_InvokeUnlock
(
env
,
dstOps
,
&
dstInfo
);
SurfaceData_InvokeUnlock
(
env
,
srcOps
,
&
srcInfo
);
}
}
static
void
static
void
...
...
jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
浏览文件 @
16ad8cc6
...
@@ -466,12 +466,16 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
...
@@ -466,12 +466,16 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
if
(
true
)
{
if
(
true
)
{
switch
(
e
.
getID
())
{
switch
(
e
.
getID
())
{
case
PaintEvent
.
UPDATE
:
case
PaintEvent
.
UPDATE
:
log
.
finer
(
"XCP coalescePaintEvent : UPDATE : add : x = "
+
if
(
log
.
isLoggable
(
PlatformLogger
.
FINER
))
{
log
.
finer
(
"XCP coalescePaintEvent : UPDATE : add : x = "
+
r
.
x
+
", y = "
+
r
.
y
+
", width = "
+
r
.
width
+
",height = "
+
r
.
height
);
r
.
x
+
", y = "
+
r
.
y
+
", width = "
+
r
.
width
+
",height = "
+
r
.
height
);
}
return
;
return
;
case
PaintEvent
.
PAINT
:
case
PaintEvent
.
PAINT
:
log
.
finer
(
"XCP coalescePaintEvent : PAINT : add : x = "
+
if
(
log
.
isLoggable
(
PlatformLogger
.
FINER
))
{
log
.
finer
(
"XCP coalescePaintEvent : PAINT : add : x = "
+
r
.
x
+
", y = "
+
r
.
y
+
", width = "
+
r
.
width
+
",height = "
+
r
.
height
);
r
.
x
+
", y = "
+
r
.
y
+
", width = "
+
r
.
width
+
",height = "
+
r
.
height
);
}
return
;
return
;
}
}
}
}
...
@@ -1248,7 +1252,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
...
@@ -1248,7 +1252,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
* ButtonPress, ButtonRelease, KeyPress, KeyRelease, EnterNotify, LeaveNotify, MotionNotify
* ButtonPress, ButtonRelease, KeyPress, KeyRelease, EnterNotify, LeaveNotify, MotionNotify
*/
*/
protected
boolean
isEventDisabled
(
XEvent
e
)
{
protected
boolean
isEventDisabled
(
XEvent
e
)
{
enableLog
.
finest
(
"Component is {1}, checking for disabled event {0}"
,
e
,
(
isEnabled
()?
"enabled"
:
"disable"
));
if
(
enableLog
.
isLoggable
(
PlatformLogger
.
FINEST
))
{
enableLog
.
finest
(
"Component is {1}, checking for disabled event {0}"
,
e
,
(
isEnabled
()?
"enabled"
:
"disable"
));
}
if
(!
isEnabled
())
{
if
(!
isEnabled
())
{
switch
(
e
.
get_type
())
{
switch
(
e
.
get_type
())
{
case
XConstants
.
ButtonPress
:
case
XConstants
.
ButtonPress
:
...
@@ -1258,7 +1264,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
...
@@ -1258,7 +1264,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
case
XConstants
.
EnterNotify
:
case
XConstants
.
EnterNotify
:
case
XConstants
.
LeaveNotify
:
case
XConstants
.
LeaveNotify
:
case
XConstants
.
MotionNotify
:
case
XConstants
.
MotionNotify
:
enableLog
.
finer
(
"Event {0} is disable"
,
e
);
if
(
enableLog
.
isLoggable
(
PlatformLogger
.
FINER
))
{
enableLog
.
finer
(
"Event {0} is disable"
,
e
);
}
return
true
;
return
true
;
}
}
}
}
...
...
jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java
浏览文件 @
16ad8cc6
...
@@ -678,7 +678,7 @@ public class WrapperGenerator {
...
@@ -678,7 +678,7 @@ public class WrapperGenerator {
public
void
writeToString
(
StructType
stp
,
PrintWriter
pw
)
{
public
void
writeToString
(
StructType
stp
,
PrintWriter
pw
)
{
int
type
;
int
type
;
pw
.
println
(
"\n\n\tString getName() {\n\t\treturn \""
+
stp
.
getName
()+
"\"; \n\t}"
);
pw
.
println
(
"\n\n\tString getName() {\n\t\treturn \""
+
stp
.
getName
()+
"\"; \n\t}"
);
pw
.
println
(
"\n\n\tString getFieldsAsString() {\n\t\tString
ret=\"\"
;\n"
);
pw
.
println
(
"\n\n\tString getFieldsAsString() {\n\t\tString
Builder ret = new StringBuilder("
+
stp
.
getNumFields
()
*
40
+
")
;\n"
);
for
(
Enumeration
e
=
stp
.
getMembers
()
;
e
.
hasMoreElements
()
;)
{
for
(
Enumeration
e
=
stp
.
getMembers
()
;
e
.
hasMoreElements
()
;)
{
AtomicType
tp
=
(
AtomicType
)
e
.
nextElement
();
AtomicType
tp
=
(
AtomicType
)
e
.
nextElement
();
...
@@ -688,24 +688,24 @@ public class WrapperGenerator {
...
@@ -688,24 +688,24 @@ public class WrapperGenerator {
if
((
name
!=
null
)
&&
(
name
.
length
()
>
0
))
if
((
name
!=
null
)
&&
(
name
.
length
()
>
0
))
{
{
if
(
type
==
AtomicType
.
TYPE_ATOM
)
{
if
(
type
==
AtomicType
.
TYPE_ATOM
)
{
pw
.
println
(
"\t\tret
+= \"\"+\""
+
name
+
" = \" + XAtom.get(get_"
+
name
+
"()) +\", \"
;"
);
pw
.
println
(
"\t\tret
.append(\""
+
name
+
" = \" ).append( XAtom.get(get_"
+
name
+
"()) ).append(\", \")
;"
);
}
else
if
(
name
.
equals
(
"type"
))
{
}
else
if
(
name
.
equals
(
"type"
))
{
pw
.
println
(
"\t\tret
+= \"\"+\"type = \" + XlibWrapper.eventToString[get_type()] +\", \"
;"
);
pw
.
println
(
"\t\tret
.append(\"type = \").append( XlibWrapper.eventToString[get_type()] ).append(\", \")
;"
);
}
else
if
(
name
.
equals
(
"window"
)){
}
else
if
(
name
.
equals
(
"window"
)){
pw
.
println
(
"\t\tret
+= \"\"+\"window = \" + getWindow(get_window()) + \", \"
;"
);
pw
.
println
(
"\t\tret
.append(\"window = \" ).append( getWindow(get_window()) ).append(\", \")
;"
);
}
else
if
(
type
==
AtomicType
.
TYPE_ARRAY
)
{
}
else
if
(
type
==
AtomicType
.
TYPE_ARRAY
)
{
pw
.
print
(
"\t\tret
+= \"{\"
"
);
pw
.
print
(
"\t\tret
.append(\"{\")
"
);
for
(
int
i
=
0
;
i
<
tp
.
getArrayLength
();
i
++)
{
for
(
int
i
=
0
;
i
<
tp
.
getArrayLength
();
i
++)
{
pw
.
print
(
"
+ get_"
+
name
+
"("
+
i
+
") + \" \"
"
);
pw
.
print
(
"
\n\t\t.append( get_"
+
name
+
"("
+
i
+
") ).append(\" \")
"
);
}
}
pw
.
println
(
"
+ \"}\"
;"
);
pw
.
println
(
"
.append( \"}\")
;"
);
}
else
{
}
else
{
pw
.
println
(
"\t\tret
+= \"\"+\""
+
name
+
" = \" + get_"
+
name
+
"() +\", \"
;"
);
pw
.
println
(
"\t\tret
.append(\""
+
name
+
" = \").append( get_"
+
name
+
"() ).append(\", \")
;"
);
}
}
}
}
}
}
pw
.
println
(
"\t\treturn ret;\n\t}\n\n"
);
pw
.
println
(
"\t\treturn ret
.toString()
;\n\t}\n\n"
);
}
}
public
void
writeStubs
(
StructType
stp
,
PrintWriter
pw
)
{
public
void
writeStubs
(
StructType
stp
,
PrintWriter
pw
)
{
...
...
jdk/src/solaris/classes/sun/print/UnixPrintJob.java
浏览文件 @
16ad8cc6
...
@@ -38,7 +38,9 @@ import java.io.InputStreamReader;
...
@@ -38,7 +38,9 @@ import java.io.InputStreamReader;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStreamWriter
;
import
java.io.OutputStreamWriter
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.io.Reader
;
import
java.io.Reader
;
import
java.io.StringWriter
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.util.Vector
;
import
java.util.Vector
;
...
@@ -955,23 +957,49 @@ public class UnixPrintJob implements CancelablePrintJob {
...
@@ -955,23 +957,49 @@ public class UnixPrintJob implements CancelablePrintJob {
private
class
PrinterSpooler
implements
java
.
security
.
PrivilegedAction
{
private
class
PrinterSpooler
implements
java
.
security
.
PrivilegedAction
{
PrintException
pex
;
PrintException
pex
;
private
void
handleProcessFailure
(
final
Process
failedProcess
,
final
String
[]
execCmd
,
final
int
result
)
throws
IOException
{
try
(
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
))
{
pw
.
append
(
"error="
).
append
(
Integer
.
toString
(
result
));
pw
.
append
(
" running:"
);
for
(
String
arg:
execCmd
)
{
pw
.
append
(
" '"
).
append
(
arg
).
append
(
"'"
);
}
try
(
InputStream
is
=
failedProcess
.
getErrorStream
();
InputStreamReader
isr
=
new
InputStreamReader
(
is
);
BufferedReader
br
=
new
BufferedReader
(
isr
))
{
while
(
br
.
ready
())
{
pw
.
println
();
pw
.
append
(
"\t\t"
).
append
(
br
.
readLine
());
}
}
finally
{
pw
.
flush
();
throw
new
IOException
(
sw
.
toString
());
}
}
}
public
Object
run
()
{
public
Object
run
()
{
if
(
spoolFile
==
null
||
!
spoolFile
.
exists
())
{
pex
=
new
PrintException
(
"No spool file"
);
notifyEvent
(
PrintJobEvent
.
JOB_FAILED
);
return
null
;
}
try
{
try
{
/**
/**
* Spool to the printer.
* Spool to the printer.
*/
*/
if
(
spoolFile
==
null
||
!
spoolFile
.
exists
())
{
pex
=
new
PrintException
(
"No spool file"
);
notifyEvent
(
PrintJobEvent
.
JOB_FAILED
);
return
null
;
}
String
fileName
=
spoolFile
.
getAbsolutePath
();
String
fileName
=
spoolFile
.
getAbsolutePath
();
String
execCmd
[]
=
printExecCmd
(
mDestination
,
mOptions
,
String
execCmd
[]
=
printExecCmd
(
mDestination
,
mOptions
,
mNoJobSheet
,
jobName
,
copies
,
fileName
);
mNoJobSheet
,
jobName
,
copies
,
fileName
);
Process
process
=
Runtime
.
getRuntime
().
exec
(
execCmd
);
Process
process
=
Runtime
.
getRuntime
().
exec
(
execCmd
);
process
.
waitFor
();
process
.
waitFor
();
spoolFile
.
delete
();
final
int
result
=
process
.
exitValue
();
if
(
0
!=
result
)
{
handleProcessFailure
(
process
,
execCmd
,
result
);
}
notifyEvent
(
PrintJobEvent
.
DATA_TRANSFER_COMPLETE
);
notifyEvent
(
PrintJobEvent
.
DATA_TRANSFER_COMPLETE
);
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
notifyEvent
(
PrintJobEvent
.
JOB_FAILED
);
notifyEvent
(
PrintJobEvent
.
JOB_FAILED
);
...
@@ -981,6 +1009,7 @@ public class UnixPrintJob implements CancelablePrintJob {
...
@@ -981,6 +1009,7 @@ public class UnixPrintJob implements CancelablePrintJob {
notifyEvent
(
PrintJobEvent
.
JOB_FAILED
);
notifyEvent
(
PrintJobEvent
.
JOB_FAILED
);
pex
=
new
PrintException
(
ie
);
pex
=
new
PrintException
(
ie
);
}
finally
{
}
finally
{
spoolFile
.
delete
();
notifyEvent
(
PrintJobEvent
.
NO_MORE_EVENTS
);
notifyEvent
(
PrintJobEvent
.
NO_MORE_EVENTS
);
}
}
return
null
;
return
null
;
...
...
jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_config.h
浏览文件 @
16ad8cc6
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
#include <X11/Xutil.h>
#include <X11/Xutil.h>
#include <X11/extensions/shape.h>
#include <X11/extensions/shape.h>
#include <sys/types.h>
#include <sys/types.h>
#include <
sys/
unistd.h>
#include <unistd.h>
#include <pthread.h>
#include <pthread.h>
#include <signal.h>
#include <signal.h>
#include <inttypes.h>
#include <inttypes.h>
...
...
jdk/src/windows/classes/java/lang/ProcessImpl.java
浏览文件 @
16ad8cc6
...
@@ -60,10 +60,11 @@ final class ProcessImpl extends Process {
...
@@ -60,10 +60,11 @@ final class ProcessImpl extends Process {
throws
IOException
throws
IOException
{
{
if
(
append
)
{
if
(
append
)
{
String
path
=
f
.
getPath
();
SecurityManager
sm
=
System
.
getSecurityManager
();
SecurityManager
sm
=
System
.
getSecurityManager
();
if
(
sm
!=
null
)
if
(
sm
!=
null
)
sm
.
checkWrite
(
f
.
getPath
()
);
sm
.
checkWrite
(
path
);
long
handle
=
openForAtomicAppend
(
f
.
getPath
()
);
long
handle
=
openForAtomicAppend
(
path
);
final
FileDescriptor
fd
=
new
FileDescriptor
();
final
FileDescriptor
fd
=
new
FileDescriptor
();
fdAccess
.
setHandle
(
fd
,
handle
);
fdAccess
.
setHandle
(
fd
,
handle
);
return
AccessController
.
doPrivileged
(
return
AccessController
.
doPrivileged
(
...
...
jdk/src/windows/native/sun/windows/awt_Window.cpp
浏览文件 @
16ad8cc6
...
@@ -355,7 +355,7 @@ void AwtWindow::RepositionSecurityWarning(JNIEnv *env)
...
@@ -355,7 +355,7 @@ void AwtWindow::RepositionSecurityWarning(JNIEnv *env)
RECT
rect
;
RECT
rect
;
CalculateWarningWindowBounds
(
env
,
&
rect
);
CalculateWarningWindowBounds
(
env
,
&
rect
);
::
SetWindowPos
(
warningWindow
,
IsAlwaysOnTop
()
?
HWND_TOPMOST
:
GetHWnd
()
,
::
SetWindowPos
(
warningWindow
,
IsAlwaysOnTop
()
?
HWND_TOPMOST
:
HWND_NOTOPMOST
,
rect
.
left
,
rect
.
top
,
rect
.
left
,
rect
.
top
,
rect
.
right
-
rect
.
left
,
rect
.
bottom
-
rect
.
top
,
rect
.
right
-
rect
.
left
,
rect
.
bottom
-
rect
.
top
,
SWP_ASYNCWINDOWPOS
|
SWP_NOACTIVATE
|
SWP_ASYNCWINDOWPOS
|
SWP_NOACTIVATE
|
...
@@ -835,7 +835,7 @@ void AwtWindow::StartSecurityAnimation(AnimationKind kind)
...
@@ -835,7 +835,7 @@ void AwtWindow::StartSecurityAnimation(AnimationKind kind)
if
(
securityAnimationKind
==
akShow
)
{
if
(
securityAnimationKind
==
akShow
)
{
::
SetWindowPos
(
warningWindow
,
::
SetWindowPos
(
warningWindow
,
IsAlwaysOnTop
()
?
HWND_TOPMOST
:
GetHWnd
()
,
IsAlwaysOnTop
()
?
HWND_TOPMOST
:
HWND_NOTOPMOST
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
SWP_NOACTIVATE
|
SWP_NOSIZE
|
SWP_NOMOVE
|
SWP_NOACTIVATE
|
SWP_NOSIZE
|
SWP_NOMOVE
|
SWP_SHOWWINDOW
|
SWP_NOOWNERZORDER
);
SWP_SHOWWINDOW
|
SWP_NOOWNERZORDER
);
...
...
jdk/test/java/util/Currency/CurrencyTest.java
浏览文件 @
16ad8cc6
...
@@ -128,18 +128,20 @@ public class CurrencyTest {
...
@@ -128,18 +128,20 @@ public class CurrencyTest {
checkCountryCurrency
(
country1
[
i
],
currency1
[
i
]);
checkCountryCurrency
(
country1
[
i
],
currency1
[
i
]);
}
}
// check currency changes
/*
String
[]
switchOverCtry
=
{
"DE"
,
"FR"
,
"ES"
,
"IT"
,
"NL"
,
"BE"
,
"TR"
,
"RO"
,
"AZ"
,
"MZ"
,
"GH"
,
"VE"
};
* check currency changes
String
[]
switchOverOld
=
{
"DEM"
,
"FRF"
,
"ESP"
,
"ITL"
,
"NLG"
,
"BEF"
,
"TRL"
,
"ROL"
,
"AZM"
,
"MZM"
,
"GHC"
,
"VEB"
};
* In current implementation, there is no data of old currency and transition date at jdk/src/share/classes/java/util/CurrencyData.properties.
String
[]
switchOverNew
=
{
"EUR"
,
"EUR"
,
"EUR"
,
"EUR"
,
"EUR"
,
"EUR"
,
"TRY"
,
"RON"
,
"AZN"
,
"MZN"
,
"GHS"
,
"VEF"
};
* So, all the switch data arrays are empty. In the future, if data of old currency and transition date are necessary for any country, the
String
[]
switchOverTZ
=
{
"Europe/Paris"
,
"Europe/Paris"
,
"Europe/Paris"
,
"Europe/Paris"
,
* arrays here can be updated so that the program can check the currency switch.
"Europe/Paris"
,
"Europe/Paris"
,
"Asia/Istanbul"
,
"Europe/Bucharest"
,
*/
"Asia/Baku"
,
"Africa/Maputo"
,
"Africa/Accra"
,
"America/Caracas"
};
String
[]
switchOverCtry
=
{};
int
[]
switchOverYear
=
{
2002
,
2002
,
2002
,
2002
,
2002
,
2002
,
2005
,
2005
,
2006
,
2006
,
2007
,
2008
};
String
[]
switchOverOld
=
{};
int
[]
switchOverMonth
=
{
Calendar
.
JANUARY
,
Calendar
.
JANUARY
,
Calendar
.
JANUARY
,
Calendar
.
JANUARY
,
String
[]
switchOverNew
=
{};
Calendar
.
JANUARY
,
Calendar
.
JANUARY
,
Calendar
.
JANUARY
,
Calendar
.
JULY
,
String
[]
switchOverTZ
=
{};
Calendar
.
JANUARY
,
Calendar
.
JULY
,
Calendar
.
JULY
,
Calendar
.
JANUARY
};
int
[]
switchOverYear
=
{};
int
[]
switchOverDay
=
{
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
};
int
[]
switchOverMonth
=
{};
int
[]
switchOverDay
=
{};
for
(
int
i
=
0
;
i
<
switchOverCtry
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
switchOverCtry
.
length
;
i
++)
{
TimeZone
.
setDefault
(
TimeZone
.
getTimeZone
(
switchOverTZ
[
i
]));
TimeZone
.
setDefault
(
TimeZone
.
getTimeZone
(
switchOverTZ
[
i
]));
Calendar
date
=
new
GregorianCalendar
(
switchOverYear
[
i
],
switchOverMonth
[
i
],
switchOverDay
[
i
]);
Calendar
date
=
new
GregorianCalendar
(
switchOverYear
[
i
],
switchOverMonth
[
i
],
switchOverDay
[
i
]);
...
...
jdk/test/java/util/Currency/ValidateISO4217.java
浏览文件 @
16ad8cc6
...
@@ -92,7 +92,7 @@ public class ValidateISO4217 {
...
@@ -92,7 +92,7 @@ public class ValidateISO4217 {
/* Codes that are obsolete, do not have related country */
/* Codes that are obsolete, do not have related country */
static
final
String
otherCodes
=
static
final
String
otherCodes
=
"ADP-AFA-ATS-AYM-
BEF-BGL-BOV-BYB-CLF-CUC-CYP-DEM-EEK-ESP-FIM-FRF-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-NLG-PTE-RUR-SDD-SIT-SKK-SRG-TMM-TPE-TRL-VEF-USN-USS
-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-YUM-ZWD-ZWN-ZWR"
;
"ADP-AFA-ATS-AYM-
AZM-BEF-BGL-BOV-BYB-CLF-CUC-CYP-DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-MZM-NLG-PTE-ROL-RUR-SDD-SIT-SKK-SRG-TMM-TPE-TRL-VEF-USN-USS-VEB
-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-YUM-ZWD-ZWN-ZWR"
;
static
boolean
err
=
false
;
static
boolean
err
=
false
;
...
...
jdk/test/java/util/Currency/tablea1.txt
浏览文件 @
16ad8cc6
...
@@ -23,7 +23,7 @@ AW AWG 533 2
...
@@ -23,7 +23,7 @@ AW AWG 533 2
AU AUD 36 2
AU AUD 36 2
AT EUR 978 2
AT EUR 978 2
# MA 129
# MA 129
AZ AZ
M 31 2 2005-12-31-20-00-00 AZ
N 944 2
AZ AZN 944 2
BS BSD 44 2
BS BSD 44 2
BH BHD 48 3
BH BHD 48 3
BD BDT 50 2
BD BDT 50 2
...
@@ -96,7 +96,7 @@ GA XAF 950 0
...
@@ -96,7 +96,7 @@ GA XAF 950 0
GM GMD 270 2
GM GMD 270 2
GE GEL 981 2
GE GEL 981 2
DE EUR 978 2
DE EUR 978 2
GH GH
C 288 2 2007-07-01-00-00-00 GH
S 936 2
GH GHS 936 2
GI GIP 292 2
GI GIP 292 2
GR EUR 978 2
GR EUR 978 2
GL DKK 208 2
GL DKK 208 2
...
@@ -166,7 +166,7 @@ MN MNT 496 2
...
@@ -166,7 +166,7 @@ MN MNT 496 2
MS XCD 951 2
MS XCD 951 2
MA MAD 504 2
MA MAD 504 2
# MA 130
# MA 130
MZ MZ
M 508 2 2006-06-30-22-00-00 MZ
N 943 2
MZ MZN 943 2
MM MMK 104 2
MM MMK 104 2
# MA 134
# MA 134
ME EUR 978 2
ME EUR 978 2
...
@@ -200,7 +200,7 @@ PT EUR 978 2
...
@@ -200,7 +200,7 @@ PT EUR 978 2
PR USD 840 2
PR USD 840 2
QA QAR 634 2
QA QAR 634 2
RE EUR 978 2
RE EUR 978 2
RO RO
L 946 2 2005-06-30-21-00-00 RO
N 946 2
RO RON 946 2
RU RUB 643 2
RU RUB 643 2
RW RWF 646 0
RW RWF 646 0
SH SHP 654 2
SH SHP 654 2
...
@@ -266,7 +266,7 @@ UM USD 840 2
...
@@ -266,7 +266,7 @@ UM USD 840 2
UY UYU 858 2
UY UYU 858 2
UZ UZS 860 2
UZ UZS 860 2
VU VUV 548 0
VU VUV 548 0
VE VE
B 862 2 2008-01-01-04-00-00 VE
F 937 2
VE VEF 937 2
VN VND 704 2
VN VND 704 2
VG USD 840 2
VG USD 840 2
VI USD 840 2
VI USD 840 2
...
...
jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java
0 → 100644
浏览文件 @
16ad8cc6
/*
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 4492274
* @summary Tests if JEditorPane.getPage() correctly returns anchor reference.
* @author Denis Sharypov
*/
import
sun.awt.SunToolkit
;
import
javax.swing.*
;
import
javax.swing.text.html.HTMLEditorKit
;
import
java.awt.*
;
import
java.io.File
;
import
java.net.URL
;
public
class
bug4492274
{
private
static
URL
page
;
private
static
JEditorPane
jep
;
public
static
void
main
(
String
args
[])
throws
Exception
{
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
createAndShowGUI
();
}
});
toolkit
.
realSync
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
page
=
new
URL
(
page
,
"#linkname"
);
jep
.
setPage
(
page
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
});
toolkit
.
realSync
();
if
(
getPageAnchor
()
==
null
)
{
throw
new
RuntimeException
(
"JEditorPane.getPage() returns null anchor reference"
);
}
}
private
static
String
getPageAnchor
()
throws
Exception
{
final
String
[]
result
=
new
String
[
1
];
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
result
[
0
]
=
jep
.
getPage
().
getRef
();
}
});
return
result
[
0
];
}
private
static
void
createAndShowGUI
()
{
try
{
File
file
=
new
File
(
System
.
getProperty
(
"test.src"
,
"."
),
"test.html"
);
page
=
file
.
toURI
().
toURL
();
JFrame
f
=
new
JFrame
();
jep
=
new
JEditorPane
();
jep
.
setEditorKit
(
new
HTMLEditorKit
());
jep
.
setEditable
(
false
);
jep
.
setPage
(
page
);
JScrollPane
sp
=
new
JScrollPane
(
jep
);
f
.
getContentPane
().
add
(
sp
);
f
.
setSize
(
500
,
500
);
f
.
setVisible
(
true
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
jdk/test/javax/swing/JEditorPane/4492274/test.html
0 → 100644
浏览文件 @
16ad8cc6
<html>
<body>
<a
name=
"top"
>
top
</a>
<img
src=
a.jpg
width=
500
height=
1000
>
<a
name=
"linkname"
>
bottom
</a>
</body>
</html>
jdk/test/javax/swing/JSlider/6348946/bug6348946.java
0 → 100644
浏览文件 @
16ad8cc6
/*
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6348946
* @summary Tests that JSlider's thumb moves in the right direction
* when it is used as a JTable cell editor.
* @author Mikhail Lapshin
*/
import
sun.awt.SunToolkit
;
import
java.awt.*
;
import
java.awt.event.InputEvent
;
import
javax.swing.*
;
import
javax.swing.event.*
;
import
javax.swing.table.*
;
public
class
bug6348946
{
private
static
JFrame
frame
;
private
static
JPanel
panel
;
private
static
volatile
boolean
passed
=
false
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
lf
=
"javax.swing.plaf.metal.MetalLookAndFeel"
;
UIManager
.
setLookAndFeel
(
lf
);
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
try
{
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
setupUI
();
}
});
toolkit
.
realSync
();
clickOnSlider
();
toolkit
.
realSync
();
checkResult
();
}
finally
{
stopEDT
();
}
}
private
static
void
setupUI
()
{
frame
=
new
JFrame
();
panel
=
new
JPanel
();
panel
.
setLayout
(
new
BorderLayout
());
panel
.
add
(
new
ParameterTable
(),
BorderLayout
.
CENTER
);
frame
.
getContentPane
().
add
(
panel
);
frame
.
pack
();
frame
.
setLocationRelativeTo
(
null
);
frame
.
setVisible
(
true
);
}
private
static
void
clickOnSlider
()
throws
Exception
{
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
10
);
Rectangle
rect
=
getPanelRectangle
();
double
clickX
=
rect
.
getX
()
+
rect
.
getWidth
()
/
4
;
double
clickY
=
rect
.
getY
()
+
rect
.
getHeight
()
/
2
;
robot
.
mouseMove
((
int
)
clickX
,
(
int
)
clickY
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
}
private
static
void
checkResult
(){
if
(
passed
)
{
System
.
out
.
println
(
"Test passed"
);
}
else
{
throw
new
RuntimeException
(
"The thumb moved "
+
"to the right instead of the left!"
);
}
}
private
static
void
stopEDT
()
{
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
frame
.
dispose
();
}
});
}
private
static
class
ParameterTable
extends
JTable
{
public
ParameterTable
()
{
super
(
new
Object
[][]{{
5
}},
new
String
[]{
"Value"
});
getColumnModel
().
getColumn
(
0
).
setCellRenderer
(
new
Renderer
());
getColumnModel
().
getColumn
(
0
).
setCellEditor
(
new
Editor
());
}
}
private
static
class
Renderer
implements
TableCellRenderer
{
private
JSlider
slider
=
new
JSlider
(
0
,
10
);
public
Component
getTableCellRendererComponent
(
JTable
table
,
Object
value
,
boolean
isSelected
,
boolean
hasFocus
,
int
row
,
int
col
)
{
int
val
=
(
Integer
)
value
;
slider
.
setValue
(
val
);
return
slider
;
}
}
private
static
class
Editor
extends
AbstractCellEditor
implements
TableCellEditor
{
private
JSlider
slider
=
new
JSlider
(
0
,
10
);
public
Component
getTableCellEditorComponent
(
JTable
table
,
Object
value
,
boolean
isSelected
,
int
row
,
int
col
)
{
int
val
=
(
Integer
)
value
;
slider
.
setValue
(
val
);
return
slider
;
}
public
Editor
()
{
slider
.
addChangeListener
(
new
ChangeListener
()
{
public
void
stateChanged
(
ChangeEvent
e
)
{
if
(!
slider
.
getValueIsAdjusting
())
{
passed
=
slider
.
getValue
()
<=
5
;
}
}
});
}
public
Object
getCellEditorValue
()
{
return
slider
.
getValue
();
}
}
private
static
Rectangle
getPanelRectangle
()
throws
Exception
{
final
Rectangle
[]
result
=
new
Rectangle
[
1
];
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
result
[
0
]
=
new
Rectangle
(
panel
.
getLocationOnScreen
(),
panel
.
getSize
());
}
});
return
result
[
0
];
}
}
jdk/test/javax/swing/JTextArea/7049024/bug7049024.java
0 → 100644
浏览文件 @
16ad8cc6
/*
* Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Portions Copyright (c) 2011 IBM Corporation
*/
/* @test
* @bug 7049024
* @summary DnD fails with JTextArea and JTextField
* @author Sean Chou
*/
import
sun.awt.SunToolkit
;
import
javax.swing.*
;
import
javax.swing.text.DefaultCaret
;
import
java.awt.*
;
import
java.awt.datatransfer.Clipboard
;
import
java.awt.datatransfer.DataFlavor
;
public
class
bug7049024
{
public
static
Clipboard
clipboard
=
null
;
public
static
JTextField
textField
=
null
;
// This button is used to move focus away from textField.
public
static
JButton
button
=
null
;
public
static
JFrame
frame
=
null
;
public
static
DefaultCaret
caret
=
null
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
frame
=
new
JFrame
(
"Test"
);
textField
=
new
JTextField
(
"test selection for textfield"
);
button
=
new
JButton
(
"To compete the focus"
);
frame
.
setLayout
(
new
FlowLayout
());
frame
.
getContentPane
().
add
(
textField
);
frame
.
getContentPane
().
add
(
button
);
frame
.
pack
();
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
frame
.
setVisible
(
true
);
}
});
toolkit
.
realSync
();
clipboard
=
textField
.
getToolkit
().
getSystemSelection
();
if
(
null
==
clipboard
)
{
return
;
}
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
textField
.
requestFocusInWindow
();
}
});
toolkit
.
realSync
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
caret
=
(
DefaultCaret
)
textField
.
getCaret
();
caret
.
setDot
(
2
);
caret
.
moveDot
(
4
);
}
});
toolkit
.
realSync
();
String
oldSelection
=
(
String
)
clipboard
.
getData
(
DataFlavor
.
stringFlavor
);
System
.
out
.
println
(
"oldSelection is "
+
oldSelection
);
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
button
.
requestFocusInWindow
();
}
});
toolkit
.
realSync
();
// So JTextField loses the focus.
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
caret
.
setDot
(
4
);
caret
.
moveDot
(
6
);
}
});
toolkit
.
realSync
();
String
newSelection
=
(
String
)
clipboard
.
getData
(
DataFlavor
.
stringFlavor
);
System
.
out
.
println
(
"newSelection is "
+
newSelection
);
boolean
passed
=
newSelection
.
equals
(
oldSelection
);
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
frame
.
dispose
();
}
});
if
(!
passed
)
{
throw
new
RuntimeException
(
"The test for bug 7049024 failed"
);
}
}
}
jdk/test/javax/swing/ToolTipManager/Test6256140.java
0 → 100644
浏览文件 @
16ad8cc6
/*
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6256140
* @summary Esc key doesn't restore old value in JFormattedtextField when ToolTip is set
* @author Alexander Potochkin
* @run main Test6256140
*/
import
sun.awt.SunToolkit
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.event.KeyEvent
;
public
class
Test6256140
{
private
static
volatile
JFormattedTextField
ft
;
private
final
static
String
initialText
=
"value"
;
private
final
static
JLabel
toolTipLabel
=
new
JLabel
(
"tip"
);
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
10
);
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
createAndShowGUI
();
}
});
toolkit
.
realSync
();
Point
point
=
ft
.
getLocationOnScreen
();
robot
.
mouseMove
(
point
.
x
,
point
.
y
);
robot
.
mouseMove
(
point
.
x
+
3
,
point
.
y
+
3
);
robot
.
keyPress
(
KeyEvent
.
VK_A
);
robot
.
keyRelease
(
KeyEvent
.
VK_A
);
toolkit
.
realSync
();
if
(!
isTooltipShowning
())
{
throw
new
RuntimeException
(
"Tooltip is not shown"
);
}
robot
.
keyPress
(
KeyEvent
.
VK_ESCAPE
);
robot
.
keyRelease
(
KeyEvent
.
VK_ESCAPE
);
toolkit
.
realSync
();
if
(
isTooltipShowning
())
{
throw
new
RuntimeException
(
"Tooltip must be hidden now"
);
}
if
(
isTextEqual
())
{
throw
new
RuntimeException
(
"FormattedTextField must *not* cancel the updated value this time"
);
}
robot
.
keyPress
(
KeyEvent
.
VK_ESCAPE
);
robot
.
keyRelease
(
KeyEvent
.
VK_ESCAPE
);
toolkit
.
realSync
();
if
(!
isTextEqual
())
{
throw
new
RuntimeException
(
"FormattedTextField must cancel the updated value"
);
}
}
private
static
boolean
isTooltipShowning
()
throws
Exception
{
final
boolean
[]
result
=
new
boolean
[
1
];
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
result
[
0
]
=
toolTipLabel
.
isShowing
();
}
});
return
result
[
0
];
}
private
static
boolean
isTextEqual
()
throws
Exception
{
final
boolean
[]
result
=
new
boolean
[
1
];
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
result
[
0
]
=
initialText
.
equals
(
ft
.
getText
());
}
});
return
result
[
0
];
}
private
static
void
createAndShowGUI
()
{
ToolTipManager
.
sharedInstance
().
setDismissDelay
(
Integer
.
MAX_VALUE
);
ToolTipManager
.
sharedInstance
().
setInitialDelay
(
0
);
final
JFrame
frame
=
new
JFrame
();
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
frame
.
setLayout
(
new
FlowLayout
());
ft
=
new
JFormattedTextField
()
{
public
JToolTip
createToolTip
()
{
JToolTip
toolTip
=
super
.
createToolTip
();
toolTip
.
setLayout
(
new
BorderLayout
());
toolTip
.
add
(
toolTipLabel
);
return
toolTip
;
}
};
ft
.
setToolTipText
(
" "
);
ft
.
setValue
(
initialText
);
frame
.
add
(
ft
);
frame
.
pack
();
frame
.
setLocationRelativeTo
(
null
);
frame
.
setVisible
(
true
);
ft
.
requestFocus
();
}
}
jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java
浏览文件 @
16ad8cc6
/*
/*
* @test
* @test
* @build TestThread Traffic Handler ServerHandler ServerThread ClientThread
* @build TestThread Traffic Handler ServerHandler ServerThread ClientThread
* @run main/othervm/timeout=140 main
* @run main/othervm/timeout=140 -Djsse.enableCBCProtection=false main
*
* SunJSSE does not support dynamic system properties, no way to re-use
* system properties in samevm/agentvm mode.
* @summary Make sure that different configurations of SSL sockets work
* @summary Make sure that different configurations of SSL sockets work
*/
*/
...
...
jdk/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/CheckStatus.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 2003, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
1
, 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
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
* This is a simple hack to test a bunch of conditions and check
* This is a simple hack to test a bunch of conditions and check
* their return codes.
* their return codes.
*
*
* @run main/othervm -Djsse.enableCBCProtection=false CheckStatus
*
* @author Brad Wetmore
* @author Brad Wetmore
*/
*/
...
...
jdk/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargeBufs.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 2004, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 20
11
, 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,6 +30,8 @@
...
@@ -30,6 +30,8 @@
* This is to test larger buffer arrays, and make sure the maximum
* This is to test larger buffer arrays, and make sure the maximum
* is being passed.
* is being passed.
*
*
* @run main/othervm -Djsse.enableCBCProtection=false LargeBufs
*
* @author Brad R. Wetmore
* @author Brad R. Wetmore
*/
*/
...
...
jdk/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargePacket.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006,
2011,
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
...
@@ -27,10 +27,7 @@
...
@@ -27,10 +27,7 @@
* @bug 6388456
* @bug 6388456
* @summary Need adjustable TLS max record size for interoperability
* @summary Need adjustable TLS max record size for interoperability
* with non-compliant
* with non-compliant
* @run main/othervm LargePacket
* @run main/othervm -Djsse.enableCBCProtection=false LargePacket
*
* SunJSSE does not support dynamic system properties, no way to re-use
* system properties in samevm/agentvm mode.
*
*
* @author Xuelei Fan
* @author Xuelei Fan
*/
*/
...
...
jdk/test/sun/text/resources/Collator/Bug6755060.java
0 → 100644
浏览文件 @
16ad8cc6
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6755060
* @summary updating collation tables for thai to make it consistent with CLDR 1.9
*/
import
java.text.*
;
import
java.util.*
;
public
class
Bug6755060
{
/********************************************************
*********************************************************/
public
static
void
main
(
String
[]
args
)
{
Locale
reservedLocale
=
Locale
.
getDefault
();
try
{
int
errors
=
0
;
Locale
loc
=
new
Locale
(
"th"
,
"TH"
);
// Thai
Locale
.
setDefault
(
loc
);
Collator
col
=
Collator
.
getInstance
();
/*
* The original data "data" are the data to be sorted provided by the submitter of the CR.
* It's in correct order in accord with thai collation in CLDR 1.9. If we use old Java without this fix,
* the output order will be incorrect. Correct order will be turned into incorrect order.
* If fix is there, "data" after sorting will be unchanged, same as "sortedData". If fix is lost (regression),
* "data" after sorting will be changed, not as "sortedData".(not correct anymore)
* The submitter of the CR also gives a expected "sortedData" in the CR, but it's in accord with collation in CLDR 1.4.
* His data to be sorted are actually well sorted in accord with CLDR 1.9.
*/
String
[]
data
=
{
"\u0e01"
,
"\u0e01\u0e2f"
,
"\u0e01\u0e46"
,
"\u0e01\u0e4f"
,
"\u0e01\u0e5a"
,
"\u0e01\u0e5b"
,
"\u0e01\u0e4e"
,
"\u0e01\u0e4c"
,
"\u0e01\u0e48"
,
"\u0e01\u0e01"
,
"\u0e01\u0e4b\u0e01"
,
"\u0e01\u0e4d"
,
"\u0e01\u0e30"
,
"\u0e01\u0e31\u0e01"
,
"\u0e01\u0e32"
,
"\u0e01\u0e33"
,
"\u0e01\u0e34"
,
"\u0e01\u0e35"
,
"\u0e01\u0e36"
,
"\u0e01\u0e37"
,
"\u0e01\u0e38"
,
"\u0e01\u0e39"
,
"\u0e40\u0e01"
,
"\u0e40\u0e01\u0e48"
,
"\u0e40\u0e01\u0e49"
,
"\u0e40\u0e01\u0e4b"
,
"\u0e41\u0e01"
,
"\u0e42\u0e01"
,
"\u0e43\u0e01"
,
"\u0e44\u0e01"
,
"\u0e01\u0e3a"
,
"\u0e24\u0e32"
,
"\u0e24\u0e45"
,
"\u0e40\u0e25"
,
"\u0e44\u0e26"
};
String
[]
sortedData
=
{
"\u0e01"
,
"\u0e01\u0e2f"
,
"\u0e01\u0e46"
,
"\u0e01\u0e4f"
,
"\u0e01\u0e5a"
,
"\u0e01\u0e5b"
,
"\u0e01\u0e4e"
,
"\u0e01\u0e4c"
,
"\u0e01\u0e48"
,
"\u0e01\u0e01"
,
"\u0e01\u0e4b\u0e01"
,
"\u0e01\u0e4d"
,
"\u0e01\u0e30"
,
"\u0e01\u0e31\u0e01"
,
"\u0e01\u0e32"
,
"\u0e01\u0e33"
,
"\u0e01\u0e34"
,
"\u0e01\u0e35"
,
"\u0e01\u0e36"
,
"\u0e01\u0e37"
,
"\u0e01\u0e38"
,
"\u0e01\u0e39"
,
"\u0e40\u0e01"
,
"\u0e40\u0e01\u0e48"
,
"\u0e40\u0e01\u0e49"
,
"\u0e40\u0e01\u0e4b"
,
"\u0e41\u0e01"
,
"\u0e42\u0e01"
,
"\u0e43\u0e01"
,
"\u0e44\u0e01"
,
"\u0e01\u0e3a"
,
"\u0e24\u0e32"
,
"\u0e24\u0e45"
,
"\u0e40\u0e25"
,
"\u0e44\u0e26"
};
Arrays
.
sort
(
data
,
col
);
System
.
out
.
println
(
"Using "
+
loc
.
getDisplayName
());
for
(
int
i
=
0
;
i
<
data
.
length
;
i
++)
{
System
.
out
.
println
(
data
[
i
]
+
" : "
+
sortedData
[
i
]);
if
(
sortedData
[
i
].
compareTo
(
data
[
i
])
!=
0
)
{
errors
++;
}
}
//end for
if
(
errors
>
0
){
StringBuffer
expected
=
new
StringBuffer
(),
actual
=
new
StringBuffer
();
expected
.
append
(
sortedData
[
0
]);
actual
.
append
(
data
[
0
]);
for
(
int
i
=
1
;
i
<
data
.
length
;
i
++)
{
expected
.
append
(
","
);
expected
.
append
(
sortedData
[
i
]);
actual
.
append
(
","
);
actual
.
append
(
data
[
i
]);
}
String
errmsg
=
"Error is found in collation testing in Thai\n"
+
"exepected order is: "
+
expected
.
toString
()
+
"\n"
+
"actual order is: "
+
actual
.
toString
()
+
"\n"
;
throw
new
RuntimeException
(
errmsg
);
}
}
finally
{
// restore the reserved locale
Locale
.
setDefault
(
reservedLocale
);
}
}
//end main
}
//end class CollatorTest
jdk/test/sun/text/resources/LocaleData
浏览文件 @
16ad8cc6
...
@@ -7006,3 +7006,7 @@ CurrencyNames/zh_CN/zwl=\u6d25\u5df4\u5e03\u97e6\u5143 (2009)
...
@@ -7006,3 +7006,7 @@ CurrencyNames/zh_CN/zwl=\u6d25\u5df4\u5e03\u97e6\u5143 (2009)
CurrencyNames/zh_TW/cuc=\u53e4\u5df4\u53ef\u8f49\u63db\u62ab\u7d22
CurrencyNames/zh_TW/cuc=\u53e4\u5df4\u53ef\u8f49\u63db\u62ab\u7d22
CurrencyNames/zh_TW/tmt=\u571f\u5eab\u66fc\u65b0\u99ac\u7d0d\u7279
CurrencyNames/zh_TW/tmt=\u571f\u5eab\u66fc\u65b0\u99ac\u7d0d\u7279
CurrencyNames/zh_TW/zwl=\u8f9b\u5df4\u5a01\u5143 (2009)
CurrencyNames/zh_TW/zwl=\u8f9b\u5df4\u5a01\u5143 (2009)
# bug 7101495
CalendarData/lv/firstDayOfWeek=2
CalendarData/lv/minimalDaysInFirstWeek=4
jdk/test/sun/text/resources/LocaleDataTest.java
浏览文件 @
16ad8cc6
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
* 6379214 6485516 6486607 4225362 4494727 6533691 6531591 6531593 6570259
* 6379214 6485516 6486607 4225362 4494727 6533691 6531591 6531593 6570259
* 6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611
* 6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611
* 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787
* 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787
* 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203
* 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203
7101495
* @summary Verify locale data
* @summary Verify locale data
*
*
*/
*/
...
...
jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh
浏览文件 @
16ad8cc6
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
#
#
# @test
# @test
# @bug 4990825
# @bug 4990825
7092186
# @run shell/timeout=90 jstatdExternalRegistry.sh
# @run shell/timeout=90 jstatdExternalRegistry.sh
# @summary Test functionality of 'jstatd -p<port>&' with an external RMI registry
# @summary Test functionality of 'jstatd -p<port>&' with an external RMI registry
...
...
langtools/.hgtags
浏览文件 @
16ad8cc6
...
@@ -133,3 +133,5 @@ e8acc2d6c32f0c8321e642e1a86672a2e196a056 jdk8-b08
...
@@ -133,3 +133,5 @@ e8acc2d6c32f0c8321e642e1a86672a2e196a056 jdk8-b08
b7a7e47c8d3daf7822abf7c37e5179ccbbf53008 jdk8-b09
b7a7e47c8d3daf7822abf7c37e5179ccbbf53008 jdk8-b09
f6c783e18bdf4d46a0ab273868afebbf32600ff7 jdk8-b10
f6c783e18bdf4d46a0ab273868afebbf32600ff7 jdk8-b10
4bf01f1c4e3464f378959d10f3983a0469181d94 jdk8-b11
4bf01f1c4e3464f378959d10f3983a0469181d94 jdk8-b11
f2d6ed25857dfa7f269ac66e13666d648cb988c6 jdk8-b12
ae25163501bc7477cd907e26a006a6f1b05fdb6d jdk8-b13
langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java
浏览文件 @
16ad8cc6
...
@@ -325,7 +325,7 @@ public class JavacTaskImpl extends JavacTask {
...
@@ -325,7 +325,7 @@ public class JavacTaskImpl extends JavacTask {
ListBuffer
<
TypeElement
>
elements
=
new
ListBuffer
<
TypeElement
>();
ListBuffer
<
TypeElement
>
elements
=
new
ListBuffer
<
TypeElement
>();
for
(
JCCompilationUnit
unit
:
units
)
{
for
(
JCCompilationUnit
unit
:
units
)
{
for
(
JCTree
node
:
unit
.
defs
)
{
for
(
JCTree
node
:
unit
.
defs
)
{
if
(
node
.
getTag
()
==
JCTree
.
CLASSDEF
)
{
if
(
node
.
hasTag
(
JCTree
.
Tag
.
CLASSDEF
)
)
{
JCClassDecl
cdef
=
(
JCClassDecl
)
node
;
JCClassDecl
cdef
=
(
JCClassDecl
)
node
;
if
(
cdef
.
sym
!=
null
)
// maybe null if errors in anno processing
if
(
cdef
.
sym
!=
null
)
// maybe null if errors in anno processing
elements
.
append
(
cdef
.
sym
);
elements
.
append
(
cdef
.
sym
);
...
@@ -383,12 +383,12 @@ public class JavacTaskImpl extends JavacTask {
...
@@ -383,12 +383,12 @@ public class JavacTaskImpl extends JavacTask {
private
void
handleFlowResults
(
Queue
<
Env
<
AttrContext
>>
queue
,
ListBuffer
<
Element
>
elems
)
{
private
void
handleFlowResults
(
Queue
<
Env
<
AttrContext
>>
queue
,
ListBuffer
<
Element
>
elems
)
{
for
(
Env
<
AttrContext
>
env:
queue
)
{
for
(
Env
<
AttrContext
>
env:
queue
)
{
switch
(
env
.
tree
.
getTag
())
{
switch
(
env
.
tree
.
getTag
())
{
case
JCTree
.
CLASSDEF
:
case
CLASSDEF:
JCClassDecl
cdef
=
(
JCClassDecl
)
env
.
tree
;
JCClassDecl
cdef
=
(
JCClassDecl
)
env
.
tree
;
if
(
cdef
.
sym
!=
null
)
if
(
cdef
.
sym
!=
null
)
elems
.
append
(
cdef
.
sym
);
elems
.
append
(
cdef
.
sym
);
break
;
break
;
case
JCTree
.
TOPLEVEL
:
case
TOPLEVEL:
JCCompilationUnit
unit
=
(
JCCompilationUnit
)
env
.
tree
;
JCCompilationUnit
unit
=
(
JCCompilationUnit
)
env
.
tree
;
if
(
unit
.
packge
!=
null
)
if
(
unit
.
packge
!=
null
)
elems
.
append
(
unit
.
packge
);
elems
.
append
(
unit
.
packge
);
...
...
langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
浏览文件 @
16ad8cc6
...
@@ -207,7 +207,7 @@ public class JavacTrees extends Trees {
...
@@ -207,7 +207,7 @@ public class JavacTrees extends Trees {
if
(
sym
==
null
&&
TreeInfo
.
isDeclaration
(
tree
))
{
if
(
sym
==
null
&&
TreeInfo
.
isDeclaration
(
tree
))
{
for
(
TreePath
p
=
path
;
p
!=
null
;
p
=
p
.
getParentPath
())
{
for
(
TreePath
p
=
path
;
p
!=
null
;
p
=
p
.
getParentPath
())
{
JCTree
t
=
(
JCTree
)
p
.
getLeaf
();
JCTree
t
=
(
JCTree
)
p
.
getLeaf
();
if
(
t
.
getTag
()
==
JCTree
.
CLASSDEF
)
{
if
(
t
.
hasTag
(
JCTree
.
Tag
.
CLASSDEF
)
)
{
JCClassDecl
ct
=
(
JCClassDecl
)
t
;
JCClassDecl
ct
=
(
JCClassDecl
)
t
;
if
(
ct
.
sym
!=
null
)
{
if
(
ct
.
sym
!=
null
)
{
if
((
ct
.
sym
.
flags_field
&
Flags
.
UNATTRIBUTED
)
!=
0
)
{
if
((
ct
.
sym
.
flags_field
&
Flags
.
UNATTRIBUTED
)
!=
0
)
{
...
...
langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 2003, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
1
, 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
...
@@ -31,6 +31,8 @@ import com.sun.tools.javac.code.Symbol.*;
...
@@ -31,6 +31,8 @@ import com.sun.tools.javac.code.Symbol.*;
import
com.sun.tools.javac.tree.*
;
import
com.sun.tools.javac.tree.*
;
import
com.sun.tools.javac.tree.JCTree.*
;
import
com.sun.tools.javac.tree.JCTree.*
;
import
static
com
.
sun
.
tools
.
javac
.
tree
.
JCTree
.
Tag
.*;
/** Enter annotations on symbols. Annotations accumulate in a queue,
/** Enter annotations on symbols. Annotations accumulate in a queue,
* which is processed at the top level of any set of recursive calls
* which is processed at the top level of any set of recursive calls
* requesting it be processed.
* requesting it be processed.
...
@@ -148,7 +150,7 @@ public class Annotate {
...
@@ -148,7 +150,7 @@ public class Annotate {
return
new
Attribute
.
Compound
(
a
.
type
,
List
.<
Pair
<
MethodSymbol
,
Attribute
>>
nil
());
return
new
Attribute
.
Compound
(
a
.
type
,
List
.<
Pair
<
MethodSymbol
,
Attribute
>>
nil
());
}
}
List
<
JCExpression
>
args
=
a
.
args
;
List
<
JCExpression
>
args
=
a
.
args
;
if
(
args
.
length
()
==
1
&&
args
.
head
.
getTag
()
!=
JCTree
.
ASSIGN
)
{
if
(
args
.
length
()
==
1
&&
!
args
.
head
.
hasTag
(
ASSIGN
)
)
{
// special case: elided "value=" assumed
// special case: elided "value=" assumed
args
.
head
=
make
.
at
(
args
.
head
.
pos
).
args
.
head
=
make
.
at
(
args
.
head
.
pos
).
Assign
(
make
.
Ident
(
names
.
value
),
args
.
head
);
Assign
(
make
.
Ident
(
names
.
value
),
args
.
head
);
...
@@ -157,12 +159,12 @@ public class Annotate {
...
@@ -157,12 +159,12 @@ public class Annotate {
new
ListBuffer
<
Pair
<
MethodSymbol
,
Attribute
>>();
new
ListBuffer
<
Pair
<
MethodSymbol
,
Attribute
>>();
for
(
List
<
JCExpression
>
tl
=
args
;
tl
.
nonEmpty
();
tl
=
tl
.
tail
)
{
for
(
List
<
JCExpression
>
tl
=
args
;
tl
.
nonEmpty
();
tl
=
tl
.
tail
)
{
JCExpression
t
=
tl
.
head
;
JCExpression
t
=
tl
.
head
;
if
(
t
.
getTag
()
!=
JCTree
.
ASSIGN
)
{
if
(
!
t
.
hasTag
(
ASSIGN
)
)
{
log
.
error
(
t
.
pos
(),
"annotation.value.must.be.name.value"
);
log
.
error
(
t
.
pos
(),
"annotation.value.must.be.name.value"
);
continue
;
continue
;
}
}
JCAssign
assign
=
(
JCAssign
)
t
;
JCAssign
assign
=
(
JCAssign
)
t
;
if
(
assign
.
lhs
.
getTag
()
!=
JCTree
.
IDENT
)
{
if
(
!
assign
.
lhs
.
hasTag
(
IDENT
)
)
{
log
.
error
(
t
.
pos
(),
"annotation.value.must.be.name.value"
);
log
.
error
(
t
.
pos
(),
"annotation.value.must.be.name.value"
);
continue
;
continue
;
}
}
...
@@ -222,14 +224,14 @@ public class Annotate {
...
@@ -222,14 +224,14 @@ public class Annotate {
(((
JCFieldAccess
)
tree
).
selected
).
type
);
(((
JCFieldAccess
)
tree
).
selected
).
type
);
}
}
if
((
expected
.
tsym
.
flags
()
&
Flags
.
ANNOTATION
)
!=
0
)
{
if
((
expected
.
tsym
.
flags
()
&
Flags
.
ANNOTATION
)
!=
0
)
{
if
(
tree
.
getTag
()
!=
JCTree
.
ANNOTATION
)
{
if
(
!
tree
.
hasTag
(
ANNOTATION
)
)
{
log
.
error
(
tree
.
pos
(),
"annotation.value.must.be.annotation"
);
log
.
error
(
tree
.
pos
(),
"annotation.value.must.be.annotation"
);
expected
=
syms
.
errorType
;
expected
=
syms
.
errorType
;
}
}
return
enterAnnotation
((
JCAnnotation
)
tree
,
expected
,
env
);
return
enterAnnotation
((
JCAnnotation
)
tree
,
expected
,
env
);
}
}
if
(
expected
.
tag
==
TypeTags
.
ARRAY
)
{
// should really be isArray()
if
(
expected
.
tag
==
TypeTags
.
ARRAY
)
{
// should really be isArray()
if
(
tree
.
getTag
()
!=
JCTree
.
NEWARRAY
)
{
if
(
!
tree
.
hasTag
(
NEWARRAY
)
)
{
tree
=
make
.
at
(
tree
.
pos
).
tree
=
make
.
at
(
tree
.
pos
).
NewArray
(
null
,
List
.<
JCExpression
>
nil
(),
List
.
of
(
tree
));
NewArray
(
null
,
List
.<
JCExpression
>
nil
(),
List
.
of
(
tree
));
}
}
...
...
langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
浏览文件 @
16ad8cc6
...
@@ -49,8 +49,13 @@ import com.sun.source.tree.TreeVisitor;
...
@@ -49,8 +49,13 @@ import com.sun.source.tree.TreeVisitor;
import
com.sun.source.util.SimpleTreeVisitor
;
import
com.sun.source.util.SimpleTreeVisitor
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.
ANNOTATION
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.
BLOCK
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.
ERRONEOUS
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.
WILDCARD
;
import
static
com
.
sun
.
tools
.
javac
.
tree
.
JCTree
.
Tag
.*;
/** This is the main context-dependent analysis phase in GJC. It
/** This is the main context-dependent analysis phase in GJC. It
* encompasses name resolution, type checking and constant folding as
* encompasses name resolution, type checking and constant folding as
...
@@ -245,7 +250,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -245,7 +250,7 @@ public class Attr extends JCTree.Visitor {
((
v
.
flags
()
&
HASINIT
)
!=
0
((
v
.
flags
()
&
HASINIT
)
!=
0
||
||
!((
base
==
null
||
!((
base
==
null
||
(
base
.
getTag
()
==
JCTree
.
IDENT
&&
TreeInfo
.
name
(
base
)
==
names
.
_this
))
&&
(
base
.
hasTag
(
IDENT
)
&&
TreeInfo
.
name
(
base
)
==
names
.
_this
))
&&
isAssignableAsBlankFinal
(
v
,
env
))))
{
isAssignableAsBlankFinal
(
v
,
env
))))
{
if
(
v
.
isResourceVariable
())
{
//TWR resource
if
(
v
.
isResourceVariable
())
{
//TWR resource
log
.
error
(
pos
,
"try.resource.may.not.be.assigned"
,
v
);
log
.
error
(
pos
,
"try.resource.may.not.be.assigned"
,
v
);
...
@@ -263,7 +268,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -263,7 +268,7 @@ public class Attr extends JCTree.Visitor {
* @param tree The candidate tree.
* @param tree The candidate tree.
*/
*/
boolean
isStaticReference
(
JCTree
tree
)
{
boolean
isStaticReference
(
JCTree
tree
)
{
if
(
tree
.
getTag
()
==
JCTree
.
SELECT
)
{
if
(
tree
.
hasTag
(
SELECT
)
)
{
Symbol
lsym
=
TreeInfo
.
symbol
(((
JCFieldAccess
)
tree
).
selected
);
Symbol
lsym
=
TreeInfo
.
symbol
(((
JCFieldAccess
)
tree
).
selected
);
if
(
lsym
==
null
||
lsym
.
kind
!=
TYP
)
{
if
(
lsym
==
null
||
lsym
.
kind
!=
TYP
)
{
return
false
;
return
false
;
...
@@ -693,7 +698,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -693,7 +698,7 @@ public class Attr extends JCTree.Visitor {
// disable implicit outer instance from being passed.
// disable implicit outer instance from being passed.
// (This would be an illegal access to "this before super").
// (This would be an illegal access to "this before super").
if
(
env
.
info
.
isSelfCall
&&
if
(
env
.
info
.
isSelfCall
&&
env
.
tree
.
getTag
()
==
JCTree
.
NEWCLASS
&&
env
.
tree
.
hasTag
(
NEWCLASS
)
&&
((
JCNewClass
)
env
.
tree
).
encl
==
null
)
((
JCNewClass
)
env
.
tree
).
encl
==
null
)
{
{
c
.
flags_field
|=
NOOUTERTHIS
;
c
.
flags_field
|=
NOOUTERTHIS
;
...
@@ -863,7 +868,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -863,7 +868,7 @@ public class Attr extends JCTree.Visitor {
chk
.
checkDeprecatedAnnotation
(
tree
.
pos
(),
v
);
chk
.
checkDeprecatedAnnotation
(
tree
.
pos
(),
v
);
if
(
tree
.
init
!=
null
)
{
if
(
tree
.
init
!=
null
)
{
if
((
v
.
flags_field
&
FINAL
)
!=
0
&&
tree
.
init
.
getTag
()
!=
JCTree
.
NEWCLASS
)
{
if
((
v
.
flags_field
&
FINAL
)
!=
0
&&
!
tree
.
init
.
hasTag
(
NEWCLASS
)
)
{
// In this case, `v' is final. Ensure that it's initializer is
// In this case, `v' is final. Ensure that it's initializer is
// evaluated.
// evaluated.
v
.
getConstValue
();
// ensure initializer is evaluated
v
.
getConstValue
();
// ensure initializer is evaluated
...
@@ -971,8 +976,8 @@ public class Attr extends JCTree.Visitor {
...
@@ -971,8 +976,8 @@ public class Attr extends JCTree.Visitor {
public
void
visitLabelled
(
JCLabeledStatement
tree
)
{
public
void
visitLabelled
(
JCLabeledStatement
tree
)
{
// Check that label is not used in an enclosing statement
// Check that label is not used in an enclosing statement
Env
<
AttrContext
>
env1
=
env
;
Env
<
AttrContext
>
env1
=
env
;
while
(
env1
!=
null
&&
env1
.
tree
.
getTag
()
!=
JCTree
.
CLASSDEF
)
{
while
(
env1
!=
null
&&
!
env1
.
tree
.
hasTag
(
CLASSDEF
)
)
{
if
(
env1
.
tree
.
getTag
()
==
JCTree
.
LABELLED
&&
if
(
env1
.
tree
.
hasTag
(
LABELLED
)
&&
((
JCLabeledStatement
)
env1
.
tree
).
label
==
tree
.
label
)
{
((
JCLabeledStatement
)
env1
.
tree
).
label
==
tree
.
label
)
{
log
.
error
(
tree
.
pos
(),
"label.already.in.use"
,
log
.
error
(
tree
.
pos
(),
"label.already.in.use"
,
tree
.
label
);
tree
.
label
);
...
@@ -1052,14 +1057,14 @@ public class Attr extends JCTree.Visitor {
...
@@ -1052,14 +1057,14 @@ public class Attr extends JCTree.Visitor {
private
static
void
addVars
(
List
<
JCStatement
>
stats
,
Scope
switchScope
)
{
private
static
void
addVars
(
List
<
JCStatement
>
stats
,
Scope
switchScope
)
{
for
(;
stats
.
nonEmpty
();
stats
=
stats
.
tail
)
{
for
(;
stats
.
nonEmpty
();
stats
=
stats
.
tail
)
{
JCTree
stat
=
stats
.
head
;
JCTree
stat
=
stats
.
head
;
if
(
stat
.
getTag
()
==
JCTree
.
VARDEF
)
if
(
stat
.
hasTag
(
VARDEF
)
)
switchScope
.
enter
(((
JCVariableDecl
)
stat
).
sym
);
switchScope
.
enter
(((
JCVariableDecl
)
stat
).
sym
);
}
}
}
}
// where
// where
/** Return the selected enumeration constant symbol, or null. */
/** Return the selected enumeration constant symbol, or null. */
private
Symbol
enumConstant
(
JCTree
tree
,
Type
enumType
)
{
private
Symbol
enumConstant
(
JCTree
tree
,
Type
enumType
)
{
if
(
tree
.
getTag
()
!=
JCTree
.
IDENT
)
{
if
(
!
tree
.
hasTag
(
IDENT
)
)
{
log
.
error
(
tree
.
pos
(),
"enum.label.must.be.unqualified.enum"
);
log
.
error
(
tree
.
pos
(),
"enum.label.must.be.unqualified.enum"
);
return
syms
.
errSymbol
;
return
syms
.
errSymbol
;
}
}
...
@@ -1094,7 +1099,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1094,7 +1099,7 @@ public class Attr extends JCTree.Visitor {
localEnv
;
localEnv
;
// Attribute resource declarations
// Attribute resource declarations
for
(
JCTree
resource
:
tree
.
resources
)
{
for
(
JCTree
resource
:
tree
.
resources
)
{
if
(
resource
.
getTag
()
==
JCTree
.
VARDEF
)
{
if
(
resource
.
hasTag
(
VARDEF
)
)
{
attribStat
(
resource
,
tryEnv
);
attribStat
(
resource
,
tryEnv
);
chk
.
checkType
(
resource
,
resource
.
type
,
syms
.
autoCloseableType
,
"try.not.applicable.to.type"
);
chk
.
checkType
(
resource
,
resource
.
type
,
syms
.
autoCloseableType
,
"try.not.applicable.to.type"
);
...
@@ -1312,7 +1317,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1312,7 +1317,7 @@ public class Attr extends JCTree.Visitor {
* @param env The environment current at the jump statement.
* @param env The environment current at the jump statement.
*/
*/
private
JCTree
findJumpTarget
(
DiagnosticPosition
pos
,
private
JCTree
findJumpTarget
(
DiagnosticPosition
pos
,
int
tag
,
JCTree
.
Tag
tag
,
Name
label
,
Name
label
,
Env
<
AttrContext
>
env
)
{
Env
<
AttrContext
>
env
)
{
// Search environments outwards from the point of jump.
// Search environments outwards from the point of jump.
...
@@ -1320,15 +1325,15 @@ public class Attr extends JCTree.Visitor {
...
@@ -1320,15 +1325,15 @@ public class Attr extends JCTree.Visitor {
LOOP:
LOOP:
while
(
env1
!=
null
)
{
while
(
env1
!=
null
)
{
switch
(
env1
.
tree
.
getTag
())
{
switch
(
env1
.
tree
.
getTag
())
{
case
JCTree
.
LABELLED
:
case
LABELLED:
JCLabeledStatement
labelled
=
(
JCLabeledStatement
)
env1
.
tree
;
JCLabeledStatement
labelled
=
(
JCLabeledStatement
)
env1
.
tree
;
if
(
label
==
labelled
.
label
)
{
if
(
label
==
labelled
.
label
)
{
// If jump is a continue, check that target is a loop.
// If jump is a continue, check that target is a loop.
if
(
tag
==
JCTree
.
CONTINUE
)
{
if
(
tag
==
CONTINUE
)
{
if
(
labelled
.
body
.
getTag
()
!=
JCTree
.
DOLOOP
&&
if
(
!
labelled
.
body
.
hasTag
(
DOLOOP
)
&&
labelled
.
body
.
getTag
()
!=
JCTree
.
WHILELOOP
&&
!
labelled
.
body
.
hasTag
(
WHILELOOP
)
&&
labelled
.
body
.
getTag
()
!=
JCTree
.
FORLOOP
&&
!
labelled
.
body
.
hasTag
(
FORLOOP
)
&&
labelled
.
body
.
getTag
()
!=
JCTree
.
FOREACHLOOP
)
!
labelled
.
body
.
hasTag
(
FOREACHLOOP
)
)
log
.
error
(
pos
,
"not.loop.label"
,
label
);
log
.
error
(
pos
,
"not.loop.label"
,
label
);
// Found labelled statement target, now go inwards
// Found labelled statement target, now go inwards
// to next non-labelled tree.
// to next non-labelled tree.
...
@@ -1338,17 +1343,17 @@ public class Attr extends JCTree.Visitor {
...
@@ -1338,17 +1343,17 @@ public class Attr extends JCTree.Visitor {
}
}
}
}
break
;
break
;
case
JCTree
.
DOLOOP
:
case
DOLOOP:
case
JCTree
.
WHILELOOP
:
case
WHILELOOP:
case
JCTree
.
FORLOOP
:
case
FORLOOP:
case
JCTree
.
FOREACHLOOP
:
case
FOREACHLOOP:
if
(
label
==
null
)
return
env1
.
tree
;
if
(
label
==
null
)
return
env1
.
tree
;
break
;
break
;
case
JCTree
.
SWITCH
:
case
SWITCH:
if
(
label
==
null
&&
tag
==
JCTree
.
BREAK
)
return
env1
.
tree
;
if
(
label
==
null
&&
tag
==
BREAK
)
return
env1
.
tree
;
break
;
break
;
case
JCTree
.
METHODDEF
:
case
METHODDEF:
case
JCTree
.
CLASSDEF
:
case
CLASSDEF:
break
LOOP
;
break
LOOP
;
default
:
default
:
}
}
...
@@ -1356,7 +1361,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1356,7 +1361,7 @@ public class Attr extends JCTree.Visitor {
}
}
if
(
label
!=
null
)
if
(
label
!=
null
)
log
.
error
(
pos
,
"undef.label"
,
label
);
log
.
error
(
pos
,
"undef.label"
,
label
);
else
if
(
tag
==
JCTree
.
CONTINUE
)
else
if
(
tag
==
CONTINUE
)
log
.
error
(
pos
,
"cont.outside.loop"
);
log
.
error
(
pos
,
"cont.outside.loop"
);
else
else
log
.
error
(
pos
,
"break.outside.switch.loop"
);
log
.
error
(
pos
,
"break.outside.switch.loop"
);
...
@@ -1452,7 +1457,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1452,7 +1457,7 @@ public class Attr extends JCTree.Visitor {
if
(
encl
.
tag
==
CLASS
)
{
if
(
encl
.
tag
==
CLASS
)
{
// we are calling a nested class
// we are calling a nested class
if
(
tree
.
meth
.
getTag
()
==
JCTree
.
SELECT
)
{
if
(
tree
.
meth
.
hasTag
(
SELECT
)
)
{
JCTree
qualifier
=
((
JCFieldAccess
)
tree
.
meth
).
selected
;
JCTree
qualifier
=
((
JCFieldAccess
)
tree
.
meth
).
selected
;
// We are seeing a prefixed call, of the form
// We are seeing a prefixed call, of the form
...
@@ -1468,7 +1473,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1468,7 +1473,7 @@ public class Attr extends JCTree.Visitor {
rs
.
resolveImplicitThis
(
tree
.
meth
.
pos
(),
rs
.
resolveImplicitThis
(
tree
.
meth
.
pos
(),
localEnv
,
site
,
true
);
localEnv
,
site
,
true
);
}
}
}
else
if
(
tree
.
meth
.
getTag
()
==
JCTree
.
SELECT
)
{
}
else
if
(
tree
.
meth
.
hasTag
(
SELECT
)
)
{
log
.
error
(
tree
.
meth
.
pos
(),
"illegal.qual.not.icls"
,
log
.
error
(
tree
.
meth
.
pos
(),
"illegal.qual.not.icls"
,
site
.
tsym
);
site
.
tsym
);
}
}
...
@@ -1522,7 +1527,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1522,7 +1527,7 @@ public class Attr extends JCTree.Visitor {
// as a special case, array.clone() has a result that is
// as a special case, array.clone() has a result that is
// the same as static type of the array being cloned
// the same as static type of the array being cloned
if
(
tree
.
meth
.
getTag
()
==
JCTree
.
SELECT
&&
if
(
tree
.
meth
.
hasTag
(
SELECT
)
&&
allowCovariantReturns
&&
allowCovariantReturns
&&
methName
==
names
.
clone
&&
methName
==
names
.
clone
&&
types
.
isArray
(((
JCFieldAccess
)
tree
.
meth
).
selected
.
type
))
types
.
isArray
(((
JCFieldAccess
)
tree
.
meth
).
selected
.
type
))
...
@@ -1531,7 +1536,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1531,7 +1536,7 @@ public class Attr extends JCTree.Visitor {
// as a special case, x.getClass() has type Class<? extends |X|>
// as a special case, x.getClass() has type Class<? extends |X|>
if
(
allowGenerics
&&
if
(
allowGenerics
&&
methName
==
names
.
getClass
&&
tree
.
args
.
isEmpty
())
{
methName
==
names
.
getClass
&&
tree
.
args
.
isEmpty
())
{
Type
qualifier
=
(
tree
.
meth
.
getTag
()
==
JCTree
.
SELECT
)
Type
qualifier
=
(
tree
.
meth
.
hasTag
(
SELECT
)
)
?
((
JCFieldAccess
)
tree
.
meth
).
selected
.
type
?
((
JCFieldAccess
)
tree
.
meth
).
selected
.
type
:
env
.
enclClass
.
sym
.
type
;
:
env
.
enclClass
.
sym
.
type
;
restype
=
new
restype
=
new
...
@@ -1560,7 +1565,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1560,7 +1565,7 @@ public class Attr extends JCTree.Visitor {
JCMethodDecl
enclMethod
=
env
.
enclMethod
;
JCMethodDecl
enclMethod
=
env
.
enclMethod
;
if
(
enclMethod
!=
null
&&
enclMethod
.
name
==
names
.
init
)
{
if
(
enclMethod
!=
null
&&
enclMethod
.
name
==
names
.
init
)
{
JCBlock
body
=
enclMethod
.
body
;
JCBlock
body
=
enclMethod
.
body
;
if
(
body
.
stats
.
head
.
getTag
()
==
JCTree
.
EXEC
&&
if
(
body
.
stats
.
head
.
hasTag
(
EXEC
)
&&
((
JCExpressionStatement
)
body
.
stats
.
head
).
expr
==
tree
)
((
JCExpressionStatement
)
body
.
stats
.
head
).
expr
==
tree
)
return
true
;
return
true
;
}
}
...
@@ -1591,7 +1596,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1591,7 +1596,7 @@ public class Attr extends JCTree.Visitor {
// complete class name to be fully qualified
// complete class name to be fully qualified
JCExpression
clazz
=
tree
.
clazz
;
// Class field following new
JCExpression
clazz
=
tree
.
clazz
;
// Class field following new
JCExpression
clazzid
=
// Identifier in class field
JCExpression
clazzid
=
// Identifier in class field
(
clazz
.
getTag
()
==
JCTree
.
TYPEAPPLY
)
(
clazz
.
hasTag
(
TYPEAPPLY
)
)
?
((
JCTypeApply
)
clazz
).
clazz
?
((
JCTypeApply
)
clazz
).
clazz
:
clazz
;
:
clazz
;
...
@@ -1610,7 +1615,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1610,7 +1615,7 @@ public class Attr extends JCTree.Visitor {
attribExpr
(
tree
.
encl
,
env
));
attribExpr
(
tree
.
encl
,
env
));
clazzid1
=
make
.
at
(
clazz
.
pos
).
Select
(
make
.
Type
(
encltype
),
clazzid1
=
make
.
at
(
clazz
.
pos
).
Select
(
make
.
Type
(
encltype
),
((
JCIdent
)
clazzid
).
name
);
((
JCIdent
)
clazzid
).
name
);
if
(
clazz
.
getTag
()
==
JCTree
.
TYPEAPPLY
)
if
(
clazz
.
hasTag
(
TYPEAPPLY
)
)
clazz
=
make
.
at
(
tree
.
pos
).
clazz
=
make
.
at
(
tree
.
pos
).
TypeApply
(
clazzid1
,
TypeApply
(
clazzid1
,
((
JCTypeApply
)
clazz
).
arguments
);
((
JCTypeApply
)
clazz
).
arguments
);
...
@@ -1689,7 +1694,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1689,7 +1694,7 @@ public class Attr extends JCTree.Visitor {
// Enums may not be instantiated except implicitly
// Enums may not be instantiated except implicitly
if
(
allowEnums
&&
if
(
allowEnums
&&
(
clazztype
.
tsym
.
flags_field
&
Flags
.
ENUM
)
!=
0
&&
(
clazztype
.
tsym
.
flags_field
&
Flags
.
ENUM
)
!=
0
&&
(
env
.
tree
.
getTag
()
!=
JCTree
.
VARDEF
||
(
!
env
.
tree
.
hasTag
(
VARDEF
)
||
(((
JCVariableDecl
)
env
.
tree
).
mods
.
flags
&
Flags
.
ENUM
)
==
0
||
(((
JCVariableDecl
)
env
.
tree
).
mods
.
flags
&
Flags
.
ENUM
)
==
0
||
((
JCVariableDecl
)
env
.
tree
).
init
!=
tree
))
((
JCVariableDecl
)
env
.
tree
).
init
!=
tree
))
log
.
error
(
tree
.
pos
(),
"enum.cant.be.instantiated"
);
log
.
error
(
tree
.
pos
(),
"enum.cant.be.instantiated"
);
...
@@ -1930,7 +1935,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1930,7 +1935,7 @@ public class Attr extends JCTree.Visitor {
Name
name
=
TreeInfo
.
name
(
arg
);
Name
name
=
TreeInfo
.
name
(
arg
);
if
(
name
==
names
.
_this
||
name
==
names
.
_super
)
return
arg
;
if
(
name
==
names
.
_this
||
name
==
names
.
_super
)
return
arg
;
int
optag
=
JCTree
.
NULLCHK
;
JCTree
.
Tag
optag
=
NULLCHK
;
JCUnary
tree
=
make
.
at
(
arg
.
pos
).
Unary
(
optag
,
arg
);
JCUnary
tree
=
make
.
at
(
arg
.
pos
).
Unary
(
optag
,
arg
);
tree
.
operator
=
syms
.
nullcheck
;
tree
.
operator
=
syms
.
nullcheck
;
tree
.
type
=
arg
.
type
;
tree
.
type
=
arg
.
type
;
...
@@ -1991,7 +1996,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1991,7 +1996,7 @@ public class Attr extends JCTree.Visitor {
Type
operand
=
attribExpr
(
tree
.
rhs
,
env
);
Type
operand
=
attribExpr
(
tree
.
rhs
,
env
);
// Find operator.
// Find operator.
Symbol
operator
=
tree
.
operator
=
rs
.
resolveBinaryOperator
(
Symbol
operator
=
tree
.
operator
=
rs
.
resolveBinaryOperator
(
tree
.
pos
(),
tree
.
getTag
()
-
JCTree
.
ASGOffset
,
env
,
tree
.
pos
(),
tree
.
getTag
()
.
noAssignOp
()
,
env
,
owntype
,
operand
);
owntype
,
operand
);
if
(
operator
.
kind
==
MTH
&&
if
(
operator
.
kind
==
MTH
&&
...
@@ -1999,7 +2004,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -1999,7 +2004,7 @@ public class Attr extends JCTree.Visitor {
!
operand
.
isErroneous
())
{
!
operand
.
isErroneous
())
{
chk
.
checkOperator
(
tree
.
pos
(),
chk
.
checkOperator
(
tree
.
pos
(),
(
OperatorSymbol
)
operator
,
(
OperatorSymbol
)
operator
,
tree
.
getTag
()
-
JCTree
.
ASGOffset
,
tree
.
getTag
()
.
noAssignOp
()
,
owntype
,
owntype
,
operand
);
operand
);
chk
.
checkDivZero
(
tree
.
rhs
.
pos
(),
operator
,
operand
);
chk
.
checkDivZero
(
tree
.
rhs
.
pos
(),
operator
,
operand
);
...
@@ -2012,7 +2017,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -2012,7 +2017,7 @@ public class Attr extends JCTree.Visitor {
public
void
visitUnary
(
JCUnary
tree
)
{
public
void
visitUnary
(
JCUnary
tree
)
{
// Attribute arguments.
// Attribute arguments.
Type
argtype
=
(
JCTree
.
PREINC
<=
tree
.
getTag
()
&&
tree
.
getTag
()
<=
JCTree
.
POSTDEC
)
Type
argtype
=
(
tree
.
getTag
().
isIncOrDecUnaryOp
()
)
?
attribTree
(
tree
.
arg
,
env
,
VAR
,
Type
.
noType
)
?
attribTree
(
tree
.
arg
,
env
,
VAR
,
Type
.
noType
)
:
chk
.
checkNonVoid
(
tree
.
arg
.
pos
(),
attribExpr
(
tree
.
arg
,
env
));
:
chk
.
checkNonVoid
(
tree
.
arg
.
pos
(),
attribExpr
(
tree
.
arg
,
env
));
...
@@ -2023,7 +2028,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -2023,7 +2028,7 @@ public class Attr extends JCTree.Visitor {
Type
owntype
=
types
.
createErrorType
(
tree
.
type
);
Type
owntype
=
types
.
createErrorType
(
tree
.
type
);
if
(
operator
.
kind
==
MTH
&&
if
(
operator
.
kind
==
MTH
&&
!
argtype
.
isErroneous
())
{
!
argtype
.
isErroneous
())
{
owntype
=
(
JCTree
.
PREINC
<=
tree
.
getTag
()
&&
tree
.
getTag
()
<=
JCTree
.
POSTDEC
)
owntype
=
(
tree
.
getTag
().
isIncOrDecUnaryOp
()
)
?
tree
.
arg
.
type
?
tree
.
arg
.
type
:
operator
.
type
.
getReturnType
();
:
operator
.
type
.
getReturnType
();
int
opc
=
((
OperatorSymbol
)
operator
).
opcode
;
int
opc
=
((
OperatorSymbol
)
operator
).
opcode
;
...
@@ -2621,7 +2626,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -2621,7 +2626,7 @@ public class Attr extends JCTree.Visitor {
canOwnInitializer
(
env
.
info
.
scope
.
owner
)
&&
canOwnInitializer
(
env
.
info
.
scope
.
owner
)
&&
v
.
owner
==
env
.
info
.
scope
.
owner
.
enclClass
()
&&
v
.
owner
==
env
.
info
.
scope
.
owner
.
enclClass
()
&&
((
v
.
flags
()
&
STATIC
)
!=
0
)
==
Resolve
.
isStatic
(
env
)
&&
((
v
.
flags
()
&
STATIC
)
!=
0
)
==
Resolve
.
isStatic
(
env
)
&&
(
env
.
tree
.
getTag
()
!=
JCTree
.
ASSIGN
||
(
!
env
.
tree
.
hasTag
(
ASSIGN
)
||
TreeInfo
.
skipParens
(((
JCAssign
)
env
.
tree
).
lhs
)
!=
tree
))
{
TreeInfo
.
skipParens
(((
JCAssign
)
env
.
tree
).
lhs
)
!=
tree
))
{
String
suffix
=
(
env
.
info
.
enclVar
==
v
)
?
String
suffix
=
(
env
.
info
.
enclVar
==
v
)
?
"self.ref"
:
"forward.ref"
;
"self.ref"
:
"forward.ref"
;
...
@@ -2812,10 +2817,10 @@ public class Attr extends JCTree.Visitor {
...
@@ -2812,10 +2817,10 @@ public class Attr extends JCTree.Visitor {
}
}
Type
elemtype
=
types
.
elemtype
(
argtype
);
Type
elemtype
=
types
.
elemtype
(
argtype
);
switch
(
tree
.
getTag
())
{
switch
(
tree
.
getTag
())
{
case
JCTree
.
APPLY
:
case
APPLY:
((
JCMethodInvocation
)
tree
).
varargsElement
=
elemtype
;
((
JCMethodInvocation
)
tree
).
varargsElement
=
elemtype
;
break
;
break
;
case
JCTree
.
NEWCLASS
:
case
NEWCLASS:
((
JCNewClass
)
tree
).
varargsElement
=
elemtype
;
((
JCNewClass
)
tree
).
varargsElement
=
elemtype
;
break
;
break
;
default
:
default
:
...
@@ -2896,9 +2901,9 @@ public class Attr extends JCTree.Visitor {
...
@@ -2896,9 +2901,9 @@ public class Attr extends JCTree.Visitor {
if
(
clazzOuter
.
tag
==
CLASS
)
{
if
(
clazzOuter
.
tag
==
CLASS
)
{
Type
site
;
Type
site
;
JCExpression
clazz
=
TreeInfo
.
typeIn
(
tree
.
clazz
);
JCExpression
clazz
=
TreeInfo
.
typeIn
(
tree
.
clazz
);
if
(
clazz
.
getTag
()
==
JCTree
.
IDENT
)
{
if
(
clazz
.
hasTag
(
IDENT
)
)
{
site
=
env
.
enclClass
.
sym
.
type
;
site
=
env
.
enclClass
.
sym
.
type
;
}
else
if
(
clazz
.
getTag
()
==
JCTree
.
SELECT
)
{
}
else
if
(
clazz
.
hasTag
(
SELECT
)
)
{
site
=
((
JCFieldAccess
)
clazz
).
selected
.
type
;
site
=
((
JCFieldAccess
)
clazz
).
selected
.
type
;
}
else
throw
new
AssertionError
(
""
+
tree
);
}
else
throw
new
AssertionError
(
""
+
tree
);
if
(
clazzOuter
.
tag
==
CLASS
&&
site
!=
clazzOuter
)
{
if
(
clazzOuter
.
tag
==
CLASS
&&
site
!=
clazzOuter
)
{
...
@@ -3068,7 +3073,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -3068,7 +3073,7 @@ public class Attr extends JCTree.Visitor {
* Attribute an env for either a top level tree or class declaration.
* Attribute an env for either a top level tree or class declaration.
*/
*/
public
void
attrib
(
Env
<
AttrContext
>
env
)
{
public
void
attrib
(
Env
<
AttrContext
>
env
)
{
if
(
env
.
tree
.
getTag
()
==
JCTree
.
TOPLEVEL
)
if
(
env
.
tree
.
hasTag
(
TOPLEVEL
)
)
attribTopLevel
(
env
);
attribTopLevel
(
env
);
else
else
attribClass
(
env
.
tree
.
pos
(),
env
.
enclClass
.
sym
);
attribClass
(
env
.
tree
.
pos
(),
env
.
enclClass
.
sym
);
...
@@ -3245,7 +3250,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -3245,7 +3250,7 @@ public class Attr extends JCTree.Visitor {
((
c
.
flags
()
&
STATIC
)
==
0
||
c
.
name
==
names
.
empty
)
&&
((
c
.
flags
()
&
STATIC
)
==
0
||
c
.
name
==
names
.
empty
)
&&
(
TreeInfo
.
flags
(
l
.
head
)
&
(
STATIC
|
INTERFACE
))
!=
0
)
{
(
TreeInfo
.
flags
(
l
.
head
)
&
(
STATIC
|
INTERFACE
))
!=
0
)
{
Symbol
sym
=
null
;
Symbol
sym
=
null
;
if
(
l
.
head
.
getTag
()
==
JCTree
.
VARDEF
)
sym
=
((
JCVariableDecl
)
l
.
head
).
sym
;
if
(
l
.
head
.
hasTag
(
VARDEF
)
)
sym
=
((
JCVariableDecl
)
l
.
head
).
sym
;
if
(
sym
==
null
||
if
(
sym
==
null
||
sym
.
kind
!=
VAR
||
sym
.
kind
!=
VAR
||
((
VarSymbol
)
sym
).
getConstValue
()
==
null
)
((
VarSymbol
)
sym
).
getConstValue
()
==
null
)
...
...
langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
浏览文件 @
16ad8cc6
...
@@ -42,10 +42,14 @@ import com.sun.tools.javac.code.Type.*;
...
@@ -42,10 +42,14 @@ import com.sun.tools.javac.code.Type.*;
import
com.sun.tools.javac.code.Symbol.*
;
import
com.sun.tools.javac.code.Symbol.*
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.
ANNOTATION
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.
SYNCHRONIZED
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.
WILDCARD
;
import
static
com
.
sun
.
tools
.
javac
.
main
.
OptionName
.*;
import
static
com
.
sun
.
tools
.
javac
.
main
.
OptionName
.*;
import
static
com
.
sun
.
tools
.
javac
.
tree
.
JCTree
.
Tag
.*;
/** Type checking helper class for the attribution phase.
/** Type checking helper class for the attribution phase.
*
*
...
@@ -987,7 +991,7 @@ public class Check {
...
@@ -987,7 +991,7 @@ public class Check {
* <i>not</i> final.
* <i>not</i> final.
*/
*/
private
long
implicitEnumFinalFlag
(
JCTree
tree
)
{
private
long
implicitEnumFinalFlag
(
JCTree
tree
)
{
if
(
tree
.
getTag
()
!=
JCTree
.
CLASSDEF
)
return
0
;
if
(
!
tree
.
hasTag
(
CLASSDEF
)
)
return
0
;
class
SpecialTreeVisitor
extends
JCTree
.
Visitor
{
class
SpecialTreeVisitor
extends
JCTree
.
Visitor
{
boolean
specialized
;
boolean
specialized
;
SpecialTreeVisitor
()
{
SpecialTreeVisitor
()
{
...
@@ -1099,7 +1103,7 @@ public class Check {
...
@@ -1099,7 +1103,7 @@ public class Check {
// not parameterized at all.
// not parameterized at all.
if
(
tree
.
type
.
getEnclosingType
().
isRaw
())
if
(
tree
.
type
.
getEnclosingType
().
isRaw
())
log
.
error
(
tree
.
pos
(),
"improperly.formed.type.inner.raw.param"
);
log
.
error
(
tree
.
pos
(),
"improperly.formed.type.inner.raw.param"
);
if
(
tree
.
clazz
.
getTag
()
==
JCTree
.
SELECT
)
if
(
tree
.
clazz
.
hasTag
(
SELECT
)
)
visitSelectInternal
((
JCFieldAccess
)
tree
.
clazz
);
visitSelectInternal
((
JCFieldAccess
)
tree
.
clazz
);
}
}
}
}
...
@@ -2413,7 +2417,7 @@ public class Check {
...
@@ -2413,7 +2417,7 @@ public class Check {
// count them off as they're annotated
// count them off as they're annotated
for
(
JCTree
arg
:
a
.
args
)
{
for
(
JCTree
arg
:
a
.
args
)
{
if
(
arg
.
getTag
()
!=
JCTree
.
ASSIGN
)
continue
;
// recovery
if
(
!
arg
.
hasTag
(
ASSIGN
)
)
continue
;
// recovery
JCAssign
assign
=
(
JCAssign
)
arg
;
JCAssign
assign
=
(
JCAssign
)
arg
;
Symbol
m
=
TreeInfo
.
symbol
(
assign
.
lhs
);
Symbol
m
=
TreeInfo
.
symbol
(
assign
.
lhs
);
if
(
m
==
null
||
m
.
type
.
isErroneous
())
continue
;
if
(
m
==
null
||
m
.
type
.
isErroneous
())
continue
;
...
@@ -2442,12 +2446,12 @@ public class Check {
...
@@ -2442,12 +2446,12 @@ public class Check {
a
.
args
.
tail
==
null
)
a
.
args
.
tail
==
null
)
return
;
return
;
if
(
a
.
args
.
head
.
getTag
()
!=
JCTree
.
ASSIGN
)
return
;
// error recovery
if
(
!
a
.
args
.
head
.
hasTag
(
ASSIGN
)
)
return
;
// error recovery
JCAssign
assign
=
(
JCAssign
)
a
.
args
.
head
;
JCAssign
assign
=
(
JCAssign
)
a
.
args
.
head
;
Symbol
m
=
TreeInfo
.
symbol
(
assign
.
lhs
);
Symbol
m
=
TreeInfo
.
symbol
(
assign
.
lhs
);
if
(
m
.
name
!=
names
.
value
)
return
;
if
(
m
.
name
!=
names
.
value
)
return
;
JCTree
rhs
=
assign
.
rhs
;
JCTree
rhs
=
assign
.
rhs
;
if
(
rhs
.
getTag
()
!=
JCTree
.
NEWARRAY
)
return
;
if
(
!
rhs
.
hasTag
(
NEWARRAY
)
)
return
;
JCNewArray
na
=
(
JCNewArray
)
rhs
;
JCNewArray
na
=
(
JCNewArray
)
rhs
;
Set
<
Symbol
>
targets
=
new
HashSet
<
Symbol
>();
Set
<
Symbol
>
targets
=
new
HashSet
<
Symbol
>();
for
(
JCTree
elem
:
na
.
elems
)
{
for
(
JCTree
elem
:
na
.
elems
)
{
...
@@ -2506,7 +2510,7 @@ public class Check {
...
@@ -2506,7 +2510,7 @@ public class Check {
try
{
try
{
tree
.
sym
.
flags_field
|=
LOCKED
;
tree
.
sym
.
flags_field
|=
LOCKED
;
for
(
JCTree
def
:
tree
.
defs
)
{
for
(
JCTree
def
:
tree
.
defs
)
{
if
(
def
.
getTag
()
!=
JCTree
.
METHODDEF
)
continue
;
if
(
!
def
.
hasTag
(
METHODDEF
)
)
continue
;
JCMethodDecl
meth
=
(
JCMethodDecl
)
def
;
JCMethodDecl
meth
=
(
JCMethodDecl
)
def
;
checkAnnotationResType
(
meth
.
pos
(),
meth
.
restype
.
type
);
checkAnnotationResType
(
meth
.
pos
(),
meth
.
restype
.
type
);
}
}
...
@@ -2614,7 +2618,7 @@ public class Check {
...
@@ -2614,7 +2618,7 @@ public class Check {
*/
*/
int
checkOperator
(
DiagnosticPosition
pos
,
int
checkOperator
(
DiagnosticPosition
pos
,
OperatorSymbol
operator
,
OperatorSymbol
operator
,
int
tag
,
JCTree
.
Tag
tag
,
Type
left
,
Type
left
,
Type
right
)
{
Type
right
)
{
if
(
operator
.
opcode
==
ByteCodes
.
error
)
{
if
(
operator
.
opcode
==
ByteCodes
.
error
)
{
...
@@ -2650,7 +2654,8 @@ public class Check {
...
@@ -2650,7 +2654,8 @@ public class Check {
* Check for empty statements after if
* Check for empty statements after if
*/
*/
void
checkEmptyIf
(
JCIf
tree
)
{
void
checkEmptyIf
(
JCIf
tree
)
{
if
(
tree
.
thenpart
.
getTag
()
==
JCTree
.
SKIP
&&
tree
.
elsepart
==
null
&&
lint
.
isEnabled
(
LintCategory
.
EMPTY
))
if
(
tree
.
thenpart
.
hasTag
(
SKIP
)
&&
tree
.
elsepart
==
null
&&
lint
.
isEnabled
(
LintCategory
.
EMPTY
))
log
.
warning
(
LintCategory
.
EMPTY
,
tree
.
thenpart
.
pos
(),
"empty.if"
);
log
.
warning
(
LintCategory
.
EMPTY
,
tree
.
thenpart
.
pos
(),
"empty.if"
);
}
}
...
@@ -2754,7 +2759,7 @@ public class Check {
...
@@ -2754,7 +2759,7 @@ public class Check {
}
}
// where
// where
private
boolean
isCanonical
(
JCTree
tree
)
{
private
boolean
isCanonical
(
JCTree
tree
)
{
while
(
tree
.
getTag
()
==
JCTree
.
SELECT
)
{
while
(
tree
.
hasTag
(
SELECT
)
)
{
JCFieldAccess
s
=
(
JCFieldAccess
)
tree
;
JCFieldAccess
s
=
(
JCFieldAccess
)
tree
;
if
(
s
.
sym
.
owner
!=
TreeInfo
.
symbol
(
s
.
selected
))
if
(
s
.
sym
.
owner
!=
TreeInfo
.
symbol
(
s
.
selected
))
return
false
;
return
false
;
...
...
langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java
浏览文件 @
16ad8cc6
...
@@ -228,7 +228,7 @@ public class Enter extends JCTree.Visitor {
...
@@ -228,7 +228,7 @@ public class Enter extends JCTree.Visitor {
* only, and members go into the class member scope.
* only, and members go into the class member scope.
*/
*/
Scope
enterScope
(
Env
<
AttrContext
>
env
)
{
Scope
enterScope
(
Env
<
AttrContext
>
env
)
{
return
(
env
.
tree
.
getTag
()
==
JCTree
.
CLASSDEF
)
return
(
env
.
tree
.
hasTag
(
JCTree
.
Tag
.
CLASSDEF
)
)
?
((
JCClassDecl
)
env
.
tree
).
sym
.
members_field
?
((
JCClassDecl
)
env
.
tree
).
sym
.
members_field
:
env
.
info
.
scope
;
:
env
.
info
.
scope
;
}
}
...
...
langtools/src/share/classes/com/sun/tools/javac/comp/Env.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 1999, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
11
, 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
...
@@ -116,9 +116,9 @@ public class Env<A> implements Iterable<Env<A>> {
...
@@ -116,9 +116,9 @@ public class Env<A> implements Iterable<Env<A>> {
/** Return closest enclosing environment which points to a tree with given tag.
/** Return closest enclosing environment which points to a tree with given tag.
*/
*/
public
Env
<
A
>
enclosing
(
int
tag
)
{
public
Env
<
A
>
enclosing
(
JCTree
.
Tag
tag
)
{
Env
<
A
>
env1
=
this
;
Env
<
A
>
env1
=
this
;
while
(
env1
!=
null
&&
env1
.
tree
.
getTag
()
!=
tag
)
env1
=
env1
.
next
;
while
(
env1
!=
null
&&
!
env1
.
tree
.
hasTag
(
tag
)
)
env1
=
env1
.
next
;
return
env1
;
return
env1
;
}
}
...
...
langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
浏览文件 @
16ad8cc6
...
@@ -40,8 +40,10 @@ import com.sun.tools.javac.code.Symbol.*;
...
@@ -40,8 +40,10 @@ import com.sun.tools.javac.code.Symbol.*;
import
com.sun.tools.javac.tree.JCTree.*
;
import
com.sun.tools.javac.tree.JCTree.*
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.
BLOCK
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.*;
import
static
com
.
sun
.
tools
.
javac
.
tree
.
JCTree
.
Tag
.*;
/** This pass implements dataflow analysis for Java programs.
/** This pass implements dataflow analysis for Java programs.
* Liveness analysis checks that every statement is reachable.
* Liveness analysis checks that every statement is reachable.
...
@@ -321,7 +323,7 @@ public class Flow extends TreeScanner {
...
@@ -321,7 +323,7 @@ public class Flow extends TreeScanner {
log
.
error
(
exit
.
tree
.
pos
(),
log
.
error
(
exit
.
tree
.
pos
(),
"unreported.exception.default.constructor"
,
"unreported.exception.default.constructor"
,
exit
.
thrown
);
exit
.
thrown
);
}
else
if
(
exit
.
tree
.
getTag
()
==
JCTree
.
VARDEF
&&
}
else
if
(
exit
.
tree
.
hasTag
(
VARDEF
)
&&
((
JCVariableDecl
)
exit
.
tree
).
sym
.
isResourceVariable
())
{
((
JCVariableDecl
)
exit
.
tree
).
sym
.
isResourceVariable
())
{
log
.
error
(
exit
.
tree
.
pos
(),
log
.
error
(
exit
.
tree
.
pos
(),
"unreported.exception.implicit.close"
,
"unreported.exception.implicit.close"
,
...
@@ -416,7 +418,7 @@ public class Flow extends TreeScanner {
...
@@ -416,7 +418,7 @@ public class Flow extends TreeScanner {
*/
*/
void
letInit
(
JCTree
tree
)
{
void
letInit
(
JCTree
tree
)
{
tree
=
TreeInfo
.
skipParens
(
tree
);
tree
=
TreeInfo
.
skipParens
(
tree
);
if
(
tree
.
getTag
()
==
JCTree
.
IDENT
||
tree
.
getTag
()
==
JCTree
.
SELECT
)
{
if
(
tree
.
hasTag
(
IDENT
)
||
tree
.
hasTag
(
SELECT
)
)
{
Symbol
sym
=
TreeInfo
.
symbol
(
tree
);
Symbol
sym
=
TreeInfo
.
symbol
(
tree
);
if
(
sym
.
kind
==
VAR
)
{
if
(
sym
.
kind
==
VAR
)
{
letInit
(
tree
.
pos
(),
(
VarSymbol
)
sym
);
letInit
(
tree
.
pos
(),
(
VarSymbol
)
sym
);
...
@@ -452,7 +454,7 @@ public class Flow extends TreeScanner {
...
@@ -452,7 +454,7 @@ public class Flow extends TreeScanner {
pendingExits
=
oldPendingExits
;
pendingExits
=
oldPendingExits
;
for
(;
exits
.
nonEmpty
();
exits
=
exits
.
tail
)
{
for
(;
exits
.
nonEmpty
();
exits
=
exits
.
tail
)
{
PendingExit
exit
=
exits
.
head
;
PendingExit
exit
=
exits
.
head
;
if
(
exit
.
tree
.
getTag
()
==
JCTree
.
BREAK
&&
if
(
exit
.
tree
.
hasTag
(
BREAK
)
&&
((
JCBreak
)
exit
.
tree
).
target
==
tree
)
{
((
JCBreak
)
exit
.
tree
).
target
==
tree
)
{
inits
.
andSet
(
exit
.
inits
);
inits
.
andSet
(
exit
.
inits
);
uninits
.
andSet
(
exit
.
uninits
);
uninits
.
andSet
(
exit
.
uninits
);
...
@@ -471,7 +473,7 @@ public class Flow extends TreeScanner {
...
@@ -471,7 +473,7 @@ public class Flow extends TreeScanner {
pendingExits
=
new
ListBuffer
<
PendingExit
>();
pendingExits
=
new
ListBuffer
<
PendingExit
>();
for
(;
exits
.
nonEmpty
();
exits
=
exits
.
tail
)
{
for
(;
exits
.
nonEmpty
();
exits
=
exits
.
tail
)
{
PendingExit
exit
=
exits
.
head
;
PendingExit
exit
=
exits
.
head
;
if
(
exit
.
tree
.
getTag
()
==
JCTree
.
CONTINUE
&&
if
(
exit
.
tree
.
hasTag
(
CONTINUE
)
&&
((
JCContinue
)
exit
.
tree
).
target
==
tree
)
{
((
JCContinue
)
exit
.
tree
).
target
==
tree
)
{
inits
.
andSet
(
exit
.
inits
);
inits
.
andSet
(
exit
.
inits
);
uninits
.
andSet
(
exit
.
uninits
);
uninits
.
andSet
(
exit
.
uninits
);
...
@@ -517,7 +519,7 @@ public class Flow extends TreeScanner {
...
@@ -517,7 +519,7 @@ public class Flow extends TreeScanner {
*/
*/
void
scanDef
(
JCTree
tree
)
{
void
scanDef
(
JCTree
tree
)
{
scanStat
(
tree
);
scanStat
(
tree
);
if
(
tree
!=
null
&&
tree
.
getTag
()
==
JCTree
.
BLOCK
&&
!
alive
)
{
if
(
tree
!=
null
&&
tree
.
hasTag
(
JCTree
.
Tag
.
BLOCK
)
&&
!
alive
)
{
log
.
error
(
tree
.
pos
(),
log
.
error
(
tree
.
pos
(),
"initializer.must.be.able.to.complete.normally"
);
"initializer.must.be.able.to.complete.normally"
);
}
}
...
@@ -528,7 +530,7 @@ public class Flow extends TreeScanner {
...
@@ -528,7 +530,7 @@ public class Flow extends TreeScanner {
void
scanStat
(
JCTree
tree
)
{
void
scanStat
(
JCTree
tree
)
{
if
(!
alive
&&
tree
!=
null
)
{
if
(!
alive
&&
tree
!=
null
)
{
log
.
error
(
tree
.
pos
(),
"unreachable.stmt"
);
log
.
error
(
tree
.
pos
(),
"unreachable.stmt"
);
if
(
tree
.
getTag
()
!=
JCTree
.
SKIP
)
alive
=
true
;
if
(
!
tree
.
hasTag
(
SKIP
)
)
alive
=
true
;
}
}
scan
(
tree
);
scan
(
tree
);
}
}
...
@@ -614,7 +616,7 @@ public class Flow extends TreeScanner {
...
@@ -614,7 +616,7 @@ public class Flow extends TreeScanner {
try
{
try
{
// define all the static fields
// define all the static fields
for
(
List
<
JCTree
>
l
=
tree
.
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
for
(
List
<
JCTree
>
l
=
tree
.
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
if
(
l
.
head
.
getTag
()
==
JCTree
.
VARDEF
)
{
if
(
l
.
head
.
hasTag
(
VARDEF
)
)
{
JCVariableDecl
def
=
(
JCVariableDecl
)
l
.
head
;
JCVariableDecl
def
=
(
JCVariableDecl
)
l
.
head
;
if
((
def
.
mods
.
flags
&
STATIC
)
!=
0
)
{
if
((
def
.
mods
.
flags
&
STATIC
)
!=
0
)
{
VarSymbol
sym
=
def
.
sym
;
VarSymbol
sym
=
def
.
sym
;
...
@@ -626,7 +628,7 @@ public class Flow extends TreeScanner {
...
@@ -626,7 +628,7 @@ public class Flow extends TreeScanner {
// process all the static initializers
// process all the static initializers
for
(
List
<
JCTree
>
l
=
tree
.
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
for
(
List
<
JCTree
>
l
=
tree
.
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
if
(
l
.
head
.
getTag
()
!=
JCTree
.
METHODDEF
&&
if
(
!
l
.
head
.
hasTag
(
METHODDEF
)
&&
(
TreeInfo
.
flags
(
l
.
head
)
&
STATIC
)
!=
0
)
{
(
TreeInfo
.
flags
(
l
.
head
)
&
STATIC
)
!=
0
)
{
scanDef
(
l
.
head
);
scanDef
(
l
.
head
);
errorUncaught
();
errorUncaught
();
...
@@ -653,7 +655,7 @@ public class Flow extends TreeScanner {
...
@@ -653,7 +655,7 @@ public class Flow extends TreeScanner {
// define all the instance fields
// define all the instance fields
for
(
List
<
JCTree
>
l
=
tree
.
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
for
(
List
<
JCTree
>
l
=
tree
.
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
if
(
l
.
head
.
getTag
()
==
JCTree
.
VARDEF
)
{
if
(
l
.
head
.
hasTag
(
VARDEF
)
)
{
JCVariableDecl
def
=
(
JCVariableDecl
)
l
.
head
;
JCVariableDecl
def
=
(
JCVariableDecl
)
l
.
head
;
if
((
def
.
mods
.
flags
&
STATIC
)
==
0
)
{
if
((
def
.
mods
.
flags
&
STATIC
)
==
0
)
{
VarSymbol
sym
=
def
.
sym
;
VarSymbol
sym
=
def
.
sym
;
...
@@ -665,7 +667,7 @@ public class Flow extends TreeScanner {
...
@@ -665,7 +667,7 @@ public class Flow extends TreeScanner {
// process all the instance initializers
// process all the instance initializers
for
(
List
<
JCTree
>
l
=
tree
.
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
for
(
List
<
JCTree
>
l
=
tree
.
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
if
(
l
.
head
.
getTag
()
!=
JCTree
.
METHODDEF
&&
if
(
!
l
.
head
.
hasTag
(
METHODDEF
)
&&
(
TreeInfo
.
flags
(
l
.
head
)
&
STATIC
)
==
0
)
{
(
TreeInfo
.
flags
(
l
.
head
)
&
STATIC
)
==
0
)
{
scanDef
(
l
.
head
);
scanDef
(
l
.
head
);
errorUncaught
();
errorUncaught
();
...
@@ -691,7 +693,7 @@ public class Flow extends TreeScanner {
...
@@ -691,7 +693,7 @@ public class Flow extends TreeScanner {
// process all the methods
// process all the methods
for
(
List
<
JCTree
>
l
=
tree
.
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
for
(
List
<
JCTree
>
l
=
tree
.
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
if
(
l
.
head
.
getTag
()
==
JCTree
.
METHODDEF
)
{
if
(
l
.
head
.
hasTag
(
METHODDEF
)
)
{
scan
(
l
.
head
);
scan
(
l
.
head
);
errorUncaught
();
errorUncaught
();
}
}
...
@@ -760,7 +762,7 @@ public class Flow extends TreeScanner {
...
@@ -760,7 +762,7 @@ public class Flow extends TreeScanner {
PendingExit
exit
=
exits
.
head
;
PendingExit
exit
=
exits
.
head
;
exits
=
exits
.
tail
;
exits
=
exits
.
tail
;
if
(
exit
.
thrown
==
null
)
{
if
(
exit
.
thrown
==
null
)
{
Assert
.
check
(
exit
.
tree
.
getTag
()
==
JCTree
.
RETURN
);
Assert
.
check
(
exit
.
tree
.
hasTag
(
RETURN
)
);
if
(
isInitialConstructor
)
{
if
(
isInitialConstructor
)
{
inits
=
exit
.
inits
;
inits
=
exit
.
inits
;
for
(
int
i
=
firstadr
;
i
<
nextadr
;
i
++)
for
(
int
i
=
firstadr
;
i
<
nextadr
;
i
++)
...
@@ -989,7 +991,7 @@ public class Flow extends TreeScanner {
...
@@ -989,7 +991,7 @@ public class Flow extends TreeScanner {
Bits
uninits
)
{
Bits
uninits
)
{
for
(;
stats
.
nonEmpty
();
stats
=
stats
.
tail
)
{
for
(;
stats
.
nonEmpty
();
stats
=
stats
.
tail
)
{
JCTree
stat
=
stats
.
head
;
JCTree
stat
=
stats
.
head
;
if
(
stat
.
getTag
()
==
JCTree
.
VARDEF
)
{
if
(
stat
.
hasTag
(
VARDEF
)
)
{
int
adr
=
((
JCVariableDecl
)
stat
).
sym
.
adr
;
int
adr
=
((
JCVariableDecl
)
stat
).
sym
.
adr
;
inits
.
excl
(
adr
);
inits
.
excl
(
adr
);
uninits
.
incl
(
adr
);
uninits
.
incl
(
adr
);
...
@@ -1346,7 +1348,7 @@ public class Flow extends TreeScanner {
...
@@ -1346,7 +1348,7 @@ public class Flow extends TreeScanner {
public
void
visitUnary
(
JCUnary
tree
)
{
public
void
visitUnary
(
JCUnary
tree
)
{
switch
(
tree
.
getTag
())
{
switch
(
tree
.
getTag
())
{
case
JCTree
.
NOT
:
case
NOT:
scanCond
(
tree
.
arg
);
scanCond
(
tree
.
arg
);
Bits
t
=
initsWhenFalse
;
Bits
t
=
initsWhenFalse
;
initsWhenFalse
=
initsWhenTrue
;
initsWhenFalse
=
initsWhenTrue
;
...
@@ -1355,8 +1357,8 @@ public class Flow extends TreeScanner {
...
@@ -1355,8 +1357,8 @@ public class Flow extends TreeScanner {
uninitsWhenFalse
=
uninitsWhenTrue
;
uninitsWhenFalse
=
uninitsWhenTrue
;
uninitsWhenTrue
=
t
;
uninitsWhenTrue
=
t
;
break
;
break
;
case
JCTree
.
PREINC
:
case
JCTree
.
POSTINC
:
case
PREINC:
case
POSTINC:
case
JCTree
.
PREDEC
:
case
JCTree
.
POSTDEC
:
case
PREDEC:
case
POSTDEC:
scanExpr
(
tree
.
arg
);
scanExpr
(
tree
.
arg
);
letInit
(
tree
.
arg
);
letInit
(
tree
.
arg
);
break
;
break
;
...
@@ -1367,7 +1369,7 @@ public class Flow extends TreeScanner {
...
@@ -1367,7 +1369,7 @@ public class Flow extends TreeScanner {
public
void
visitBinary
(
JCBinary
tree
)
{
public
void
visitBinary
(
JCBinary
tree
)
{
switch
(
tree
.
getTag
())
{
switch
(
tree
.
getTag
())
{
case
JCTree
.
AND
:
case
AND:
scanCond
(
tree
.
lhs
);
scanCond
(
tree
.
lhs
);
Bits
initsWhenFalseLeft
=
initsWhenFalse
;
Bits
initsWhenFalseLeft
=
initsWhenFalse
;
Bits
uninitsWhenFalseLeft
=
uninitsWhenFalse
;
Bits
uninitsWhenFalseLeft
=
uninitsWhenFalse
;
...
@@ -1377,7 +1379,7 @@ public class Flow extends TreeScanner {
...
@@ -1377,7 +1379,7 @@ public class Flow extends TreeScanner {
initsWhenFalse
.
andSet
(
initsWhenFalseLeft
);
initsWhenFalse
.
andSet
(
initsWhenFalseLeft
);
uninitsWhenFalse
.
andSet
(
uninitsWhenFalseLeft
);
uninitsWhenFalse
.
andSet
(
uninitsWhenFalseLeft
);
break
;
break
;
case
JCTree
.
OR
:
case
OR:
scanCond
(
tree
.
lhs
);
scanCond
(
tree
.
lhs
);
Bits
initsWhenTrueLeft
=
initsWhenTrue
;
Bits
initsWhenTrueLeft
=
initsWhenTrue
;
Bits
uninitsWhenTrueLeft
=
uninitsWhenTrue
;
Bits
uninitsWhenTrueLeft
=
uninitsWhenTrue
;
...
@@ -1418,7 +1420,7 @@ public class Flow extends TreeScanner {
...
@@ -1418,7 +1420,7 @@ public class Flow extends TreeScanner {
private
boolean
is292targetTypeCast
(
JCTypeCast
tree
)
{
private
boolean
is292targetTypeCast
(
JCTypeCast
tree
)
{
boolean
is292targetTypeCast
=
false
;
boolean
is292targetTypeCast
=
false
;
JCExpression
expr
=
TreeInfo
.
skipParens
(
tree
.
expr
);
JCExpression
expr
=
TreeInfo
.
skipParens
(
tree
.
expr
);
if
(
expr
.
getTag
()
==
JCTree
.
APPLY
)
{
if
(
expr
.
hasTag
(
APPLY
)
)
{
JCMethodInvocation
apply
=
(
JCMethodInvocation
)
expr
;
JCMethodInvocation
apply
=
(
JCMethodInvocation
)
expr
;
Symbol
sym
=
TreeInfo
.
symbol
(
apply
.
meth
);
Symbol
sym
=
TreeInfo
.
symbol
(
apply
.
meth
);
is292targetTypeCast
=
sym
!=
null
&&
is292targetTypeCast
=
sym
!=
null
&&
...
...
langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
浏览文件 @
16ad8cc6
...
@@ -633,13 +633,13 @@ public class Infer {
...
@@ -633,13 +633,13 @@ public class Infer {
//the polymorphic signature call environment is nested.
//the polymorphic signature call environment is nested.
switch
(
env
.
next
.
tree
.
getTag
())
{
switch
(
env
.
next
.
tree
.
getTag
())
{
case
JCTree
.
TYPECAST
:
case
TYPECAST:
JCTypeCast
castTree
=
(
JCTypeCast
)
env
.
next
.
tree
;
JCTypeCast
castTree
=
(
JCTypeCast
)
env
.
next
.
tree
;
restype
=
(
TreeInfo
.
skipParens
(
castTree
.
expr
)
==
env
.
tree
)
?
restype
=
(
TreeInfo
.
skipParens
(
castTree
.
expr
)
==
env
.
tree
)
?
castTree
.
clazz
.
type
:
castTree
.
clazz
.
type
:
syms
.
objectType
;
syms
.
objectType
;
break
;
break
;
case
JCTree
.
EXEC
:
case
EXEC:
JCTree
.
JCExpressionStatement
execTree
=
JCTree
.
JCExpressionStatement
execTree
=
(
JCTree
.
JCExpressionStatement
)
env
.
next
.
tree
;
(
JCTree
.
JCExpressionStatement
)
env
.
next
.
tree
;
restype
=
(
TreeInfo
.
skipParens
(
execTree
.
expr
)
==
env
.
tree
)
?
restype
=
(
TreeInfo
.
skipParens
(
execTree
.
expr
)
==
env
.
tree
)
?
...
...
langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
浏览文件 @
16ad8cc6
...
@@ -40,8 +40,10 @@ import com.sun.tools.javac.code.Symbol.*;
...
@@ -40,8 +40,10 @@ import com.sun.tools.javac.code.Symbol.*;
import
com.sun.tools.javac.tree.JCTree.*
;
import
com.sun.tools.javac.tree.JCTree.*
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.
ANNOTATION
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.*;
import
static
com
.
sun
.
tools
.
javac
.
tree
.
JCTree
.
Tag
.*;
import
com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition
;
import
com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition
;
/** This is the second phase of Enter, in which classes are completed
/** This is the second phase of Enter, in which classes are completed
...
@@ -644,7 +646,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
...
@@ -644,7 +646,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
tree
.
sym
=
v
;
tree
.
sym
=
v
;
if
(
tree
.
init
!=
null
)
{
if
(
tree
.
init
!=
null
)
{
v
.
flags_field
|=
HASINIT
;
v
.
flags_field
|=
HASINIT
;
if
((
v
.
flags_field
&
FINAL
)
!=
0
&&
tree
.
init
.
getTag
()
!=
JCTree
.
NEWCLASS
)
{
if
((
v
.
flags_field
&
FINAL
)
!=
0
&&
!
tree
.
init
.
hasTag
(
NEWCLASS
)
)
{
Env
<
AttrContext
>
initEnv
=
getInitEnv
(
tree
,
env
);
Env
<
AttrContext
>
initEnv
=
getInitEnv
(
tree
,
env
);
initEnv
.
info
.
enclVar
=
v
;
initEnv
.
info
.
enclVar
=
v
;
v
.
setLazyConstValue
(
initEnv
(
tree
,
initEnv
),
attr
,
tree
.
init
);
v
.
setLazyConstValue
(
initEnv
(
tree
,
initEnv
),
attr
,
tree
.
init
);
...
@@ -868,7 +870,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
...
@@ -868,7 +870,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
// If this is a toplevel-class, make sure any preceding import
// If this is a toplevel-class, make sure any preceding import
// clauses have been seen.
// clauses have been seen.
if
(
c
.
owner
.
kind
==
PCK
)
{
if
(
c
.
owner
.
kind
==
PCK
)
{
memberEnter
(
env
.
toplevel
,
env
.
enclosing
(
JCTree
.
TOPLEVEL
));
memberEnter
(
env
.
toplevel
,
env
.
enclosing
(
TOPLEVEL
));
todo
.
append
(
env
);
todo
.
append
(
env
);
}
}
...
...
langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
浏览文件 @
16ad8cc6
...
@@ -49,9 +49,12 @@ import java.util.Set;
...
@@ -49,9 +49,12 @@ import java.util.Set;
import
javax.lang.model.element.ElementVisitor
;
import
javax.lang.model.element.ElementVisitor
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Flags
.
BLOCK
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
Kinds
.
ERRONEOUS
;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.*;
import
static
com
.
sun
.
tools
.
javac
.
code
.
TypeTags
.*;
import
static
com
.
sun
.
tools
.
javac
.
comp
.
Resolve
.
MethodResolutionPhase
.*;
import
static
com
.
sun
.
tools
.
javac
.
comp
.
Resolve
.
MethodResolutionPhase
.*;
import
static
com
.
sun
.
tools
.
javac
.
tree
.
JCTree
.
Tag
.*;
/** Helper class for name resolution, used mostly by the attribution phase.
/** Helper class for name resolution, used mostly by the attribution phase.
*
*
...
@@ -1269,7 +1272,7 @@ public class Resolve {
...
@@ -1269,7 +1272,7 @@ public class Resolve {
staticOnly
=
true
;
staticOnly
=
true
;
}
}
if
(
env
.
tree
.
getTag
()
!=
JCTree
.
IMPORT
)
{
if
(
!
env
.
tree
.
hasTag
(
IMPORT
)
)
{
sym
=
findGlobalType
(
env
,
env
.
toplevel
.
namedImportScope
,
name
);
sym
=
findGlobalType
(
env
,
env
.
toplevel
.
namedImportScope
,
name
);
if
(
sym
.
exists
())
return
sym
;
if
(
sym
.
exists
())
return
sym
;
else
if
(
sym
.
kind
<
bestSoFar
.
kind
)
bestSoFar
=
sym
;
else
if
(
sym
.
kind
<
bestSoFar
.
kind
)
bestSoFar
=
sym
;
...
@@ -1796,7 +1799,7 @@ public class Resolve {
...
@@ -1796,7 +1799,7 @@ public class Resolve {
* @param env The environment current at the operation.
* @param env The environment current at the operation.
* @param argtypes The types of the operands.
* @param argtypes The types of the operands.
*/
*/
Symbol
resolveOperator
(
DiagnosticPosition
pos
,
int
optag
,
Symbol
resolveOperator
(
DiagnosticPosition
pos
,
JCTree
.
Tag
optag
,
Env
<
AttrContext
>
env
,
List
<
Type
>
argtypes
)
{
Env
<
AttrContext
>
env
,
List
<
Type
>
argtypes
)
{
startResolution
();
startResolution
();
Name
name
=
treeinfo
.
operatorName
(
optag
);
Name
name
=
treeinfo
.
operatorName
(
optag
);
...
@@ -1815,7 +1818,7 @@ public class Resolve {
...
@@ -1815,7 +1818,7 @@ public class Resolve {
* @param env The environment current at the operation.
* @param env The environment current at the operation.
* @param arg The type of the operand.
* @param arg The type of the operand.
*/
*/
Symbol
resolveUnaryOperator
(
DiagnosticPosition
pos
,
int
optag
,
Env
<
AttrContext
>
env
,
Type
arg
)
{
Symbol
resolveUnaryOperator
(
DiagnosticPosition
pos
,
JCTree
.
Tag
optag
,
Env
<
AttrContext
>
env
,
Type
arg
)
{
return
resolveOperator
(
pos
,
optag
,
env
,
List
.
of
(
arg
));
return
resolveOperator
(
pos
,
optag
,
env
,
List
.
of
(
arg
));
}
}
...
@@ -1827,7 +1830,7 @@ public class Resolve {
...
@@ -1827,7 +1830,7 @@ public class Resolve {
* @param right The types of the right operand.
* @param right The types of the right operand.
*/
*/
Symbol
resolveBinaryOperator
(
DiagnosticPosition
pos
,
Symbol
resolveBinaryOperator
(
DiagnosticPosition
pos
,
int
optag
,
JCTree
.
Tag
optag
,
Env
<
AttrContext
>
env
,
Env
<
AttrContext
>
env
,
Type
left
,
Type
left
,
Type
right
)
{
Type
right
)
{
...
...
langtools/src/share/classes/com/sun/tools/javac/jvm/CRTable.java
浏览文件 @
16ad8cc6
...
@@ -532,7 +532,7 @@ implements CRTFlags {
...
@@ -532,7 +532,7 @@ implements CRTFlags {
*/
*/
public
int
endPos
(
JCTree
tree
)
{
public
int
endPos
(
JCTree
tree
)
{
if
(
tree
==
null
)
return
Position
.
NOPOS
;
if
(
tree
==
null
)
return
Position
.
NOPOS
;
if
(
tree
.
getTag
()
==
JCTree
.
BLOCK
)
if
(
tree
.
hasTag
(
JCTree
.
Tag
.
BLOCK
)
)
return
((
JCBlock
)
tree
).
endpos
;
return
((
JCBlock
)
tree
).
endpos
;
Integer
endpos
=
endPositions
.
get
(
tree
);
Integer
endpos
=
endPositions
.
get
(
tree
);
if
(
endpos
!=
null
)
if
(
endpos
!=
null
)
...
...
langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
浏览文件 @
16ad8cc6
...
@@ -47,6 +47,8 @@ import static com.sun.tools.javac.code.TypeTags.*;
...
@@ -47,6 +47,8 @@ import static com.sun.tools.javac.code.TypeTags.*;
import
static
com
.
sun
.
tools
.
javac
.
jvm
.
ByteCodes
.*;
import
static
com
.
sun
.
tools
.
javac
.
jvm
.
ByteCodes
.*;
import
static
com
.
sun
.
tools
.
javac
.
jvm
.
CRTFlags
.*;
import
static
com
.
sun
.
tools
.
javac
.
jvm
.
CRTFlags
.*;
import
static
com
.
sun
.
tools
.
javac
.
main
.
OptionName
.*;
import
static
com
.
sun
.
tools
.
javac
.
main
.
OptionName
.*;
import
static
com
.
sun
.
tools
.
javac
.
tree
.
JCTree
.
Tag
.*;
import
static
com
.
sun
.
tools
.
javac
.
tree
.
JCTree
.
Tag
.
BLOCK
;
/** This pass maps flat Java (i.e. without inner classes) to bytecodes.
/** This pass maps flat Java (i.e. without inner classes) to bytecodes.
*
*
...
@@ -433,7 +435,7 @@ public class Gen extends JCTree.Visitor {
...
@@ -433,7 +435,7 @@ public class Gen extends JCTree.Visitor {
*/
*/
boolean
hasFinally
(
JCTree
target
,
Env
<
GenContext
>
env
)
{
boolean
hasFinally
(
JCTree
target
,
Env
<
GenContext
>
env
)
{
while
(
env
.
tree
!=
target
)
{
while
(
env
.
tree
!=
target
)
{
if
(
env
.
tree
.
getTag
()
==
JCTree
.
TRY
&&
env
.
info
.
finalize
.
hasFinalizer
())
if
(
env
.
tree
.
hasTag
(
TRY
)
&&
env
.
info
.
finalize
.
hasFinalizer
())
return
true
;
return
true
;
env
=
env
.
next
;
env
=
env
.
next
;
}
}
...
@@ -460,17 +462,17 @@ public class Gen extends JCTree.Visitor {
...
@@ -460,17 +462,17 @@ public class Gen extends JCTree.Visitor {
for
(
List
<
JCTree
>
l
=
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
for
(
List
<
JCTree
>
l
=
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
JCTree
def
=
l
.
head
;
JCTree
def
=
l
.
head
;
switch
(
def
.
getTag
())
{
switch
(
def
.
getTag
())
{
case
JCTree
.
BLOCK
:
case
BLOCK:
JCBlock
block
=
(
JCBlock
)
def
;
JCBlock
block
=
(
JCBlock
)
def
;
if
((
block
.
flags
&
STATIC
)
!=
0
)
if
((
block
.
flags
&
STATIC
)
!=
0
)
clinitCode
.
append
(
block
);
clinitCode
.
append
(
block
);
else
else
initCode
.
append
(
block
);
initCode
.
append
(
block
);
break
;
break
;
case
JCTree
.
METHODDEF
:
case
METHODDEF:
methodDefs
.
append
(
def
);
methodDefs
.
append
(
def
);
break
;
break
;
case
JCTree
.
VARDEF
:
case
VARDEF:
JCVariableDecl
vdef
=
(
JCVariableDecl
)
def
;
JCVariableDecl
vdef
=
(
JCVariableDecl
)
def
;
VarSymbol
sym
=
vdef
.
sym
;
VarSymbol
sym
=
vdef
.
sym
;
checkDimension
(
vdef
.
pos
(),
sym
.
type
);
checkDimension
(
vdef
.
pos
(),
sym
.
type
);
...
@@ -707,7 +709,7 @@ public class Gen extends JCTree.Visitor {
...
@@ -707,7 +709,7 @@ public class Gen extends JCTree.Visitor {
}
}
int
startpc
=
code
.
curPc
();
int
startpc
=
code
.
curPc
();
genStat
(
tree
,
env
);
genStat
(
tree
,
env
);
if
(
tree
.
getTag
()
==
JCTree
.
BLOCK
)
crtFlags
|=
CRT_BLOCK
;
if
(
tree
.
hasTag
(
BLOCK
)
)
crtFlags
|=
CRT_BLOCK
;
code
.
crt
.
put
(
tree
,
crtFlags
,
startpc
,
code
.
curPc
());
code
.
crt
.
put
(
tree
,
crtFlags
,
startpc
,
code
.
curPc
());
}
}
...
@@ -717,7 +719,7 @@ public class Gen extends JCTree.Visitor {
...
@@ -717,7 +719,7 @@ public class Gen extends JCTree.Visitor {
if
(
code
.
isAlive
())
{
if
(
code
.
isAlive
())
{
code
.
statBegin
(
tree
.
pos
);
code
.
statBegin
(
tree
.
pos
);
genDef
(
tree
,
env
);
genDef
(
tree
,
env
);
}
else
if
(
env
.
info
.
isSwitch
&&
tree
.
getTag
()
==
JCTree
.
VARDEF
)
{
}
else
if
(
env
.
info
.
isSwitch
&&
tree
.
hasTag
(
VARDEF
)
)
{
// variables whose declarations are in a switch
// variables whose declarations are in a switch
// can be used even if the decl is unreachable.
// can be used even if the decl is unreachable.
code
.
newLocal
(((
JCVariableDecl
)
tree
).
sym
);
code
.
newLocal
(((
JCVariableDecl
)
tree
).
sym
);
...
@@ -784,7 +786,7 @@ public class Gen extends JCTree.Visitor {
...
@@ -784,7 +786,7 @@ public class Gen extends JCTree.Visitor {
*/
*/
public
CondItem
genCond
(
JCTree
_tree
,
boolean
markBranches
)
{
public
CondItem
genCond
(
JCTree
_tree
,
boolean
markBranches
)
{
JCTree
inner_tree
=
TreeInfo
.
skipParens
(
_tree
);
JCTree
inner_tree
=
TreeInfo
.
skipParens
(
_tree
);
if
(
inner_tree
.
getTag
()
==
JCTree
.
CONDEXPR
)
{
if
(
inner_tree
.
hasTag
(
CONDEXPR
)
)
{
JCConditional
tree
=
(
JCConditional
)
inner_tree
;
JCConditional
tree
=
(
JCConditional
)
inner_tree
;
CondItem
cond
=
genCond
(
tree
.
cond
,
CRT_FLOW_CONTROLLER
);
CondItem
cond
=
genCond
(
tree
.
cond
,
CRT_FLOW_CONTROLLER
);
if
(
cond
.
isTrue
())
{
if
(
cond
.
isTrue
())
{
...
@@ -1033,7 +1035,7 @@ public class Gen extends JCTree.Visitor {
...
@@ -1033,7 +1035,7 @@ public class Gen extends JCTree.Visitor {
Env
<
GenContext
>
localEnv
=
env
.
dup
(
tree
,
new
GenContext
());
Env
<
GenContext
>
localEnv
=
env
.
dup
(
tree
,
new
GenContext
());
genStats
(
tree
.
stats
,
localEnv
);
genStats
(
tree
.
stats
,
localEnv
);
// End the scope of all block-local variables in variable info.
// End the scope of all block-local variables in variable info.
if
(
env
.
tree
.
getTag
()
!=
JCTree
.
METHODDEF
)
{
if
(
!
env
.
tree
.
hasTag
(
METHODDEF
)
)
{
code
.
statBegin
(
tree
.
endpos
);
code
.
statBegin
(
tree
.
endpos
);
code
.
endScopes
(
limit
);
code
.
endScopes
(
limit
);
code
.
pendingStatPos
=
Position
.
NOPOS
;
code
.
pendingStatPos
=
Position
.
NOPOS
;
...
@@ -1628,11 +1630,11 @@ public class Gen extends JCTree.Visitor {
...
@@ -1628,11 +1630,11 @@ public class Gen extends JCTree.Visitor {
// Optimize x++ to ++x and x-- to --x.
// Optimize x++ to ++x and x-- to --x.
JCExpression
e
=
tree
.
expr
;
JCExpression
e
=
tree
.
expr
;
switch
(
e
.
getTag
())
{
switch
(
e
.
getTag
())
{
case
JCTree
.
POSTINC
:
case
POSTINC:
((
JCUnary
)
e
).
setTag
(
JCTree
.
PREINC
);
((
JCUnary
)
e
).
setTag
(
PREINC
);
break
;
break
;
case
JCTree
.
POSTDEC
:
case
POSTDEC:
((
JCUnary
)
e
).
setTag
(
JCTree
.
PREDEC
);
((
JCUnary
)
e
).
setTag
(
PREDEC
);
break
;
break
;
}
}
genExpr
(
tree
.
expr
,
tree
.
expr
.
type
).
drop
();
genExpr
(
tree
.
expr
,
tree
.
expr
.
type
).
drop
();
...
@@ -1819,13 +1821,13 @@ public class Gen extends JCTree.Visitor {
...
@@ -1819,13 +1821,13 @@ public class Gen extends JCTree.Visitor {
// If we have an increment of -32768 to +32767 of a local
// If we have an increment of -32768 to +32767 of a local
// int variable we can use an incr instruction instead of
// int variable we can use an incr instruction instead of
// proceeding further.
// proceeding further.
if
((
tree
.
getTag
()
==
JCTree
.
PLUS_ASG
||
tree
.
getTag
()
==
JCTree
.
MINUS_ASG
)
&&
if
((
tree
.
hasTag
(
PLUS_ASG
)
||
tree
.
hasTag
(
MINUS_ASG
)
)
&&
l
instanceof
LocalItem
&&
l
instanceof
LocalItem
&&
tree
.
lhs
.
type
.
tag
<=
INT
&&
tree
.
lhs
.
type
.
tag
<=
INT
&&
tree
.
rhs
.
type
.
tag
<=
INT
&&
tree
.
rhs
.
type
.
tag
<=
INT
&&
tree
.
rhs
.
type
.
constValue
()
!=
null
)
{
tree
.
rhs
.
type
.
constValue
()
!=
null
)
{
int
ival
=
((
Number
)
tree
.
rhs
.
type
.
constValue
()).
intValue
();
int
ival
=
((
Number
)
tree
.
rhs
.
type
.
constValue
()).
intValue
();
if
(
tree
.
getTag
()
==
JCTree
.
MINUS_ASG
)
ival
=
-
ival
;
if
(
tree
.
hasTag
(
MINUS_ASG
)
)
ival
=
-
ival
;
((
LocalItem
)
l
).
incr
(
ival
);
((
LocalItem
)
l
).
incr
(
ival
);
result
=
l
;
result
=
l
;
return
;
return
;
...
@@ -1841,29 +1843,29 @@ public class Gen extends JCTree.Visitor {
...
@@ -1841,29 +1843,29 @@ public class Gen extends JCTree.Visitor {
public
void
visitUnary
(
JCUnary
tree
)
{
public
void
visitUnary
(
JCUnary
tree
)
{
OperatorSymbol
operator
=
(
OperatorSymbol
)
tree
.
operator
;
OperatorSymbol
operator
=
(
OperatorSymbol
)
tree
.
operator
;
if
(
tree
.
getTag
()
==
JCTree
.
NOT
)
{
if
(
tree
.
hasTag
(
NOT
)
)
{
CondItem
od
=
genCond
(
tree
.
arg
,
false
);
CondItem
od
=
genCond
(
tree
.
arg
,
false
);
result
=
od
.
negate
();
result
=
od
.
negate
();
}
else
{
}
else
{
Item
od
=
genExpr
(
tree
.
arg
,
operator
.
type
.
getParameterTypes
().
head
);
Item
od
=
genExpr
(
tree
.
arg
,
operator
.
type
.
getParameterTypes
().
head
);
switch
(
tree
.
getTag
())
{
switch
(
tree
.
getTag
())
{
case
JCTree
.
POS
:
case
POS:
result
=
od
.
load
();
result
=
od
.
load
();
break
;
break
;
case
JCTree
.
NEG
:
case
NEG:
result
=
od
.
load
();
result
=
od
.
load
();
code
.
emitop0
(
operator
.
opcode
);
code
.
emitop0
(
operator
.
opcode
);
break
;
break
;
case
JCTree
.
COMPL
:
case
COMPL:
result
=
od
.
load
();
result
=
od
.
load
();
emitMinusOne
(
od
.
typecode
);
emitMinusOne
(
od
.
typecode
);
code
.
emitop0
(
operator
.
opcode
);
code
.
emitop0
(
operator
.
opcode
);
break
;
break
;
case
JCTree
.
PREINC
:
case
JCTree
.
PREDEC
:
case
PREINC:
case
PREDEC:
od
.
duplicate
();
od
.
duplicate
();
if
(
od
instanceof
LocalItem
&&
if
(
od
instanceof
LocalItem
&&
(
operator
.
opcode
==
iadd
||
operator
.
opcode
==
isub
))
{
(
operator
.
opcode
==
iadd
||
operator
.
opcode
==
isub
))
{
((
LocalItem
)
od
).
incr
(
tree
.
getTag
()
==
JCTree
.
PREINC
?
1
:
-
1
);
((
LocalItem
)
od
).
incr
(
tree
.
hasTag
(
PREINC
)
?
1
:
-
1
);
result
=
od
;
result
=
od
;
}
else
{
}
else
{
od
.
load
();
od
.
load
();
...
@@ -1877,12 +1879,12 @@ public class Gen extends JCTree.Visitor {
...
@@ -1877,12 +1879,12 @@ public class Gen extends JCTree.Visitor {
result
=
items
.
makeAssignItem
(
od
);
result
=
items
.
makeAssignItem
(
od
);
}
}
break
;
break
;
case
JCTree
.
POSTINC
:
case
JCTree
.
POSTDEC
:
case
POSTINC:
case
POSTDEC:
od
.
duplicate
();
od
.
duplicate
();
if
(
od
instanceof
LocalItem
&&
if
(
od
instanceof
LocalItem
&&
(
operator
.
opcode
==
iadd
||
operator
.
opcode
==
isub
))
{
(
operator
.
opcode
==
iadd
||
operator
.
opcode
==
isub
))
{
Item
res
=
od
.
load
();
Item
res
=
od
.
load
();
((
LocalItem
)
od
).
incr
(
tree
.
getTag
()
==
JCTree
.
POSTINC
?
1
:
-
1
);
((
LocalItem
)
od
).
incr
(
tree
.
hasTag
(
POSTINC
)
?
1
:
-
1
);
result
=
res
;
result
=
res
;
}
else
{
}
else
{
Item
res
=
od
.
load
();
Item
res
=
od
.
load
();
...
@@ -1898,7 +1900,7 @@ public class Gen extends JCTree.Visitor {
...
@@ -1898,7 +1900,7 @@ public class Gen extends JCTree.Visitor {
result
=
res
;
result
=
res
;
}
}
break
;
break
;
case
JCTree
.
NULLCHK
:
case
NULLCHK:
result
=
od
.
load
();
result
=
od
.
load
();
code
.
emitop0
(
dup
);
code
.
emitop0
(
dup
);
genNullCheck
(
tree
.
pos
());
genNullCheck
(
tree
.
pos
());
...
@@ -1926,7 +1928,7 @@ public class Gen extends JCTree.Visitor {
...
@@ -1926,7 +1928,7 @@ public class Gen extends JCTree.Visitor {
// Convert buffer to string.
// Convert buffer to string.
bufferToString
(
tree
.
pos
());
bufferToString
(
tree
.
pos
());
result
=
items
.
makeStackItem
(
syms
.
stringType
);
result
=
items
.
makeStackItem
(
syms
.
stringType
);
}
else
if
(
tree
.
getTag
()
==
JCTree
.
AND
)
{
}
else
if
(
tree
.
hasTag
(
AND
)
)
{
CondItem
lcond
=
genCond
(
tree
.
lhs
,
CRT_FLOW_CONTROLLER
);
CondItem
lcond
=
genCond
(
tree
.
lhs
,
CRT_FLOW_CONTROLLER
);
if
(!
lcond
.
isFalse
())
{
if
(!
lcond
.
isFalse
())
{
Chain
falseJumps
=
lcond
.
jumpFalse
();
Chain
falseJumps
=
lcond
.
jumpFalse
();
...
@@ -1940,7 +1942,7 @@ public class Gen extends JCTree.Visitor {
...
@@ -1940,7 +1942,7 @@ public class Gen extends JCTree.Visitor {
}
else
{
}
else
{
result
=
lcond
;
result
=
lcond
;
}
}
}
else
if
(
tree
.
getTag
()
==
JCTree
.
OR
)
{
}
else
if
(
tree
.
hasTag
(
OR
)
)
{
CondItem
lcond
=
genCond
(
tree
.
lhs
,
CRT_FLOW_CONTROLLER
);
CondItem
lcond
=
genCond
(
tree
.
lhs
,
CRT_FLOW_CONTROLLER
);
if
(!
lcond
.
isTrue
())
{
if
(!
lcond
.
isTrue
())
{
Chain
trueJumps
=
lcond
.
jumpTrue
();
Chain
trueJumps
=
lcond
.
jumpTrue
();
...
@@ -1997,7 +1999,7 @@ public class Gen extends JCTree.Visitor {
...
@@ -1997,7 +1999,7 @@ public class Gen extends JCTree.Visitor {
*/
*/
void
appendStrings
(
JCTree
tree
)
{
void
appendStrings
(
JCTree
tree
)
{
tree
=
TreeInfo
.
skipParens
(
tree
);
tree
=
TreeInfo
.
skipParens
(
tree
);
if
(
tree
.
getTag
()
==
JCTree
.
PLUS
&&
tree
.
type
.
constValue
()
==
null
)
{
if
(
tree
.
hasTag
(
PLUS
)
&&
tree
.
type
.
constValue
()
==
null
)
{
JCBinary
op
=
(
JCBinary
)
tree
;
JCBinary
op
=
(
JCBinary
)
tree
;
if
(
op
.
operator
.
kind
==
MTH
&&
if
(
op
.
operator
.
kind
==
MTH
&&
((
OperatorSymbol
)
op
.
operator
).
opcode
==
string_add
)
{
((
OperatorSymbol
)
op
.
operator
).
opcode
==
string_add
)
{
...
@@ -2240,7 +2242,7 @@ public class Gen extends JCTree.Visitor {
...
@@ -2240,7 +2242,7 @@ public class Gen extends JCTree.Visitor {
if
(
nerrs
!=
0
)
{
if
(
nerrs
!=
0
)
{
// if errors, discard code
// if errors, discard code
for
(
List
<
JCTree
>
l
=
cdef
.
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
for
(
List
<
JCTree
>
l
=
cdef
.
defs
;
l
.
nonEmpty
();
l
=
l
.
tail
)
{
if
(
l
.
head
.
getTag
()
==
JCTree
.
METHODDEF
)
if
(
l
.
head
.
hasTag
(
METHODDEF
)
)
((
JCMethodDecl
)
l
.
head
).
sym
.
code
=
null
;
((
JCMethodDecl
)
l
.
head
).
sym
.
code
=
null
;
}
}
}
}
...
...
langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
浏览文件 @
16ad8cc6
...
@@ -1506,20 +1506,20 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
...
@@ -1506,20 +1506,20 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
for
(
List
<
JCTree
>
it
=
tree
.
defs
;
it
.
tail
!=
null
;
it
=
it
.
tail
)
{
for
(
List
<
JCTree
>
it
=
tree
.
defs
;
it
.
tail
!=
null
;
it
=
it
.
tail
)
{
JCTree
t
=
it
.
head
;
JCTree
t
=
it
.
head
;
switch
(
t
.
getTag
())
{
switch
(
t
.
getTag
())
{
case
JCTree
.
CLASSDEF
:
case
CLASSDEF:
if
(
isInterface
||
if
(
isInterface
||
(((
JCClassDecl
)
t
).
mods
.
flags
&
(
Flags
.
PROTECTED
|
Flags
.
PUBLIC
))
!=
0
||
(((
JCClassDecl
)
t
).
mods
.
flags
&
(
Flags
.
PROTECTED
|
Flags
.
PUBLIC
))
!=
0
||
(((
JCClassDecl
)
t
).
mods
.
flags
&
(
Flags
.
PRIVATE
))
==
0
&&
((
JCClassDecl
)
t
).
sym
.
packge
().
getQualifiedName
()
==
names
.
java_lang
)
(((
JCClassDecl
)
t
).
mods
.
flags
&
(
Flags
.
PRIVATE
))
==
0
&&
((
JCClassDecl
)
t
).
sym
.
packge
().
getQualifiedName
()
==
names
.
java_lang
)
newdefs
.
append
(
t
);
newdefs
.
append
(
t
);
break
;
break
;
case
JCTree
.
METHODDEF
:
case
METHODDEF:
if
(
isInterface
||
if
(
isInterface
||
(((
JCMethodDecl
)
t
).
mods
.
flags
&
(
Flags
.
PROTECTED
|
Flags
.
PUBLIC
))
!=
0
||
(((
JCMethodDecl
)
t
).
mods
.
flags
&
(
Flags
.
PROTECTED
|
Flags
.
PUBLIC
))
!=
0
||
((
JCMethodDecl
)
t
).
sym
.
name
==
names
.
init
||
((
JCMethodDecl
)
t
).
sym
.
name
==
names
.
init
||
(((
JCMethodDecl
)
t
).
mods
.
flags
&
(
Flags
.
PRIVATE
))
==
0
&&
((
JCMethodDecl
)
t
).
sym
.
packge
().
getQualifiedName
()
==
names
.
java_lang
)
(((
JCMethodDecl
)
t
).
mods
.
flags
&
(
Flags
.
PRIVATE
))
==
0
&&
((
JCMethodDecl
)
t
).
sym
.
packge
().
getQualifiedName
()
==
names
.
java_lang
)
newdefs
.
append
(
t
);
newdefs
.
append
(
t
);
break
;
break
;
case
JCTree
.
VARDEF
:
case
VARDEF:
if
(
isInterface
||
(((
JCVariableDecl
)
t
).
mods
.
flags
&
(
Flags
.
PROTECTED
|
Flags
.
PUBLIC
))
!=
0
||
if
(
isInterface
||
(((
JCVariableDecl
)
t
).
mods
.
flags
&
(
Flags
.
PROTECTED
|
Flags
.
PUBLIC
))
!=
0
||
(((
JCVariableDecl
)
t
).
mods
.
flags
&
(
Flags
.
PRIVATE
))
==
0
&&
((
JCVariableDecl
)
t
).
sym
.
packge
().
getQualifiedName
()
==
names
.
java_lang
)
(((
JCVariableDecl
)
t
).
mods
.
flags
&
(
Flags
.
PRIVATE
))
==
0
&&
((
JCVariableDecl
)
t
).
sym
.
packge
().
getQualifiedName
()
==
names
.
java_lang
)
newdefs
.
append
(
t
);
newdefs
.
append
(
t
);
...
...
langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java
浏览文件 @
16ad8cc6
/*
/*
* Copyright (c) 2005, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 201
1
, 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
...
@@ -48,6 +48,7 @@ import com.sun.tools.javac.tree.TreeScanner;
...
@@ -48,6 +48,7 @@ import com.sun.tools.javac.tree.TreeScanner;
import
com.sun.tools.javac.util.*
;
import
com.sun.tools.javac.util.*
;
import
com.sun.tools.javac.util.Name
;
import
com.sun.tools.javac.util.Name
;
import
static
com
.
sun
.
tools
.
javac
.
tree
.
JCTree
.
Tag
.*;
import
static
javax
.
lang
.
model
.
util
.
ElementFilter
.
methodsIn
;
import
static
javax
.
lang
.
model
.
util
.
ElementFilter
.
methodsIn
;
/**
/**
...
@@ -288,7 +289,7 @@ public class JavacElements implements Elements {
...
@@ -288,7 +289,7 @@ public class JavacElements implements Elements {
}
}
}
}
public
void
visitArray
(
Attribute
.
Array
array
)
{
public
void
visitArray
(
Attribute
.
Array
array
)
{
if
(
tree
.
getTag
()
==
JCTree
.
NEWARRAY
&&
if
(
tree
.
hasTag
(
NEWARRAY
)
&&
types
.
elemtype
(
array
.
type
).
tsym
==
findme
.
type
.
tsym
)
{
types
.
elemtype
(
array
.
type
).
tsym
==
findme
.
type
.
tsym
)
{
List
<
JCExpression
>
elems
=
((
JCNewArray
)
tree
).
elems
;
List
<
JCExpression
>
elems
=
((
JCNewArray
)
tree
).
elems
;
for
(
Attribute
value
:
array
.
values
)
{
for
(
Attribute
value
:
array
.
values
)
{
...
@@ -327,7 +328,7 @@ public class JavacElements implements Elements {
...
@@ -327,7 +328,7 @@ public class JavacElements implements Elements {
scan
(
t
.
args
);
scan
(
t
.
args
);
}
}
public
void
visitAssign
(
JCAssign
t
)
{
public
void
visitAssign
(
JCAssign
t
)
{
if
(
t
.
lhs
.
getTag
()
==
JCTree
.
IDENT
)
{
if
(
t
.
lhs
.
hasTag
(
IDENT
)
)
{
JCIdent
ident
=
(
JCIdent
)
t
.
lhs
;
JCIdent
ident
=
(
JCIdent
)
t
.
lhs
;
if
(
ident
.
sym
==
sym
)
if
(
ident
.
sym
==
sym
)
result
=
t
.
rhs
;
result
=
t
.
rhs
;
...
...
langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
浏览文件 @
16ad8cc6
...
@@ -29,6 +29,7 @@ import java.util.*;
...
@@ -29,6 +29,7 @@ import java.util.*;
import
com.sun.tools.javac.code.*
;
import
com.sun.tools.javac.code.*
;
import
com.sun.tools.javac.parser.Tokens.*
;
import
com.sun.tools.javac.parser.Tokens.*
;
import
com.sun.tools.javac.parser.Tokens.Comment.CommentStyle
;
import
com.sun.tools.javac.tree.*
;
import
com.sun.tools.javac.tree.*
;
import
com.sun.tools.javac.tree.JCTree.*
;
import
com.sun.tools.javac.tree.JCTree.*
;
import
com.sun.tools.javac.util.*
;
import
com.sun.tools.javac.util.*
;
...
@@ -36,8 +37,16 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
...
@@ -36,8 +37,16 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
import
com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition
;
import
com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition
;
import
com.sun.tools.javac.util.List
;
import
com.sun.tools.javac.util.List
;
import
static
com
.
sun
.
tools
.
javac
.
util
.
ListBuffer
.
lb
;
import
static
com
.
sun
.
tools
.
javac
.
parser
.
Tokens
.
TokenKind
.*;
import
static
com
.
sun
.
tools
.
javac
.
parser
.
Tokens
.
TokenKind
.*;
import
static
com
.
sun
.
tools
.
javac
.
parser
.
Tokens
.
TokenKind
.
ASSERT
;
import
static
com
.
sun
.
tools
.
javac
.
parser
.
Tokens
.
TokenKind
.
CASE
;
import
static
com
.
sun
.
tools
.
javac
.
parser
.
Tokens
.
TokenKind
.
CATCH
;
import
static
com
.
sun
.
tools
.
javac
.
parser
.
Tokens
.
TokenKind
.
EQ
;
import
static
com
.
sun
.
tools
.
javac
.
parser
.
Tokens
.
TokenKind
.
GT
;
import
static
com
.
sun
.
tools
.
javac
.
parser
.
Tokens
.
TokenKind
.
IMPORT
;
import
static
com
.
sun
.
tools
.
javac
.
parser
.
Tokens
.
TokenKind
.
LT
;
import
static
com
.
sun
.
tools
.
javac
.
util
.
ListBuffer
.
lb
;
import
static
com
.
sun
.
tools
.
javac
.
tree
.
JCTree
.
Tag
.*;
/** The parser maps a token sequence into an abstract syntax
/** The parser maps a token sequence into an abstract syntax
* tree. It operates by recursive descent, with code derived
* tree. It operates by recursive descent, with code derived
...
@@ -757,7 +766,7 @@ public class JavacParser implements Parser {
...
@@ -757,7 +766,7 @@ public class JavacParser implements Parser {
Assert
.
check
(
top
==
0
);
Assert
.
check
(
top
==
0
);
t
=
odStack
[
0
];
t
=
odStack
[
0
];
if
(
t
.
getTag
()
==
JCTree
.
PLUS
)
{
if
(
t
.
hasTag
(
JCTree
.
Tag
.
PLUS
)
)
{
StringBuffer
buf
=
foldStrings
(
t
);
StringBuffer
buf
=
foldStrings
(
t
);
if
(
buf
!=
null
)
{
if
(
buf
!=
null
)
{
t
=
toP
(
F
.
at
(
startPos
).
Literal
(
TypeTags
.
CLASS
,
buf
.
toString
()));
t
=
toP
(
F
.
at
(
startPos
).
Literal
(
TypeTags
.
CLASS
,
buf
.
toString
()));
...
@@ -790,7 +799,7 @@ public class JavacParser implements Parser {
...
@@ -790,7 +799,7 @@ public class JavacParser implements Parser {
return
null
;
return
null
;
List
<
String
>
buf
=
List
.
nil
();
List
<
String
>
buf
=
List
.
nil
();
while
(
true
)
{
while
(
true
)
{
if
(
tree
.
getTag
()
==
JCTree
.
LITERAL
)
{
if
(
tree
.
hasTag
(
LITERAL
)
)
{
JCLiteral
lit
=
(
JCLiteral
)
tree
;
JCLiteral
lit
=
(
JCLiteral
)
tree
;
if
(
lit
.
typetag
==
TypeTags
.
CLASS
)
{
if
(
lit
.
typetag
==
TypeTags
.
CLASS
)
{
StringBuffer
sbuf
=
StringBuffer
sbuf
=
...
@@ -801,9 +810,9 @@ public class JavacParser implements Parser {
...
@@ -801,9 +810,9 @@ public class JavacParser implements Parser {
}
}
return
sbuf
;
return
sbuf
;
}
}
}
else
if
(
tree
.
getTag
()
==
JCTree
.
PLUS
)
{
}
else
if
(
tree
.
hasTag
(
JCTree
.
Tag
.
PLUS
)
)
{
JCBinary
op
=
(
JCBinary
)
tree
;
JCBinary
op
=
(
JCBinary
)
tree
;
if
(
op
.
rhs
.
getTag
()
==
JCTree
.
LITERAL
)
{
if
(
op
.
rhs
.
hasTag
(
LITERAL
)
)
{
JCLiteral
lit
=
(
JCLiteral
)
op
.
rhs
;
JCLiteral
lit
=
(
JCLiteral
)
op
.
rhs
;
if
(
lit
.
typetag
==
TypeTags
.
CLASS
)
{
if
(
lit
.
typetag
==
TypeTags
.
CLASS
)
{
buf
=
buf
.
prepend
((
String
)
lit
.
value
);
buf
=
buf
.
prepend
((
String
)
lit
.
value
);
...
@@ -899,7 +908,7 @@ public class JavacParser implements Parser {
...
@@ -899,7 +908,7 @@ public class JavacParser implements Parser {
t
=
term3
();
t
=
term3
();
if
((
mode
&
TYPE
)
!=
0
&&
token
.
kind
==
LT
)
{
if
((
mode
&
TYPE
)
!=
0
&&
token
.
kind
==
LT
)
{
// Could be a cast to a parameterized type
// Could be a cast to a parameterized type
int
op
=
JCTree
.
LT
;
JCTree
.
Tag
op
=
JCTree
.
Tag
.
LT
;
int
pos1
=
token
.
pos
;
int
pos1
=
token
.
pos
;
nextToken
();
nextToken
();
mode
&=
(
EXPR
|
TYPE
);
mode
&=
(
EXPR
|
TYPE
);
...
@@ -1153,7 +1162,7 @@ public class JavacParser implements Parser {
...
@@ -1153,7 +1162,7 @@ public class JavacParser implements Parser {
while
((
token
.
kind
==
PLUSPLUS
||
token
.
kind
==
SUBSUB
)
&&
(
mode
&
EXPR
)
!=
0
)
{
while
((
token
.
kind
==
PLUSPLUS
||
token
.
kind
==
SUBSUB
)
&&
(
mode
&
EXPR
)
!=
0
)
{
mode
=
EXPR
;
mode
=
EXPR
;
t
=
to
(
F
.
at
(
token
.
pos
).
Unary
(
t
=
to
(
F
.
at
(
token
.
pos
).
Unary
(
token
.
kind
==
PLUSPLUS
?
JCTree
.
POSTINC
:
JCTree
.
POSTDEC
,
t
));
token
.
kind
==
PLUSPLUS
?
POSTINC
:
POSTDEC
,
t
));
nextToken
();
nextToken
();
}
}
return
toP
(
t
);
return
toP
(
t
);
...
@@ -1584,7 +1593,7 @@ public class JavacParser implements Parser {
...
@@ -1584,7 +1593,7 @@ public class JavacParser implements Parser {
break
;
break
;
case
MONKEYS_AT:
case
MONKEYS_AT:
case
FINAL:
{
case
FINAL:
{
String
dc
=
token
.
docComment
;
String
dc
=
token
.
comment
(
CommentStyle
.
JAVADOC
)
;
JCModifiers
mods
=
modifiersOpt
();
JCModifiers
mods
=
modifiersOpt
();
if
(
token
.
kind
==
INTERFACE
||
if
(
token
.
kind
==
INTERFACE
||
token
.
kind
==
CLASS
||
token
.
kind
==
CLASS
||
...
@@ -1601,21 +1610,21 @@ public class JavacParser implements Parser {
...
@@ -1601,21 +1610,21 @@ public class JavacParser implements Parser {
break
;
break
;
}
}
case
ABSTRACT:
case
STRICTFP:
{
case
ABSTRACT:
case
STRICTFP:
{
String
dc
=
token
.
docComment
;
String
dc
=
token
.
comment
(
CommentStyle
.
JAVADOC
)
;
JCModifiers
mods
=
modifiersOpt
();
JCModifiers
mods
=
modifiersOpt
();
stats
.
append
(
classOrInterfaceOrEnumDeclaration
(
mods
,
dc
));
stats
.
append
(
classOrInterfaceOrEnumDeclaration
(
mods
,
dc
));
break
;
break
;
}
}
case
INTERFACE:
case
INTERFACE:
case
CLASS:
case
CLASS:
String
dc
=
token
.
docComment
;
String
dc
=
token
.
comment
(
CommentStyle
.
JAVADOC
)
;
stats
.
append
(
classOrInterfaceOrEnumDeclaration
(
modifiersOpt
(),
dc
));
stats
.
append
(
classOrInterfaceOrEnumDeclaration
(
modifiersOpt
(),
dc
));
break
;
break
;
case
ENUM:
case
ENUM:
case
ASSERT:
case
ASSERT:
if
(
allowEnums
&&
token
.
kind
==
ENUM
)
{
if
(
allowEnums
&&
token
.
kind
==
ENUM
)
{
error
(
token
.
pos
,
"local.enum"
);
error
(
token
.
pos
,
"local.enum"
);
dc
=
token
.
docComment
;
dc
=
token
.
comment
(
CommentStyle
.
JAVADOC
)
;
stats
.
append
(
classOrInterfaceOrEnumDeclaration
(
modifiersOpt
(),
dc
));
stats
.
append
(
classOrInterfaceOrEnumDeclaration
(
modifiersOpt
(),
dc
));
break
;
break
;
}
else
if
(
allowAsserts
&&
token
.
kind
==
ASSERT
)
{
}
else
if
(
allowAsserts
&&
token
.
kind
==
ASSERT
)
{
...
@@ -1626,7 +1635,7 @@ public class JavacParser implements Parser {
...
@@ -1626,7 +1635,7 @@ public class JavacParser implements Parser {
default
:
default
:
Token
prevToken
=
token
;
Token
prevToken
=
token
;
JCExpression
t
=
term
(
EXPR
|
TYPE
);
JCExpression
t
=
term
(
EXPR
|
TYPE
);
if
(
token
.
kind
==
COLON
&&
t
.
getTag
()
==
JCTree
.
IDENT
)
{
if
(
token
.
kind
==
COLON
&&
t
.
hasTag
(
IDENT
)
)
{
nextToken
();
nextToken
();
JCStatement
stat
=
parseStatement
();
JCStatement
stat
=
parseStatement
();
stats
.
append
(
F
.
at
(
pos
).
Labelled
(
prevToken
.
name
(),
stat
));
stats
.
append
(
F
.
at
(
pos
).
Labelled
(
prevToken
.
name
(),
stat
));
...
@@ -1701,7 +1710,7 @@ public class JavacParser implements Parser {
...
@@ -1701,7 +1710,7 @@ public class JavacParser implements Parser {
accept
(
LPAREN
);
accept
(
LPAREN
);
List
<
JCStatement
>
inits
=
token
.
kind
==
SEMI
?
List
.<
JCStatement
>
nil
()
:
forInit
();
List
<
JCStatement
>
inits
=
token
.
kind
==
SEMI
?
List
.<
JCStatement
>
nil
()
:
forInit
();
if
(
inits
.
length
()
==
1
&&
if
(
inits
.
length
()
==
1
&&
inits
.
head
.
getTag
()
==
JCTree
.
VARDEF
&&
inits
.
head
.
hasTag
(
VARDEF
)
&&
((
JCVariableDecl
)
inits
.
head
).
init
==
null
&&
((
JCVariableDecl
)
inits
.
head
).
init
==
null
&&
token
.
kind
==
COLON
)
{
token
.
kind
==
COLON
)
{
checkForeach
();
checkForeach
();
...
@@ -1834,7 +1843,7 @@ public class JavacParser implements Parser {
...
@@ -1834,7 +1843,7 @@ public class JavacParser implements Parser {
default
:
default
:
Token
prevToken
=
token
;
Token
prevToken
=
token
;
JCExpression
expr
=
parseExpression
();
JCExpression
expr
=
parseExpression
();
if
(
token
.
kind
==
COLON
&&
expr
.
getTag
()
==
JCTree
.
IDENT
)
{
if
(
token
.
kind
==
COLON
&&
expr
.
hasTag
(
IDENT
)
)
{
nextToken
();
nextToken
();
JCStatement
stat
=
parseStatement
();
JCStatement
stat
=
parseStatement
();
return
F
.
at
(
pos
).
Labelled
(
prevToken
.
name
(),
stat
);
return
F
.
at
(
pos
).
Labelled
(
prevToken
.
name
(),
stat
);
...
@@ -1991,7 +2000,7 @@ public class JavacParser implements Parser {
...
@@ -1991,7 +2000,7 @@ public class JavacParser implements Parser {
annotations
.
appendList
(
partial
.
annotations
);
annotations
.
appendList
(
partial
.
annotations
);
pos
=
partial
.
pos
;
pos
=
partial
.
pos
;
}
}
if
(
token
.
deprecatedFlag
)
{
if
(
token
.
deprecatedFlag
()
)
{
flags
|=
Flags
.
DEPRECATED
;
flags
|=
Flags
.
DEPRECATED
;
}
}
int
lastPos
=
Position
.
NOPOS
;
int
lastPos
=
Position
.
NOPOS
;
...
@@ -2087,7 +2096,7 @@ public class JavacParser implements Parser {
...
@@ -2087,7 +2096,7 @@ public class JavacParser implements Parser {
if
(
token
.
kind
==
IDENTIFIER
)
{
if
(
token
.
kind
==
IDENTIFIER
)
{
mode
=
EXPR
;
mode
=
EXPR
;
JCExpression
t1
=
term1
();
JCExpression
t1
=
term1
();
if
(
t1
.
getTag
()
==
JCTree
.
IDENT
&&
token
.
kind
==
EQ
)
{
if
(
t1
.
hasTag
(
IDENT
)
&&
token
.
kind
==
EQ
)
{
int
pos
=
token
.
pos
;
int
pos
=
token
.
pos
;
accept
(
EQ
);
accept
(
EQ
);
JCExpression
v
=
annotationValue
();
JCExpression
v
=
annotationValue
();
...
@@ -2271,9 +2280,9 @@ public class JavacParser implements Parser {
...
@@ -2271,9 +2280,9 @@ public class JavacParser implements Parser {
seenImport
=
true
;
seenImport
=
true
;
defs
.
append
(
importDeclaration
());
defs
.
append
(
importDeclaration
());
}
else
{
}
else
{
String
docComment
=
token
.
docComment
;
String
docComment
=
token
.
comment
(
CommentStyle
.
JAVADOC
)
;
if
(
firstTypeDecl
&&
!
seenImport
&&
!
seenPackage
)
{
if
(
firstTypeDecl
&&
!
seenImport
&&
!
seenPackage
)
{
docComment
=
firstToken
.
docComment
;
docComment
=
firstToken
.
comment
(
CommentStyle
.
JAVADOC
)
;
consumedToplevelDoc
=
true
;
consumedToplevelDoc
=
true
;
}
}
JCTree
def
=
typeDeclaration
(
mods
,
docComment
);
JCTree
def
=
typeDeclaration
(
mods
,
docComment
);
...
@@ -2288,7 +2297,7 @@ public class JavacParser implements Parser {
...
@@ -2288,7 +2297,7 @@ public class JavacParser implements Parser {
}
}
JCTree
.
JCCompilationUnit
toplevel
=
F
.
at
(
firstToken
.
pos
).
TopLevel
(
packageAnnotations
,
pid
,
defs
.
toList
());
JCTree
.
JCCompilationUnit
toplevel
=
F
.
at
(
firstToken
.
pos
).
TopLevel
(
packageAnnotations
,
pid
,
defs
.
toList
());
if
(!
consumedToplevelDoc
)
if
(!
consumedToplevelDoc
)
attach
(
toplevel
,
firstToken
.
docComment
);
attach
(
toplevel
,
firstToken
.
comment
(
CommentStyle
.
JAVADOC
)
);
if
(
defs
.
elems
.
isEmpty
())
if
(
defs
.
elems
.
isEmpty
())
storeEnd
(
toplevel
,
S
.
prevToken
().
endPos
);
storeEnd
(
toplevel
,
S
.
prevToken
().
endPos
);
if
(
keepDocComments
)
if
(
keepDocComments
)
...
@@ -2498,9 +2507,9 @@ public class JavacParser implements Parser {
...
@@ -2498,9 +2507,9 @@ public class JavacParser implements Parser {
/** EnumeratorDeclaration = AnnotationsOpt [TypeArguments] IDENTIFIER [ Arguments ] [ "{" ClassBody "}" ]
/** EnumeratorDeclaration = AnnotationsOpt [TypeArguments] IDENTIFIER [ Arguments ] [ "{" ClassBody "}" ]
*/
*/
JCTree
enumeratorDeclaration
(
Name
enumName
)
{
JCTree
enumeratorDeclaration
(
Name
enumName
)
{
String
dc
=
token
.
docComment
;
String
dc
=
token
.
comment
(
CommentStyle
.
JAVADOC
)
;
int
flags
=
Flags
.
PUBLIC
|
Flags
.
STATIC
|
Flags
.
FINAL
|
Flags
.
ENUM
;
int
flags
=
Flags
.
PUBLIC
|
Flags
.
STATIC
|
Flags
.
FINAL
|
Flags
.
ENUM
;
if
(
token
.
deprecatedFlag
)
{
if
(
token
.
deprecatedFlag
()
)
{
flags
|=
Flags
.
DEPRECATED
;
flags
|=
Flags
.
DEPRECATED
;
}
}
int
pos
=
token
.
pos
;
int
pos
=
token
.
pos
;
...
@@ -2587,7 +2596,7 @@ public class JavacParser implements Parser {
...
@@ -2587,7 +2596,7 @@ public class JavacParser implements Parser {
nextToken
();
nextToken
();
return
List
.<
JCTree
>
nil
();
return
List
.<
JCTree
>
nil
();
}
else
{
}
else
{
String
dc
=
token
.
docComment
;
String
dc
=
token
.
comment
(
CommentStyle
.
JAVADOC
)
;
int
pos
=
token
.
pos
;
int
pos
=
token
.
pos
;
JCModifiers
mods
=
modifiersOpt
();
JCModifiers
mods
=
modifiersOpt
();
if
(
token
.
kind
==
CLASS
||
if
(
token
.
kind
==
CLASS
||
...
@@ -2617,7 +2626,7 @@ public class JavacParser implements Parser {
...
@@ -2617,7 +2626,7 @@ public class JavacParser implements Parser {
}
else
{
}
else
{
type
=
parseType
();
type
=
parseType
();
}
}
if
(
token
.
kind
==
LPAREN
&&
!
isInterface
&&
type
.
getTag
()
==
JCTree
.
IDENT
)
{
if
(
token
.
kind
==
LPAREN
&&
!
isInterface
&&
type
.
hasTag
(
IDENT
)
)
{
if
(
isInterface
||
tk
.
name
()
!=
className
)
if
(
isInterface
||
tk
.
name
()
!=
className
)
error
(
pos
,
"invalid.meth.decl.ret.type.req"
);
error
(
pos
,
"invalid.meth.decl.ret.type.req"
);
return
List
.
of
(
methodDeclaratorRest
(
return
List
.
of
(
methodDeclaratorRest
(
...
@@ -2814,15 +2823,15 @@ public class JavacParser implements Parser {
...
@@ -2814,15 +2823,15 @@ public class JavacParser implements Parser {
*/
*/
protected
JCExpression
checkExprStat
(
JCExpression
t
)
{
protected
JCExpression
checkExprStat
(
JCExpression
t
)
{
switch
(
t
.
getTag
())
{
switch
(
t
.
getTag
())
{
case
JCTree
.
PREINC
:
case
JCTree
.
PREDEC
:
case
PREINC:
case
PREDEC:
case
JCTree
.
POSTINC
:
case
JCTree
.
POSTDEC
:
case
POSTINC:
case
POSTDEC:
case
JCTree
.
ASSIGN
:
case
ASSIGN:
case
JCTree
.
BITOR_ASG
:
case
JCTree
.
BITXOR_ASG
:
case
JCTree
.
BITAND_ASG
:
case
BITOR_ASG:
case
BITXOR_ASG:
case
BITAND_ASG:
case
JCTree
.
SL_ASG
:
case
JCTree
.
SR_ASG
:
case
JCTree
.
USR_ASG
:
case
SL_ASG:
case
SR_ASG:
case
USR_ASG:
case
JCTree
.
PLUS_ASG
:
case
JCTree
.
MINUS_ASG
:
case
PLUS_ASG:
case
MINUS_ASG:
case
JCTree
.
MUL_ASG
:
case
JCTree
.
DIV_ASG
:
case
JCTree
.
MOD_ASG
:
case
MUL_ASG:
case
DIV_ASG:
case
MOD_ASG:
case
JCTree
.
APPLY
:
case
JCTree
.
NEWCLASS
:
case
APPLY:
case
NEWCLASS:
case
JCTree
.
ERRONEOUS
:
case
ERRONEOUS:
return
t
;
return
t
;
default
:
default
:
JCExpression
ret
=
F
.
at
(
t
.
pos
).
Erroneous
(
List
.<
JCTree
>
of
(
t
));
JCExpression
ret
=
F
.
at
(
t
.
pos
).
Erroneous
(
List
.<
JCTree
>
of
(
t
));
...
@@ -2835,8 +2844,8 @@ public class JavacParser implements Parser {
...
@@ -2835,8 +2844,8 @@ public class JavacParser implements Parser {
* -1 if token is not a binary operator. @see TreeInfo.opPrec
* -1 if token is not a binary operator. @see TreeInfo.opPrec
*/
*/
static
int
prec
(
TokenKind
token
)
{
static
int
prec
(
TokenKind
token
)
{
int
oc
=
optag
(
token
);
JCTree
.
Tag
oc
=
optag
(
token
);
return
(
oc
>=
0
)
?
TreeInfo
.
opPrec
(
oc
)
:
-
1
;
return
(
oc
!=
NO_TAG
)
?
TreeInfo
.
opPrec
(
oc
)
:
-
1
;
}
}
/**
/**
...
@@ -2852,96 +2861,96 @@ public class JavacParser implements Parser {
...
@@ -2852,96 +2861,96 @@ public class JavacParser implements Parser {
}
}
/** Return operation tag of binary operator represented by token,
/** Return operation tag of binary operator represented by token,
*
-1
if token is not a binary operator.
*
No_TAG
if token is not a binary operator.
*/
*/
static
int
optag
(
TokenKind
token
)
{
static
JCTree
.
Tag
optag
(
TokenKind
token
)
{
switch
(
token
)
{
switch
(
token
)
{
case
BARBAR:
case
BARBAR:
return
JCTree
.
OR
;
return
OR
;
case
AMPAMP:
case
AMPAMP:
return
JCTree
.
AND
;
return
AND
;
case
BAR:
case
BAR:
return
JCTree
.
BITOR
;
return
BITOR
;
case
BAREQ:
case
BAREQ:
return
JCTree
.
BITOR_ASG
;
return
BITOR_ASG
;
case
CARET:
case
CARET:
return
JCTree
.
BITXOR
;
return
BITXOR
;
case
CARETEQ:
case
CARETEQ:
return
JCTree
.
BITXOR_ASG
;
return
BITXOR_ASG
;
case
AMP:
case
AMP:
return
JCTree
.
BITAND
;
return
BITAND
;
case
AMPEQ:
case
AMPEQ:
return
JCTree
.
BITAND_ASG
;
return
BITAND_ASG
;
case
EQEQ:
case
EQEQ:
return
JCTree
.
EQ
;
return
JCTree
.
Tag
.
EQ
;
case
BANGEQ:
case
BANGEQ:
return
JCTree
.
NE
;
return
NE
;
case
LT:
case
LT:
return
JCTree
.
LT
;
return
JCTree
.
Tag
.
LT
;
case
GT:
case
GT:
return
JCTree
.
GT
;
return
JCTree
.
Tag
.
GT
;
case
LTEQ:
case
LTEQ:
return
JCTree
.
LE
;
return
LE
;
case
GTEQ:
case
GTEQ:
return
JCTree
.
GE
;
return
GE
;
case
LTLT:
case
LTLT:
return
JCTree
.
SL
;
return
SL
;
case
LTLTEQ:
case
LTLTEQ:
return
JCTree
.
SL_ASG
;
return
SL_ASG
;
case
GTGT:
case
GTGT:
return
JCTree
.
SR
;
return
SR
;
case
GTGTEQ:
case
GTGTEQ:
return
JCTree
.
SR_ASG
;
return
SR_ASG
;
case
GTGTGT:
case
GTGTGT:
return
JCTree
.
USR
;
return
USR
;
case
GTGTGTEQ:
case
GTGTGTEQ:
return
JCTree
.
USR_ASG
;
return
USR_ASG
;
case
PLUS:
case
PLUS:
return
JCTree
.
PLUS
;
return
JCTree
.
Tag
.
PLUS
;
case
PLUSEQ:
case
PLUSEQ:
return
JCTree
.
PLUS_ASG
;
return
PLUS_ASG
;
case
SUB:
case
SUB:
return
JCTree
.
MINUS
;
return
MINUS
;
case
SUBEQ:
case
SUBEQ:
return
JCTree
.
MINUS_ASG
;
return
MINUS_ASG
;
case
STAR:
case
STAR:
return
JCTree
.
MUL
;
return
MUL
;
case
STAREQ:
case
STAREQ:
return
JCTree
.
MUL_ASG
;
return
MUL_ASG
;
case
SLASH:
case
SLASH:
return
JCTree
.
DIV
;
return
DIV
;
case
SLASHEQ:
case
SLASHEQ:
return
JCTree
.
DIV_ASG
;
return
DIV_ASG
;
case
PERCENT:
case
PERCENT:
return
JCTree
.
MOD
;
return
MOD
;
case
PERCENTEQ:
case
PERCENTEQ:
return
JCTree
.
MOD_ASG
;
return
MOD_ASG
;
case
INSTANCEOF:
case
INSTANCEOF:
return
JCTree
.
TYPETEST
;
return
TYPETEST
;
default
:
default
:
return
-
1
;
return
NO_TAG
;
}
}
}
}
/** Return operation tag of unary operator represented by token,
/** Return operation tag of unary operator represented by token,
*
-1
if token is not a binary operator.
*
No_TAG
if token is not a binary operator.
*/
*/
static
int
unoptag
(
TokenKind
token
)
{
static
JCTree
.
Tag
unoptag
(
TokenKind
token
)
{
switch
(
token
)
{
switch
(
token
)
{
case
PLUS:
case
PLUS:
return
JCTree
.
POS
;
return
POS
;
case
SUB:
case
SUB:
return
JCTree
.
NEG
;
return
NEG
;
case
BANG:
case
BANG:
return
JCTree
.
NOT
;
return
NOT
;
case
TILDE:
case
TILDE:
return
JCTree
.
COMPL
;
return
COMPL
;
case
PLUSPLUS:
case
PLUSPLUS:
return
JCTree
.
PREINC
;
return
PREINC
;
case
SUBSUB:
case
SUBSUB:
return
JCTree
.
PREDEC
;
return
PREDEC
;
default
:
default
:
return
-
1
;
return
NO_TAG
;
}
}
}
}
...
...
langtools/src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/src/share/classes/com/sun/tools/javac/parser/UnicodeReader.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
浏览文件 @
16ad8cc6
...
@@ -1222,7 +1222,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
...
@@ -1222,7 +1222,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
List
<
ClassSymbol
>
classes
=
List
.
nil
();
List
<
ClassSymbol
>
classes
=
List
.
nil
();
for
(
JCCompilationUnit
unit
:
units
)
{
for
(
JCCompilationUnit
unit
:
units
)
{
for
(
JCTree
node
:
unit
.
defs
)
{
for
(
JCTree
node
:
unit
.
defs
)
{
if
(
node
.
getTag
()
==
JCTree
.
CLASSDEF
)
{
if
(
node
.
hasTag
(
JCTree
.
Tag
.
CLASSDEF
)
)
{
ClassSymbol
sym
=
((
JCClassDecl
)
node
).
sym
;
ClassSymbol
sym
=
((
JCClassDecl
)
node
).
sym
;
Assert
.
checkNonNull
(
sym
);
Assert
.
checkNonNull
(
sym
);
classes
=
classes
.
prepend
(
sym
);
classes
=
classes
.
prepend
(
sym
);
...
...
langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java
浏览文件 @
16ad8cc6
...
@@ -406,7 +406,7 @@ public class TreeCopier<P> implements TreeVisitor<JCTree,P> {
...
@@ -406,7 +406,7 @@ public class TreeCopier<P> implements TreeVisitor<JCTree,P> {
public
JCTree
visitOther
(
Tree
node
,
P
p
)
{
public
JCTree
visitOther
(
Tree
node
,
P
p
)
{
JCTree
tree
=
(
JCTree
)
node
;
JCTree
tree
=
(
JCTree
)
node
;
switch
(
tree
.
getTag
())
{
switch
(
tree
.
getTag
())
{
case
JCTree
.
LETEXPR
:
{
case
LETEXPR:
{
LetExpr
t
=
(
LetExpr
)
node
;
LetExpr
t
=
(
LetExpr
)
node
;
List
<
JCVariableDecl
>
defs
=
copy
(
t
.
defs
,
p
);
List
<
JCVariableDecl
>
defs
=
copy
(
t
.
defs
,
p
);
JCTree
expr
=
copy
(
t
.
expr
,
p
);
JCTree
expr
=
copy
(
t
.
expr
,
p
);
...
...
langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/src/share/classes/com/sun/tools/javadoc/JavadocTool.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/test/Makefile
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/test/tools/javac/depDocComment/DeprecatedDocComment4.java
0 → 100644
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/test/tools/javac/depDocComment/DeprecatedDocComment4.out
0 → 100644
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/test/tools/javac/failover/CheckAttributedTree.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/test/tools/javac/tree/AbstractTreeScannerTest.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
langtools/test/tools/javac/tree/TreePosTest.java
浏览文件 @
16ad8cc6
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录