Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
92fd97c5
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
92fd97c5
编写于
7月 22, 2011
作者:
O
ohair
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
7fd2be92
7cc8634a
变更
99
展开全部
显示空白变更内容
内联
并排
Showing
99 changed file
with
1630 addition
and
1559 deletion
+1630
-1559
make/com/sun/java/pack/Makefile
make/com/sun/java/pack/Makefile
+2
-0
make/common/shared/Defs-java.gmk
make/common/shared/Defs-java.gmk
+8
-7
make/common/shared/Defs-versions.gmk
make/common/shared/Defs-versions.gmk
+1
-1
make/java/java/Makefile
make/java/java/Makefile
+2
-0
make/sun/security/ec/Makefile
make/sun/security/ec/Makefile
+1
-1
make/sun/security/mscapi/Makefile
make/sun/security/mscapi/Makefile
+1
-1
make/tools/Makefile
make/tools/Makefile
+2
-0
make/tools/src/build/tools/buildmetaindex/BuildMetaIndex.java
.../tools/src/build/tools/buildmetaindex/BuildMetaIndex.java
+10
-14
make/tools/src/build/tools/compileproperties/CompileProperties.java
.../src/build/tools/compileproperties/CompileProperties.java
+4
-7
make/tools/src/build/tools/dirdiff/DirDiff.java
make/tools/src/build/tools/dirdiff/DirDiff.java
+2
-2
make/tools/src/build/tools/dtdbuilder/DTDBuilder.java
make/tools/src/build/tools/dtdbuilder/DTDBuilder.java
+17
-17
make/tools/src/build/tools/dtdbuilder/DTDInputStream.java
make/tools/src/build/tools/dtdbuilder/DTDInputStream.java
+4
-2
make/tools/src/build/tools/dtdbuilder/DTDParser.java
make/tools/src/build/tools/dtdbuilder/DTDParser.java
+26
-18
make/tools/src/build/tools/dtdbuilder/PublicMapping.java
make/tools/src/build/tools/dtdbuilder/PublicMapping.java
+3
-3
make/tools/src/build/tools/generatebreakiteratordata/CharSet.java
...ls/src/build/tools/generatebreakiteratordata/CharSet.java
+8
-8
make/tools/src/build/tools/generatebreakiteratordata/DictionaryBasedBreakIteratorBuilder.java
...reakiteratordata/DictionaryBasedBreakIteratorBuilder.java
+4
-4
make/tools/src/build/tools/generatebreakiteratordata/GenerateBreakIteratorData.java
.../generatebreakiteratordata/GenerateBreakIteratorData.java
+3
-3
make/tools/src/build/tools/generatebreakiteratordata/RuleBasedBreakIteratorBuilder.java
...eratebreakiteratordata/RuleBasedBreakIteratorBuilder.java
+107
-94
make/tools/src/build/tools/generatebreakiteratordata/SupplementaryCharacterData.java
...generatebreakiteratordata/SupplementaryCharacterData.java
+3
-3
make/tools/src/build/tools/generatecharacter/GenerateCharacter.java
.../src/build/tools/generatecharacter/GenerateCharacter.java
+2
-2
make/tools/src/build/tools/generatecharacter/SpecialCaseMap.java
...ols/src/build/tools/generatecharacter/SpecialCaseMap.java
+74
-69
make/tools/src/build/tools/generatecharacter/UnicodeSpec.java
.../tools/src/build/tools/generatecharacter/UnicodeSpec.java
+11
-11
make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java
...uild/tools/generatecurrencydata/GenerateCurrencyData.java
+3
-3
make/tools/src/build/tools/hasher/Hasher.java
make/tools/src/build/tools/hasher/Hasher.java
+19
-19
make/tools/src/build/tools/jarsplit/JarSplit.java
make/tools/src/build/tools/jarsplit/JarSplit.java
+3
-2
make/tools/src/build/tools/javazic/Gen.java
make/tools/src/build/tools/javazic/Gen.java
+4
-10
make/tools/src/build/tools/javazic/GenDoc.java
make/tools/src/build/tools/javazic/GenDoc.java
+6
-10
make/tools/src/build/tools/javazic/Main.java
make/tools/src/build/tools/javazic/Main.java
+1
-2
make/tools/src/build/tools/javazic/Mappings.java
make/tools/src/build/tools/javazic/Mappings.java
+1
-4
make/tools/src/build/tools/javazic/Simple.java
make/tools/src/build/tools/javazic/Simple.java
+7
-18
make/tools/src/build/tools/javazic/Time.java
make/tools/src/build/tools/javazic/Time.java
+5
-5
make/tools/src/build/tools/javazic/Zoneinfo.java
make/tools/src/build/tools/javazic/Zoneinfo.java
+8
-10
make/tools/src/build/tools/jdwpgen/AbstractCommandNode.java
make/tools/src/build/tools/jdwpgen/AbstractCommandNode.java
+3
-4
make/tools/src/build/tools/jdwpgen/AbstractGroupNode.java
make/tools/src/build/tools/jdwpgen/AbstractGroupNode.java
+3
-4
make/tools/src/build/tools/jdwpgen/AbstractNamedNode.java
make/tools/src/build/tools/jdwpgen/AbstractNamedNode.java
+7
-7
make/tools/src/build/tools/jdwpgen/AbstractTypeListNode.java
make/tools/src/build/tools/jdwpgen/AbstractTypeListNode.java
+13
-13
make/tools/src/build/tools/jdwpgen/AltNode.java
make/tools/src/build/tools/jdwpgen/AltNode.java
+2
-2
make/tools/src/build/tools/jdwpgen/CommandSetNode.java
make/tools/src/build/tools/jdwpgen/CommandSetNode.java
+5
-6
make/tools/src/build/tools/jdwpgen/ConstantSetNode.java
make/tools/src/build/tools/jdwpgen/ConstantSetNode.java
+5
-8
make/tools/src/build/tools/jdwpgen/ErrorSetNode.java
make/tools/src/build/tools/jdwpgen/ErrorSetNode.java
+4
-5
make/tools/src/build/tools/jdwpgen/Node.java
make/tools/src/build/tools/jdwpgen/Node.java
+11
-16
make/tools/src/build/tools/jdwpgen/OutNode.java
make/tools/src/build/tools/jdwpgen/OutNode.java
+7
-7
make/tools/src/build/tools/jdwpgen/RootNode.java
make/tools/src/build/tools/jdwpgen/RootNode.java
+5
-5
make/tools/src/build/tools/jdwpgen/SelectNode.java
make/tools/src/build/tools/jdwpgen/SelectNode.java
+5
-5
make/tools/src/build/tools/makeclasslist/MakeClasslist.java
make/tools/src/build/tools/makeclasslist/MakeClasslist.java
+7
-8
make/tools/src/build/tools/stripproperties/StripProperties.java
...ools/src/build/tools/stripproperties/StripProperties.java
+2
-2
src/share/classes/com/sun/java/util/jar/pack/Attribute.java
src/share/classes/com/sun/java/util/jar/pack/Attribute.java
+7
-7
src/share/classes/com/sun/java/util/jar/pack/BandStructure.java
...are/classes/com/sun/java/util/jar/pack/BandStructure.java
+3
-3
src/share/classes/com/sun/java/util/jar/pack/ClassReader.java
...share/classes/com/sun/java/util/jar/pack/ClassReader.java
+7
-5
src/share/classes/com/sun/java/util/jar/pack/ClassWriter.java
...share/classes/com/sun/java/util/jar/pack/ClassWriter.java
+3
-5
src/share/classes/com/sun/java/util/jar/pack/Code.java
src/share/classes/com/sun/java/util/jar/pack/Code.java
+2
-2
src/share/classes/com/sun/java/util/jar/pack/Coding.java
src/share/classes/com/sun/java/util/jar/pack/Coding.java
+3
-4
src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java
...hare/classes/com/sun/java/util/jar/pack/ConstantPool.java
+15
-19
src/share/classes/com/sun/java/util/jar/pack/Constants.java
src/share/classes/com/sun/java/util/jar/pack/Constants.java
+6
-6
src/share/classes/com/sun/java/util/jar/pack/Fixups.java
src/share/classes/com/sun/java/util/jar/pack/Fixups.java
+16
-25
src/share/classes/com/sun/java/util/jar/pack/Instruction.java
...share/classes/com/sun/java/util/jar/pack/Instruction.java
+3
-1
src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
...hare/classes/com/sun/java/util/jar/pack/NativeUnpack.java
+1
-1
src/share/classes/com/sun/java/util/jar/pack/Package.java
src/share/classes/com/sun/java/util/jar/pack/Package.java
+23
-35
src/share/classes/com/sun/java/util/jar/pack/PackageReader.java
...are/classes/com/sun/java/util/jar/pack/PackageReader.java
+14
-15
src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java
...are/classes/com/sun/java/util/jar/pack/PackageWriter.java
+18
-20
src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java
src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java
+4
-7
src/share/classes/com/sun/java/util/jar/pack/PropMap.java
src/share/classes/com/sun/java/util/jar/pack/PropMap.java
+30
-31
src/share/classes/com/sun/java/util/jar/pack/TLGlobals.java
src/share/classes/com/sun/java/util/jar/pack/TLGlobals.java
+2
-2
src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java
...hare/classes/com/sun/java/util/jar/pack/UnpackerImpl.java
+1
-2
src/share/classes/com/sun/java/util/jar/pack/Utils.java
src/share/classes/com/sun/java/util/jar/pack/Utils.java
+2
-2
src/share/classes/com/sun/jndi/ldap/Filter.java
src/share/classes/com/sun/jndi/ldap/Filter.java
+19
-11
src/share/classes/java/lang/Math.java
src/share/classes/java/lang/Math.java
+38
-38
src/share/classes/java/lang/StrictMath.java
src/share/classes/java/lang/StrictMath.java
+10
-10
src/share/classes/java/lang/reflect/Constructor.java
src/share/classes/java/lang/reflect/Constructor.java
+99
-267
src/share/classes/java/lang/reflect/Executable.java
src/share/classes/java/lang/reflect/Executable.java
+394
-0
src/share/classes/java/lang/reflect/Method.java
src/share/classes/java/lang/reflect/Method.java
+95
-261
src/share/classes/java/net/SocketPermission.java
src/share/classes/java/net/SocketPermission.java
+8
-2
src/share/classes/java/security/KeyStore.java
src/share/classes/java/security/KeyStore.java
+2
-14
src/share/classes/java/security/cert/X509CRL.java
src/share/classes/java/security/cert/X509CRL.java
+2
-8
src/share/classes/java/security/cert/X509Certificate.java
src/share/classes/java/security/cert/X509Certificate.java
+2
-8
src/share/classes/java/security/cert/X509Extension.java
src/share/classes/java/security/cert/X509Extension.java
+3
-16
src/share/classes/sun/launcher/LauncherHelper.java
src/share/classes/sun/launcher/LauncherHelper.java
+5
-1
src/share/classes/sun/launcher/resources/launcher.properties
src/share/classes/sun/launcher/resources/launcher.properties
+1
-1
src/share/classes/sun/net/httpserver/ServerConfig.java
src/share/classes/sun/net/httpserver/ServerConfig.java
+42
-42
src/share/classes/sun/net/httpserver/ServerImpl.java
src/share/classes/sun/net/httpserver/ServerImpl.java
+6
-3
src/share/classes/sun/reflect/generics/reflectiveObjects/NotImplementedException.java
...t/generics/reflectiveObjects/NotImplementedException.java
+4
-2
src/share/classes/sun/reflect/misc/ConstructorUtil.java
src/share/classes/sun/reflect/misc/ConstructorUtil.java
+3
-3
src/share/classes/sun/reflect/misc/FieldUtil.java
src/share/classes/sun/reflect/misc/FieldUtil.java
+4
-4
src/share/classes/sun/reflect/misc/MethodUtil.java
src/share/classes/sun/reflect/misc/MethodUtil.java
+15
-19
src/share/classes/sun/reflect/misc/ReflectUtil.java
src/share/classes/sun/reflect/misc/ReflectUtil.java
+9
-9
src/share/classes/sun/security/ssl/SSLContextImpl.java
src/share/classes/sun/security/ssl/SSLContextImpl.java
+36
-32
src/share/classes/sun/security/ssl/SSLSocketImpl.java
src/share/classes/sun/security/ssl/SSLSocketImpl.java
+2
-1
src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java
...are/classes/sun/security/ssl/TrustManagerFactoryImpl.java
+58
-55
src/share/classes/sun/util/locale/LocaleObjectCache.java
src/share/classes/sun/util/locale/LocaleObjectCache.java
+7
-7
test/ProblemList.txt
test/ProblemList.txt
+22
-14
test/com/sun/crypto/provider/Cipher/DES/PaddingTest.java
test/com/sun/crypto/provider/Cipher/DES/PaddingTest.java
+53
-79
test/com/sun/jndi/ldap/InvalidLdapFilters.java
test/com/sun/jndi/ldap/InvalidLdapFilters.java
+7
-2
test/com/sun/net/httpserver/Test1.java
test/com/sun/net/httpserver/Test1.java
+5
-0
test/java/net/SocketPermission/Wildcard.java
test/java/net/SocketPermission/Wildcard.java
+45
-0
test/java/util/Locale/LocaleCategory.sh
test/java/util/Locale/LocaleCategory.sh
+1
-1
test/java/util/concurrent/Executors/AutoShutdown.java
test/java/util/concurrent/Executors/AutoShutdown.java
+5
-0
test/java/util/concurrent/Phaser/Arrive.java
test/java/util/concurrent/Phaser/Arrive.java
+7
-4
test/tools/launcher/Arrrghs.java
test/tools/launcher/Arrrghs.java
+12
-1
test/tools/launcher/TestHelper.java
test/tools/launcher/TestHelper.java
+18
-10
未找到文件。
make/com/sun/java/pack/Makefile
浏览文件 @
92fd97c5
...
@@ -32,6 +32,8 @@ PACKAGE = com.sun.java.util.jar.pack
...
@@ -32,6 +32,8 @@ PACKAGE = com.sun.java.util.jar.pack
LIBRARY
=
unpack
LIBRARY
=
unpack
PRODUCT
=
sun
PRODUCT
=
sun
PGRM
=
unpack200
PGRM
=
unpack200
JAVAC_MAX_WARNINGS
=
true
JAVAC_WARNINGS_FATAL
=
true
include
$(BUILDDIR)/common/Defs.gmk
include
$(BUILDDIR)/common/Defs.gmk
CPLUSPLUSLIBRARY
=
true
CPLUSPLUSLIBRARY
=
true
...
...
make/common/shared/Defs-java.gmk
浏览文件 @
92fd97c5
...
@@ -116,12 +116,17 @@ ifeq ($(DEBUG_CLASSFILES),true)
...
@@ -116,12 +116,17 @@ ifeq ($(DEBUG_CLASSFILES),true)
JAVACFLAGS += -g
JAVACFLAGS += -g
endif
endif
ifeq ($(JAVAC_MAX_WARNINGS), true)
ifeq ($(JAVAC_MAX_WARNINGS), true)
JAVAC
FLAGS
+= -Xlint:all
JAVAC
_LINT_OPTIONS
+= -Xlint:all
endif
endif
ifeq ($(JAVAC_WARNINGS_FATAL), true)
ifeq ($(JAVAC_WARNINGS_FATAL), true)
JAVACFLAGS += -Werror
JAVACFLAGS += -Werror
endif
endif
# TODO: Workaround for CR 7063027. Remove -path eventually.
JAVAC_LINT_OPTIONS += -Xlint:-path
JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
#
#
# Some licensees do not get the Security Source bundles. We will
# Some licensees do not get the Security Source bundles. We will
# fall back on the prebuilt jce.jar so that we can do a best
# fall back on the prebuilt jce.jar so that we can do a best
...
@@ -211,16 +216,12 @@ endif
...
@@ -211,16 +216,12 @@ endif
# The javac options supplied to the boot javac is limited. This compiler
# The javac options supplied to the boot javac is limited. This compiler
# should only be used to build the 'make/tools' sources, which are not
# should only be used to build the 'make/tools' sources, which are not
# class files that end up in the classes directory.
# class files that end up in the classes directory.
ifeq ($(JAVAC_MAX_WARNINGS), true)
BOOT_JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
BOOT_JAVACFLAGS += -Xlint:all
endif
ifeq ($(JAVAC_WARNINGS_FATAL), true)
ifeq ($(JAVAC_WARNINGS_FATAL), true)
BOOT_JAVACFLAGS += -Werror
BOOT_JAVACFLAGS += -Werror
endif
endif
BOOT_SOURCE_LANGUAGE_VERSION = 6
BOOT_JAVACFLAGS += -encoding ascii
BOOT_TARGET_CLASS_VERSION = 6
BOOT_JAVACFLAGS += -encoding ascii -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
BOOT_JAR_JFLAGS += $(JAR_JFLAGS)
BOOT_JAR_JFLAGS += $(JAR_JFLAGS)
BOOT_JAVACFLAGS += $(NO_PROPRIETARY_API_WARNINGS)
BOOT_JAVACFLAGS += $(NO_PROPRIETARY_API_WARNINGS)
...
...
make/common/shared/Defs-versions.gmk
浏览文件 @
92fd97c5
...
@@ -191,7 +191,7 @@ endif
...
@@ -191,7 +191,7 @@ endif
# Generic
# Generic
REQUIRED_ANT_VER = 1.7.1
REQUIRED_ANT_VER = 1.7.1
REQUIRED_BOOT_VER = 1.
6
REQUIRED_BOOT_VER = 1.
7
REQUIRED_FREETYPE_VERSION = 2.3.0
REQUIRED_FREETYPE_VERSION = 2.3.0
REQUIRED_MAKE_VER = 3.81
REQUIRED_MAKE_VER = 3.81
REQUIRED_UNZIP_VER = 5.12
REQUIRED_UNZIP_VER = 5.12
...
...
make/java/java/Makefile
浏览文件 @
92fd97c5
...
@@ -32,6 +32,8 @@ BUILDDIR = ../..
...
@@ -32,6 +32,8 @@ BUILDDIR = ../..
PACKAGE
=
java.lang
PACKAGE
=
java.lang
LIBRARY
=
java
LIBRARY
=
java
PRODUCT
=
java
PRODUCT
=
java
SUBDIRS_MAKEFLAGS
+=
JAVAC_MAX_WARNINGS
=
true
SUBDIRS_MAKEFLAGS
+=
JAVAC_WARNINGS_FATAL
=
true
include
$(BUILDDIR)/common/Defs.gmk
include
$(BUILDDIR)/common/Defs.gmk
# windows compiler flags
# windows compiler flags
...
...
make/sun/security/ec/Makefile
浏览文件 @
92fd97c5
...
@@ -156,7 +156,7 @@ ifeq ($(NATIVE_ECC_AVAILABLE), true)
...
@@ -156,7 +156,7 @@ ifeq ($(NATIVE_ECC_AVAILABLE), true)
$(PKGDIR)
/ECDSASignature.java
\
$(PKGDIR)
/ECDSASignature.java
\
$(PKGDIR)
/ECKeyPairGenerator.java
$(PKGDIR)
/ECKeyPairGenerator.java
JAVAHFLAGS
+=
-
classpath
$(CLASSDESTDIR)
JAVAHFLAGS
+=
-
Xbootclasspath
/p:
$(CLASSDESTDIR)
#
#
# C and C++ files
# C and C++ files
...
...
make/sun/security/mscapi/Makefile
浏览文件 @
92fd97c5
...
@@ -149,7 +149,7 @@ OTHER_INCLUDES += \
...
@@ -149,7 +149,7 @@ OTHER_INCLUDES += \
# Rules
# Rules
#
#
CLASSDESTDIR
=
$(TEMPDIR)
/classes
CLASSDESTDIR
=
$(TEMPDIR)
/classes
JAVAHFLAGS
+=
-
classpath
$(CLASSDESTDIR)
JAVAHFLAGS
+=
-
Xbootclasspath
/p:
$(CLASSDESTDIR)
include
$(BUILDDIR)/common/Mapfile-vers.gmk
include
$(BUILDDIR)/common/Mapfile-vers.gmk
...
...
make/tools/Makefile
浏览文件 @
92fd97c5
...
@@ -28,6 +28,8 @@
...
@@ -28,6 +28,8 @@
#
#
BUILDDIR
=
..
BUILDDIR
=
..
SUBDIRS_MAKEFLAGS
+=
JAVAC_MAX_WARNINGS
=
true
JAVAC_WARNINGS_FATAL
=
true
include
$(BUILDDIR)/common/Defs.gmk
include
$(BUILDDIR)/common/Defs.gmk
# Note: freetypecheck is built by Sanity.gmk if needed
# Note: freetypecheck is built by Sanity.gmk if needed
...
...
make/tools/src/build/tools/buildmetaindex/BuildMetaIndex.java
浏览文件 @
92fd97c5
/*
/*
* 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
...
@@ -114,8 +114,8 @@ public class BuildMetaIndex {
...
@@ -114,8 +114,8 @@ public class BuildMetaIndex {
*/
*/
out
.
println
(
jmi
.
getJarFileKind
().
getMarkerChar
()
+
" "
+
filename
);
out
.
println
(
jmi
.
getJarFileKind
().
getMarkerChar
()
+
" "
+
filename
);
for
(
Iterator
<
String
>
iter
=
index
.
iterator
();
iter
.
hasNext
();
)
{
for
(
String
entry
:
index
)
{
out
.
println
(
iter
.
next
()
);
out
.
println
(
entry
);
}
}
}
}
...
@@ -171,8 +171,7 @@ class JarMetaIndex {
...
@@ -171,8 +171,7 @@ class JarMetaIndex {
* A hashmap contains a mapping from the prefix string to
* A hashmap contains a mapping from the prefix string to
* a hashset which contains a set of the second level of prefix string.
* a hashset which contains a set of the second level of prefix string.
*/
*/
private
HashMap
<
String
,
HashSet
<
String
>>
knownPrefixMap
=
new
private
HashMap
<
String
,
HashSet
<
String
>>
knownPrefixMap
=
new
HashMap
<>();
HashMap
<
String
,
HashSet
<
String
>>();
/*
/*
* We add maximum 5 second level entries to "sun", "java" and
* We add maximum 5 second level entries to "sun", "java" and
...
@@ -195,12 +194,12 @@ class JarMetaIndex {
...
@@ -195,12 +194,12 @@ class JarMetaIndex {
if
(
indexSet
==
null
)
{
if
(
indexSet
==
null
)
{
synchronized
(
this
)
{
synchronized
(
this
)
{
if
(
indexSet
==
null
)
{
if
(
indexSet
==
null
)
{
indexSet
=
new
HashSet
<
String
>();
indexSet
=
new
HashSet
<>();
Enumeration
entries
=
jar
.
entries
();
Enumeration
<
JarEntry
>
entries
=
jar
.
entries
();
boolean
containsOnlyClass
=
true
;
boolean
containsOnlyClass
=
true
;
boolean
containsOnlyResource
=
true
;
boolean
containsOnlyResource
=
true
;
while
(
entries
.
hasMoreElements
())
{
while
(
entries
.
hasMoreElements
())
{
JarEntry
entry
=
(
JarEntry
)
entries
.
nextElement
();
JarEntry
entry
=
entries
.
nextElement
();
String
name
=
entry
.
getName
();
String
name
=
entry
.
getName
();
/* We only look at the non-directory entry.
/* We only look at the non-directory entry.
MANIFEST file is also skipped. */
MANIFEST file is also skipped. */
...
@@ -338,9 +337,7 @@ class JarMetaIndex {
...
@@ -338,9 +337,7 @@ class JarMetaIndex {
/* Iterate through the hash map, add the second level package names
/* Iterate through the hash map, add the second level package names
* to the indexSet if has any.
* to the indexSet if has any.
*/
*/
for
(
Iterator
<
String
>
keysIterator
=
knownPrefixMap
.
keySet
().
iterator
();
for
(
String
key
:
knownPrefixMap
.
keySet
())
{
keysIterator
.
hasNext
();)
{
String
key
=
keysIterator
.
next
();
HashSet
<
String
>
pkgSetStartsWithKey
=
knownPrefixMap
.
get
(
key
);
HashSet
<
String
>
pkgSetStartsWithKey
=
knownPrefixMap
.
get
(
key
);
int
setSize
=
pkgSetStartsWithKey
.
size
();
int
setSize
=
pkgSetStartsWithKey
.
size
();
...
@@ -353,9 +350,8 @@ class JarMetaIndex {
...
@@ -353,9 +350,8 @@ class JarMetaIndex {
/* If the set contains less than MAX_PKGS_WITH_KNOWN_PREFIX, add
/* If the set contains less than MAX_PKGS_WITH_KNOWN_PREFIX, add
* them to the indexSet of the MetaIndex object.
* them to the indexSet of the MetaIndex object.
*/
*/
for
(
Iterator
<
String
>
secondPkgElements
=
pkgSetStartsWithKey
.
iterator
();
for
(
String
secondPkgElement
:
pkgSetStartsWithKey
)
{
secondPkgElements
.
hasNext
();)
{
indexSet
.
add
(
key
+
"/"
+
secondPkgElement
);
indexSet
.
add
(
key
+
"/"
+
secondPkgElements
.
next
());
}
}
}
}
}
// end the outer "for"
}
// end the outer "for"
...
...
make/tools/src/build/tools/compileproperties/CompileProperties.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2002, 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
...
@@ -36,7 +36,6 @@ import java.io.Writer;
...
@@ -36,7 +36,6 @@ import java.io.Writer;
import
java.text.MessageFormat
;
import
java.text.MessageFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Properties
;
import
java.util.Properties
;
...
@@ -223,18 +222,16 @@ public class CompileProperties {
...
@@ -223,18 +222,16 @@ public class CompileProperties {
if
(
ok
)
{
if
(
ok
)
{
String
packageName
=
inferPackageName
(
propertiesPath
,
outputPath
);
String
packageName
=
inferPackageName
(
propertiesPath
,
outputPath
);
System
.
out
.
println
(
"inferred package name: "
+
packageName
);
System
.
out
.
println
(
"inferred package name: "
+
packageName
);
List
<
String
>
sortedKeys
=
new
ArrayList
<
String
>();
List
<
String
>
sortedKeys
=
new
ArrayList
<>();
for
(
Object
key
:
p
.
keySet
()
)
{
for
(
Object
key
:
p
.
keySet
()
)
{
sortedKeys
.
add
((
String
)
key
);
sortedKeys
.
add
((
String
)
key
);
}
}
Collections
.
sort
(
sortedKeys
);
Collections
.
sort
(
sortedKeys
);
Iterator
keys
=
sortedKeys
.
iterator
();
StringBuffer
data
=
new
StringBuffer
();
StringBuffer
data
=
new
StringBuffer
();
while
(
keys
.
hasNext
())
{
for
(
String
key
:
sortedKeys
)
{
Object
key
=
keys
.
next
();
data
.
append
(
" { \""
+
escape
(
key
)
+
"\", \""
+
data
.
append
(
" { \""
+
escape
((
String
)
key
)
+
"\", \""
+
escape
((
String
)
p
.
get
(
key
))
+
"\" },\n"
);
escape
((
String
)
p
.
get
(
key
))
+
"\" },\n"
);
}
}
...
...
make/tools/src/build/tools/dirdiff/DirDiff.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002,
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
...
@@ -164,7 +164,7 @@ public class DirDiff implements Runnable {
...
@@ -164,7 +164,7 @@ public class DirDiff implements Runnable {
}
}
File
[]
currentGoldenDirs
=
null
;
File
[]
currentGoldenDirs
=
null
;
TreeSet
goldDirSet
=
new
TreeSet
();
TreeSet
<
String
>
goldDirSet
=
new
TreeSet
<>
();
if
(
goldenDir
!=
null
)
{
if
(
goldenDir
!=
null
)
{
currentGoldenDirs
=
goldenDir
.
listFiles
();
currentGoldenDirs
=
goldenDir
.
listFiles
();
for
(
int
i
=
0
;
i
<
currentGoldenDirs
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
currentGoldenDirs
.
length
;
i
++)
{
...
...
make/tools/src/build/tools/dtdbuilder/DTDBuilder.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
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
...
@@ -63,9 +63,9 @@ class DTDBuilder extends DTD {
...
@@ -63,9 +63,9 @@ class DTDBuilder extends DTD {
static
PublicMapping
mapping
=
null
;
static
PublicMapping
mapping
=
null
;
// Hash from name to Integer
// Hash from name to Integer
private
Hashtable
namesHash
=
new
Hashtable
();
private
Hashtable
<
String
,
Integer
>
namesHash
=
new
Hashtable
<>
();
// Vector of all names
// Vector of all names
private
Vector
namesVector
=
new
Vector
();
private
Vector
<
String
>
namesVector
=
new
Vector
<>
();
/**
/**
* Create a new DTD.
* Create a new DTD.
...
@@ -87,15 +87,15 @@ class DTDBuilder extends DTD {
...
@@ -87,15 +87,15 @@ class DTDBuilder extends DTD {
int
numNames
=
namesVector
.
size
();
int
numNames
=
namesVector
.
size
();
out
.
writeShort
((
short
)
(
namesVector
.
size
()));
out
.
writeShort
((
short
)
(
namesVector
.
size
()));
for
(
int
i
=
0
;
i
<
namesVector
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
namesVector
.
size
();
i
++)
{
String
nm
=
(
String
)
namesVector
.
elementAt
(
i
);
String
nm
=
namesVector
.
elementAt
(
i
);
out
.
writeUTF
(
nm
);
out
.
writeUTF
(
nm
);
}
}
saveEntities
(
out
);
saveEntities
(
out
);
out
.
writeShort
((
short
)
(
elements
.
size
()));
out
.
writeShort
((
short
)
(
elements
.
size
()));
for
(
Enumeration
e
=
elements
.
elements
()
;
e
.
hasMoreElements
()
;
)
{
for
(
Enumeration
<
Element
>
e
=
elements
.
elements
()
;
e
.
hasMoreElements
()
;
)
{
saveElement
(
out
,
(
Element
)
e
.
nextElement
());
saveElement
(
out
,
e
.
nextElement
());
}
}
if
(
namesVector
.
size
()
!=
numNames
)
{
if
(
namesVector
.
size
()
!=
numNames
)
{
...
@@ -106,21 +106,21 @@ class DTDBuilder extends DTD {
...
@@ -106,21 +106,21 @@ class DTDBuilder extends DTD {
}
}
private
void
buildNamesTable
()
{
private
void
buildNamesTable
()
{
for
(
Enumeration
e
=
entityHash
.
elements
()
;
e
.
hasMoreElements
()
;
)
{
for
(
Enumeration
<
Entity
>
e
=
entityHash
.
elements
()
;
e
.
hasMoreElements
()
;
)
{
Entity
ent
=
(
Entity
)
e
.
nextElement
();
Entity
ent
=
e
.
nextElement
();
// Do even if not isGeneral(). That way, exclusions and inclusions
// Do even if not isGeneral(). That way, exclusions and inclusions
// will definitely have their element.
// will definitely have their element.
getNameId
(
ent
.
getName
());
getNameId
(
ent
.
getName
());
}
}
for
(
Enumeration
e
=
elements
.
elements
()
;
e
.
hasMoreElements
()
;
)
{
for
(
Enumeration
<
Element
>
e
=
elements
.
elements
()
;
e
.
hasMoreElements
()
;
)
{
Element
el
=
(
Element
)
e
.
nextElement
();
Element
el
=
e
.
nextElement
();
getNameId
(
el
.
getName
());
getNameId
(
el
.
getName
());
for
(
AttributeList
atts
=
el
.
getAttributes
()
;
atts
!=
null
;
atts
=
atts
.
getNext
())
{
for
(
AttributeList
atts
=
el
.
getAttributes
()
;
atts
!=
null
;
atts
=
atts
.
getNext
())
{
getNameId
(
atts
.
getName
());
getNameId
(
atts
.
getName
());
if
(
atts
.
getValue
()
!=
null
)
{
if
(
atts
.
getValue
()
!=
null
)
{
getNameId
(
atts
.
getValue
());
getNameId
(
atts
.
getValue
());
}
}
Enumeration
vals
=
atts
.
getValues
();
Enumeration
<?>
vals
=
atts
.
getValues
();
while
(
vals
!=
null
&&
vals
.
hasMoreElements
())
{
while
(
vals
!=
null
&&
vals
.
hasMoreElements
())
{
String
s
=
(
String
)
vals
.
nextElement
();
String
s
=
(
String
)
vals
.
nextElement
();
getNameId
(
s
);
getNameId
(
s
);
...
@@ -133,9 +133,9 @@ class DTDBuilder extends DTD {
...
@@ -133,9 +133,9 @@ class DTDBuilder extends DTD {
// The the id of a name from the list of names
// The the id of a name from the list of names
//
//
private
short
getNameId
(
String
name
)
{
private
short
getNameId
(
String
name
)
{
Object
o
=
namesHash
.
get
(
name
);
Integer
o
=
namesHash
.
get
(
name
);
if
(
o
!=
null
)
{
if
(
o
!=
null
)
{
return
(
short
)
((
Integer
)
o
)
.
intValue
();
return
(
short
)
o
.
intValue
();
}
}
int
i
=
namesVector
.
size
();
int
i
=
namesVector
.
size
();
namesVector
.
addElement
(
name
);
namesVector
.
addElement
(
name
);
...
@@ -149,16 +149,16 @@ class DTDBuilder extends DTD {
...
@@ -149,16 +149,16 @@ class DTDBuilder extends DTD {
*/
*/
void
saveEntities
(
DataOutputStream
out
)
throws
IOException
{
void
saveEntities
(
DataOutputStream
out
)
throws
IOException
{
int
num
=
0
;
int
num
=
0
;
for
(
Enumeration
e
=
entityHash
.
elements
()
;
e
.
hasMoreElements
()
;
)
{
for
(
Enumeration
<
Entity
>
e
=
entityHash
.
elements
()
;
e
.
hasMoreElements
()
;
)
{
Entity
ent
=
(
Entity
)
e
.
nextElement
();
Entity
ent
=
e
.
nextElement
();
if
(
ent
.
isGeneral
())
{
if
(
ent
.
isGeneral
())
{
num
++;
num
++;
}
}
}
}
out
.
writeShort
((
short
)
num
);
out
.
writeShort
((
short
)
num
);
for
(
Enumeration
e
=
entityHash
.
elements
()
;
e
.
hasMoreElements
()
;
)
{
for
(
Enumeration
<
Entity
>
e
=
entityHash
.
elements
()
;
e
.
hasMoreElements
()
;
)
{
Entity
ent
=
(
Entity
)
e
.
nextElement
();
Entity
ent
=
e
.
nextElement
();
if
(
ent
.
isGeneral
())
{
if
(
ent
.
isGeneral
())
{
out
.
writeShort
(
getNameId
(
ent
.
getName
()));
out
.
writeShort
(
getNameId
(
ent
.
getName
()));
out
.
writeByte
(
ent
.
getType
()
&
~
GENERAL
);
out
.
writeByte
(
ent
.
getType
()
&
~
GENERAL
);
...
...
make/tools/src/build/tools/dtdbuilder/DTDInputStream.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
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
...
@@ -48,7 +48,7 @@ import java.net.URL;
...
@@ -48,7 +48,7 @@ import java.net.URL;
public
final
public
final
class
DTDInputStream
extends
FilterReader
implements
DTDConstants
{
class
DTDInputStream
extends
FilterReader
implements
DTDConstants
{
public
DTD
dtd
;
public
DTD
dtd
;
public
Stack
stack
=
new
Stack
();
public
Stack
<
Object
>
stack
=
new
Stack
<>
();
public
char
str
[]
=
new
char
[
64
];
public
char
str
[]
=
new
char
[
64
];
public
int
replace
=
0
;
public
int
replace
=
0
;
public
int
ln
=
1
;
public
int
ln
=
1
;
...
@@ -105,6 +105,7 @@ class DTDInputStream extends FilterReader implements DTDConstants {
...
@@ -105,6 +105,7 @@ class DTDInputStream extends FilterReader implements DTDConstants {
* parameter entities.
* parameter entities.
* [60] 350:22
* [60] 350:22
*/
*/
@SuppressWarnings
(
"fallthrough"
)
public
int
read
()
throws
IOException
{
public
int
read
()
throws
IOException
{
switch
(
ch
)
{
switch
(
ch
)
{
case
'%'
:
{
case
'%'
:
{
...
@@ -134,6 +135,7 @@ class DTDInputStream extends FilterReader implements DTDConstants {
...
@@ -134,6 +135,7 @@ class DTDInputStream extends FilterReader implements DTDConstants {
switch
(
ch
)
{
switch
(
ch
)
{
case
'\r'
:
case
'\r'
:
ln
++;
ln
++;
/* fall through */
case
';'
:
case
';'
:
ch
=
in
.
read
();
ch
=
in
.
read
();
break
;
break
;
...
...
make/tools/src/build/tools/dtdbuilder/DTDParser.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998, 20
00
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
...
@@ -87,7 +87,7 @@ class DTDParser implements DTDConstants {
...
@@ -87,7 +87,7 @@ class DTDParser implements DTDConstants {
return
null
;
return
null
;
}
}
return
MessageFormat
.
format
(
prop
,
args
);
return
MessageFormat
.
format
(
prop
,
(
Object
[])
args
);
}
}
/**
/**
...
@@ -201,6 +201,7 @@ class DTDParser implements DTDConstants {
...
@@ -201,6 +201,7 @@ class DTDParser implements DTDConstants {
* Parse identifier. Uppercase characters are automatically
* Parse identifier. Uppercase characters are automatically
* folded to lowercase. Returns falsed if no identifier is found.
* folded to lowercase. Returns falsed if no identifier is found.
*/
*/
@SuppressWarnings
(
"fallthrough"
)
boolean
parseIdentifier
(
boolean
lower
)
throws
IOException
{
boolean
parseIdentifier
(
boolean
lower
)
throws
IOException
{
switch
(
ch
)
{
switch
(
ch
)
{
case
'A'
:
case
'B'
:
case
'C'
:
case
'D'
:
case
'E'
:
case
'F'
:
case
'A'
:
case
'B'
:
case
'C'
:
case
'D'
:
case
'E'
:
case
'F'
:
...
@@ -211,6 +212,7 @@ class DTDParser implements DTDConstants {
...
@@ -211,6 +212,7 @@ class DTDParser implements DTDConstants {
if
(
lower
)
{
if
(
lower
)
{
ch
=
'a'
+
(
ch
-
'A'
);
ch
=
'a'
+
(
ch
-
'A'
);
}
}
/* fall through */
case
'a'
:
case
'b'
:
case
'c'
:
case
'd'
:
case
'e'
:
case
'f'
:
case
'a'
:
case
'b'
:
case
'c'
:
case
'd'
:
case
'e'
:
case
'f'
:
case
'g'
:
case
'h'
:
case
'i'
:
case
'j'
:
case
'k'
:
case
'l'
:
case
'g'
:
case
'h'
:
case
'i'
:
case
'j'
:
case
'k'
:
case
'l'
:
...
@@ -233,6 +235,7 @@ class DTDParser implements DTDConstants {
...
@@ -233,6 +235,7 @@ class DTDParser implements DTDConstants {
* Parses name token. If <code>lower</code> is true, upper case letters
* Parses name token. If <code>lower</code> is true, upper case letters
* are folded to lower case. Returns falsed if no token is found.
* are folded to lower case. Returns falsed if no token is found.
*/
*/
@SuppressWarnings
(
"fallthrough"
)
boolean
parseNameToken
(
boolean
lower
)
throws
IOException
{
boolean
parseNameToken
(
boolean
lower
)
throws
IOException
{
boolean
first
=
true
;
boolean
first
=
true
;
...
@@ -246,6 +249,7 @@ class DTDParser implements DTDConstants {
...
@@ -246,6 +249,7 @@ class DTDParser implements DTDConstants {
if
(
lower
)
{
if
(
lower
)
{
ch
=
'a'
+
(
ch
-
'A'
);
ch
=
'a'
+
(
ch
-
'A'
);
}
}
/* fall through */
case
'a'
:
case
'b'
:
case
'c'
:
case
'd'
:
case
'e'
:
case
'f'
:
case
'a'
:
case
'b'
:
case
'c'
:
case
'd'
:
case
'e'
:
case
'f'
:
case
'g'
:
case
'h'
:
case
'i'
:
case
'j'
:
case
'k'
:
case
'l'
:
case
'g'
:
case
'h'
:
case
'i'
:
case
'j'
:
case
'k'
:
case
'l'
:
...
@@ -271,8 +275,8 @@ class DTDParser implements DTDConstants {
...
@@ -271,8 +275,8 @@ class DTDParser implements DTDConstants {
/**
/**
* Parse a list of identifiers.
* Parse a list of identifiers.
*/
*/
Vector
parseIdentifierList
(
boolean
lower
)
throws
IOException
{
Vector
<
String
>
parseIdentifierList
(
boolean
lower
)
throws
IOException
{
Vector
elems
=
new
Vector
();
Vector
<
String
>
elems
=
new
Vector
<>
();
skipSpace
();
skipSpace
();
switch
(
ch
)
{
switch
(
ch
)
{
case
'('
:
case
'('
:
...
@@ -507,7 +511,7 @@ class DTDParser implements DTDConstants {
...
@@ -507,7 +511,7 @@ class DTDParser implements DTDConstants {
* [116] 405:6
* [116] 405:6
*/
*/
void
parseElementDeclaration
()
throws
IOException
{
void
parseElementDeclaration
()
throws
IOException
{
Vector
elems
=
parseIdentifierList
(
true
);
Vector
<
String
>
elems
=
parseIdentifierList
(
true
);
BitSet
inclusions
=
null
;
BitSet
inclusions
=
null
;
BitSet
exclusions
=
null
;
BitSet
exclusions
=
null
;
boolean
omitStart
=
false
;
boolean
omitStart
=
false
;
...
@@ -544,26 +548,26 @@ class DTDParser implements DTDConstants {
...
@@ -544,26 +548,26 @@ class DTDParser implements DTDConstants {
if
((
type
==
MODEL
)
||
(
type
==
ANY
))
{
if
((
type
==
MODEL
)
||
(
type
==
ANY
))
{
if
(
ch
==
'-'
)
{
if
(
ch
==
'-'
)
{
ch
=
in
.
read
();
ch
=
in
.
read
();
Vector
v
=
parseIdentifierList
(
true
);
Vector
<
String
>
v
=
parseIdentifierList
(
true
);
exclusions
=
new
BitSet
();
exclusions
=
new
BitSet
();
for
(
Enumeration
e
=
v
.
elements
()
;
e
.
hasMoreElements
()
;)
{
for
(
Enumeration
<
String
>
e
=
v
.
elements
()
;
e
.
hasMoreElements
()
;)
{
exclusions
.
set
(
dtd
.
getElement
(
(
String
)
e
.
nextElement
()).
getIndex
());
exclusions
.
set
(
dtd
.
getElement
(
e
.
nextElement
()).
getIndex
());
}
}
}
}
if
(
ch
==
'+'
)
{
if
(
ch
==
'+'
)
{
ch
=
in
.
read
();
ch
=
in
.
read
();
Vector
v
=
parseIdentifierList
(
true
);
Vector
<
String
>
v
=
parseIdentifierList
(
true
);
inclusions
=
new
BitSet
();
inclusions
=
new
BitSet
();
for
(
Enumeration
e
=
v
.
elements
()
;
e
.
hasMoreElements
()
;)
{
for
(
Enumeration
<
String
>
e
=
v
.
elements
()
;
e
.
hasMoreElements
()
;)
{
inclusions
.
set
(
dtd
.
getElement
(
(
String
)
e
.
nextElement
()).
getIndex
());
inclusions
.
set
(
dtd
.
getElement
(
e
.
nextElement
()).
getIndex
());
}
}
}
}
}
}
expect
(
'>'
);
expect
(
'>'
);
if
(
in
.
replace
==
0
)
{
if
(
in
.
replace
==
0
)
{
for
(
Enumeration
e
=
elems
.
elements
()
;
e
.
hasMoreElements
()
;)
{
for
(
Enumeration
<
String
>
e
=
elems
.
elements
()
;
e
.
hasMoreElements
()
;)
{
dtd
.
defineElement
(
(
String
)
e
.
nextElement
(),
type
,
omitStart
,
omitEnd
,
content
,
exclusions
,
inclusions
,
null
);
dtd
.
defineElement
(
e
.
nextElement
(),
type
,
omitStart
,
omitEnd
,
content
,
exclusions
,
inclusions
,
null
);
}
}
}
}
}
}
...
@@ -582,7 +586,7 @@ class DTDParser implements DTDConstants {
...
@@ -582,7 +586,7 @@ class DTDParser implements DTDConstants {
error
(
"invalid"
,
"attribute value"
);
error
(
"invalid"
,
"attribute value"
);
return
;
return
;
}
}
atts
.
type
=
atts
.
name2type
(
getString
(
0
));
atts
.
type
=
AttributeList
.
name2type
(
getString
(
0
));
skipParameterSpace
();
skipParameterSpace
();
if
(
atts
.
type
==
NOTATION
)
{
if
(
atts
.
type
==
NOTATION
)
{
atts
.
values
=
parseIdentifierList
(
true
);
atts
.
values
=
parseIdentifierList
(
true
);
...
@@ -593,6 +597,7 @@ class DTDParser implements DTDConstants {
...
@@ -593,6 +597,7 @@ class DTDParser implements DTDConstants {
* Parse an attribute value specification.
* Parse an attribute value specification.
* [33] 331:1
* [33] 331:1
*/
*/
@SuppressWarnings
(
"fallthrough"
)
String
parseAttributeValueSpecification
()
throws
IOException
{
String
parseAttributeValueSpecification
()
throws
IOException
{
int
delim
=
-
1
;
int
delim
=
-
1
;
switch
(
ch
)
{
switch
(
ch
)
{
...
@@ -627,6 +632,7 @@ class DTDParser implements DTDConstants {
...
@@ -627,6 +632,7 @@ class DTDParser implements DTDConstants {
ch
=
in
.
read
();
ch
=
in
.
read
();
return
getString
(
0
);
return
getString
(
0
);
}
}
/* fall through */
default
:
default
:
addString
(
ch
&
0xFF
);
addString
(
ch
&
0xFF
);
...
@@ -648,7 +654,7 @@ class DTDParser implements DTDConstants {
...
@@ -648,7 +654,7 @@ class DTDParser implements DTDConstants {
return
;
return
;
}
}
skipParameterSpace
();
skipParameterSpace
();
atts
.
modifier
=
atts
.
name2type
(
getString
(
0
));
atts
.
modifier
=
AttributeList
.
name2type
(
getString
(
0
));
if
(
atts
.
modifier
!=
FIXED
)
{
if
(
atts
.
modifier
!=
FIXED
)
{
return
;
return
;
}
}
...
@@ -663,7 +669,7 @@ class DTDParser implements DTDConstants {
...
@@ -663,7 +669,7 @@ class DTDParser implements DTDConstants {
* REMIND: associated notation name
* REMIND: associated notation name
*/
*/
void
parseAttlistDeclaration
()
throws
IOException
{
void
parseAttlistDeclaration
()
throws
IOException
{
Vector
elems
=
parseIdentifierList
(
true
);
Vector
<
String
>
elems
=
parseIdentifierList
(
true
);
AttributeList
attlist
=
null
,
atts
=
null
;
AttributeList
attlist
=
null
,
atts
=
null
;
while
(
parseIdentifier
(
true
))
{
while
(
parseIdentifier
(
true
))
{
...
@@ -685,8 +691,8 @@ class DTDParser implements DTDConstants {
...
@@ -685,8 +691,8 @@ class DTDParser implements DTDConstants {
expect
(
'>'
);
expect
(
'>'
);
if
(
in
.
replace
==
0
)
{
if
(
in
.
replace
==
0
)
{
for
(
Enumeration
e
=
elems
.
elements
()
;
e
.
hasMoreElements
()
;)
{
for
(
Enumeration
<
String
>
e
=
elems
.
elements
()
;
e
.
hasMoreElements
()
;)
{
dtd
.
defineAttributes
(
(
String
)
e
.
nextElement
(),
attlist
);
dtd
.
defineAttributes
(
e
.
nextElement
(),
attlist
);
}
}
}
}
}
}
...
@@ -810,6 +816,7 @@ class DTDParser implements DTDConstants {
...
@@ -810,6 +816,7 @@ class DTDParser implements DTDConstants {
/**
/**
* Parse a section of the input upto EOF or ']'.
* Parse a section of the input upto EOF or ']'.
*/
*/
@SuppressWarnings
(
"fallthrough"
)
void
parseSection
()
throws
IOException
{
void
parseSection
()
throws
IOException
{
while
(
true
)
{
while
(
true
)
{
switch
(
ch
)
{
switch
(
ch
)
{
...
@@ -883,6 +890,7 @@ class DTDParser implements DTDConstants {
...
@@ -883,6 +890,7 @@ class DTDParser implements DTDConstants {
default
:
default
:
char
str
[]
=
{(
char
)
ch
};
char
str
[]
=
{(
char
)
ch
};
error
(
"invalid.arg"
,
"character"
,
"'"
+
new
String
(
str
)
+
"' / "
+
ch
);
error
(
"invalid.arg"
,
"character"
,
"'"
+
new
String
(
str
)
+
"' / "
+
ch
);
/* fall through */
case
' '
:
case
' '
:
case
'\t'
:
case
'\t'
:
...
...
make/tools/src/build/tools/dtdbuilder/PublicMapping.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
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
...
@@ -44,7 +44,7 @@ import java.util.Hashtable;
...
@@ -44,7 +44,7 @@ import java.util.Hashtable;
final
class
PublicMapping
{
final
class
PublicMapping
{
String
baseStr
;
String
baseStr
;
Hashtable
tab
=
new
Hashtable
();
Hashtable
<
String
,
String
>
tab
=
new
Hashtable
<>
();
/**
/**
* Create a mapping.
* Create a mapping.
...
@@ -103,6 +103,6 @@ final class PublicMapping {
...
@@ -103,6 +103,6 @@ final class PublicMapping {
*/
*/
public
String
get
(
String
id
)
{
public
String
get
(
String
id
)
{
// System.err.println(" id = "+id);
// System.err.println(" id = "+id);
return
(
String
)
tab
.
get
(
id
);
return
tab
.
get
(
id
);
}
}
}
}
make/tools/src/build/tools/generatebreakiteratordata/CharSet.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003,
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
...
@@ -66,7 +66,7 @@ class CharSet {
...
@@ -66,7 +66,7 @@ class CharSet {
* A cache which is used to speed up parseString() whenever it is
* A cache which is used to speed up parseString() whenever it is
* used to parse a description that has been parsed before
* used to parse a description that has been parsed before
*/
*/
private
static
Hashtable
expressionCache
=
null
;
private
static
Hashtable
<
String
,
CharSet
>
expressionCache
=
null
;
/**
/**
* Builds a CharSet based on a textual description. For the syntax of
* Builds a CharSet based on a textual description. For the syntax of
...
@@ -79,7 +79,7 @@ class CharSet {
...
@@ -79,7 +79,7 @@ class CharSet {
// if "s" is in the expression cache, pull the result out
// if "s" is in the expression cache, pull the result out
// of the expresison cache
// of the expresison cache
if
(
expressionCache
!=
null
)
{
if
(
expressionCache
!=
null
)
{
result
=
(
CharSet
)
expressionCache
.
get
(
s
);
result
=
expressionCache
.
get
(
s
);
}
}
// otherwise, use doParseString() to actually parse the string,
// otherwise, use doParseString() to actually parse the string,
...
@@ -87,7 +87,7 @@ class CharSet {
...
@@ -87,7 +87,7 @@ class CharSet {
if
(
result
==
null
)
{
if
(
result
==
null
)
{
result
=
doParseString
(
s
);
result
=
doParseString
(
s
);
if
(
expressionCache
==
null
)
{
if
(
expressionCache
==
null
)
{
expressionCache
=
new
Hashtable
();
expressionCache
=
new
Hashtable
<>
();
}
}
expressionCache
.
put
(
s
,
result
);
expressionCache
.
put
(
s
,
result
);
}
}
...
@@ -336,8 +336,8 @@ class CharSet {
...
@@ -336,8 +336,8 @@ class CharSet {
* Returns a copy of CharSet's expression cache and sets CharSet's
* Returns a copy of CharSet's expression cache and sets CharSet's
* expression cache to empty.
* expression cache to empty.
*/
*/
public
static
Hashtable
releaseExpressionCache
()
{
public
static
Hashtable
<
String
,
CharSet
>
releaseExpressionCache
()
{
Hashtable
result
=
expressionCache
;
Hashtable
<
String
,
CharSet
>
result
=
expressionCache
;
expressionCache
=
null
;
expressionCache
=
null
;
return
result
;
return
result
;
}
}
...
@@ -778,7 +778,7 @@ class CharSet {
...
@@ -778,7 +778,7 @@ class CharSet {
* An Enumeration that can be used to extract the character ranges
* An Enumeration that can be used to extract the character ranges
* from a CharSet one at a time
* from a CharSet one at a time
*/
*/
public
class
Enumeration
implements
java
.
util
.
Enumeration
{
public
class
Enumeration
implements
java
.
util
.
Enumeration
<
int
[]>
{
/**
/**
* Initializes a CharSet.Enumeration
* Initializes a CharSet.Enumeration
*/
*/
...
@@ -798,7 +798,7 @@ class CharSet {
...
@@ -798,7 +798,7 @@ class CharSet {
/**
/**
* Returns the next range in the CarSet
* Returns the next range in the CarSet
*/
*/
public
Object
nextElement
()
{
public
int
[]
nextElement
()
{
int
[]
result
=
new
int
[
2
];
int
[]
result
=
new
int
[
2
];
result
[
0
]
=
chars
[
p
++];
result
[
0
]
=
chars
[
p
++];
result
[
1
]
=
chars
[
p
++];
result
[
1
]
=
chars
[
p
++];
...
...
make/tools/src/build/tools/generatebreakiteratordata/DictionaryBasedBreakIteratorBuilder.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003,
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
...
@@ -78,12 +78,12 @@ class DictionaryBasedBreakIteratorBuilder extends RuleBasedBreakIteratorBuilder
...
@@ -78,12 +78,12 @@ class DictionaryBasedBreakIteratorBuilder extends RuleBasedBreakIteratorBuilder
* contains "true" for every character category that includes a dictionary
* contains "true" for every character category that includes a dictionary
* character.
* character.
*/
*/
protected
void
buildCharCategories
(
Vector
tempRuleList
)
{
protected
void
buildCharCategories
(
Vector
<
String
>
tempRuleList
)
{
super
.
buildCharCategories
(
tempRuleList
);
super
.
buildCharCategories
(
tempRuleList
);
categoryFlags
=
new
boolean
[
categories
.
size
()];
categoryFlags
=
new
boolean
[
categories
.
size
()];
for
(
int
i
=
0
;
i
<
categories
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
categories
.
size
();
i
++)
{
CharSet
cs
=
(
CharSet
)
categories
.
elementAt
(
i
);
CharSet
cs
=
categories
.
elementAt
(
i
);
if
(!(
cs
.
intersection
(
dictionaryChars
).
empty
()))
{
if
(!(
cs
.
intersection
(
dictionaryChars
).
empty
()))
{
categoryFlags
[
i
]
=
true
;
categoryFlags
[
i
]
=
true
;
}
}
...
@@ -95,7 +95,7 @@ class DictionaryBasedBreakIteratorBuilder extends RuleBasedBreakIteratorBuilder
...
@@ -95,7 +95,7 @@ class DictionaryBasedBreakIteratorBuilder extends RuleBasedBreakIteratorBuilder
// the function above. This gives us a way to create a separate character
// the function above. This gives us a way to create a separate character
// category for the dictionary characters even when
// category for the dictionary characters even when
// RuleBasedBreakIteratorBuilder isn't making a distinction.
// RuleBasedBreakIteratorBuilder isn't making a distinction.
protected
void
mungeExpressionList
(
Hashtable
expressions
)
{
protected
void
mungeExpressionList
(
Hashtable
<
String
,
Object
>
expressions
)
{
expressions
.
put
(
dictionaryExpression
,
dictionaryChars
);
expressions
.
put
(
dictionaryExpression
,
dictionaryChars
);
}
}
...
...
make/tools/src/build/tools/generatebreakiteratordata/GenerateBreakIteratorData.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003,
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
...
@@ -91,9 +91,9 @@ public class GenerateBreakIteratorData {
...
@@ -91,9 +91,9 @@ public class GenerateBreakIteratorData {
try
{
try
{
info
=
(
ResourceBundle
)
Class
.
forName
(
"sun.text.resources.BreakIteratorInfo"
+
localeName
).
newInstance
();
info
=
(
ResourceBundle
)
Class
.
forName
(
"sun.text.resources.BreakIteratorInfo"
+
localeName
).
newInstance
();
Enumeration
keys
=
info
.
getKeys
();
Enumeration
<
String
>
keys
=
info
.
getKeys
();
while
(
keys
.
hasMoreElements
())
{
while
(
keys
.
hasMoreElements
())
{
String
key
=
(
String
)
keys
.
nextElement
();
String
key
=
keys
.
nextElement
();
if
(
key
.
equals
(
"CharacterData"
))
{
if
(
key
.
equals
(
"CharacterData"
))
{
generateDataFile
(
info
.
getString
(
key
),
generateDataFile
(
info
.
getString
(
key
),
...
...
make/tools/src/build/tools/generatebreakiteratordata/RuleBasedBreakIteratorBuilder.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
make/tools/src/build/tools/generatebreakiteratordata/SupplementaryCharacterData.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003,
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
...
@@ -128,7 +128,7 @@ final class SupplementaryCharacterData {
...
@@ -128,7 +128,7 @@ final class SupplementaryCharacterData {
int
new_index
=
0
;
int
new_index
=
0
;
int
loop_count
=
dataCount
-
1
;
int
loop_count
=
dataCount
-
1
;
long
data
=
tempTable
[
old_index
];
long
data
=
tempTable
[
old_index
];
int
start
=
(
int
)(
(
long
)(
data
>>
32
)
)
&
CODEPOINT_MASK
;
int
start
=
(
int
)(
data
>>
32
)
&
CODEPOINT_MASK
;
int
end
=
(
int
)(
data
>>
8
)
&
CODEPOINT_MASK
;
int
end
=
(
int
)(
data
>>
8
)
&
CODEPOINT_MASK
;
/*
/*
...
@@ -142,7 +142,7 @@ final class SupplementaryCharacterData {
...
@@ -142,7 +142,7 @@ final class SupplementaryCharacterData {
newTempTable
[
new_index
++]
=
composeEntry
(
start
,
(
int
)
data
);
newTempTable
[
new_index
++]
=
composeEntry
(
start
,
(
int
)
data
);
for
(
int
i
=
0
;
i
<
loop_count
;
i
++)
{
for
(
int
i
=
0
;
i
<
loop_count
;
i
++)
{
data
=
tempTable
[++
old_index
];
data
=
tempTable
[++
old_index
];
int
nextStart
=
(
int
)(
(
long
)(
data
>>
32
)
)
&
CODEPOINT_MASK
;
int
nextStart
=
(
int
)(
data
>>
32
)
&
CODEPOINT_MASK
;
/*
/*
* If the previous end code point is not equal to the previous start
* If the previous end code point is not equal to the previous start
...
...
make/tools/src/build/tools/generatecharacter/GenerateCharacter.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2002, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
...
@@ -1290,7 +1290,7 @@ OUTER: for (int i = 0; i < n; i += m) {
...
@@ -1290,7 +1290,7 @@ OUTER: for (int i = 0; i < n; i += m) {
else
if
(
bits
==
32
||
bits
<
8
)
else
if
(
bits
==
32
||
bits
<
8
)
result
.
append
(
hex8
((
int
)
val
));
result
.
append
(
hex8
((
int
)
val
));
else
{
else
{
result
.
append
(
hex16
(
(
long
)
val
));
result
.
append
(
hex16
(
val
));
if
(!
Csyntax
)
if
(!
Csyntax
)
result
.
append
(
"L"
);
result
.
append
(
"L"
);
}
}
...
...
make/tools/src/build/tools/generatecharacter/SpecialCaseMap.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2002, 20
03
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
...
@@ -39,7 +39,7 @@ import java.lang.*;
...
@@ -39,7 +39,7 @@ import java.lang.*;
* <p>
* <p>
* @author John O'Conner
* @author John O'Conner
*/
*/
public
class
SpecialCaseMap
implements
Comparable
{
public
class
SpecialCaseMap
implements
Comparable
<
SpecialCaseMap
>
{
SpecialCaseMap
()
{
SpecialCaseMap
()
{
chSource
=
0xFFFF
;
chSource
=
0xFFFF
;
...
@@ -55,7 +55,7 @@ public class SpecialCaseMap implements Comparable {
...
@@ -55,7 +55,7 @@ public class SpecialCaseMap implements Comparable {
*/
*/
public
static
SpecialCaseMap
[]
readSpecFile
(
File
file
,
int
plane
)
throws
FileNotFoundException
{
public
static
SpecialCaseMap
[]
readSpecFile
(
File
file
,
int
plane
)
throws
FileNotFoundException
{
ArrayList
caseMaps
=
new
ArrayList
(
150
);
ArrayList
<
SpecialCaseMap
>
caseMaps
=
new
ArrayList
<>
(
150
);
int
count
=
0
;
int
count
=
0
;
BufferedReader
f
=
new
BufferedReader
(
new
FileReader
(
file
));
BufferedReader
f
=
new
BufferedReader
(
new
FileReader
(
file
));
String
line
=
null
;
String
line
=
null
;
...
@@ -69,7 +69,7 @@ public class SpecialCaseMap implements Comparable {
...
@@ -69,7 +69,7 @@ public class SpecialCaseMap implements Comparable {
SpecialCaseMap
item
=
parse
(
line
.
trim
());
SpecialCaseMap
item
=
parse
(
line
.
trim
());
if
(
item
!=
null
)
{
if
(
item
!=
null
)
{
if
(
item
.
getCharSource
()
>>
16
<
plane
)
continue
;
if
(
item
.
getCharSource
()
>>
16
<
plane
)
continue
;
if
(
(
int
)(
item
.
getCharSource
()
>>
16
)
>
plane
)
break
;
if
(
item
.
getCharSource
()
>>
16
>
plane
)
break
;
caseMaps
.
add
(
item
);
caseMaps
.
add
(
item
);
++
count
;
++
count
;
}
}
...
@@ -215,7 +215,6 @@ public class SpecialCaseMap implements Comparable {
...
@@ -215,7 +215,6 @@ public class SpecialCaseMap implements Comparable {
static
String
hex6
(
int
n
)
{
static
String
hex6
(
int
n
)
{
String
str
=
Integer
.
toHexString
(
n
&
0xFFFFFF
).
toUpperCase
();
String
str
=
Integer
.
toHexString
(
n
&
0xFFFFFF
).
toUpperCase
();
return
"000000"
.
substring
(
Math
.
min
(
6
,
str
.
length
()))
+
str
;
return
"000000"
.
substring
(
Math
.
min
(
6
,
str
.
length
()))
+
str
;
}
}
static
String
hex6
(
char
[]
map
){
static
String
hex6
(
char
[]
map
){
...
@@ -302,20 +301,26 @@ public class SpecialCaseMap implements Comparable {
...
@@ -302,20 +301,26 @@ public class SpecialCaseMap implements Comparable {
static
String
CONTEXT_MODERN
=
"MODERN"
;
static
String
CONTEXT_MODERN
=
"MODERN"
;
static
String
CONTEXT_NONMODERN
=
"NON_MODERN"
;
static
String
CONTEXT_NONMODERN
=
"NON_MODERN"
;
public
int
compareTo
(
Object
otherObject
)
{
public
int
compareTo
(
SpecialCaseMap
otherObject
)
{
SpecialCaseMap
other
=
(
SpecialCaseMap
)
otherObject
;
if
(
chSource
<
otherObject
.
chSource
)
{
if
(
chSource
<
other
.
chSource
)
{
return
-
1
;
return
-
1
;
}
}
else
if
(
chSource
>
other
.
chSource
)
{
else
if
(
chSource
>
other
Object
.
chSource
)
{
return
1
;
return
1
;
}
}
else
return
0
;
else
return
0
;
}
}
public
boolean
equals
(
Object
o1
)
{
public
boolean
equals
(
Object
o1
)
{
if
(
this
==
o1
)
{
return
true
;
}
if
(
o1
==
null
||
!(
o1
instanceof
SpecialCaseMap
))
{
return
false
;
}
SpecialCaseMap
other
=
(
SpecialCaseMap
)
o1
;
boolean
bEqual
=
false
;
boolean
bEqual
=
false
;
if
(
0
==
compareTo
(
o1
))
{
if
(
0
==
compareTo
(
other
))
{
bEqual
=
true
;
bEqual
=
true
;
}
}
return
bEqual
;
return
bEqual
;
...
@@ -332,7 +337,7 @@ public class SpecialCaseMap implements Comparable {
...
@@ -332,7 +337,7 @@ public class SpecialCaseMap implements Comparable {
}
}
public
int
hashCode
()
{
public
int
hashCode
()
{
return
(
int
)
chSource
;
return
chSource
;
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
make/tools/src/build/tools/generatecharacter/UnicodeSpec.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2002, 20
04
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
...
@@ -391,7 +391,7 @@ public class UnicodeSpec {
...
@@ -391,7 +391,7 @@ public class UnicodeSpec {
*/
*/
public
static
UnicodeSpec
[]
readSpecFile
(
File
file
,
int
plane
)
throws
FileNotFoundException
{
public
static
UnicodeSpec
[]
readSpecFile
(
File
file
,
int
plane
)
throws
FileNotFoundException
{
ArrayList
list
=
new
ArrayList
(
3000
);
ArrayList
<
UnicodeSpec
>
list
=
new
ArrayList
<>
(
3000
);
UnicodeSpec
[]
result
=
null
;
UnicodeSpec
[]
result
=
null
;
int
count
=
0
;
int
count
=
0
;
BufferedReader
f
=
new
BufferedReader
(
new
FileReader
(
file
));
BufferedReader
f
=
new
BufferedReader
(
new
FileReader
(
file
));
...
@@ -406,7 +406,7 @@ public class UnicodeSpec {
...
@@ -406,7 +406,7 @@ public class UnicodeSpec {
}
}
if
(
line
==
null
)
break
loop
;
if
(
line
==
null
)
break
loop
;
UnicodeSpec
item
=
parse
(
line
.
trim
());
UnicodeSpec
item
=
parse
(
line
.
trim
());
int
specPlane
=
(
int
)(
item
.
getCodePoint
()
>>>
16
)
;
int
specPlane
=
item
.
getCodePoint
()
>>>
16
;
if
(
specPlane
<
plane
)
continue
;
if
(
specPlane
<
plane
)
continue
;
if
(
specPlane
>
plane
)
break
;
if
(
specPlane
>
plane
)
break
;
...
...
make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2001, 20
06
, 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
...
@@ -250,10 +250,10 @@ public class GenerateCurrencyData {
...
@@ -250,10 +250,10 @@ public class GenerateCurrencyData {
return
Integer
.
parseInt
(
numericCode
);
return
Integer
.
parseInt
(
numericCode
);
}
}
static
HashMap
specialCaseMap
=
new
HashMap
();
static
HashMap
<
String
,
Integer
>
specialCaseMap
=
new
HashMap
<>
();
private
static
int
makeSpecialCaseEntry
(
String
currencyInfo
)
throws
Exception
{
private
static
int
makeSpecialCaseEntry
(
String
currencyInfo
)
throws
Exception
{
Integer
oldEntry
=
(
Integer
)
specialCaseMap
.
get
(
currencyInfo
);
Integer
oldEntry
=
specialCaseMap
.
get
(
currencyInfo
);
if
(
oldEntry
!=
null
)
{
if
(
oldEntry
!=
null
)
{
return
oldEntry
.
intValue
();
return
oldEntry
.
intValue
();
}
}
...
...
make/tools/src/build/tools/hasher/Hasher.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2004, 20
05
, 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
...
@@ -51,8 +51,8 @@ public class Hasher {
...
@@ -51,8 +51,8 @@ public class Hasher {
boolean
verbose
=
false
;
boolean
verbose
=
false
;
List
keys
=
new
ArrayList
();
// Key strings
List
<
String
>
keys
=
new
ArrayList
<>();
// Key strings
List
values
=
new
ArrayList
();
// Value expressions
List
<
String
>
values
=
new
ArrayList
<>();
// Value expressions
String
pkg
=
null
;
// Package prefix for generated class
String
pkg
=
null
;
// Package prefix for generated class
String
cln
=
null
;
// Name of generated class
String
cln
=
null
;
// Name of generated class
String
vtype
=
"String"
;
// Value type
String
vtype
=
"String"
;
// Value type
...
@@ -76,9 +76,9 @@ public class Hasher {
...
@@ -76,9 +76,9 @@ public class Hasher {
}
}
Hasher
(
String
[]
args
)
{
Hasher
(
String
[]
args
)
{
List
as
=
Arrays
.
asList
(
args
);
List
<
String
>
as
=
Arrays
.
asList
(
args
);
for
(
Iterator
i
=
as
.
iterator
();
i
.
hasNext
();)
{
for
(
Iterator
<
String
>
i
=
as
.
iterator
();
i
.
hasNext
();)
{
String
a
=
(
String
)
i
.
next
();
String
a
=
i
.
next
();
if
(
a
.
equals
(
"-e"
))
{
if
(
a
.
equals
(
"-e"
))
{
empty
=
true
;
empty
=
true
;
}
else
if
(
a
.
equals
(
"-i"
))
{
}
else
if
(
a
.
equals
(
"-i"
))
{
...
@@ -88,15 +88,15 @@ public class Hasher {
...
@@ -88,15 +88,15 @@ public class Hasher {
}
else
if
(
a
.
equals
(
"-md"
))
{
}
else
if
(
a
.
equals
(
"-md"
))
{
if
(!
i
.
hasNext
())
if
(!
i
.
hasNext
())
usage
();
usage
();
maxDepth
=
Integer
.
parseInt
(
(
String
)
i
.
next
());
maxDepth
=
Integer
.
parseInt
(
i
.
next
());
}
else
if
(
a
.
equals
(
"-mb"
))
{
}
else
if
(
a
.
equals
(
"-mb"
))
{
if
(!
i
.
hasNext
())
if
(!
i
.
hasNext
())
usage
();
usage
();
maxBits
=
Integer
.
parseInt
(
(
String
)
i
.
next
());
maxBits
=
Integer
.
parseInt
(
i
.
next
());
}
else
if
(
a
.
equals
(
"-t"
))
{
}
else
if
(
a
.
equals
(
"-t"
))
{
if
(!
i
.
hasNext
())
if
(!
i
.
hasNext
())
usage
();
usage
();
vtype
=
(
String
)
i
.
next
();
vtype
=
i
.
next
();
}
else
if
(
a
.
startsWith
(
"-"
))
{
}
else
if
(
a
.
startsWith
(
"-"
))
{
usage
();
usage
();
}
else
{
}
else
{
...
@@ -153,8 +153,8 @@ public class Hasher {
...
@@ -153,8 +153,8 @@ public class Hasher {
int
nw
=
keys
.
size
();
int
nw
=
keys
.
size
();
for
(
int
i
=
0
;
i
<
nw
;
i
++)
{
for
(
int
i
=
0
;
i
<
nw
;
i
++)
{
String
w
=
(
String
)
keys
.
get
(
i
);
String
w
=
keys
.
get
(
i
);
String
v
=
(
String
)
values
.
get
(
i
);
String
v
=
values
.
get
(
i
);
int
h
=
hash
(
w
);
int
h
=
hash
(
w
);
if
(
ht
[
h
]
==
null
)
if
(
ht
[
h
]
==
null
)
ht
[
h
]
=
new
Object
[]
{
w
,
v
};
ht
[
h
]
=
new
Object
[]
{
w
,
v
};
...
@@ -217,7 +217,7 @@ public class Hasher {
...
@@ -217,7 +217,7 @@ public class Hasher {
if
(
verbose
)
if
(
verbose
)
err
.
println
();
err
.
println
();
for
(
int
i
=
0
,
n
=
keys
.
size
();
i
<
n
;
i
++)
{
for
(
int
i
=
0
,
n
=
keys
.
size
();
i
<
n
;
i
++)
{
String
w
=
(
String
)
keys
.
get
(
i
);
String
w
=
keys
.
get
(
i
);
String
v
=
get
(
w
);
String
v
=
get
(
w
);
if
(
verbose
)
if
(
verbose
)
err
.
println
(
hash
(
w
)
+
"\t"
+
w
);
err
.
println
(
hash
(
w
)
+
"\t"
+
w
);
...
...
make/tools/src/build/tools/jarsplit/JarSplit.java
浏览文件 @
92fd97c5
/*
/*
* 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
...
@@ -43,7 +43,8 @@ public class JarSplit {
...
@@ -43,7 +43,8 @@ public class JarSplit {
/* classlist[0] contains class file list
/* classlist[0] contains class file list
* classlist[1] contains non-class file list
* classlist[1] contains non-class file list
*/
*/
private
static
Vector
<
String
>[]
classlist
=
(
Vector
<
String
>[])(
new
Vector
[
2
]);
@SuppressWarnings
(
"unchecked"
)
private
static
Vector
<
String
>[]
classlist
=
new
Vector
<>[
2
];
/* The 2 class list name passed as arguments. */
/* The 2 class list name passed as arguments. */
private
static
String
[]
fileNamelist
=
new
String
[
2
];
private
static
String
[]
fileNamelist
=
new
String
[
2
];
...
...
make/tools/src/build/tools/javazic/Gen.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2000, 20
05
, 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
...
@@ -30,14 +30,9 @@ import java.io.File;
...
@@ -30,14 +30,9 @@ import java.io.File;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.DataOutputStream
;
import
java.io.DataOutputStream
;
import
java.io.RandomAccessFile
;
import
java.io.RandomAccessFile
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.TreeMap
;
import
java.util.TreeSet
;
import
sun.util.calendar.ZoneInfoFile
;
import
sun.util.calendar.ZoneInfoFile
;
/**
/**
...
@@ -105,14 +100,13 @@ class Gen extends BackEnd {
...
@@ -105,14 +100,13 @@ class Gen extends BackEnd {
/* if DST offset is 0, this means DST isn't used.
/* if DST offset is 0, this means DST isn't used.
* (NOT: offset's index is 0.)
* (NOT: offset's index is 0.)
*/
*/
if
((
dstoffset
=
if
((
dstoffset
=
dstOffsets
.
get
(
i
).
intValue
())
==
-
1
)
{
((
Integer
)
dstOffsets
.
get
(
i
)).
intValue
())
==
-
1
)
{
dstoffset
=
0
;
dstoffset
=
0
;
}
}
dos
.
writeLong
((
((
Long
)
transitions
.
get
(
i
)
).
longValue
()
<<
12
)
dos
.
writeLong
((
transitions
.
get
(
i
).
longValue
()
<<
12
)
|
(
dstoffset
<<
4
)
|
(
dstoffset
<<
4
)
|
((
Integer
)
offsets
.
get
(
i
)
).
intValue
());
|
offsets
.
get
(
i
).
intValue
());
}
}
...
...
make/tools/src/build/tools/javazic/GenDoc.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2001, 20
06
, 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
...
@@ -31,12 +31,8 @@ import java.io.File;
...
@@ -31,12 +31,8 @@ import java.io.File;
import
java.io.FileReader
;
import
java.io.FileReader
;
import
java.io.FileWriter
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -189,7 +185,7 @@ class GenDoc extends BackEnd {
...
@@ -189,7 +185,7 @@ class GenDoc extends BackEnd {
out
.
write
(
header1
+
new
Date
()
+
header3
+
zonename
+
header4
);
out
.
write
(
header1
+
new
Date
()
+
header3
+
zonename
+
header4
);
out
.
write
(
body1
+
"<FONT size=\"+2\"><B>"
+
zonename
+
"</B></FONT>"
);
out
.
write
(
body1
+
"<FONT size=\"+2\"><B>"
+
zonename
+
"</B></FONT>"
);
LatitudeAndLongitude
location
=
(
LatitudeAndLongitude
)
mapList
.
get
(
zonename
);
LatitudeAndLongitude
location
=
mapList
.
get
(
zonename
);
if
(
location
!=
null
)
{
if
(
location
!=
null
)
{
int
deg
,
min
,
sec
;
int
deg
,
min
,
sec
;
...
@@ -608,12 +604,12 @@ class GenDoc extends BackEnd {
...
@@ -608,12 +604,12 @@ class GenDoc extends BackEnd {
"<BR>\n\n"
+
"<TABLE BORDER=\"0\" WIDTH=\"100%\">\n"
+
"<BR>\n\n"
+
"<TABLE BORDER=\"0\" WIDTH=\"100%\">\n"
+
"<TR>\n<TD NOWRAP>\n"
);
"<TR>\n<TD NOWRAP>\n"
);
Set
aliasSet
=
a
.
keySet
();
Set
<
String
>
aliasSet
=
a
.
keySet
();
len
=
aliasSet
.
size
();
len
=
aliasSet
.
size
();
Object
aliasNames
[]
=
aliasSet
.
toArray
(
);
String
aliasNames
[]
=
aliasSet
.
toArray
(
new
String
[
0
]
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
displayNameList
.
put
(
transform
(
(
String
)
aliasNames
[
i
]),
displayNameList
.
put
(
transform
(
aliasNames
[
i
]),
(
String
)
aliasNames
[
i
]);
aliasNames
[
i
]);
}
}
o
=
displayNameList
.
keySet
().
toArray
();
o
=
displayNameList
.
keySet
().
toArray
();
...
...
make/tools/src/build/tools/javazic/Main.java
浏览文件 @
92fd97c5
/*
/*
* 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
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
package
build.tools.javazic
;
package
build.tools.javazic
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
...
make/tools/src/build/tools/javazic/Mappings.java
浏览文件 @
92fd97c5
/*
/*
* 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
...
@@ -26,9 +26,6 @@
...
@@ -26,9 +26,6 @@
package
build.tools.javazic
;
package
build.tools.javazic
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.LinkedList
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
...
make/tools/src/build/tools/javazic/Simple.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2000, 20
06
, 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
...
@@ -29,10 +29,7 @@ import java.io.BufferedWriter;
...
@@ -29,10 +29,7 @@ import java.io.BufferedWriter;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -51,22 +48,19 @@ class Simple extends BackEnd {
...
@@ -51,22 +48,19 @@ class Simple extends BackEnd {
/**
/**
* Zone records which are applied for given year.
* Zone records which are applied for given year.
*/
*/
private
static
Map
<
String
,
ZoneRec
>
lastZoneRecs
private
static
Map
<
String
,
ZoneRec
>
lastZoneRecs
=
new
HashMap
<>();
=
new
HashMap
<
String
,
ZoneRec
>();
/**
/**
* Rule records which are applied for given year.
* Rule records which are applied for given year.
*/
*/
private
static
Map
<
String
,
List
<
RuleRec
>>
lastRules
private
static
Map
<
String
,
List
<
RuleRec
>>
lastRules
=
new
TreeMap
<>();
=
new
TreeMap
<
String
,
List
<
RuleRec
>>();
/**
/**
* zone IDs sorted by their GMT offsets. If zone's GMT
* zone IDs sorted by their GMT offsets. If zone's GMT
* offset will change in the future, its last known offset is
* offset will change in the future, its last known offset is
* used.
* used.
*/
*/
private
SortedMap
<
Integer
,
Set
<
String
>>
zonesByOffset
private
SortedMap
<
Integer
,
Set
<
String
>>
zonesByOffset
=
new
TreeMap
<>();
=
new
TreeMap
<
Integer
,
Set
<
String
>>();
/**
/**
* Sets last Rule records and Zone records for given timezone to
* Sets last Rule records and Zone records for given timezone to
...
@@ -86,7 +80,7 @@ class Simple extends BackEnd {
...
@@ -86,7 +80,7 @@ class Simple extends BackEnd {
int
lastKnownOffset
=
tz
.
getRawOffset
();
int
lastKnownOffset
=
tz
.
getRawOffset
();
Set
<
String
>
set
=
zonesByOffset
.
get
(
lastKnownOffset
);
Set
<
String
>
set
=
zonesByOffset
.
get
(
lastKnownOffset
);
if
(
set
==
null
)
{
if
(
set
==
null
)
{
set
=
new
TreeSet
<
String
>();
set
=
new
TreeSet
<>();
zonesByOffset
.
put
(
lastKnownOffset
,
set
);
zonesByOffset
.
put
(
lastKnownOffset
,
set
);
}
}
set
.
add
(
zonename
);
set
.
add
(
zonename
);
...
@@ -101,16 +95,11 @@ class Simple extends BackEnd {
...
@@ -101,16 +95,11 @@ class Simple extends BackEnd {
*/
*/
int
generateSrc
(
Mappings
map
)
{
int
generateSrc
(
Mappings
map
)
{
try
{
try
{
String
outputDir
=
Main
.
getOutputDir
();
File
outD
=
new
File
(
Main
.
getOutputDir
());
File
outD
=
new
File
(
outputDir
);
if
(!
outputDir
.
endsWith
(
File
.
separator
))
{
outputDir
+=
outD
.
separator
;
}
outD
.
mkdirs
();
outD
.
mkdirs
();
FileWriter
fw
=
FileWriter
fw
=
new
FileWriter
(
outputDir
+
"TimeZoneData.java"
,
false
);
new
FileWriter
(
new
File
(
outD
,
"TimeZoneData.java"
)
,
false
);
BufferedWriter
out
=
new
BufferedWriter
(
fw
);
BufferedWriter
out
=
new
BufferedWriter
(
fw
);
out
.
write
(
"import java.util.SimpleTimeZone;\n\n"
);
out
.
write
(
"import java.util.SimpleTimeZone;\n\n"
);
...
...
make/tools/src/build/tools/javazic/Time.java
浏览文件 @
92fd97c5
/*
/*
* 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
...
@@ -268,16 +268,16 @@ class Time {
...
@@ -268,16 +268,16 @@ class Time {
if
(
index
<
time
.
length
())
{
if
(
index
<
time
.
length
())
{
char
c
=
time
.
charAt
(
index
++);
char
c
=
time
.
charAt
(
index
++);
if
(
c
==
's'
)
{
if
(
c
==
's'
)
{
tm
.
setType
(
tm
.
STD
);
tm
.
setType
(
Time
.
STD
);
}
else
if
(
c
==
'u'
||
c
==
'g'
||
c
==
'z'
)
{
}
else
if
(
c
==
'u'
||
c
==
'g'
||
c
==
'z'
)
{
tm
.
setType
(
tm
.
UTC
);
tm
.
setType
(
Time
.
UTC
);
}
else
if
(
c
==
'w'
)
{
}
else
if
(
c
==
'w'
)
{
tm
.
setType
(
tm
.
WALL
);
tm
.
setType
(
Time
.
WALL
);
}
else
{
}
else
{
Main
.
panic
(
"unknown time mode: "
+
c
);
Main
.
panic
(
"unknown time mode: "
+
c
);
}
}
}
else
{
}
else
{
tm
.
setType
(
tm
.
WALL
);
tm
.
setType
(
Time
.
WALL
);
}
}
return
tm
;
return
tm
;
}
}
...
...
make/tools/src/build/tools/javazic/Zoneinfo.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2000, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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,9 +29,7 @@ import java.io.BufferedReader;
...
@@ -29,9 +29,7 @@ import java.io.BufferedReader;
import
java.io.FileReader
;
import
java.io.FileReader
;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.StringTokenizer
;
import
java.util.StringTokenizer
;
...
@@ -407,9 +405,9 @@ class Zoneinfo {
...
@@ -407,9 +405,9 @@ class Zoneinfo {
if
(!
zrec
.
hasUntil
())
{
if
(!
zrec
.
hasUntil
())
{
if
(
tz
.
getNTransitions
()
>
0
)
{
if
(
tz
.
getNTransitions
()
>
0
)
{
if
(
stdOffset
==
0
)
{
if
(
stdOffset
==
0
)
{
tz
.
setDSTType
(
tz
.
X_DST
);
tz
.
setDSTType
(
Timezone
.
X_DST
);
}
else
{
}
else
{
tz
.
setDSTType
(
tz
.
LAST_DST
);
tz
.
setDSTType
(
Timezone
.
LAST_DST
);
}
}
long
time
=
Time
.
getLocalTime
(
maxYear
,
long
time
=
Time
.
getLocalTime
(
maxYear
,
Month
.
JANUARY
,
1
,
0
);
Month
.
JANUARY
,
1
,
0
);
...
@@ -419,7 +417,7 @@ class Zoneinfo {
...
@@ -419,7 +417,7 @@ class Zoneinfo {
tz
.
getDstOffsetIndex
(
stdOffset
));
tz
.
getDstOffsetIndex
(
stdOffset
));
tz
.
addUsedRec
(
zrec
);
tz
.
addUsedRec
(
zrec
);
}
else
{
}
else
{
tz
.
setDSTType
(
tz
.
NO_DST
);
tz
.
setDSTType
(
Timezone
.
NO_DST
);
}
}
break
;
break
;
}
}
...
@@ -527,7 +525,7 @@ class Zoneinfo {
...
@@ -527,7 +525,7 @@ class Zoneinfo {
if
(
year
==
endYear
&&
!
zrec
.
hasUntil
())
{
if
(
year
==
endYear
&&
!
zrec
.
hasUntil
())
{
if
(
tz
.
getNTransitions
()
>
0
)
{
if
(
tz
.
getNTransitions
()
>
0
)
{
// Assume that this Zone stopped DST
// Assume that this Zone stopped DST
tz
.
setDSTType
(
tz
.
X_DST
);
tz
.
setDSTType
(
Timezone
.
X_DST
);
long
time
=
Time
.
getLocalTime
(
maxYear
,
Month
.
JANUARY
,
long
time
=
Time
.
getLocalTime
(
maxYear
,
Month
.
JANUARY
,
1
,
0
);
1
,
0
);
time
-=
zrec
.
getGmtOffset
();
time
-=
zrec
.
getGmtOffset
();
...
@@ -536,7 +534,7 @@ class Zoneinfo {
...
@@ -536,7 +534,7 @@ class Zoneinfo {
tz
.
getDstOffsetIndex
(
0
));
tz
.
getDstOffsetIndex
(
0
));
usedZone
=
true
;
usedZone
=
true
;
}
else
{
}
else
{
tz
.
setDSTType
(
tz
.
NO_DST
);
tz
.
setDSTType
(
Timezone
.
NO_DST
);
}
}
}
}
}
}
...
@@ -552,8 +550,8 @@ class Zoneinfo {
...
@@ -552,8 +550,8 @@ class Zoneinfo {
}
}
}
}
if
(
tz
.
getDSTType
()
==
tz
.
UNDEF_DST
)
{
if
(
tz
.
getDSTType
()
==
Timezone
.
UNDEF_DST
)
{
tz
.
setDSTType
(
tz
.
DST
);
tz
.
setDSTType
(
Timezone
.
DST
);
}
}
tz
.
optimize
();
tz
.
optimize
();
tz
.
checksum
();
tz
.
checksum
();
...
...
make/tools/src/build/tools/jdwpgen/AbstractCommandNode.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998,
1999
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
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
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
package
build.tools.jdwpgen
;
package
build.tools.jdwpgen
;
import
java.util.*
;
import
java.io.*
;
import
java.io.*
;
class
AbstractCommandNode
extends
AbstractNamedNode
{
class
AbstractCommandNode
extends
AbstractNamedNode
{
...
@@ -35,8 +34,8 @@ class AbstractCommandNode extends AbstractNamedNode {
...
@@ -35,8 +34,8 @@ class AbstractCommandNode extends AbstractNamedNode {
" Command</a> ("
+
nameNode
.
value
()
+
")</h5>"
);
" Command</a> ("
+
nameNode
.
value
()
+
")</h5>"
);
writer
.
println
(
comment
());
writer
.
println
(
comment
());
writer
.
println
(
"<dl>"
);
writer
.
println
(
"<dl>"
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
((
Node
)
it
.
next
())
.
document
(
writer
);
node
.
document
(
writer
);
}
}
writer
.
println
(
"</dl>"
);
writer
.
println
(
"</dl>"
);
}
}
...
...
make/tools/src/build/tools/jdwpgen/AbstractGroupNode.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998,
1999
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
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
...
@@ -25,14 +25,13 @@
...
@@ -25,14 +25,13 @@
package
build.tools.jdwpgen
;
package
build.tools.jdwpgen
;
import
java.util.*
;
import
java.io.*
;
import
java.io.*
;
abstract
class
AbstractGroupNode
extends
AbstractTypeListNode
{
abstract
class
AbstractGroupNode
extends
AbstractTypeListNode
{
void
document
(
PrintWriter
writer
)
{
void
document
(
PrintWriter
writer
)
{
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
((
Node
)
it
.
next
())
.
document
(
writer
);
node
.
document
(
writer
);
}
}
}
}
...
...
make/tools/src/build/tools/jdwpgen/AbstractNamedNode.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998,
1999
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
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
...
@@ -38,10 +38,10 @@ abstract class AbstractNamedNode extends Node {
...
@@ -38,10 +38,10 @@ abstract class AbstractNamedNode extends Node {
}
}
void
prune
()
{
void
prune
()
{
Iterator
it
=
components
.
iterator
();
Iterator
<
Node
>
it
=
components
.
iterator
();
if
(
it
.
hasNext
())
{
if
(
it
.
hasNext
())
{
Node
nameNode
=
(
Node
)
it
.
next
();
Node
nameNode
=
it
.
next
();
if
(
nameNode
instanceof
NameNode
)
{
if
(
nameNode
instanceof
NameNode
)
{
this
.
nameNode
=
(
NameNode
)
nameNode
;
this
.
nameNode
=
(
NameNode
)
nameNode
;
...
@@ -64,8 +64,8 @@ abstract class AbstractNamedNode extends Node {
...
@@ -64,8 +64,8 @@ abstract class AbstractNamedNode extends Node {
void
document
(
PrintWriter
writer
)
{
void
document
(
PrintWriter
writer
)
{
writer
.
println
(
"<h4><a name="
+
name
+
">"
+
name
+
writer
.
println
(
"<h4><a name="
+
name
+
">"
+
name
+
" Command Set</a></h4>"
);
" Command Set</a></h4>"
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
((
Node
)
it
.
next
())
.
document
(
writer
);
node
.
document
(
writer
);
}
}
}
}
...
@@ -90,8 +90,8 @@ abstract class AbstractNamedNode extends Node {
...
@@ -90,8 +90,8 @@ abstract class AbstractNamedNode extends Node {
writer
.
print
(
"class "
+
javaClassName
());
writer
.
print
(
"class "
+
javaClassName
());
writer
.
println
(
javaClassImplements
()
+
" {"
);
writer
.
println
(
javaClassImplements
()
+
" {"
);
genJavaClassSpecifics
(
writer
,
depth
+
1
);
genJavaClassSpecifics
(
writer
,
depth
+
1
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
((
Node
)
it
.
next
())
.
genJava
(
writer
,
depth
+
1
);
node
.
genJava
(
writer
,
depth
+
1
);
}
}
indent
(
writer
,
depth
);
indent
(
writer
,
depth
);
writer
.
println
(
"}"
);
writer
.
println
(
"}"
);
...
...
make/tools/src/build/tools/jdwpgen/AbstractTypeListNode.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998, 20
02
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
...
@@ -40,7 +40,7 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
...
@@ -40,7 +40,7 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
void
document
(
PrintWriter
writer
)
{
void
document
(
PrintWriter
writer
)
{
writer
.
println
(
"<dt>"
+
name
()
+
" Data"
);
writer
.
println
(
"<dt>"
+
name
()
+
" Data"
);
if
(
components
.
size
()
==
0
)
{
if
(
components
.
isEmpty
()
)
{
writer
.
println
(
"<dd>(None)"
);
writer
.
println
(
"<dd>(None)"
);
}
else
{
}
else
{
writer
.
println
(
"<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>"
);
writer
.
println
(
"<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>"
);
...
@@ -49,24 +49,24 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
...
@@ -49,24 +49,24 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
}
}
writer
.
println
(
"<th width=\"15%\"><th width=\"65%\">"
);
writer
.
println
(
"<th width=\"15%\"><th width=\"65%\">"
);
writer
.
println
(
""
);
writer
.
println
(
""
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
((
Node
)
it
.
next
())
.
document
(
writer
);
node
.
document
(
writer
);
}
}
writer
.
println
(
"</table>"
);
writer
.
println
(
"</table>"
);
}
}
}
}
void
genJavaClassBodyComponents
(
PrintWriter
writer
,
int
depth
)
{
void
genJavaClassBodyComponents
(
PrintWriter
writer
,
int
depth
)
{
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
TypeNode
tn
=
(
TypeNode
)
it
.
next
()
;
TypeNode
tn
=
(
TypeNode
)
node
;
tn
.
genJavaDeclaration
(
writer
,
depth
);
tn
.
genJavaDeclaration
(
writer
,
depth
);
}
}
}
}
void
genJavaReads
(
PrintWriter
writer
,
int
depth
)
{
void
genJavaReads
(
PrintWriter
writer
,
int
depth
)
{
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
TypeNode
tn
=
(
TypeNode
)
it
.
next
()
;
TypeNode
tn
=
(
TypeNode
)
node
;
tn
.
genJavaRead
(
writer
,
depth
,
tn
.
name
());
tn
.
genJavaRead
(
writer
,
depth
,
tn
.
name
());
}
}
}
}
...
@@ -88,7 +88,7 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
...
@@ -88,7 +88,7 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
String
javaParams
()
{
String
javaParams
()
{
StringBuffer
sb
=
new
StringBuffer
();
StringBuffer
sb
=
new
StringBuffer
();
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();)
{
for
(
Iterator
<
Node
>
it
=
components
.
iterator
();
it
.
hasNext
();)
{
TypeNode
tn
=
(
TypeNode
)
it
.
next
();
TypeNode
tn
=
(
TypeNode
)
it
.
next
();
sb
.
append
(
tn
.
javaParam
());
sb
.
append
(
tn
.
javaParam
());
if
(
it
.
hasNext
())
{
if
(
it
.
hasNext
())
{
...
@@ -99,8 +99,8 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
...
@@ -99,8 +99,8 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
}
}
void
genJavaWrites
(
PrintWriter
writer
,
int
depth
)
{
void
genJavaWrites
(
PrintWriter
writer
,
int
depth
)
{
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
TypeNode
tn
=
(
TypeNode
)
it
.
next
()
;
TypeNode
tn
=
(
TypeNode
)
node
;
tn
.
genJavaWrite
(
writer
,
depth
,
tn
.
name
());
tn
.
genJavaWrite
(
writer
,
depth
,
tn
.
name
());
}
}
}
}
...
@@ -111,8 +111,8 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
...
@@ -111,8 +111,8 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
writer
.
println
();
writer
.
println
();
indent
(
writer
,
depth
);
indent
(
writer
,
depth
);
writer
.
println
(
className
+
"("
+
javaParams
()
+
") {"
);
writer
.
println
(
className
+
"("
+
javaParams
()
+
") {"
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
TypeNode
tn
=
(
TypeNode
)
it
.
next
()
;
TypeNode
tn
=
(
TypeNode
)
node
;
indent
(
writer
,
depth
+
1
);
indent
(
writer
,
depth
+
1
);
writer
.
println
(
"this."
+
tn
.
name
()
+
" = "
+
tn
.
name
()
+
";"
);
writer
.
println
(
"this."
+
tn
.
name
()
+
" = "
+
tn
.
name
()
+
";"
);
}
}
...
...
make/tools/src/build/tools/jdwpgen/AltNode.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998,
1999
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
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
...
@@ -100,7 +100,7 @@ class AltNode extends AbstractGroupNode implements TypeNode {
...
@@ -100,7 +100,7 @@ class AltNode extends AbstractGroupNode implements TypeNode {
indent
(
writer
,
depth
+
1
);
indent
(
writer
,
depth
+
1
);
writer
.
print
(
"return new "
+
select
.
name
()
+
"("
);
writer
.
print
(
"return new "
+
select
.
name
()
+
"("
);
writer
.
print
(
"ALT_ID, new "
+
javaClassName
()
+
"("
);
writer
.
print
(
"ALT_ID, new "
+
javaClassName
()
+
"("
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();)
{
for
(
Iterator
<
Node
>
it
=
components
.
iterator
();
it
.
hasNext
();)
{
TypeNode
tn
=
(
TypeNode
)
it
.
next
();
TypeNode
tn
=
(
TypeNode
)
it
.
next
();
writer
.
print
(
tn
.
name
());
writer
.
print
(
tn
.
name
());
if
(
it
.
hasNext
())
{
if
(
it
.
hasNext
())
{
...
...
make/tools/src/build/tools/jdwpgen/CommandSetNode.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998,
1999
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
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
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
package
build.tools.jdwpgen
;
package
build.tools.jdwpgen
;
import
java.util.*
;
import
java.io.*
;
import
java.io.*
;
class
CommandSetNode
extends
AbstractNamedNode
{
class
CommandSetNode
extends
AbstractNamedNode
{
...
@@ -43,8 +42,8 @@ class CommandSetNode extends AbstractNamedNode {
...
@@ -43,8 +42,8 @@ class CommandSetNode extends AbstractNamedNode {
" Command Set</a> ("
+
" Command Set</a> ("
+
nameNode
.
value
()
+
")</h4>"
);
nameNode
.
value
()
+
")</h4>"
);
writer
.
println
(
comment
());
writer
.
println
(
comment
());
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
((
Node
)
it
.
next
())
.
document
(
writer
);
node
.
document
(
writer
);
}
}
}
}
...
@@ -53,8 +52,8 @@ class CommandSetNode extends AbstractNamedNode {
...
@@ -53,8 +52,8 @@ class CommandSetNode extends AbstractNamedNode {
writer
.
println
(
name
()
+
"</a> Command Set ("
+
writer
.
println
(
name
()
+
"</a> Command Set ("
+
nameNode
.
value
()
+
")"
);
nameNode
.
value
()
+
")"
);
writer
.
println
(
"<ul>"
);
writer
.
println
(
"<ul>"
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
((
Node
)
it
.
next
())
.
documentIndex
(
writer
);
node
.
documentIndex
(
writer
);
}
}
writer
.
println
(
"</ul>"
);
writer
.
println
(
"</ul>"
);
}
}
...
...
make/tools/src/build/tools/jdwpgen/ConstantSetNode.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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,14 +33,11 @@ class ConstantSetNode extends AbstractNamedNode {
...
@@ -33,14 +33,11 @@ class ConstantSetNode extends AbstractNamedNode {
/**
/**
* The mapping between a constant and its value.
* The mapping between a constant and its value.
*/
*/
protected
static
final
Map
<
String
,
String
>
constantMap
=
new
HashMap
<
String
,
String
>();
protected
static
final
Map
<
String
,
String
>
constantMap
=
new
HashMap
<>();
void
prune
()
{
void
prune
()
{
List
<
Node
>
addons
=
new
ArrayList
<
Node
>();
List
<
Node
>
addons
=
new
ArrayList
<>();
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
Node
node
=
(
Node
)
it
.
next
();
}
if
(!
addons
.
isEmpty
())
{
if
(!
addons
.
isEmpty
())
{
components
.
addAll
(
addons
);
components
.
addAll
(
addons
);
}
}
...
@@ -63,8 +60,8 @@ class ConstantSetNode extends AbstractNamedNode {
...
@@ -63,8 +60,8 @@ class ConstantSetNode extends AbstractNamedNode {
writer
.
println
(
"<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>"
);
writer
.
println
(
"<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>"
);
writer
.
println
(
"<th width=\"20%\"><th width=\"5%\"><th width=\"65%\">"
);
writer
.
println
(
"<th width=\"20%\"><th width=\"5%\"><th width=\"65%\">"
);
ConstantNode
n
;
ConstantNode
n
;
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
n
=
(
(
ConstantNode
)
it
.
next
())
;
n
=
(
ConstantNode
)
node
;
writer
.
println
(
"<a NAME=\""
+
name
+
"_"
+
n
.
name
+
"\"></a>"
);
writer
.
println
(
"<a NAME=\""
+
name
+
"_"
+
n
.
name
+
"\"></a>"
);
n
.
document
(
writer
);
n
.
document
(
writer
);
}
}
...
...
make/tools/src/build/tools/jdwpgen/ErrorSetNode.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2001, 20
02
, 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
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
package
build.tools.jdwpgen
;
package
build.tools.jdwpgen
;
import
java.util.*
;
import
java.io.*
;
import
java.io.*
;
class
ErrorSetNode
extends
AbstractSimpleNode
{
class
ErrorSetNode
extends
AbstractSimpleNode
{
...
@@ -41,12 +40,12 @@ class ErrorSetNode extends AbstractSimpleNode {
...
@@ -41,12 +40,12 @@ class ErrorSetNode extends AbstractSimpleNode {
void
document
(
PrintWriter
writer
)
{
void
document
(
PrintWriter
writer
)
{
writer
.
println
(
"<dt>"
+
"Error Data"
);
writer
.
println
(
"<dt>"
+
"Error Data"
);
if
(
components
.
size
()
==
0
)
{
if
(
components
.
isEmpty
()
)
{
writer
.
println
(
"<dd>(None)"
);
writer
.
println
(
"<dd>(None)"
);
}
else
{
}
else
{
writer
.
println
(
"<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\">"
);
writer
.
println
(
"<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\">"
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
((
Node
)
it
.
next
())
.
document
(
writer
);
node
.
document
(
writer
);
}
}
writer
.
println
(
"</table>"
);
writer
.
println
(
"</table>"
);
}
}
...
...
make/tools/src/build/tools/jdwpgen/Node.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998,
1999
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
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
...
@@ -34,7 +34,7 @@ abstract class Node {
...
@@ -34,7 +34,7 @@ abstract class Node {
String
kind
;
String
kind
;
List
<
Node
>
components
;
List
<
Node
>
components
;
int
lineno
;
int
lineno
;
List
<
String
>
commentList
=
new
ArrayList
<
String
>();
List
<
String
>
commentList
=
new
ArrayList
<>();
Node
parent
=
null
;
Node
parent
=
null
;
Context
context
=
null
;
Context
context
=
null
;
...
@@ -50,8 +50,8 @@ abstract class Node {
...
@@ -50,8 +50,8 @@ abstract class Node {
}
}
void
parentAndExtractComments
()
{
void
parentAndExtractComments
()
{
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();)
{
for
(
Iterator
<
Node
>
it
=
components
.
iterator
();
it
.
hasNext
();)
{
Node
node
=
(
Node
)
it
.
next
();
Node
node
=
it
.
next
();
if
(
node
instanceof
CommentNode
)
{
if
(
node
instanceof
CommentNode
)
{
it
.
remove
();
it
.
remove
();
commentList
.
add
(((
CommentNode
)
node
).
text
());
commentList
.
add
(((
CommentNode
)
node
).
text
());
...
@@ -63,16 +63,14 @@ abstract class Node {
...
@@ -63,16 +63,14 @@ abstract class Node {
}
}
void
prune
()
{
void
prune
()
{
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();)
{
for
(
Node
node
:
components
)
{
Node
node
=
(
Node
)
it
.
next
();
node
.
prune
();
node
.
prune
();
}
}
}
}
void
constrain
(
Context
ctx
)
{
void
constrain
(
Context
ctx
)
{
context
=
ctx
;
context
=
ctx
;
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();)
{
for
(
Node
node
:
components
)
{
Node
node
=
(
Node
)
it
.
next
();
constrainComponent
(
ctx
,
node
);
constrainComponent
(
ctx
,
node
);
}
}
}
}
...
@@ -109,9 +107,9 @@ abstract class Node {
...
@@ -109,9 +107,9 @@ abstract class Node {
if
(
commentList
.
size
()
>
0
)
{
if
(
commentList
.
size
()
>
0
)
{
indent
(
writer
,
depth
);
indent
(
writer
,
depth
);
writer
.
println
(
"/**"
);
writer
.
println
(
"/**"
);
for
(
Iterator
it
=
commentList
.
iterator
();
it
.
hasNext
();
)
{
for
(
String
comment
:
commentList
)
{
indent
(
writer
,
depth
);
indent
(
writer
,
depth
);
writer
.
println
(
" * "
+
(
String
)
it
.
next
()
);
writer
.
println
(
" * "
+
comment
);
}
}
indent
(
writer
,
depth
);
indent
(
writer
,
depth
);
writer
.
println
(
" */"
);
writer
.
println
(
" */"
);
...
@@ -123,15 +121,13 @@ abstract class Node {
...
@@ -123,15 +121,13 @@ abstract class Node {
}
}
void
genJava
(
PrintWriter
writer
,
int
depth
)
{
void
genJava
(
PrintWriter
writer
,
int
depth
)
{
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();)
{
for
(
Node
node
:
components
)
{
Node
node
=
(
Node
)
it
.
next
();
node
.
genJava
(
writer
,
depth
);
node
.
genJava
(
writer
,
depth
);
}
}
}
}
void
genCInclude
(
PrintWriter
writer
)
{
void
genCInclude
(
PrintWriter
writer
)
{
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();)
{
for
(
Node
node
:
components
)
{
Node
node
=
(
Node
)
it
.
next
();
node
.
genCInclude
(
writer
);
node
.
genCInclude
(
writer
);
}
}
}
}
...
@@ -184,8 +180,7 @@ abstract class Node {
...
@@ -184,8 +180,7 @@ abstract class Node {
}
}
void
genJavaPreDef
(
PrintWriter
writer
,
int
depth
)
{
void
genJavaPreDef
(
PrintWriter
writer
,
int
depth
)
{
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();)
{
for
(
Node
node
:
components
)
{
Node
node
=
(
Node
)
it
.
next
();
node
.
genJavaPreDef
(
writer
,
depth
);
node
.
genJavaPreDef
(
writer
,
depth
);
}
}
}
}
...
...
make/tools/src/build/tools/jdwpgen/OutNode.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998,
1999
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
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
...
@@ -48,8 +48,8 @@ class OutNode extends AbstractTypeListNode {
...
@@ -48,8 +48,8 @@ class OutNode extends AbstractTypeListNode {
indent
(
writer
,
depth
);
indent
(
writer
,
depth
);
writer
.
print
(
writer
.
print
(
"static "
+
cmdName
+
" process(VirtualMachineImpl vm"
);
"static "
+
cmdName
+
" process(VirtualMachineImpl vm"
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
TypeNode
tn
=
(
TypeNode
)
it
.
next
()
;
TypeNode
tn
=
(
TypeNode
)
node
;
writer
.
println
(
", "
);
writer
.
println
(
", "
);
indent
(
writer
,
depth
+
5
);
indent
(
writer
,
depth
+
5
);
writer
.
print
(
tn
.
javaParam
());
writer
.
print
(
tn
.
javaParam
());
...
@@ -59,8 +59,8 @@ class OutNode extends AbstractTypeListNode {
...
@@ -59,8 +59,8 @@ class OutNode extends AbstractTypeListNode {
writer
.
println
(
"throws JDWPException {"
);
writer
.
println
(
"throws JDWPException {"
);
indent
(
writer
,
depth
+
1
);
indent
(
writer
,
depth
+
1
);
writer
.
print
(
"PacketStream ps = enqueueCommand(vm"
);
writer
.
print
(
"PacketStream ps = enqueueCommand(vm"
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
TypeNode
tn
=
(
TypeNode
)
it
.
next
()
;
TypeNode
tn
=
(
TypeNode
)
node
;
writer
.
print
(
", "
);
writer
.
print
(
", "
);
writer
.
print
(
tn
.
name
());
writer
.
print
(
tn
.
name
());
}
}
...
@@ -76,8 +76,8 @@ class OutNode extends AbstractTypeListNode {
...
@@ -76,8 +76,8 @@ class OutNode extends AbstractTypeListNode {
indent
(
writer
,
depth
);
indent
(
writer
,
depth
);
writer
.
print
(
writer
.
print
(
"static PacketStream enqueueCommand(VirtualMachineImpl vm"
);
"static PacketStream enqueueCommand(VirtualMachineImpl vm"
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
TypeNode
tn
=
(
TypeNode
)
it
.
next
()
;
TypeNode
tn
=
(
TypeNode
)
node
;
writer
.
println
(
", "
);
writer
.
println
(
", "
);
indent
(
writer
,
depth
+
5
);
indent
(
writer
,
depth
+
5
);
writer
.
print
(
tn
.
javaParam
());
writer
.
print
(
tn
.
javaParam
());
...
...
make/tools/src/build/tools/jdwpgen/RootNode.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998,
1999
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
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
...
@@ -42,11 +42,11 @@ class RootNode extends AbstractNamedNode {
...
@@ -42,11 +42,11 @@ class RootNode extends AbstractNamedNode {
void
document
(
PrintWriter
writer
)
{
void
document
(
PrintWriter
writer
)
{
writer
.
println
(
"<html><head><title>"
+
comment
()
+
"</title></head>"
);
writer
.
println
(
"<html><head><title>"
+
comment
()
+
"</title></head>"
);
writer
.
println
(
"<body bgcolor=\"white\">"
);
writer
.
println
(
"<body bgcolor=\"white\">"
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
((
Node
)
it
.
next
())
.
documentIndex
(
writer
);
node
.
documentIndex
(
writer
);
}
}
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
((
Node
)
it
.
next
())
.
document
(
writer
);
node
.
document
(
writer
);
}
}
writer
.
println
(
"</body></html>"
);
writer
.
println
(
"</body></html>"
);
}
}
...
...
make/tools/src/build/tools/jdwpgen/SelectNode.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1998,
1999
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998,
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
...
@@ -34,10 +34,10 @@ class SelectNode extends AbstractGroupNode implements TypeNode {
...
@@ -34,10 +34,10 @@ class SelectNode extends AbstractGroupNode implements TypeNode {
void
prune
()
{
void
prune
()
{
super
.
prune
();
super
.
prune
();
Iterator
it
=
components
.
iterator
();
Iterator
<
Node
>
it
=
components
.
iterator
();
if
(
it
.
hasNext
())
{
if
(
it
.
hasNext
())
{
Node
typeNode
=
(
Node
)
it
.
next
();
Node
typeNode
=
it
.
next
();
if
(
typeNode
instanceof
ByteTypeNode
||
if
(
typeNode
instanceof
ByteTypeNode
||
typeNode
instanceof
IntTypeNode
)
{
typeNode
instanceof
IntTypeNode
)
{
...
@@ -131,8 +131,8 @@ class SelectNode extends AbstractGroupNode implements TypeNode {
...
@@ -131,8 +131,8 @@ class SelectNode extends AbstractGroupNode implements TypeNode {
typeNode
.
genJavaRead
(
writer
,
depth
,
typeNode
.
name
());
typeNode
.
genJavaRead
(
writer
,
depth
,
typeNode
.
name
());
indent
(
writer
,
depth
);
indent
(
writer
,
depth
);
writer
.
println
(
"switch ("
+
typeNode
.
name
()
+
") {"
);
writer
.
println
(
"switch ("
+
typeNode
.
name
()
+
") {"
);
for
(
Iterator
it
=
components
.
iterator
();
it
.
hasNext
();
)
{
for
(
Node
node
:
components
)
{
AltNode
alt
=
(
AltNode
)
it
.
next
()
;
AltNode
alt
=
(
AltNode
)
node
;
alt
.
genJavaReadsSelectCase
(
writer
,
depth
+
1
,
commonVar
());
alt
.
genJavaReadsSelectCase
(
writer
,
depth
+
1
,
commonVar
());
}
}
indent
(
writer
,
depth
);
indent
(
writer
,
depth
);
...
...
make/tools/src/build/tools/makeclasslist/MakeClasslist.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2003, 20
06
, 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
...
@@ -38,7 +38,7 @@ import java.util.jar.*;
...
@@ -38,7 +38,7 @@ import java.util.jar.*;
public
class
MakeClasslist
{
public
class
MakeClasslist
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
List
/*<String>*/
classes
=
new
ArrayList
();
List
<
String
>
classes
=
new
ArrayList
<>
();
String
origJavaHome
=
System
.
getProperty
(
"java.home"
);
String
origJavaHome
=
System
.
getProperty
(
"java.home"
);
String
javaHome
=
origJavaHome
.
toLowerCase
();
String
javaHome
=
origJavaHome
.
toLowerCase
();
if
(
javaHome
.
endsWith
(
"jre"
))
{
if
(
javaHome
.
endsWith
(
"jre"
))
{
...
@@ -84,10 +84,9 @@ public class MakeClasslist {
...
@@ -84,10 +84,9 @@ public class MakeClasslist {
}
}
}
}
Set
/*<String>*/
seenClasses
=
new
HashSet
();
Set
<
String
>
seenClasses
=
new
HashSet
<>
();
for
(
Iterator
iter
=
classes
.
iterator
();
iter
.
hasNext
();
)
{
for
(
String
str
:
seenClasses
)
{
String
str
=
(
String
)
iter
.
next
();
if
(
seenClasses
.
add
(
str
))
{
if
(
seenClasses
.
add
(
str
))
{
System
.
out
.
println
(
str
);
System
.
out
.
println
(
str
);
}
}
...
@@ -109,13 +108,13 @@ public class MakeClasslist {
...
@@ -109,13 +108,13 @@ public class MakeClasslist {
// completePackage(seenClasses, rtJar, "java/lang");
// completePackage(seenClasses, rtJar, "java/lang");
}
}
private
static
void
completePackage
(
Set
seenClasses
,
private
static
void
completePackage
(
Set
<
String
>
seenClasses
,
JarFile
jar
,
JarFile
jar
,
String
packageName
)
{
String
packageName
)
{
int
len
=
packageName
.
length
();
int
len
=
packageName
.
length
();
Enumeration
entries
=
jar
.
entries
();
Enumeration
<
JarEntry
>
entries
=
jar
.
entries
();
while
(
entries
.
hasMoreElements
())
{
while
(
entries
.
hasMoreElements
())
{
JarEntry
entry
=
(
JarEntry
)
entries
.
nextElement
();
JarEntry
entry
=
entries
.
nextElement
();
String
name
=
entry
.
getName
();
String
name
=
entry
.
getName
();
if
(
name
.
startsWith
(
packageName
)
&&
if
(
name
.
startsWith
(
packageName
)
&&
name
.
endsWith
(
".class"
)
&&
name
.
endsWith
(
".class"
)
&&
...
...
make/tools/src/build/tools/stripproperties/StripProperties.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001,
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
...
@@ -246,7 +246,7 @@ public class StripProperties {
...
@@ -246,7 +246,7 @@ public class StripProperties {
throws
IOException
{
throws
IOException
{
BufferedWriter
awriter
;
BufferedWriter
awriter
;
awriter
=
new
BufferedWriter
(
new
OutputStreamWriter
(
out
,
"8859_1"
));
awriter
=
new
BufferedWriter
(
new
OutputStreamWriter
(
out
,
"8859_1"
));
for
(
Enumeration
e
=
properties
.
keys
();
e
.
hasMoreElements
();)
{
for
(
Enumeration
<
Object
>
e
=
properties
.
keys
();
e
.
hasMoreElements
();)
{
String
key
=
(
String
)
e
.
nextElement
();
String
key
=
(
String
)
e
.
nextElement
();
String
val
=
(
String
)
properties
.
get
(
key
);
String
val
=
(
String
)
properties
.
get
(
key
);
key
=
saveConvert
(
key
,
true
);
key
=
saveConvert
(
key
,
true
);
...
...
src/share/classes/com/sun/java/util/jar/pack/Attribute.java
浏览文件 @
92fd97c5
/*
/*
* 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
...
@@ -45,7 +45,7 @@ import static com.sun.java.util.jar.pack.Constants.*;
...
@@ -45,7 +45,7 @@ import static com.sun.java.util.jar.pack.Constants.*;
* attribute layouts.
* attribute layouts.
* @author John Rose
* @author John Rose
*/
*/
class
Attribute
implements
Comparable
{
class
Attribute
implements
Comparable
<
Attribute
>
{
// Attribute instance fields.
// Attribute instance fields.
Layout
def
;
// the name and format of this attr
Layout
def
;
// the name and format of this attr
...
@@ -99,8 +99,7 @@ class Attribute implements Comparable {
...
@@ -99,8 +99,7 @@ class Attribute implements Comparable {
return
this
==
def
.
canon
;
return
this
==
def
.
canon
;
}
}
public
int
compareTo
(
Object
o
)
{
public
int
compareTo
(
Attribute
that
)
{
Attribute
that
=
(
Attribute
)
o
;
return
this
.
def
.
compareTo
(
that
.
def
);
return
this
.
def
.
compareTo
(
that
.
def
);
}
}
...
@@ -447,7 +446,7 @@ class Attribute implements Comparable {
...
@@ -447,7 +446,7 @@ class Attribute implements Comparable {
* and format. The formats are specified in a "little language".
* and format. The formats are specified in a "little language".
*/
*/
public
static
public
static
class
Layout
implements
Comparable
{
class
Layout
implements
Comparable
<
Layout
>
{
int
ctype
;
// attribute context type, e.g., ATTR_CONTEXT_CODE
int
ctype
;
// attribute context type, e.g., ATTR_CONTEXT_CODE
String
name
;
// name of attribute
String
name
;
// name of attribute
boolean
hasRefs
;
// this kind of attr contains CP refs?
boolean
hasRefs
;
// this kind of attr contains CP refs?
...
@@ -540,8 +539,7 @@ class Attribute implements Comparable {
...
@@ -540,8 +539,7 @@ class Attribute implements Comparable {
*
37
+
layout
.
hashCode
())
*
37
+
layout
.
hashCode
())
*
37
+
ctype
);
*
37
+
ctype
);
}
}
public
int
compareTo
(
Object
o
)
{
public
int
compareTo
(
Layout
that
)
{
Layout
that
=
(
Layout
)
o
;
int
r
;
int
r
;
r
=
this
.
name
.
compareTo
(
that
.
name
);
r
=
this
.
name
.
compareTo
(
that
.
name
);
if
(
r
!=
0
)
return
r
;
if
(
r
!=
0
)
return
r
;
...
@@ -663,6 +661,8 @@ class Attribute implements Comparable {
...
@@ -663,6 +661,8 @@ class Attribute implements Comparable {
public
static
public
static
class
FormatException
extends
IOException
{
class
FormatException
extends
IOException
{
private
static
final
long
serialVersionUID
=
-
2542243830788066513L
;
private
int
ctype
;
private
int
ctype
;
private
String
name
;
private
String
name
;
String
layout
;
String
layout
;
...
...
src/share/classes/com/sun/java/util/jar/pack/BandStructure.java
浏览文件 @
92fd97c5
...
@@ -1704,7 +1704,7 @@ class BandStructure {
...
@@ -1704,7 +1704,7 @@ class BandStructure {
for
(
int
i
=
0
;
i
<
ATTR_CONTEXT_LIMIT
;
i
++)
{
for
(
int
i
=
0
;
i
<
ATTR_CONTEXT_LIMIT
;
i
++)
{
assert
(
attrIndexLimit
[
i
]
==
0
);
assert
(
attrIndexLimit
[
i
]
==
0
);
attrIndexLimit
[
i
]
=
32
;
// just for the sake of predefs.
attrIndexLimit
[
i
]
=
32
;
// just for the sake of predefs.
attrDefs
.
set
(
i
,
new
ArrayList
<
Attribute
.
Layout
>(
Collections
.
nCopies
(
attrDefs
.
set
(
i
,
new
ArrayList
<>(
Collections
.
nCopies
(
attrIndexLimit
[
i
],
(
Attribute
.
Layout
)
null
)));
attrIndexLimit
[
i
],
(
Attribute
.
Layout
)
null
)));
}
}
...
@@ -1892,7 +1892,7 @@ class BandStructure {
...
@@ -1892,7 +1892,7 @@ class BandStructure {
return
testBit
(
archiveOptions
,
mask
);
return
testBit
(
archiveOptions
,
mask
);
}
}
protected
List
getPredefinedAttrs
(
int
ctype
)
{
protected
List
<
Attribute
.
Layout
>
getPredefinedAttrs
(
int
ctype
)
{
assert
(
attrIndexLimit
[
ctype
]
!=
0
);
assert
(
attrIndexLimit
[
ctype
]
!=
0
);
List
<
Attribute
.
Layout
>
res
=
new
ArrayList
<>(
attrIndexLimit
[
ctype
]);
List
<
Attribute
.
Layout
>
res
=
new
ArrayList
<>(
attrIndexLimit
[
ctype
]);
// Remove nulls and non-predefs.
// Remove nulls and non-predefs.
...
@@ -2649,7 +2649,7 @@ class BandStructure {
...
@@ -2649,7 +2649,7 @@ class BandStructure {
// Utilities for reallocating:
// Utilities for reallocating:
protected
static
Object
[]
realloc
(
Object
[]
a
,
int
len
)
{
protected
static
Object
[]
realloc
(
Object
[]
a
,
int
len
)
{
java
.
lang
.
Class
elt
=
a
.
getClass
().
getComponentType
();
java
.
lang
.
Class
<?>
elt
=
a
.
getClass
().
getComponentType
();
Object
[]
na
=
(
Object
[])
java
.
lang
.
reflect
.
Array
.
newInstance
(
elt
,
len
);
Object
[]
na
=
(
Object
[])
java
.
lang
.
reflect
.
Array
.
newInstance
(
elt
,
len
);
System
.
arraycopy
(
a
,
0
,
na
,
0
,
Math
.
min
(
a
.
length
,
len
));
System
.
arraycopy
(
a
,
0
,
na
,
0
,
Math
.
min
(
a
.
length
,
len
));
return
na
;
return
na
;
...
...
src/share/classes/com/sun/java/util/jar/pack/ClassReader.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2001, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
...
@@ -52,7 +52,7 @@ class ClassReader {
...
@@ -52,7 +52,7 @@ class ClassReader {
long
inPos
;
long
inPos
;
DataInputStream
in
;
DataInputStream
in
;
Map
<
Attribute
.
Layout
,
Attribute
>
attrDefs
;
Map
<
Attribute
.
Layout
,
Attribute
>
attrDefs
;
Map
attrCommands
;
Map
<
Attribute
.
Layout
,
String
>
attrCommands
;
String
unknownAttrCommand
=
"error"
;;
String
unknownAttrCommand
=
"error"
;;
ClassReader
(
Class
cls
,
InputStream
in
)
throws
IOException
{
ClassReader
(
Class
cls
,
InputStream
in
)
throws
IOException
{
...
@@ -82,7 +82,7 @@ class ClassReader {
...
@@ -82,7 +82,7 @@ class ClassReader {
this
.
attrDefs
=
attrDefs
;
this
.
attrDefs
=
attrDefs
;
}
}
public
void
setAttrCommands
(
Map
attrCommands
)
{
public
void
setAttrCommands
(
Map
<
Attribute
.
Layout
,
String
>
attrCommands
)
{
this
.
attrCommands
=
attrCommands
;
this
.
attrCommands
=
attrCommands
;
}
}
...
@@ -348,8 +348,8 @@ class ClassReader {
...
@@ -348,8 +348,8 @@ class ClassReader {
int
length
=
readInt
();
int
length
=
readInt
();
// See if there is a special command that applies.
// See if there is a special command that applies.
if
(
attrCommands
!=
null
)
{
if
(
attrCommands
!=
null
)
{
Objec
t
lkey
=
Attribute
.
keyForLookup
(
ctype
,
name
);
Attribute
.
Layou
t
lkey
=
Attribute
.
keyForLookup
(
ctype
,
name
);
String
cmd
=
(
String
)
attrCommands
.
get
(
lkey
);
String
cmd
=
attrCommands
.
get
(
lkey
);
if
(
cmd
!=
null
)
{
if
(
cmd
!=
null
)
{
switch
(
cmd
)
{
switch
(
cmd
)
{
case
"pass"
:
case
"pass"
:
...
@@ -483,6 +483,8 @@ class ClassReader {
...
@@ -483,6 +483,8 @@ class ClassReader {
}
}
static
class
ClassFormatException
extends
IOException
{
static
class
ClassFormatException
extends
IOException
{
private
static
final
long
serialVersionUID
=
-
3564121733989501833L
;
public
ClassFormatException
(
String
message
)
{
public
ClassFormatException
(
String
message
)
{
super
(
message
);
super
(
message
);
}
}
...
...
src/share/classes/com/sun/java/util/jar/pack/ClassWriter.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2001, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
...
@@ -36,7 +36,6 @@ import java.io.ByteArrayOutputStream;
...
@@ -36,7 +36,6 @@ import java.io.ByteArrayOutputStream;
import
java.io.DataOutputStream
;
import
java.io.DataOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
static
com
.
sun
.
java
.
util
.
jar
.
pack
.
Constants
.*;
import
static
com
.
sun
.
java
.
util
.
jar
.
pack
.
Constants
.*;
/**
/**
...
@@ -165,14 +164,13 @@ class ClassWriter {
...
@@ -165,14 +164,13 @@ class ClassWriter {
}
}
void
writeMembers
(
boolean
doMethods
)
throws
IOException
{
void
writeMembers
(
boolean
doMethods
)
throws
IOException
{
List
mems
;
List
<?
extends
Class
.
Member
>
mems
;
if
(!
doMethods
)
if
(!
doMethods
)
mems
=
cls
.
getFields
();
mems
=
cls
.
getFields
();
else
else
mems
=
cls
.
getMethods
();
mems
=
cls
.
getMethods
();
writeShort
(
mems
.
size
());
writeShort
(
mems
.
size
());
for
(
Iterator
i
=
mems
.
iterator
();
i
.
hasNext
();
)
{
for
(
Class
.
Member
m
:
mems
)
{
Class
.
Member
m
=
(
Class
.
Member
)
i
.
next
();
writeMember
(
m
,
doMethods
);
writeMember
(
m
,
doMethods
);
}
}
}
}
...
...
src/share/classes/com/sun/java/util/jar/pack/Code.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2001, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
...
@@ -125,7 +125,7 @@ class Code extends Attribute.Holder {
...
@@ -125,7 +125,7 @@ class Code extends Attribute.Holder {
return
expandInstructionMap
(
getInsnMap
());
return
expandInstructionMap
(
getInsnMap
());
}
}
void
addFixups
(
Collection
moreFixups
)
{
void
addFixups
(
Collection
<
Fixups
.
Fixup
>
moreFixups
)
{
if
(
fixups
==
null
)
{
if
(
fixups
==
null
)
{
fixups
=
new
Fixups
(
bytes
);
fixups
=
new
Fixups
(
bytes
);
}
}
...
...
src/share/classes/com/sun/java/util/jar/pack/Coding.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2001, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
...
@@ -37,7 +37,7 @@ import static com.sun.java.util.jar.pack.Constants.*;
...
@@ -37,7 +37,7 @@ import static com.sun.java.util.jar.pack.Constants.*;
* varying degrees of length variability, and varying amounts of signed-ness.
* varying degrees of length variability, and varying amounts of signed-ness.
* @author John Rose
* @author John Rose
*/
*/
class
Coding
implements
Comparable
,
CodingMethod
,
Histogram
.
BitMetric
{
class
Coding
implements
Comparable
<
Coding
>
,
CodingMethod
,
Histogram
.
BitMetric
{
/*
/*
Coding schema for single integers, parameterized by (B,H,S):
Coding schema for single integers, parameterized by (B,H,S):
...
@@ -605,8 +605,7 @@ class Coding implements Comparable, CodingMethod, Histogram.BitMetric {
...
@@ -605,8 +605,7 @@ class Coding implements Comparable, CodingMethod, Histogram.BitMetric {
public
int
byteMin
(
int
b
)
{
return
byteMin
[
b
-
1
];
}
public
int
byteMin
(
int
b
)
{
return
byteMin
[
b
-
1
];
}
public
int
byteMax
(
int
b
)
{
return
byteMax
[
b
-
1
];
}
public
int
byteMax
(
int
b
)
{
return
byteMax
[
b
-
1
];
}
public
int
compareTo
(
Object
x
)
{
public
int
compareTo
(
Coding
that
)
{
Coding
that
=
(
Coding
)
x
;
int
dkey
=
this
.
del
-
that
.
del
;
int
dkey
=
this
.
del
-
that
.
del
;
if
(
dkey
==
0
)
if
(
dkey
==
0
)
dkey
=
this
.
B
-
that
.
B
;
dkey
=
this
.
B
-
that
.
B
;
...
...
src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2001, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
...
@@ -72,7 +72,7 @@ class ConstantPool {
...
@@ -72,7 +72,7 @@ class ConstantPool {
return
e
;
return
e
;
}
}
/** Factory for literal constants (String, Integer, etc.). */
/** Factory for literal constants (String, Integer, etc.). */
public
static
synchronized
LiteralEntry
getLiteralEntry
(
Comparable
value
)
{
public
static
synchronized
LiteralEntry
getLiteralEntry
(
Comparable
<?>
value
)
{
Map
<
Object
,
LiteralEntry
>
literalEntries
=
Utils
.
getLiteralEntries
();
Map
<
Object
,
LiteralEntry
>
literalEntries
=
Utils
.
getLiteralEntries
();
LiteralEntry
e
=
literalEntries
.
get
(
value
);
LiteralEntry
e
=
literalEntries
.
get
(
value
);
if
(
e
==
null
)
{
if
(
e
==
null
)
{
...
@@ -140,7 +140,7 @@ class ConstantPool {
...
@@ -140,7 +140,7 @@ class ConstantPool {
/** Entries in the constant pool. */
/** Entries in the constant pool. */
public
static
abstract
public
static
abstract
class
Entry
implements
Comparable
{
class
Entry
implements
Comparable
<
Object
>
{
protected
final
byte
tag
;
// a CONSTANT_foo code
protected
final
byte
tag
;
// a CONSTANT_foo code
protected
int
valueHash
;
// cached hashCode
protected
int
valueHash
;
// cached hashCode
...
@@ -257,7 +257,7 @@ class ConstantPool {
...
@@ -257,7 +257,7 @@ class ConstantPool {
super
(
tag
);
super
(
tag
);
}
}
public
abstract
Comparable
literalValue
();
public
abstract
Comparable
<?>
literalValue
();
}
}
public
static
public
static
...
@@ -280,15 +280,17 @@ class ConstantPool {
...
@@ -280,15 +280,17 @@ class ConstantPool {
public
int
compareTo
(
Object
o
)
{
public
int
compareTo
(
Object
o
)
{
int
x
=
superCompareTo
(
o
);
int
x
=
superCompareTo
(
o
);
if
(
x
==
0
)
{
if
(
x
==
0
)
{
x
=
((
Comparable
)
value
).
compareTo
(((
NumberEntry
)
o
).
value
);
@SuppressWarnings
(
"unchecked"
)
Comparable
<
Number
>
compValue
=
(
Comparable
<
Number
>)
value
;
x
=
compValue
.
compareTo
(((
NumberEntry
)
o
).
value
);
}
}
return
x
;
return
x
;
}
}
public
Number
numberValue
()
{
public
Number
numberValue
()
{
return
value
;
return
value
;
}
}
public
Comparable
literalValue
()
{
public
Comparable
<?>
literalValue
()
{
return
(
Comparable
)
value
;
return
(
Comparable
<?>
)
value
;
}
}
public
String
stringValue
()
{
public
String
stringValue
()
{
return
value
.
toString
();
return
value
.
toString
();
...
@@ -319,7 +321,7 @@ class ConstantPool {
...
@@ -319,7 +321,7 @@ class ConstantPool {
}
}
return
x
;
return
x
;
}
}
public
Comparable
literalValue
()
{
public
Comparable
<?>
literalValue
()
{
return
ref
.
stringValue
();
return
ref
.
stringValue
();
}
}
public
String
stringValue
()
{
public
String
stringValue
()
{
...
@@ -728,7 +730,7 @@ class ConstantPool {
...
@@ -728,7 +730,7 @@ class ConstantPool {
/** An Index is a mapping between CP entries and small integers. */
/** An Index is a mapping between CP entries and small integers. */
public
static
final
public
static
final
class
Index
extends
AbstractList
{
class
Index
extends
AbstractList
<
Entry
>
{
protected
String
debugName
;
protected
String
debugName
;
protected
Entry
[]
cpMap
;
protected
Entry
[]
cpMap
;
protected
boolean
flattenSigs
;
protected
boolean
flattenSigs
;
...
@@ -758,7 +760,7 @@ class ConstantPool {
...
@@ -758,7 +760,7 @@ class ConstantPool {
public
int
size
()
{
public
int
size
()
{
return
cpMap
.
length
;
return
cpMap
.
length
;
}
}
public
Object
get
(
int
i
)
{
public
Entry
get
(
int
i
)
{
return
cpMap
[
i
];
return
cpMap
[
i
];
}
}
public
Entry
getEntry
(
int
i
)
{
public
Entry
getEntry
(
int
i
)
{
...
@@ -803,13 +805,7 @@ class ConstantPool {
...
@@ -803,13 +805,7 @@ class ConstantPool {
assert
(
index
>=
0
);
assert
(
index
>=
0
);
return
index
;
return
index
;
}
}
public
boolean
contains
(
Object
e
)
{
public
int
lastIndexOf
(
Entry
e
)
{
return
findIndexOf
((
Entry
)
e
)
>=
0
;
}
public
int
indexOf
(
Object
e
)
{
return
findIndexOf
((
Entry
)
e
);
}
public
int
lastIndexOf
(
Object
e
)
{
return
indexOf
(
e
);
return
indexOf
(
e
);
}
}
...
@@ -862,14 +858,14 @@ class ConstantPool {
...
@@ -862,14 +858,14 @@ class ConstantPool {
indexValue
[
probe
]
=
i
;
indexValue
[
probe
]
=
i
;
}
}
}
}
public
Object
[]
toArray
(
Object
[]
a
)
{
public
Entry
[]
toArray
(
Entry
[]
a
)
{
int
sz
=
size
();
int
sz
=
size
();
if
(
a
.
length
<
sz
)
return
super
.
toArray
(
a
);
if
(
a
.
length
<
sz
)
return
super
.
toArray
(
a
);
System
.
arraycopy
(
cpMap
,
0
,
a
,
0
,
sz
);
System
.
arraycopy
(
cpMap
,
0
,
a
,
0
,
sz
);
if
(
a
.
length
>
sz
)
a
[
sz
]
=
null
;
if
(
a
.
length
>
sz
)
a
[
sz
]
=
null
;
return
a
;
return
a
;
}
}
public
Object
[]
toArray
()
{
public
Entry
[]
toArray
()
{
return
toArray
(
new
Entry
[
size
()]);
return
toArray
(
new
Entry
[
size
()]);
}
}
public
Object
clone
()
{
public
Object
clone
()
{
...
...
src/share/classes/com/sun/java/util/jar/pack/Constants.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2001, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
...
@@ -157,7 +157,7 @@ class Constants {
...
@@ -157,7 +157,7 @@ class Constants {
public
final
static
byte
[]
noBytes
=
{};
public
final
static
byte
[]
noBytes
=
{};
public
final
static
Object
[]
noValues
=
{};
public
final
static
Object
[]
noValues
=
{};
public
final
static
String
[]
noStrings
=
{};
public
final
static
String
[]
noStrings
=
{};
public
final
static
List
emptyList
=
Arrays
.
asList
(
noValues
);
public
final
static
List
<
Object
>
emptyList
=
Arrays
.
asList
(
noValues
);
// meta-coding
// meta-coding
public
final
static
int
public
final
static
int
...
...
src/share/classes/com/sun/java/util/jar/pack/Fixups.java
浏览文件 @
92fd97c5
/*
/*
* 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
...
@@ -42,7 +42,7 @@ import java.util.Iterator;
...
@@ -42,7 +42,7 @@ import java.util.Iterator;
*
*
* @author John Rose
* @author John Rose
*/
*/
final
class
Fixups
extends
AbstractCollection
{
final
class
Fixups
extends
AbstractCollection
<
Fixups
.
Fixup
>
{
byte
[]
bytes
;
// the subject of the relocations
byte
[]
bytes
;
// the subject of the relocations
int
head
;
// desc locating first reloc
int
head
;
// desc locating first reloc
int
tail
;
// desc locating last reloc
int
tail
;
// desc locating last reloc
...
@@ -66,11 +66,11 @@ final class Fixups extends AbstractCollection {
...
@@ -66,11 +66,11 @@ final class Fixups extends AbstractCollection {
// If there are no bytes, all descs are kept in bigDescs.
// If there are no bytes, all descs are kept in bigDescs.
this
((
byte
[])
null
);
this
((
byte
[])
null
);
}
}
Fixups
(
byte
[]
bytes
,
Collection
fixups
)
{
Fixups
(
byte
[]
bytes
,
Collection
<
Fixup
>
fixups
)
{
this
(
bytes
);
this
(
bytes
);
addAll
(
fixups
);
addAll
(
fixups
);
}
}
Fixups
(
Collection
fixups
)
{
Fixups
(
Collection
<
Fixup
>
fixups
)
{
this
((
byte
[])
null
);
this
((
byte
[])
null
);
addAll
(
fixups
);
addAll
(
fixups
);
}
}
...
@@ -108,8 +108,7 @@ final class Fixups extends AbstractCollection {
...
@@ -108,8 +108,7 @@ final class Fixups extends AbstractCollection {
public
void
clear
()
{
public
void
clear
()
{
if
(
bytes
!=
null
)
{
if
(
bytes
!=
null
)
{
// Clean the bytes:
// Clean the bytes:
for
(
Iterator
i
=
iterator
();
i
.
hasNext
();
)
{
for
(
Fixup
fx
:
this
)
{
Fixup
fx
=
(
Fixup
)
i
.
next
();
//System.out.println("clean "+fx);
//System.out.println("clean "+fx);
storeIndex
(
fx
.
location
(),
fx
.
format
(),
0
);
storeIndex
(
fx
.
location
(),
fx
.
format
(),
0
);
}
}
...
@@ -124,15 +123,14 @@ final class Fixups extends AbstractCollection {
...
@@ -124,15 +123,14 @@ final class Fixups extends AbstractCollection {
return
bytes
;
return
bytes
;
}
}
@SuppressWarnings
(
"unchecked"
)
public
void
setBytes
(
byte
[]
newBytes
)
{
public
void
setBytes
(
byte
[]
newBytes
)
{
if
(
bytes
==
newBytes
)
return
;
if
(
bytes
==
newBytes
)
return
;
ArrayList
old
=
null
;
ArrayList
<
Fixup
>
old
=
null
;
assert
((
old
=
new
ArrayList
(
this
))
!=
null
);
assert
((
old
=
new
ArrayList
<>
(
this
))
!=
null
);
if
(
bytes
==
null
||
newBytes
==
null
)
{
if
(
bytes
==
null
||
newBytes
==
null
)
{
// One or the other representations is deficient.
// One or the other representations is deficient.
// Construct a checkpoint.
// Construct a checkpoint.
ArrayList
save
=
new
ArrayList
(
this
);
ArrayList
<
Fixup
>
save
=
new
ArrayList
<>
(
this
);
clear
();
clear
();
bytes
=
newBytes
;
bytes
=
newBytes
;
addAll
(
save
);
addAll
(
save
);
...
@@ -140,7 +138,7 @@ final class Fixups extends AbstractCollection {
...
@@ -140,7 +138,7 @@ final class Fixups extends AbstractCollection {
// assume newBytes is some sort of bitwise copy of the old bytes
// assume newBytes is some sort of bitwise copy of the old bytes
bytes
=
newBytes
;
bytes
=
newBytes
;
}
}
assert
(
old
.
equals
(
new
ArrayList
(
this
)));
assert
(
old
.
equals
(
new
ArrayList
<>
(
this
)));
}
}
static
final
int
LOC_SHIFT
=
1
;
static
final
int
LOC_SHIFT
=
1
;
...
@@ -236,7 +234,7 @@ final class Fixups extends AbstractCollection {
...
@@ -236,7 +234,7 @@ final class Fixups extends AbstractCollection {
/** Simple and necessary tuple to present each fixup. */
/** Simple and necessary tuple to present each fixup. */
public
static
public
static
class
Fixup
implements
Comparable
{
class
Fixup
implements
Comparable
<
Fixup
>
{
int
desc
;
// location and format of reloc
int
desc
;
// location and format of reloc
Entry
entry
;
// which entry to plug into the bytes
Entry
entry
;
// which entry to plug into the bytes
Fixup
(
int
desc
,
Entry
entry
)
{
Fixup
(
int
desc
,
Entry
entry
)
{
...
@@ -254,9 +252,6 @@ final class Fixups extends AbstractCollection {
...
@@ -254,9 +252,6 @@ final class Fixups extends AbstractCollection {
// Ordering depends only on location.
// Ordering depends only on location.
return
this
.
location
()
-
that
.
location
();
return
this
.
location
()
-
that
.
location
();
}
}
public
int
compareTo
(
Object
that
)
{
return
compareTo
((
Fixup
)
that
);
}
public
boolean
equals
(
Object
x
)
{
public
boolean
equals
(
Object
x
)
{
if
(!(
x
instanceof
Fixup
))
return
false
;
if
(!(
x
instanceof
Fixup
))
return
false
;
Fixup
that
=
(
Fixup
)
x
;
Fixup
that
=
(
Fixup
)
x
;
...
@@ -268,13 +263,13 @@ final class Fixups extends AbstractCollection {
...
@@ -268,13 +263,13 @@ final class Fixups extends AbstractCollection {
}
}
private
private
class
Itr
implements
Iterator
{
class
Itr
implements
Iterator
<
Fixup
>
{
int
index
=
0
;
// index into entries
int
index
=
0
;
// index into entries
int
bigIndex
=
BIGSIZE
+
1
;
// index into bigDescs
int
bigIndex
=
BIGSIZE
+
1
;
// index into bigDescs
int
next
=
head
;
// desc pointing to next fixup
int
next
=
head
;
// desc pointing to next fixup
public
boolean
hasNext
()
{
return
index
<
size
;
}
public
boolean
hasNext
()
{
return
index
<
size
;
}
public
void
remove
()
{
throw
new
UnsupportedOperationException
();
}
public
void
remove
()
{
throw
new
UnsupportedOperationException
();
}
public
Object
next
()
{
public
Fixup
next
()
{
int
thisIndex
=
index
;
int
thisIndex
=
index
;
return
new
Fixup
(
nextDesc
(),
entries
[
thisIndex
]);
return
new
Fixup
(
nextDesc
(),
entries
[
thisIndex
]);
}
}
...
@@ -298,7 +293,7 @@ final class Fixups extends AbstractCollection {
...
@@ -298,7 +293,7 @@ final class Fixups extends AbstractCollection {
}
}
}
}
public
Iterator
iterator
()
{
public
Iterator
<
Fixup
>
iterator
()
{
return
new
Itr
();
return
new
Itr
();
}
}
public
void
add
(
int
location
,
int
format
,
Entry
entry
)
{
public
void
add
(
int
location
,
int
format
,
Entry
entry
)
{
...
@@ -308,11 +303,8 @@ final class Fixups extends AbstractCollection {
...
@@ -308,11 +303,8 @@ final class Fixups extends AbstractCollection {
addDesc
(
f
.
desc
,
f
.
entry
);
addDesc
(
f
.
desc
,
f
.
entry
);
return
true
;
return
true
;
}
}
public
boolean
add
(
Object
fixup
)
{
return
add
((
Fixup
)
fixup
);
public
boolean
addAll
(
Collection
<?
extends
Fixup
>
c
)
{
}
@SuppressWarnings
(
"unchecked"
)
public
boolean
addAll
(
Collection
c
)
{
if
(
c
instanceof
Fixups
)
{
if
(
c
instanceof
Fixups
)
{
// Use knowledge of Itr structure to avoid building little structs.
// Use knowledge of Itr structure to avoid building little structs.
Fixups
that
=
(
Fixups
)
c
;
Fixups
that
=
(
Fixups
)
c
;
...
@@ -453,8 +445,7 @@ final class Fixups extends AbstractCollection {
...
@@ -453,8 +445,7 @@ final class Fixups extends AbstractCollection {
void
finishRefs
(
ConstantPool
.
Index
ix
)
{
void
finishRefs
(
ConstantPool
.
Index
ix
)
{
if
(
isEmpty
())
if
(
isEmpty
())
return
;
return
;
for
(
Iterator
i
=
iterator
();
i
.
hasNext
();
)
{
for
(
Fixup
fx
:
this
)
{
Fixup
fx
=
(
Fixup
)
i
.
next
();
int
index
=
ix
.
indexOf
(
fx
.
entry
);
int
index
=
ix
.
indexOf
(
fx
.
entry
);
//System.out.println("finish "+fx+" = "+index);
//System.out.println("finish "+fx+" = "+index);
// Note that the iterator has already fetched the
// Note that the iterator has already fetched the
...
...
src/share/classes/com/sun/java/util/jar/pack/Instruction.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2001, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
...
@@ -657,6 +657,8 @@ class Instruction {
...
@@ -657,6 +657,8 @@ class Instruction {
}
}
}
}
static
class
FormatException
extends
IOException
{
static
class
FormatException
extends
IOException
{
private
static
final
long
serialVersionUID
=
3175572275651367015L
;
FormatException
(
String
message
)
{
FormatException
(
String
message
)
{
super
(
message
);
super
(
message
);
}
}
...
...
src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
浏览文件 @
92fd97c5
...
@@ -292,7 +292,7 @@ class NativeUnpack {
...
@@ -292,7 +292,7 @@ class NativeUnpack {
}
}
ZipEntry
z
=
new
ZipEntry
(
name
);
ZipEntry
z
=
new
ZipEntry
(
name
);
z
.
setTime
(
(
long
)
mtime
*
1000
);
z
.
setTime
(
mtime
*
1000
);
if
(
size
==
0
)
{
if
(
size
==
0
)
{
z
.
setMethod
(
ZipOutputStream
.
STORED
);
z
.
setMethod
(
ZipOutputStream
.
STORED
);
...
...
src/share/classes/com/sun/java/util/jar/pack/Package.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2001, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
...
@@ -188,7 +188,7 @@ class Package {
...
@@ -188,7 +188,7 @@ class Package {
}
}
public
final
public
final
class
Class
extends
Attribute
.
Holder
implements
Comparable
{
class
Class
extends
Attribute
.
Holder
implements
Comparable
<
Class
>
{
public
Package
getPackage
()
{
return
Package
.
this
;
}
public
Package
getPackage
()
{
return
Package
.
this
;
}
// Optional file characteristics and data source (a "class stub")
// Optional file characteristics and data source (a "class stub")
...
@@ -247,8 +247,7 @@ class Package {
...
@@ -247,8 +247,7 @@ class Package {
}
}
// Note: equals and hashCode are identity-based.
// Note: equals and hashCode are identity-based.
public
int
compareTo
(
Object
o
)
{
public
int
compareTo
(
Class
that
)
{
Class
that
=
(
Class
)
o
;
String
n0
=
this
.
getName
();
String
n0
=
this
.
getName
();
String
n1
=
that
.
getName
();
String
n1
=
that
.
getName
();
return
n0
.
compareTo
(
n1
);
return
n0
.
compareTo
(
n1
);
...
@@ -488,7 +487,7 @@ class Package {
...
@@ -488,7 +487,7 @@ class Package {
}
}
public
abstract
public
abstract
class
Member
extends
Attribute
.
Holder
implements
Comparable
{
class
Member
extends
Attribute
.
Holder
implements
Comparable
<
Member
>
{
DescriptorEntry
descriptor
;
DescriptorEntry
descriptor
;
protected
Member
(
int
flags
,
DescriptorEntry
descriptor
)
{
protected
Member
(
int
flags
,
DescriptorEntry
descriptor
)
{
...
@@ -549,7 +548,7 @@ class Package {
...
@@ -549,7 +548,7 @@ class Package {
return
descriptor
.
getLiteralTag
();
return
descriptor
.
getLiteralTag
();
}
}
public
int
compareTo
(
Object
o
)
{
public
int
compareTo
(
Member
o
)
{
Field
that
=
(
Field
)
o
;
Field
that
=
(
Field
)
o
;
return
this
.
order
-
that
.
order
;
return
this
.
order
-
that
.
order
;
}
}
...
@@ -582,7 +581,7 @@ class Package {
...
@@ -582,7 +581,7 @@ class Package {
}
}
// Sort methods in a canonical order (by type, then by name).
// Sort methods in a canonical order (by type, then by name).
public
int
compareTo
(
Object
o
)
{
public
int
compareTo
(
Member
o
)
{
Method
that
=
(
Method
)
o
;
Method
that
=
(
Method
)
o
;
return
this
.
getDescriptor
().
compareTo
(
that
.
getDescriptor
());
return
this
.
getDescriptor
().
compareTo
(
that
.
getDescriptor
());
}
}
...
@@ -608,11 +607,10 @@ class Package {
...
@@ -608,11 +607,10 @@ class Package {
public
void
trimToSize
()
{
public
void
trimToSize
()
{
super
.
trimToSize
();
super
.
trimToSize
();
for
(
int
isM
=
0
;
isM
<=
1
;
isM
++)
{
for
(
int
isM
=
0
;
isM
<=
1
;
isM
++)
{
ArrayList
members
=
(
isM
==
0
)
?
fields
:
methods
;
ArrayList
<?
extends
Member
>
members
=
(
isM
==
0
)
?
fields
:
methods
;
if
(
members
==
null
)
continue
;
if
(
members
==
null
)
continue
;
members
.
trimToSize
();
members
.
trimToSize
();
for
(
Iterator
i
=
members
.
iterator
();
i
.
hasNext
();
)
{
for
(
Member
m
:
members
)
{
Member
m
=
(
Member
)
i
.
next
();
m
.
trimToSize
();
m
.
trimToSize
();
}
}
}
}
...
@@ -625,10 +623,9 @@ class Package {
...
@@ -625,10 +623,9 @@ class Package {
if
(
"InnerClass"
.
equals
(
attrName
))
if
(
"InnerClass"
.
equals
(
attrName
))
innerClasses
=
null
;
innerClasses
=
null
;
for
(
int
isM
=
0
;
isM
<=
1
;
isM
++)
{
for
(
int
isM
=
0
;
isM
<=
1
;
isM
++)
{
ArrayList
members
=
(
isM
==
0
)
?
fields
:
methods
;
ArrayList
<?
extends
Member
>
members
=
(
isM
==
0
)
?
fields
:
methods
;
if
(
members
==
null
)
continue
;
if
(
members
==
null
)
continue
;
for
(
Iterator
i
=
members
.
iterator
();
i
.
hasNext
();
)
{
for
(
Member
m
:
members
)
{
Member
m
=
(
Member
)
i
.
next
();
m
.
strip
(
attrName
);
m
.
strip
(
attrName
);
}
}
}
}
...
@@ -641,10 +638,9 @@ class Package {
...
@@ -641,10 +638,9 @@ class Package {
refs
.
add
(
superClass
);
refs
.
add
(
superClass
);
refs
.
addAll
(
Arrays
.
asList
(
interfaces
));
refs
.
addAll
(
Arrays
.
asList
(
interfaces
));
for
(
int
isM
=
0
;
isM
<=
1
;
isM
++)
{
for
(
int
isM
=
0
;
isM
<=
1
;
isM
++)
{
ArrayList
members
=
(
isM
==
0
)
?
fields
:
methods
;
ArrayList
<?
extends
Member
>
members
=
(
isM
==
0
)
?
fields
:
methods
;
if
(
members
==
null
)
continue
;
if
(
members
==
null
)
continue
;
for
(
Iterator
i
=
members
.
iterator
();
i
.
hasNext
();
)
{
for
(
Member
m
:
members
)
{
Member
m
=
(
Member
)
i
.
next
();
boolean
ok
=
false
;
boolean
ok
=
false
;
try
{
try
{
m
.
visitRefs
(
mode
,
refs
);
m
.
visitRefs
(
mode
,
refs
);
...
@@ -747,13 +743,13 @@ class Package {
...
@@ -747,13 +743,13 @@ class Package {
return
classStubs
;
return
classStubs
;
}
}
public
final
class
File
implements
Comparable
{
public
final
class
File
implements
Comparable
<
File
>
{
String
nameString
;
// true name of this file
String
nameString
;
// true name of this file
Utf8Entry
name
;
Utf8Entry
name
;
int
modtime
=
NO_MODTIME
;
int
modtime
=
NO_MODTIME
;
int
options
=
0
;
// random flag bits, such as deflate_hint
int
options
=
0
;
// random flag bits, such as deflate_hint
Class
stubClass
;
// if this is a stub, here's the class
Class
stubClass
;
// if this is a stub, here's the class
ArrayList
prepend
=
new
ArrayList
();
// list of byte[]
ArrayList
<
byte
[]>
prepend
=
new
ArrayList
<>
();
// list of byte[]
java
.
io
.
ByteArrayOutputStream
append
=
new
ByteArrayOutputStream
();
java
.
io
.
ByteArrayOutputStream
append
=
new
ByteArrayOutputStream
();
File
(
Utf8Entry
name
)
{
File
(
Utf8Entry
name
)
{
...
@@ -798,8 +794,7 @@ class Package {
...
@@ -798,8 +794,7 @@ class Package {
return
nameString
.
hashCode
();
return
nameString
.
hashCode
();
}
}
// Simple alphabetic sort. PackageWriter uses a better comparator.
// Simple alphabetic sort. PackageWriter uses a better comparator.
public
int
compareTo
(
Object
o
)
{
public
int
compareTo
(
File
that
)
{
File
that
=
(
File
)
o
;
return
this
.
nameString
.
compareTo
(
that
.
nameString
);
return
this
.
nameString
.
compareTo
(
that
.
nameString
);
}
}
public
String
toString
()
{
public
String
toString
()
{
...
@@ -834,8 +829,7 @@ class Package {
...
@@ -834,8 +829,7 @@ class Package {
public
long
getFileLength
()
{
public
long
getFileLength
()
{
long
len
=
0
;
long
len
=
0
;
if
(
prepend
==
null
||
append
==
null
)
return
0
;
if
(
prepend
==
null
||
append
==
null
)
return
0
;
for
(
Iterator
i
=
prepend
.
iterator
();
i
.
hasNext
();
)
{
for
(
byte
[]
block
:
prepend
)
{
byte
[]
block
=
(
byte
[])
i
.
next
();
len
+=
block
.
length
;
len
+=
block
.
length
;
}
}
len
+=
append
.
size
();
len
+=
append
.
size
();
...
@@ -843,8 +837,7 @@ class Package {
...
@@ -843,8 +837,7 @@ class Package {
}
}
public
void
writeTo
(
OutputStream
out
)
throws
IOException
{
public
void
writeTo
(
OutputStream
out
)
throws
IOException
{
if
(
prepend
==
null
||
append
==
null
)
return
;
if
(
prepend
==
null
||
append
==
null
)
return
;
for
(
Iterator
i
=
prepend
.
iterator
();
i
.
hasNext
();
)
{
for
(
byte
[]
block
:
prepend
)
{
byte
[]
block
=
(
byte
[])
i
.
next
();
out
.
write
(
block
);
out
.
write
(
block
);
}
}
append
.
writeTo
(
out
);
append
.
writeTo
(
out
);
...
@@ -860,8 +853,7 @@ class Package {
...
@@ -860,8 +853,7 @@ class Package {
InputStream
in
=
new
ByteArrayInputStream
(
append
.
toByteArray
());
InputStream
in
=
new
ByteArrayInputStream
(
append
.
toByteArray
());
if
(
prepend
.
isEmpty
())
return
in
;
if
(
prepend
.
isEmpty
())
return
in
;
List
<
InputStream
>
isa
=
new
ArrayList
<>(
prepend
.
size
()+
1
);
List
<
InputStream
>
isa
=
new
ArrayList
<>(
prepend
.
size
()+
1
);
for
(
Iterator
i
=
prepend
.
iterator
();
i
.
hasNext
();
)
{
for
(
byte
[]
bytes
:
prepend
)
{
byte
[]
bytes
=
(
byte
[])
i
.
next
();
isa
.
add
(
new
ByteArrayInputStream
(
bytes
));
isa
.
add
(
new
ByteArrayInputStream
(
bytes
));
}
}
isa
.
add
(
in
);
isa
.
add
(
in
);
...
@@ -926,7 +918,7 @@ class Package {
...
@@ -926,7 +918,7 @@ class Package {
}
}
static
static
class
InnerClass
implements
Comparable
{
class
InnerClass
implements
Comparable
<
InnerClass
>
{
final
ClassEntry
thisClass
;
final
ClassEntry
thisClass
;
final
ClassEntry
outerClass
;
final
ClassEntry
outerClass
;
final
Utf8Entry
name
;
final
Utf8Entry
name
;
...
@@ -977,8 +969,7 @@ class Package {
...
@@ -977,8 +969,7 @@ class Package {
public
int
hashCode
()
{
public
int
hashCode
()
{
return
thisClass
.
hashCode
();
return
thisClass
.
hashCode
();
}
}
public
int
compareTo
(
Object
o
)
{
public
int
compareTo
(
InnerClass
that
)
{
InnerClass
that
=
(
InnerClass
)
o
;
return
this
.
thisClass
.
compareTo
(
that
.
thisClass
);
return
this
.
thisClass
.
compareTo
(
that
.
thisClass
);
}
}
...
@@ -1108,7 +1099,7 @@ class Package {
...
@@ -1108,7 +1099,7 @@ class Package {
return
ConstantPool
.
getUtf8Entry
(
s
);
return
ConstantPool
.
getUtf8Entry
(
s
);
}
}
static
LiteralEntry
getRefLiteral
(
Comparable
s
)
{
static
LiteralEntry
getRefLiteral
(
Comparable
<?>
s
)
{
return
ConstantPool
.
getLiteralEntry
(
s
);
return
ConstantPool
.
getLiteralEntry
(
s
);
}
}
...
@@ -1199,7 +1190,6 @@ class Package {
...
@@ -1199,7 +1190,6 @@ class Package {
// compress better. It also moves classes to the end of the
// compress better. It also moves classes to the end of the
// file order. It also removes JAR directory entries, which
// file order. It also removes JAR directory entries, which
// are useless.
// are useless.
@SuppressWarnings
(
"unchecked"
)
void
reorderFiles
(
boolean
keepClassOrder
,
boolean
stripDirectories
)
{
void
reorderFiles
(
boolean
keepClassOrder
,
boolean
stripDirectories
)
{
// First reorder the classes, if that is allowed.
// First reorder the classes, if that is allowed.
if
(!
keepClassOrder
)
{
if
(!
keepClassOrder
)
{
...
@@ -1226,10 +1216,8 @@ class Package {
...
@@ -1226,10 +1216,8 @@ class Package {
// This keeps files of similar format near each other.
// This keeps files of similar format near each other.
// Put class files at the end, keeping their fixed order.
// Put class files at the end, keeping their fixed order.
// Be sure the JAR file's required manifest stays at the front. (4893051)
// Be sure the JAR file's required manifest stays at the front. (4893051)
Collections
.
sort
(
files
,
new
Comparator
()
{
Collections
.
sort
(
files
,
new
Comparator
<
File
>()
{
public
int
compare
(
Object
o0
,
Object
o1
)
{
public
int
compare
(
File
r0
,
File
r1
)
{
File
r0
=
(
File
)
o0
;
File
r1
=
(
File
)
o1
;
// Get the file name.
// Get the file name.
String
f0
=
r0
.
nameString
;
String
f0
=
r0
.
nameString
;
String
f1
=
r1
.
nameString
;
String
f1
=
r1
.
nameString
;
...
...
src/share/classes/com/sun/java/util/jar/pack/PackageReader.java
浏览文件 @
92fd97c5
...
@@ -750,7 +750,7 @@ class PackageReader extends BandStructure {
...
@@ -750,7 +750,7 @@ class PackageReader extends BandStructure {
file_options
.
readFrom
(
in
);
file_options
.
readFrom
(
in
);
file_bits
.
setInputStreamFrom
(
in
);
file_bits
.
setInputStreamFrom
(
in
);
Iterator
nextClass
=
pkg
.
getClasses
().
iterator
();
Iterator
<
Class
>
nextClass
=
pkg
.
getClasses
().
iterator
();
// Compute file lengths before reading any file bits.
// Compute file lengths before reading any file bits.
long
totalFileLength
=
0
;
long
totalFileLength
=
0
;
...
@@ -790,14 +790,14 @@ class PackageReader extends BandStructure {
...
@@ -790,14 +790,14 @@ class PackageReader extends BandStructure {
pkg
.
addFile
(
file
);
pkg
.
addFile
(
file
);
if
(
file
.
isClassStub
())
{
if
(
file
.
isClassStub
())
{
assert
(
file
.
getFileLength
()
==
0
);
assert
(
file
.
getFileLength
()
==
0
);
Class
cls
=
(
Class
)
nextClass
.
next
();
Class
cls
=
nextClass
.
next
();
cls
.
initFile
(
file
);
cls
.
initFile
(
file
);
}
}
}
}
// Do the rest of the classes.
// Do the rest of the classes.
while
(
nextClass
.
hasNext
())
{
while
(
nextClass
.
hasNext
())
{
Class
cls
=
(
Class
)
nextClass
.
next
();
Class
cls
=
nextClass
.
next
();
cls
.
initFile
(
null
);
// implicitly initialize to a trivial one
cls
.
initFile
(
null
);
// implicitly initialize to a trivial one
cls
.
file
.
modtime
=
pkg
.
default_modtime
;
cls
.
file
.
modtime
=
pkg
.
default_modtime
;
}
}
...
@@ -1006,7 +1006,7 @@ class PackageReader extends BandStructure {
...
@@ -1006,7 +1006,7 @@ class PackageReader extends BandStructure {
if
(
k
>=
0
)
if
(
k
>=
0
)
return
k
;
return
k
;
if
(
e
.
tag
==
CONSTANT_Utf8
)
{
if
(
e
.
tag
==
CONSTANT_Utf8
)
{
Entry
se
=
(
Entry
)
utf8Signatures
.
get
(
e
);
Entry
se
=
utf8Signatures
.
get
(
e
);
return
pkg
.
cp
.
untypedIndexOf
(
se
);
return
pkg
.
cp
.
untypedIndexOf
(
se
);
}
}
return
-
1
;
return
-
1
;
...
@@ -1332,7 +1332,8 @@ class PackageReader extends BandStructure {
...
@@ -1332,7 +1332,8 @@ class PackageReader extends BandStructure {
// classes, fields, methods, and codes.
// classes, fields, methods, and codes.
// The holders is a global list, already collected,
// The holders is a global list, already collected,
// of attribute "customers".
// of attribute "customers".
void
countAndReadAttrs
(
int
ctype
,
Collection
holders
)
throws
IOException
{
void
countAndReadAttrs
(
int
ctype
,
Collection
<?
extends
Attribute
.
Holder
>
holders
)
throws
IOException
{
// class_attr_bands:
// class_attr_bands:
// *class_flags :UNSIGNED5
// *class_flags :UNSIGNED5
// *class_attr_count :UNSIGNED5
// *class_attr_count :UNSIGNED5
...
@@ -1386,7 +1387,8 @@ class PackageReader extends BandStructure {
...
@@ -1386,7 +1387,8 @@ class PackageReader extends BandStructure {
// Read flags and count the attributes that are to be placed
// Read flags and count the attributes that are to be placed
// on the given holders.
// on the given holders.
void
countAttrs
(
int
ctype
,
Collection
holders
)
throws
IOException
{
void
countAttrs
(
int
ctype
,
Collection
<?
extends
Attribute
.
Holder
>
holders
)
throws
IOException
{
// Here, xxx stands for one of class, field, method, code.
// Here, xxx stands for one of class, field, method, code.
MultiBand
xxx_attr_bands
=
attrBands
[
ctype
];
MultiBand
xxx_attr_bands
=
attrBands
[
ctype
];
long
flagMask
=
attrFlagMask
[
ctype
];
long
flagMask
=
attrFlagMask
[
ctype
];
...
@@ -1414,8 +1416,7 @@ class PackageReader extends BandStructure {
...
@@ -1414,8 +1416,7 @@ class PackageReader extends BandStructure {
xxx_flags_lo
.
expectLength
(
holders
.
size
());
xxx_flags_lo
.
expectLength
(
holders
.
size
());
xxx_flags_lo
.
readFrom
(
in
);
xxx_flags_lo
.
readFrom
(
in
);
assert
((
flagMask
&
overflowMask
)
==
overflowMask
);
assert
((
flagMask
&
overflowMask
)
==
overflowMask
);
for
(
Iterator
i
=
holders
.
iterator
();
i
.
hasNext
();
)
{
for
(
Attribute
.
Holder
h
:
holders
)
{
Attribute
.
Holder
h
=
(
Attribute
.
Holder
)
i
.
next
();
int
flags
=
xxx_flags_lo
.
getInt
();
int
flags
=
xxx_flags_lo
.
getInt
();
h
.
flags
=
flags
;
h
.
flags
=
flags
;
if
((
flags
&
overflowMask
)
!=
0
)
if
((
flags
&
overflowMask
)
!=
0
)
...
@@ -1433,8 +1434,7 @@ class PackageReader extends BandStructure {
...
@@ -1433,8 +1434,7 @@ class PackageReader extends BandStructure {
// (class/field/method/code), and also we accumulate (b) a total
// (class/field/method/code), and also we accumulate (b) a total
// count for each attribute type.
// count for each attribute type.
int
[]
totalCounts
=
new
int
[
defs
.
length
];
int
[]
totalCounts
=
new
int
[
defs
.
length
];
for
(
Iterator
i
=
holders
.
iterator
();
i
.
hasNext
();
)
{
for
(
Attribute
.
Holder
h
:
holders
)
{
Attribute
.
Holder
h
=
(
Attribute
.
Holder
)
i
.
next
();
assert
(
h
.
attributes
==
null
);
assert
(
h
.
attributes
==
null
);
// System.out.println("flags="+h.flags+" using fm="+flagMask);
// System.out.println("flags="+h.flags+" using fm="+flagMask);
long
attrBits
=
((
h
.
flags
&
flagMask
)
<<
32
)
>>>
32
;
long
attrBits
=
((
h
.
flags
&
flagMask
)
<<
32
)
>>>
32
;
...
@@ -1582,13 +1582,12 @@ class PackageReader extends BandStructure {
...
@@ -1582,13 +1582,12 @@ class PackageReader extends BandStructure {
ATTR_CONTEXT_NAME
[
ctype
]+
" attribute"
);
ATTR_CONTEXT_NAME
[
ctype
]+
" attribute"
);
}
}
@SuppressWarnings
(
"unchecked"
)
void
readAttrs
(
int
ctype
,
Collection
<?
extends
Attribute
.
Holder
>
holders
)
void
readAttrs
(
int
ctype
,
Collection
holders
)
throws
IOException
{
throws
IOException
{
// Decode band values into attributes.
// Decode band values into attributes.
Set
<
Attribute
.
Layout
>
sawDefs
=
new
HashSet
<>();
Set
<
Attribute
.
Layout
>
sawDefs
=
new
HashSet
<>();
ByteArrayOutputStream
buf
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
buf
=
new
ByteArrayOutputStream
();
for
(
Iterator
i
=
holders
.
iterator
();
i
.
hasNext
();
)
{
for
(
final
Attribute
.
Holder
h
:
holders
)
{
final
Attribute
.
Holder
h
=
(
Attribute
.
Holder
)
i
.
next
();
if
(
h
.
attributes
==
null
)
continue
;
if
(
h
.
attributes
==
null
)
continue
;
for
(
ListIterator
<
Attribute
>
j
=
h
.
attributes
.
listIterator
();
j
.
hasNext
();
)
{
for
(
ListIterator
<
Attribute
>
j
=
h
.
attributes
.
listIterator
();
j
.
hasNext
();
)
{
Attribute
a
=
j
.
next
();
Attribute
a
=
j
.
next
();
...
...
src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java
浏览文件 @
92fd97c5
...
@@ -720,7 +720,6 @@ class PackageWriter extends BandStructure {
...
@@ -720,7 +720,6 @@ class PackageWriter extends BandStructure {
Utils
.
log
.
info
(
"Wrote "
+
numFiles
+
" resource files"
);
Utils
.
log
.
info
(
"Wrote "
+
numFiles
+
" resource files"
);
}
}
@SuppressWarnings
(
"unchecked"
)
void
collectAttributeLayouts
()
{
void
collectAttributeLayouts
()
{
maxFlags
=
new
int
[
ATTR_CONTEXT_LIMIT
];
maxFlags
=
new
int
[
ATTR_CONTEXT_LIMIT
];
allLayouts
=
new
FixedList
<>(
ATTR_CONTEXT_LIMIT
);
allLayouts
=
new
FixedList
<>(
ATTR_CONTEXT_LIMIT
);
...
@@ -781,26 +780,27 @@ class PackageWriter extends BandStructure {
...
@@ -781,26 +780,27 @@ class PackageWriter extends BandStructure {
avHiBits
&=
(
1L
<<
attrIndexLimit
[
i
])-
1
;
avHiBits
&=
(
1L
<<
attrIndexLimit
[
i
])-
1
;
int
nextLoBit
=
0
;
int
nextLoBit
=
0
;
Map
<
Attribute
.
Layout
,
int
[]>
defMap
=
allLayouts
.
get
(
i
);
Map
<
Attribute
.
Layout
,
int
[]>
defMap
=
allLayouts
.
get
(
i
);
Map
.
Entry
[]
layoutsAndCounts
=
new
Map
.
Entry
[
defMap
.
size
()];
@SuppressWarnings
(
"unchecked"
)
Map
.
Entry
<
Attribute
.
Layout
,
int
[]>[]
layoutsAndCounts
=
new
Map
.
Entry
<>[
defMap
.
size
()];
defMap
.
entrySet
().
toArray
(
layoutsAndCounts
);
defMap
.
entrySet
().
toArray
(
layoutsAndCounts
);
// Sort by count, most frequent first.
// Sort by count, most frequent first.
// Predefs. participate in this sort, though it does not matter.
// Predefs. participate in this sort, though it does not matter.
Arrays
.
sort
(
layoutsAndCounts
,
new
Comparator
<
Object
>()
{
Arrays
.
sort
(
layoutsAndCounts
,
public
int
compare
(
Object
o0
,
Object
o1
)
{
new
Comparator
<
Map
.
Entry
<
Attribute
.
Layout
,
int
[]>>(
)
{
Map
.
Entry
e0
=
(
Map
.
Entry
)
o0
;
public
int
compare
(
Map
.
Entry
<
Attribute
.
Layout
,
int
[]>
e0
,
Map
.
Entry
e1
=
(
Map
.
Entry
)
o1
;
Map
.
Entry
<
Attribute
.
Layout
,
int
[]>
e1
)
{
// Primary sort key is count, reversed.
// Primary sort key is count, reversed.
int
r
=
-
(
((
int
[])
e0
.
getValue
())[
0
]
int
r
=
-(
e0
.
getValue
()[
0
]
-
e1
.
getValue
()[
0
]);
-
((
int
[])
e1
.
getValue
())[
0
]
);
if
(
r
!=
0
)
return
r
;
if
(
r
!=
0
)
return
r
;
return
((
Comparable
)
e0
.
getKey
()
).
compareTo
(
e1
.
getKey
());
return
e0
.
getKey
(
).
compareTo
(
e1
.
getKey
());
}
}
});
});
attrCounts
[
i
]
=
new
int
[
attrIndexLimit
[
i
]+
layoutsAndCounts
.
length
];
attrCounts
[
i
]
=
new
int
[
attrIndexLimit
[
i
]+
layoutsAndCounts
.
length
];
for
(
int
j
=
0
;
j
<
layoutsAndCounts
.
length
;
j
++)
{
for
(
int
j
=
0
;
j
<
layoutsAndCounts
.
length
;
j
++)
{
Map
.
Entry
e
=
layoutsAndCounts
[
j
];
Map
.
Entry
<
Attribute
.
Layout
,
int
[]>
e
=
layoutsAndCounts
[
j
];
Attribute
.
Layout
def
=
(
Attribute
.
Layout
)
e
.
getKey
();
Attribute
.
Layout
def
=
e
.
getKey
();
int
count
=
((
int
[])
e
.
getValue
()
)[
0
];
int
count
=
e
.
getValue
(
)[
0
];
int
index
;
int
index
;
Integer
predefIndex
=
attrIndexTable
.
get
(
def
);
Integer
predefIndex
=
attrIndexTable
.
get
(
def
);
if
(
predefIndex
!=
null
)
{
if
(
predefIndex
!=
null
)
{
...
@@ -881,7 +881,6 @@ class PackageWriter extends BandStructure {
...
@@ -881,7 +881,6 @@ class PackageWriter extends BandStructure {
Attribute
.
Layout
[]
attrDefsWritten
;
Attribute
.
Layout
[]
attrDefsWritten
;
@SuppressWarnings
(
"unchecked"
)
void
writeAttrDefs
()
throws
IOException
{
void
writeAttrDefs
()
throws
IOException
{
List
<
Object
[]>
defList
=
new
ArrayList
<>();
List
<
Object
[]>
defList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
ATTR_CONTEXT_LIMIT
;
i
++)
{
for
(
int
i
=
0
;
i
<
ATTR_CONTEXT_LIMIT
;
i
++)
{
...
@@ -906,20 +905,19 @@ class PackageWriter extends BandStructure {
...
@@ -906,20 +905,19 @@ class PackageWriter extends BandStructure {
int
numAttrDefs
=
defList
.
size
();
int
numAttrDefs
=
defList
.
size
();
Object
[][]
defs
=
new
Object
[
numAttrDefs
][];
Object
[][]
defs
=
new
Object
[
numAttrDefs
][];
defList
.
toArray
(
defs
);
defList
.
toArray
(
defs
);
Arrays
.
sort
(
defs
,
new
Comparator
()
{
Arrays
.
sort
(
defs
,
new
Comparator
<
Object
[]>()
{
public
int
compare
(
Object
o0
,
Object
o1
)
{
public
int
compare
(
Object
[]
a0
,
Object
[]
a1
)
{
Object
[]
a0
=
(
Object
[])
o0
;
Object
[]
a1
=
(
Object
[])
o1
;
// Primary sort key is attr def header.
// Primary sort key is attr def header.
@SuppressWarnings
(
"unchecked"
)
int
r
=
((
Comparable
)
a0
[
0
]).
compareTo
(
a1
[
0
]);
int
r
=
((
Comparable
)
a0
[
0
]).
compareTo
(
a1
[
0
]);
if
(
r
!=
0
)
return
r
;
if
(
r
!=
0
)
return
r
;
Object
ind0
=
attrIndexTable
.
get
(
a0
[
1
]);
Integer
ind0
=
attrIndexTable
.
get
(
a0
[
1
]);
Object
ind1
=
attrIndexTable
.
get
(
a1
[
1
]);
Integer
ind1
=
attrIndexTable
.
get
(
a1
[
1
]);
// Secondary sort key is attribute index.
// Secondary sort key is attribute index.
// (This must be so, in order to keep overflow attr order.)
// (This must be so, in order to keep overflow attr order.)
assert
(
ind0
!=
null
);
assert
(
ind0
!=
null
);
assert
(
ind1
!=
null
);
assert
(
ind1
!=
null
);
return
((
Comparable
)
ind0
)
.
compareTo
(
ind1
);
return
ind0
.
compareTo
(
ind1
);
}
}
});
});
attrDefsWritten
=
new
Attribute
.
Layout
[
numAttrDefs
];
attrDefsWritten
=
new
Attribute
.
Layout
[
numAttrDefs
];
...
...
src/share/classes/com/sun/java/util/jar/pack/PackerImpl.java
浏览文件 @
92fd97c5
/*
/*
* 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
...
@@ -69,8 +69,7 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
...
@@ -69,8 +69,7 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
* Get the set of options for the pack and unpack engines.
* Get the set of options for the pack and unpack engines.
* @return A sorted association of option key strings to option values.
* @return A sorted association of option key strings to option values.
*/
*/
@SuppressWarnings
(
"unchecked"
)
public
SortedMap
<
String
,
String
>
properties
()
{
public
SortedMap
properties
()
{
return
props
;
return
props
;
}
}
...
@@ -157,7 +156,6 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
...
@@ -157,7 +156,6 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
// All the worker bees.....
// All the worker bees.....
// The packer worker.
// The packer worker.
@SuppressWarnings
(
"unchecked"
)
private
class
DoPack
{
private
class
DoPack
{
final
int
verbose
=
props
.
getInteger
(
Utils
.
DEBUG_VERBOSE
);
final
int
verbose
=
props
.
getInteger
(
Utils
.
DEBUG_VERBOSE
);
...
@@ -199,9 +197,8 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
...
@@ -199,9 +197,8 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
};
};
for
(
int
i
=
0
;
i
<
ctypes
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
ctypes
.
length
;
i
++)
{
String
pfx
=
keys
[
i
];
String
pfx
=
keys
[
i
];
Map
<
Object
,
Object
>
map
=
props
.
prefixMap
(
pfx
);
Map
<
String
,
String
>
map
=
props
.
prefixMap
(
pfx
);
for
(
Object
k
:
map
.
keySet
())
{
for
(
String
key
:
map
.
keySet
())
{
String
key
=
(
String
)
k
;
assert
(
key
.
startsWith
(
pfx
));
assert
(
key
.
startsWith
(
pfx
));
String
name
=
key
.
substring
(
pfx
.
length
());
String
name
=
key
.
substring
(
pfx
.
length
());
String
layout
=
props
.
getProperty
(
key
);
String
layout
=
props
.
getProperty
(
key
);
...
...
src/share/classes/com/sun/java/util/jar/pack/PropMap.java
浏览文件 @
92fd97c5
...
@@ -27,7 +27,6 @@ package com.sun.java.util.jar.pack;
...
@@ -27,7 +27,6 @@ package com.sun.java.util.jar.pack;
import
java.beans.PropertyChangeListener
;
import
java.beans.PropertyChangeListener
;
import
java.beans.PropertyChangeEvent
;
import
java.beans.PropertyChangeEvent
;
import
java.io.BufferedInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.PrintStream
;
import
java.io.PrintStream
;
...
@@ -47,8 +46,8 @@ import java.util.jar.Pack200;
...
@@ -47,8 +46,8 @@ import java.util.jar.Pack200;
* Control block for publishing Pack200 options to the other classes.
* Control block for publishing Pack200 options to the other classes.
*/
*/
final
class
PropMap
implements
SortedMap
<
Object
,
Object
>
{
final
class
PropMap
implements
SortedMap
<
String
,
String
>
{
private
final
TreeMap
<
Object
,
Object
>
theMap
=
new
TreeMap
<>();;
private
final
TreeMap
<
String
,
String
>
theMap
=
new
TreeMap
<>();;
private
final
List
<
PropertyChangeListener
>
listenerList
=
new
ArrayList
<>(
1
);
private
final
List
<
PropertyChangeListener
>
listenerList
=
new
ArrayList
<>(
1
);
void
addListener
(
PropertyChangeListener
listener
)
{
void
addListener
(
PropertyChangeListener
listener
)
{
...
@@ -68,12 +67,12 @@ final class PropMap implements SortedMap<Object, Object> {
...
@@ -68,12 +67,12 @@ final class PropMap implements SortedMap<Object, Object> {
}
}
// Override:
// Override:
public
Object
put
(
Object
key
,
Object
value
)
{
public
String
put
(
String
key
,
String
value
)
{
Object
oldValue
=
theMap
.
put
(
key
,
value
);
String
oldValue
=
theMap
.
put
(
key
,
value
);
if
(
value
!=
oldValue
&&
!
listenerList
.
isEmpty
())
{
if
(
value
!=
oldValue
&&
!
listenerList
.
isEmpty
())
{
// Post the property change event.
// Post the property change event.
PropertyChangeEvent
event
=
PropertyChangeEvent
event
=
new
PropertyChangeEvent
(
this
,
(
String
)
key
,
new
PropertyChangeEvent
(
this
,
key
,
oldValue
,
value
);
oldValue
,
value
);
for
(
PropertyChangeListener
listener
:
listenerList
)
{
for
(
PropertyChangeListener
listener
:
listenerList
)
{
listener
.
propertyChange
(
event
);
listener
.
propertyChange
(
event
);
...
@@ -85,7 +84,7 @@ final class PropMap implements SortedMap<Object, Object> {
...
@@ -85,7 +84,7 @@ final class PropMap implements SortedMap<Object, Object> {
// All this other stuff is private to the current package.
// All this other stuff is private to the current package.
// Outide clients of Pack200 do not need to use it; they can
// Outide clients of Pack200 do not need to use it; they can
// get by with generic SortedMap functionality.
// get by with generic SortedMap functionality.
private
static
Map
<
Object
,
Object
>
defaultProps
;
private
static
Map
<
String
,
String
>
defaultProps
;
static
{
static
{
Properties
props
=
new
Properties
();
Properties
props
=
new
Properties
();
...
@@ -141,7 +140,9 @@ final class PropMap implements SortedMap<Object, Object> {
...
@@ -141,7 +140,9 @@ final class PropMap implements SortedMap<Object, Object> {
}
}
}
}
defaultProps
=
(
new
HashMap
<>(
props
));
// shrink to fit
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
HashMap
<
String
,
String
>
temp
=
new
HashMap
(
props
);
// shrink to fit
defaultProps
=
temp
;
}
}
PropMap
()
{
PropMap
()
{
...
@@ -151,7 +152,7 @@ final class PropMap implements SortedMap<Object, Object> {
...
@@ -151,7 +152,7 @@ final class PropMap implements SortedMap<Object, Object> {
// Return a view of this map which includes only properties
// Return a view of this map which includes only properties
// that begin with the given prefix. This is easy because
// that begin with the given prefix. This is easy because
// the map is sorted, and has a subMap accessor.
// the map is sorted, and has a subMap accessor.
SortedMap
<
Object
,
Object
>
prefixMap
(
String
prefix
)
{
SortedMap
<
String
,
String
>
prefixMap
(
String
prefix
)
{
int
len
=
prefix
.
length
();
int
len
=
prefix
.
length
();
if
(
len
==
0
)
if
(
len
==
0
)
return
this
;
return
this
;
...
@@ -162,7 +163,7 @@ final class PropMap implements SortedMap<Object, Object> {
...
@@ -162,7 +163,7 @@ final class PropMap implements SortedMap<Object, Object> {
}
}
String
getProperty
(
String
s
)
{
String
getProperty
(
String
s
)
{
return
(
String
)
get
(
s
);
return
get
(
s
);
}
}
String
getProperty
(
String
s
,
String
defaultVal
)
{
String
getProperty
(
String
s
,
String
defaultVal
)
{
String
val
=
getProperty
(
s
);
String
val
=
getProperty
(
s
);
...
@@ -171,13 +172,13 @@ final class PropMap implements SortedMap<Object, Object> {
...
@@ -171,13 +172,13 @@ final class PropMap implements SortedMap<Object, Object> {
return
val
;
return
val
;
}
}
String
setProperty
(
String
s
,
String
val
)
{
String
setProperty
(
String
s
,
String
val
)
{
return
(
String
)
put
(
s
,
val
);
return
put
(
s
,
val
);
}
}
// Get sequence of props for "prefix", and "prefix.*".
// Get sequence of props for "prefix", and "prefix.*".
List
getProperties
(
String
prefix
)
{
List
<
String
>
getProperties
(
String
prefix
)
{
Collection
<
Object
>
values
=
prefixMap
(
prefix
).
values
();
Collection
<
String
>
values
=
prefixMap
(
prefix
).
values
();
List
<
Object
>
res
=
new
ArrayList
<>(
values
.
size
());
List
<
String
>
res
=
new
ArrayList
<>(
values
.
size
());
res
.
addAll
(
values
);
res
.
addAll
(
values
);
while
(
res
.
remove
(
null
));
while
(
res
.
remove
(
null
));
return
res
;
return
res
;
...
@@ -241,8 +242,8 @@ final class PropMap implements SortedMap<Object, Object> {
...
@@ -241,8 +242,8 @@ final class PropMap implements SortedMap<Object, Object> {
}
}
void
list
(
PrintWriter
out
)
{
void
list
(
PrintWriter
out
)
{
out
.
println
(
"#"
+
Utils
.
PACK_ZIP_ARCHIVE_MARKER_COMMENT
+
"["
);
out
.
println
(
"#"
+
Utils
.
PACK_ZIP_ARCHIVE_MARKER_COMMENT
+
"["
);
Set
defaults
=
defaultProps
.
entrySet
();
Set
<
Map
.
Entry
<
String
,
String
>>
defaults
=
defaultProps
.
entrySet
();
for
(
Map
.
Entry
e
:
theMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
String
>
e
:
theMap
.
entrySet
())
{
if
(
defaults
.
contains
(
e
))
continue
;
if
(
defaults
.
contains
(
e
))
continue
;
out
.
println
(
" "
+
e
.
getKey
()
+
" = "
+
e
.
getValue
());
out
.
println
(
" "
+
e
.
getKey
()
+
" = "
+
e
.
getValue
());
}
}
...
@@ -270,18 +271,17 @@ final class PropMap implements SortedMap<Object, Object> {
...
@@ -270,18 +271,17 @@ final class PropMap implements SortedMap<Object, Object> {
}
}
@Override
@Override
public
Object
get
(
Object
key
)
{
public
String
get
(
Object
key
)
{
return
theMap
.
get
(
key
);
return
theMap
.
get
(
key
);
}
}
@Override
@Override
public
Object
remove
(
Object
key
)
{
public
String
remove
(
Object
key
)
{
return
theMap
.
remove
(
key
);
return
theMap
.
remove
(
key
);
}
}
@Override
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
putAll
(
Map
<?
extends
String
,
?
extends
String
>
m
)
{
public
void
putAll
(
Map
m
)
{
theMap
.
putAll
(
m
);
theMap
.
putAll
(
m
);
}
}
...
@@ -291,48 +291,47 @@ final class PropMap implements SortedMap<Object, Object> {
...
@@ -291,48 +291,47 @@ final class PropMap implements SortedMap<Object, Object> {
}
}
@Override
@Override
public
Set
<
Object
>
keySet
()
{
public
Set
<
String
>
keySet
()
{
return
theMap
.
keySet
();
return
theMap
.
keySet
();
}
}
@Override
@Override
public
Collection
<
Object
>
values
()
{
public
Collection
<
String
>
values
()
{
return
theMap
.
values
();
return
theMap
.
values
();
}
}
@Override
@Override
public
Set
<
Map
.
Entry
<
Object
,
Object
>>
entrySet
()
{
public
Set
<
Map
.
Entry
<
String
,
String
>>
entrySet
()
{
return
theMap
.
entrySet
();
return
theMap
.
entrySet
();
}
}
@Override
@Override
@SuppressWarnings
(
"unchecked"
)
public
Comparator
<?
super
String
>
comparator
()
{
public
Comparator
<
Object
>
comparator
()
{
return
theMap
.
comparator
();
return
(
Comparator
<
Object
>)
theMap
.
comparator
();
}
}
@Override
@Override
public
SortedMap
<
Object
,
Object
>
subMap
(
Object
fromKey
,
Object
toKey
)
{
public
SortedMap
<
String
,
String
>
subMap
(
String
fromKey
,
String
toKey
)
{
return
theMap
.
subMap
(
fromKey
,
toKey
);
return
theMap
.
subMap
(
fromKey
,
toKey
);
}
}
@Override
@Override
public
SortedMap
<
Object
,
Object
>
headMap
(
Object
toKey
)
{
public
SortedMap
<
String
,
String
>
headMap
(
String
toKey
)
{
return
theMap
.
headMap
(
toKey
);
return
theMap
.
headMap
(
toKey
);
}
}
@Override
@Override
public
SortedMap
<
Object
,
Object
>
tailMap
(
Object
fromKey
)
{
public
SortedMap
<
String
,
String
>
tailMap
(
String
fromKey
)
{
return
theMap
.
tailMap
(
fromKey
);
return
theMap
.
tailMap
(
fromKey
);
}
}
@Override
@Override
public
Object
firstKey
()
{
public
String
firstKey
()
{
return
theMap
.
firstKey
();
return
theMap
.
firstKey
();
}
}
@Override
@Override
public
Object
lastKey
()
{
public
String
lastKey
()
{
return
theMap
.
lastKey
();
return
theMap
.
lastKey
();
}
}
}
}
src/share/classes/com/sun/java/util/jar/pack/TLGlobals.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010,
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
...
@@ -67,7 +67,7 @@ class TLGlobals {
...
@@ -67,7 +67,7 @@ class TLGlobals {
props
=
new
PropMap
();
props
=
new
PropMap
();
}
}
SortedMap
<
Object
,
Object
>
getPropMap
()
{
SortedMap
<
String
,
String
>
getPropMap
()
{
return
props
;
return
props
;
}
}
...
...
src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java
浏览文件 @
92fd97c5
...
@@ -81,8 +81,7 @@ public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
...
@@ -81,8 +81,7 @@ public class UnpackerImpl extends TLGlobals implements Pack200.Unpacker {
* Get the set of options for the pack and unpack engines.
* Get the set of options for the pack and unpack engines.
* @return A sorted association of option key strings to option values.
* @return A sorted association of option key strings to option values.
*/
*/
@SuppressWarnings
(
"unchecked"
)
public
SortedMap
<
String
,
String
>
properties
()
{
public
SortedMap
properties
()
{
return
props
;
return
props
;
}
}
...
...
src/share/classes/com/sun/java/util/jar/pack/Utils.java
浏览文件 @
92fd97c5
...
@@ -253,8 +253,8 @@ class Utils {
...
@@ -253,8 +253,8 @@ class Utils {
}
}
static
void
copyJarFile
(
JarFile
in
,
JarOutputStream
out
)
throws
IOException
{
static
void
copyJarFile
(
JarFile
in
,
JarOutputStream
out
)
throws
IOException
{
byte
[]
buffer
=
new
byte
[
1
<<
14
];
byte
[]
buffer
=
new
byte
[
1
<<
14
];
for
(
Enumeration
e
=
in
.
entries
();
e
.
hasMoreElements
();
)
{
for
(
Enumeration
<
JarEntry
>
e
=
in
.
entries
();
e
.
hasMoreElements
();
)
{
JarEntry
je
=
(
JarEntry
)
e
.
nextElement
();
JarEntry
je
=
e
.
nextElement
();
out
.
putNextEntry
(
je
);
out
.
putNextEntry
(
je
);
InputStream
ein
=
in
.
getInputStream
(
je
);
InputStream
ein
=
in
.
getInputStream
(
je
);
for
(
int
nr
;
0
<
(
nr
=
ein
.
read
(
buffer
));
)
{
for
(
int
nr
;
0
<
(
nr
=
ein
.
read
(
buffer
));
)
{
...
...
src/share/classes/com/sun/jndi/ldap/Filter.java
浏览文件 @
92fd97c5
/*
/*
* 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
...
@@ -632,15 +632,17 @@ final class Filter {
...
@@ -632,15 +632,17 @@ final class Filter {
}
}
}
}
// The complex filter types look like:
// "&(type=val)(type=val)"
// "|(type=val)(type=val)"
// "!(type=val)"
//
// The filtOffset[0] pointing to the '&', '|', or '!'.
//
private
static
void
encodeComplexFilter
(
BerEncoder
ber
,
byte
[]
filter
,
private
static
void
encodeComplexFilter
(
BerEncoder
ber
,
byte
[]
filter
,
int
filterType
,
int
filtOffset
[],
int
filtEnd
)
int
filterType
,
int
filtOffset
[],
int
filtEnd
)
throws
IOException
,
NamingException
{
throws
IOException
,
NamingException
{
//
// We have a complex filter of type "&(type=val)(type=val)"
// with filtOffset[0] pointing to the &
//
if
(
dbg
)
{
if
(
dbg
)
{
dprint
(
"encComplexFilter: "
,
filter
,
filtOffset
[
0
],
filtEnd
);
dprint
(
"encComplexFilter: "
,
filter
,
filtOffset
[
0
],
filtEnd
);
dprint
(
", type: "
+
Integer
.
toString
(
filterType
,
16
));
dprint
(
", type: "
+
Integer
.
toString
(
filterType
,
16
));
...
@@ -652,7 +654,7 @@ final class Filter {
...
@@ -652,7 +654,7 @@ final class Filter {
ber
.
beginSeq
(
filterType
);
ber
.
beginSeq
(
filterType
);
int
[]
parens
=
findRightParen
(
filter
,
filtOffset
,
filtEnd
);
int
[]
parens
=
findRightParen
(
filter
,
filtOffset
,
filtEnd
);
encodeFilterList
(
ber
,
filter
,
parens
[
0
],
parens
[
1
]);
encodeFilterList
(
ber
,
filter
,
filterType
,
parens
[
0
],
parens
[
1
]);
ber
.
endSeq
();
ber
.
endSeq
();
...
@@ -706,7 +708,7 @@ final class Filter {
...
@@ -706,7 +708,7 @@ final class Filter {
// Encode filter list of type "(filter1)(filter2)..."
// Encode filter list of type "(filter1)(filter2)..."
//
//
private
static
void
encodeFilterList
(
BerEncoder
ber
,
byte
[]
filter
,
private
static
void
encodeFilterList
(
BerEncoder
ber
,
byte
[]
filter
,
int
start
,
int
end
)
throws
IOException
,
NamingException
{
int
filterType
,
int
start
,
int
end
)
throws
IOException
,
NamingException
{
if
(
dbg
)
{
if
(
dbg
)
{
dprint
(
"encFilterList: "
,
filter
,
start
,
end
);
dprint
(
"encFilterList: "
,
filter
,
start
,
end
);
...
@@ -714,12 +716,16 @@ final class Filter {
...
@@ -714,12 +716,16 @@ final class Filter {
}
}
int
filtOffset
[]
=
new
int
[
1
];
int
filtOffset
[]
=
new
int
[
1
];
int
listNumber
=
0
;
for
(
filtOffset
[
0
]
=
start
;
filtOffset
[
0
]
<
end
;
for
(
filtOffset
[
0
]
=
start
;
filtOffset
[
0
]
<
end
;
filtOffset
[
0
]++)
{
filtOffset
[
0
]++)
{
if
(
Character
.
isSpaceChar
((
char
)
filter
[
filtOffset
[
0
]]))
if
(
Character
.
isSpaceChar
((
char
)
filter
[
filtOffset
[
0
]]))
continue
;
continue
;
if
((
filterType
==
LDAP_FILTER_NOT
)
&&
(
listNumber
>
0
))
{
throw
new
InvalidSearchFilterException
(
"Filter (!) cannot be followed by more than one filters"
);
}
if
(
filter
[
filtOffset
[
0
]]
==
'('
)
{
if
(
filter
[
filtOffset
[
0
]]
==
'('
)
{
continue
;
continue
;
}
}
...
@@ -733,6 +739,8 @@ final class Filter {
...
@@ -733,6 +739,8 @@ final class Filter {
newfilter
[
0
]
=
(
byte
)
'('
;
newfilter
[
0
]
=
(
byte
)
'('
;
newfilter
[
len
+
1
]
=
(
byte
)
')'
;
newfilter
[
len
+
1
]
=
(
byte
)
')'
;
encodeFilter
(
ber
,
newfilter
,
0
,
newfilter
.
length
);
encodeFilter
(
ber
,
newfilter
,
0
,
newfilter
.
length
);
listNumber
++;
}
}
if
(
dbg
)
{
if
(
dbg
)
{
...
...
src/share/classes/java/lang/Math.java
浏览文件 @
92fd97c5
...
@@ -50,34 +50,34 @@ import java.util.Random;
...
@@ -50,34 +50,34 @@ import java.util.Random;
*
*
* <p>The quality of implementation specifications concern two
* <p>The quality of implementation specifications concern two
* properties, accuracy of the returned result and monotonicity of the
* properties, accuracy of the returned result and monotonicity of the
* method. Accuracy of the floating-point {@code Math} methods
* method. Accuracy of the floating-point {@code Math} methods
is
*
is measured in terms of <i>ulps</i>, units in the last place. For
*
measured in terms of <i>ulps</i>, units in the last place. For a
*
a given floating-point format, an ulp of a specific real number
*
given floating-point format, an {@linkplain #ulp(double) ulp} of a
*
value is the distance between the two floating-point values
*
specific real number value is the distance between the two
*
bracketing that numerical value. When discussing the accuracy of a
*
floating-point values bracketing that numerical value. When
*
method as a whole rather than at a specific argument, the number of
*
discussing the accuracy of a method as a whole rather than at a
*
ulps cited is for the worst-case error at any argument. If a
*
specific argument, the number of ulps cited is for the worst-case
*
method always has an error less than 0.5 ulps, the method always
*
error at any argument. If a method always has an error less than
*
returns the floating-point number nearest the exact result; such a
*
0.5 ulps, the method always returns the floating-point number
*
method is <i>correctly rounded</i>. A correctly rounded method is
*
nearest the exact result; such a method is <i>correctly
*
generally the best a floating-point approximation can be; however,
*
rounded</i>. A correctly rounded method is generally the best a
*
it is impractical for many floating-point methods to be correctly
*
floating-point approximation can be; however, it is impractical for
*
rounded. Instead, for the {@code Math} class, a larger err
or
*
many floating-point methods to be correctly rounded. Instead, f
or
*
bound of 1 or 2 ulps is allowed for certain methods. Informally,
*
the {@code Math} class, a larger error bound of 1 or 2 ulps is
*
with a 1 ulp error bound, when the exact result is a representable
*
allowed for certain methods. Informally, with a 1 ulp error bound,
*
number, the exact result should be returned as the computed result;
*
when the exact result is a representable number, the exact result
*
otherwise, either of the two floating-point values which bracket
*
should be returned as the computed result; otherwise, either of the
* t
he exact result may be returned. For exact results large in
* t
wo floating-point values which bracket the exact result may be
*
magnitude, one of the endpoints of the bracket may be infinite.
*
returned. For exact results large in magnitude, one of the
*
Besides accuracy at individual arguments, maintaining proper
*
endpoints of the bracket may be infinite. Besides accuracy at
*
relations between the method at different arguments is also
*
individual arguments, maintaining proper relations between the
*
important. Therefore, most methods with more than 0.5 ulp errors
*
method at different arguments is also important. Therefore, most
*
are required to be <i>semi-monotonic</i>: whenever the mathematical
*
methods with more than 0.5 ulp errors are required to be
*
function is non-decreasing, so is the floating-point approximation,
*
<i>semi-monotonic</i>: whenever the mathematical function is
*
likewise, whenever the mathematical function is non-increasing, so
*
non-decreasing, so is the floating-point approximation, likewise,
*
is the floating-point approximation. Not all approximations that
*
whenever the mathematical function is non-increasing, so is the
*
have 1 ulp accuracy will automatically meet the monotonicity
*
floating-point approximation. Not all approximations that have 1
* requirements.
*
ulp accuracy will automatically meet the monotonicity
requirements.
*
*
* @author unascribed
* @author unascribed
* @author Joseph D. Darcy
* @author Joseph D. Darcy
...
@@ -940,11 +940,11 @@ public final class Math {
...
@@ -940,11 +940,11 @@ public final class Math {
}
}
/**
/**
* Returns the size of an ulp of the argument. An ulp
of a
* Returns the size of an ulp of the argument. An ulp
, unit in
*
{@code double} value is the positive distance between this
*
the last place, of a {@code double} value is the positive
*
floating-point value and the {@code double} value next
*
distance between this floating-point value and the {@code
*
larger in magnitude. Note that for non-NaN <i>x</i>,
*
double} value next larger in magnitude. Note that for non-NaN
* <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
* <
i>x</i>, <
code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
*
*
* <p>Special Cases:
* <p>Special Cases:
* <ul>
* <ul>
...
@@ -967,11 +967,11 @@ public final class Math {
...
@@ -967,11 +967,11 @@ public final class Math {
}
}
/**
/**
* Returns the size of an ulp of the argument. An ulp
of a
* Returns the size of an ulp of the argument. An ulp
, unit in
*
{@code float} value is the positive distance between this
*
the last place, of a {@code float} value is the positive
*
floating-point value and the {@code float} value next
*
distance between this floating-point value and the {@code
*
larger in magnitude. Note that for non-NaN <i>x</i>,
*
float} value next larger in magnitude. Note that for non-NaN
* <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
* <
i>x</i>, <
code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
*
*
* <p>Special Cases:
* <p>Special Cases:
* <ul>
* <ul>
...
...
src/share/classes/java/lang/StrictMath.java
浏览文件 @
92fd97c5
...
@@ -932,11 +932,11 @@ public final class StrictMath {
...
@@ -932,11 +932,11 @@ public final class StrictMath {
}
}
/**
/**
* Returns the size of an ulp of the argument. An ulp
of a
* Returns the size of an ulp of the argument. An ulp
, unit in
*
{@code double} value is the positive distance between this
*
the last place, of a {@code double} value is the positive
*
floating-point value and the {@code double} value next
*
distance between this floating-point value and the {@code
*
larger in magnitude. Note that for non-NaN <i>x</i>,
*
double} value next larger in magnitude. Note that for non-NaN
* <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
* <
i>x</i>, <
code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
*
*
* <p>Special Cases:
* <p>Special Cases:
* <ul>
* <ul>
...
@@ -959,11 +959,11 @@ public final class StrictMath {
...
@@ -959,11 +959,11 @@ public final class StrictMath {
}
}
/**
/**
* Returns the size of an ulp of the argument. An ulp
of a
* Returns the size of an ulp of the argument. An ulp
, unit in
*
{@code float} value is the positive distance between this
*
the last place, of a {@code float} value is the positive
*
floating-point value and the {@code float} value next
*
distance between this floating-point value and the {@code
*
larger in magnitude. Note that for non-NaN <i>x</i>,
*
float} value next larger in magnitude. Note that for non-NaN
* <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
* <
i>x</i>, <
code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
*
*
* <p>Special Cases:
* <p>Special Cases:
* <ul>
* <ul>
...
...
src/share/classes/java/lang/reflect/Constructor.java
浏览文件 @
92fd97c5
/*
/*
* 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
...
@@ -27,13 +27,12 @@ package java.lang.reflect;
...
@@ -27,13 +27,12 @@ package java.lang.reflect;
import
sun.reflect.ConstructorAccessor
;
import
sun.reflect.ConstructorAccessor
;
import
sun.reflect.Reflection
;
import
sun.reflect.Reflection
;
import
sun.reflect.annotation.AnnotationParser
;
import
sun.reflect.generics.repository.ConstructorRepository
;
import
sun.reflect.generics.repository.ConstructorRepository
;
import
sun.reflect.generics.factory.CoreReflectionFactory
;
import
sun.reflect.generics.factory.CoreReflectionFactory
;
import
sun.reflect.generics.factory.GenericsFactory
;
import
sun.reflect.generics.factory.GenericsFactory
;
import
sun.reflect.generics.scope.ConstructorScope
;
import
sun.reflect.generics.scope.ConstructorScope
;
import
java.lang.annotation.Annotation
;
import
java.lang.annotation.Annotation
;
import
java.util.Map
;
import
sun.reflect.annotation.AnnotationParser
;
import
java.lang.annotation.AnnotationFormatError
;
import
java.lang.annotation.AnnotationFormatError
;
import
java.lang.reflect.Modifier
;
import
java.lang.reflect.Modifier
;
...
@@ -57,11 +56,7 @@ import java.lang.reflect.Modifier;
...
@@ -57,11 +56,7 @@ import java.lang.reflect.Modifier;
* @author Kenneth Russell
* @author Kenneth Russell
* @author Nakul Saraiya
* @author Nakul Saraiya
*/
*/
public
final
public
final
class
Constructor
<
T
>
extends
Executable
{
class
Constructor
<
T
>
extends
AccessibleObject
implements
GenericDeclaration
,
Member
{
private
Class
<
T
>
clazz
;
private
Class
<
T
>
clazz
;
private
int
slot
;
private
int
slot
;
private
Class
<?>[]
parameterTypes
;
private
Class
<?>[]
parameterTypes
;
...
@@ -82,7 +77,8 @@ public final
...
@@ -82,7 +77,8 @@ public final
}
}
// Accessor for generic info repository
// Accessor for generic info repository
private
ConstructorRepository
getGenericInfo
()
{
@Override
ConstructorRepository
getGenericInfo
()
{
// lazily initialize repository if necessary
// lazily initialize repository if necessary
if
(
genericInfo
==
null
)
{
if
(
genericInfo
==
null
)
{
// create and cache generic info repository
// create and cache generic info repository
...
@@ -111,8 +107,7 @@ public final
...
@@ -111,8 +107,7 @@ public final
int
slot
,
int
slot
,
String
signature
,
String
signature
,
byte
[]
annotations
,
byte
[]
annotations
,
byte
[]
parameterAnnotations
)
byte
[]
parameterAnnotations
)
{
{
this
.
clazz
=
declaringClass
;
this
.
clazz
=
declaringClass
;
this
.
parameterTypes
=
parameterTypes
;
this
.
parameterTypes
=
parameterTypes
;
this
.
exceptionTypes
=
checkedExceptions
;
this
.
exceptionTypes
=
checkedExceptions
;
...
@@ -148,10 +143,20 @@ public final
...
@@ -148,10 +143,20 @@ public final
return
res
;
return
res
;
}
}
@Override
boolean
hasGenericInformation
()
{
return
(
getSignature
()
!=
null
);
}
@Override
byte
[]
getAnnotationBytes
()
{
return
annotations
;
}
/**
/**
* Returns the {@code Class} object representing the class that declares
* {@inheritDoc}
* the constructor represented by this {@code Constructor} object.
*/
*/
@Override
public
Class
<
T
>
getDeclaringClass
()
{
public
Class
<
T
>
getDeclaringClass
()
{
return
clazz
;
return
clazz
;
}
}
...
@@ -160,36 +165,25 @@ public final
...
@@ -160,36 +165,25 @@ public final
* Returns the name of this constructor, as a string. This is
* Returns the name of this constructor, as a string. This is
* the binary name of the constructor's declaring class.
* the binary name of the constructor's declaring class.
*/
*/
@Override
public
String
getName
()
{
public
String
getName
()
{
return
getDeclaringClass
().
getName
();
return
getDeclaringClass
().
getName
();
}
}
/**
/**
* Returns the Java language modifiers for the constructor
* {@inheritDoc}
* represented by this {@code Constructor} object, as an integer. The
* {@code Modifier} class should be used to decode the modifiers.
*
* @see Modifier
*/
*/
@Override
public
int
getModifiers
()
{
public
int
getModifiers
()
{
return
modifiers
;
return
modifiers
;
}
}
/**
/**
* Returns an array of {@code TypeVariable} objects that represent the
* {@inheritDoc}
* type variables declared by the generic declaration represented by this
* @throws GenericSignatureFormatError {@inheritDoc}
* {@code GenericDeclaration} object, in declaration order. Returns an
* array of length 0 if the underlying generic declaration declares no type
* variables.
*
* @return an array of {@code TypeVariable} objects that represent
* the type variables declared by this generic declaration
* @throws GenericSignatureFormatError if the generic
* signature of this generic declaration does not conform to
* the format specified in
* <cite>The Java™ Virtual Machine Specification</cite>
* @since 1.5
* @since 1.5
*/
*/
@Override
public
TypeVariable
<
Constructor
<
T
>>[]
getTypeParameters
()
{
public
TypeVariable
<
Constructor
<
T
>>[]
getTypeParameters
()
{
if
(
getSignature
()
!=
null
)
{
if
(
getSignature
()
!=
null
)
{
return
(
TypeVariable
<
Constructor
<
T
>>[])
getGenericInfo
().
getTypeParameters
();
return
(
TypeVariable
<
Constructor
<
T
>>[])
getGenericInfo
().
getTypeParameters
();
...
@@ -199,97 +193,44 @@ public final
...
@@ -199,97 +193,44 @@ public final
/**
/**
* Returns an array of {@code Class} objects that represent the formal
* {@inheritDoc}
* parameter types, in declaration order, of the constructor
* represented by this {@code Constructor} object. Returns an array of
* length 0 if the underlying constructor takes no parameters.
*
* @return the parameter types for the constructor this object
* represents
*/
*/
@Override
public
Class
<?>[]
getParameterTypes
()
{
public
Class
<?>[]
getParameterTypes
()
{
return
(
Class
<?>[])
parameterTypes
.
clone
();
return
(
Class
<?>[])
parameterTypes
.
clone
();
}
}
/**
/**
* Returns an array of {@code Type} objects that represent the formal
* {@inheritDoc}
* parameter types, in declaration order, of the method represented by
* @throws GenericSignatureFormatError {@inheritDoc}
* this {@code Constructor} object. Returns an array of length 0 if the
* @throws TypeNotPresentException {@inheritDoc}
* underlying method takes no parameters.
* @throws MalformedParameterizedTypeException {@inheritDoc}
*
* <p>If a formal parameter type is a parameterized type,
* the {@code Type} object returned for it must accurately reflect
* the actual type parameters used in the source code.
*
* <p>If a formal parameter type is a type variable or a parameterized
* type, it is created. Otherwise, it is resolved.
*
* @return an array of {@code Type}s that represent the formal
* parameter types of the underlying method, in declaration order
* @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format
* specified in
* <cite>The Java™ Virtual Machine Specification</cite>
* @throws TypeNotPresentException if any of the parameter
* types of the underlying method refers to a non-existent type
* declaration
* @throws MalformedParameterizedTypeException if any of
* the underlying method's parameter types refer to a parameterized
* type that cannot be instantiated for any reason
* @since 1.5
* @since 1.5
*/
*/
@Override
public
Type
[]
getGenericParameterTypes
()
{
public
Type
[]
getGenericParameterTypes
()
{
if
(
getSignature
()
!=
null
)
return
super
.
getGenericParameterTypes
();
return
getGenericInfo
().
getParameterTypes
();
else
return
getParameterTypes
();
}
}
/**
/**
* Returns an array of {@code Class} objects that represent the types
* {@inheritDoc}
* of exceptions declared to be thrown by the underlying constructor
* represented by this {@code Constructor} object. Returns an array of
* length 0 if the constructor declares no exceptions in its {@code throws} clause.
*
* @return the exception types declared as being thrown by the
* constructor this object represents
*/
*/
@Override
public
Class
<?>[]
getExceptionTypes
()
{
public
Class
<?>[]
getExceptionTypes
()
{
return
(
Class
<?>[])
exceptionTypes
.
clone
();
return
(
Class
<?>[])
exceptionTypes
.
clone
();
}
}
/**
/**
* Returns an array of {@code Type} objects that represent the
* {@inheritDoc}
* exceptions declared to be thrown by this {@code Constructor} object.
* @throws GenericSignatureFormatError {@inheritDoc}
* Returns an array of length 0 if the underlying method declares
* @throws TypeNotPresentException {@inheritDoc}
* no exceptions in its {@code throws} clause.
* @throws MalformedParameterizedTypeException {@inheritDoc}
*
* <p>If an exception type is a type variable or a parameterized
* type, it is created. Otherwise, it is resolved.
*
* @return an array of Types that represent the exception types
* thrown by the underlying method
* @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format
* specified in
* <cite>The Java™ Virtual Machine Specification</cite>
* @throws TypeNotPresentException if the underlying method's
* {@code throws} clause refers to a non-existent type declaration
* @throws MalformedParameterizedTypeException if
* the underlying method's {@code throws} clause refers to a
* parameterized type that cannot be instantiated for any reason
* @since 1.5
* @since 1.5
*/
*/
@Override
public
Type
[]
getGenericExceptionTypes
()
{
public
Type
[]
getGenericExceptionTypes
()
{
Type
[]
result
;
return
super
.
getGenericExceptionTypes
();
if
(
getSignature
()
!=
null
&&
(
(
result
=
getGenericInfo
().
getExceptionTypes
()).
length
>
0
))
return
result
;
else
return
getExceptionTypes
();
}
}
/**
/**
...
@@ -302,16 +243,7 @@ public final
...
@@ -302,16 +243,7 @@ public final
if
(
obj
!=
null
&&
obj
instanceof
Constructor
)
{
if
(
obj
!=
null
&&
obj
instanceof
Constructor
)
{
Constructor
<?>
other
=
(
Constructor
<?>)
obj
;
Constructor
<?>
other
=
(
Constructor
<?>)
obj
;
if
(
getDeclaringClass
()
==
other
.
getDeclaringClass
())
{
if
(
getDeclaringClass
()
==
other
.
getDeclaringClass
())
{
/* Avoid unnecessary cloning */
return
equalParamTypes
(
parameterTypes
,
other
.
parameterTypes
);
Class
<?>[]
params1
=
parameterTypes
;
Class
<?>[]
params2
=
other
.
parameterTypes
;
if
(
params1
.
length
==
params2
.
length
)
{
for
(
int
i
=
0
;
i
<
params1
.
length
;
i
++)
{
if
(
params1
[
i
]
!=
params2
[
i
])
return
false
;
}
return
true
;
}
}
}
}
}
return
false
;
return
false
;
...
@@ -342,34 +274,14 @@ public final
...
@@ -342,34 +274,14 @@ public final
* constructor has default (package) access.
* constructor has default (package) access.
*/
*/
public
String
toString
()
{
public
String
toString
()
{
try
{
return
sharedToString
(
Modifier
.
constructorModifiers
(),
StringBuffer
sb
=
new
StringBuffer
();
parameterTypes
,
int
mod
=
getModifiers
()
&
Modifier
.
constructorModifiers
();
exceptionTypes
);
if
(
mod
!=
0
)
{
sb
.
append
(
Modifier
.
toString
(
mod
)
+
" "
);
}
}
@Override
void
specificToStringHeader
(
StringBuilder
sb
)
{
sb
.
append
(
Field
.
getTypeName
(
getDeclaringClass
()));
sb
.
append
(
Field
.
getTypeName
(
getDeclaringClass
()));
sb
.
append
(
"("
);
Class
<?>[]
params
=
parameterTypes
;
// avoid clone
for
(
int
j
=
0
;
j
<
params
.
length
;
j
++)
{
sb
.
append
(
Field
.
getTypeName
(
params
[
j
]));
if
(
j
<
(
params
.
length
-
1
))
sb
.
append
(
","
);
}
sb
.
append
(
")"
);
Class
<?>[]
exceptions
=
exceptionTypes
;
// avoid clone
if
(
exceptions
.
length
>
0
)
{
sb
.
append
(
" throws "
);
for
(
int
k
=
0
;
k
<
exceptions
.
length
;
k
++)
{
sb
.
append
(
exceptions
[
k
].
getName
());
if
(
k
<
(
exceptions
.
length
-
1
))
sb
.
append
(
","
);
}
}
return
sb
.
toString
();
}
catch
(
Exception
e
)
{
return
"<"
+
e
+
">"
;
}
}
}
/**
/**
...
@@ -405,56 +317,14 @@ public final
...
@@ -405,56 +317,14 @@ public final
*
*
* @since 1.5
* @since 1.5
*/
*/
@Override
public
String
toGenericString
()
{
public
String
toGenericString
()
{
try
{
return
sharedToGenericString
(
Modifier
.
constructorModifiers
());
StringBuilder
sb
=
new
StringBuilder
();
int
mod
=
getModifiers
()
&
Modifier
.
constructorModifiers
();
if
(
mod
!=
0
)
{
sb
.
append
(
Modifier
.
toString
(
mod
)
+
" "
);
}
TypeVariable
<?>[]
typeparms
=
getTypeParameters
();
if
(
typeparms
.
length
>
0
)
{
boolean
first
=
true
;
sb
.
append
(
"<"
);
for
(
TypeVariable
<?>
typeparm:
typeparms
)
{
if
(!
first
)
sb
.
append
(
","
);
// Class objects can't occur here; no need to test
// and call Class.getName().
sb
.
append
(
typeparm
.
toString
());
first
=
false
;
}
sb
.
append
(
"> "
);
}
sb
.
append
(
Field
.
getTypeName
(
getDeclaringClass
()));
sb
.
append
(
"("
);
Type
[]
params
=
getGenericParameterTypes
();
for
(
int
j
=
0
;
j
<
params
.
length
;
j
++)
{
String
param
=
(
params
[
j
]
instanceof
Class
<?>)?
Field
.
getTypeName
((
Class
<?>)
params
[
j
]):
(
params
[
j
].
toString
());
if
(
isVarArgs
()
&&
(
j
==
params
.
length
-
1
))
// replace T[] with T...
param
=
param
.
replaceFirst
(
"\\[\\]$"
,
"..."
);
sb
.
append
(
param
);
if
(
j
<
(
params
.
length
-
1
))
sb
.
append
(
","
);
}
sb
.
append
(
")"
);
Type
[]
exceptions
=
getGenericExceptionTypes
();
if
(
exceptions
.
length
>
0
)
{
sb
.
append
(
" throws "
);
for
(
int
k
=
0
;
k
<
exceptions
.
length
;
k
++)
{
sb
.
append
((
exceptions
[
k
]
instanceof
Class
)?
((
Class
<?>)
exceptions
[
k
]).
getName
():
exceptions
[
k
].
toString
());
if
(
k
<
(
exceptions
.
length
-
1
))
sb
.
append
(
","
);
}
}
return
sb
.
toString
();
}
catch
(
Exception
e
)
{
return
"<"
+
e
+
">"
;
}
}
@Override
void
specificToGenericStringHeader
(
StringBuilder
sb
)
{
specificToStringHeader
(
sb
);
}
}
/**
/**
...
@@ -526,29 +396,21 @@ public final
...
@@ -526,29 +396,21 @@ public final
}
}
/**
/**
* Returns {@code true} if this constructor was declared to take
* {@inheritDoc}
* a variable number of arguments; returns {@code false}
* otherwise.
*
* @return {@code true} if an only if this constructor was declared to
* take a variable number of arguments.
* @since 1.5
* @since 1.5
*/
*/
@Override
public
boolean
isVarArgs
()
{
public
boolean
isVarArgs
()
{
return
(
getModifiers
()
&
Modifier
.
VARARGS
)
!=
0
;
return
super
.
isVarArgs
()
;
}
}
/**
/**
* Returns {@code true} if this constructor is a synthetic
* {@inheritDoc}
* constructor; returns {@code false} otherwise.
*
* @return true if and only if this constructor is a synthetic
* constructor as defined by
* <cite>The Java™ Language Specification</cite>.
* @since 1.5
* @since 1.5
*/
*/
@Override
public
boolean
isSynthetic
()
{
public
boolean
isSynthetic
()
{
return
Modifier
.
isSynthetic
(
getModifiers
()
);
return
super
.
isSynthetic
(
);
}
}
// NOTE that there is no synchronization used here. It is correct
// NOTE that there is no synchronization used here. It is correct
...
@@ -604,80 +466,50 @@ public final
...
@@ -604,80 +466,50 @@ public final
return
parameterAnnotations
;
return
parameterAnnotations
;
}
}
/**
/**
* {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
* @since 1.5
* @since 1.5
*/
*/
public
<
T
extends
Annotation
>
T
getAnnotation
(
Class
<
T
>
annotationClass
)
{
public
<
T
extends
Annotation
>
T
getAnnotation
(
Class
<
T
>
annotationClass
)
{
if
(
annotationClass
==
null
)
return
super
.
getAnnotation
(
annotationClass
);
throw
new
NullPointerException
();
return
(
T
)
declaredAnnotations
().
get
(
annotationClass
);
}
}
/**
/**
* {@inheritDoc}
* @since 1.5
* @since 1.5
*/
*/
public
Annotation
[]
getDeclaredAnnotations
()
{
public
Annotation
[]
getDeclaredAnnotations
()
{
return
AnnotationParser
.
toArray
(
declaredAnnotations
());
return
super
.
getDeclaredAnnotations
();
}
private
transient
Map
<
Class
<?
extends
Annotation
>,
Annotation
>
declaredAnnotations
;
private
synchronized
Map
<
Class
<?
extends
Annotation
>,
Annotation
>
declaredAnnotations
()
{
if
(
declaredAnnotations
==
null
)
{
declaredAnnotations
=
AnnotationParser
.
parseAnnotations
(
annotations
,
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
getConstantPool
(
getDeclaringClass
()),
getDeclaringClass
());
}
return
declaredAnnotations
;
}
}
/**
/**
* Returns an array of arrays that represent the annotations on the formal
* {@inheritDoc}
* parameters, in declaration order, of the method represented by
* this {@code Constructor} object. (Returns an array of length zero if the
* underlying method is parameterless. If the method has one or more
* parameters, a nested array of length zero is returned for each parameter
* with no annotations.) The annotation objects contained in the returned
* arrays are serializable. The caller of this method is free to modify
* the returned arrays; it will have no effect on the arrays returned to
* other callers.
*
* @return an array of arrays that represent the annotations on the formal
* parameters, in declaration order, of the method represented by this
* Constructor object
* @since 1.5
* @since 1.5
*/
*/
@Override
public
Annotation
[][]
getParameterAnnotations
()
{
public
Annotation
[][]
getParameterAnnotations
()
{
int
numParameters
=
parameterTypes
.
length
;
return
sharedGetParameterAnnotations
(
parameterTypes
,
parameterAnnotations
);
if
(
parameterAnnotations
==
null
)
}
return
new
Annotation
[
numParameters
][
0
];
@Override
Annotation
[][]
result
=
AnnotationParser
.
parseParameterAnnotations
(
void
handleParameterNumberMismatch
(
int
resultLength
,
int
numParameters
)
{
parameterAnnotations
,
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
getConstantPool
(
getDeclaringClass
()),
getDeclaringClass
());
if
(
result
.
length
!=
numParameters
)
{
Class
<?>
declaringClass
=
getDeclaringClass
();
Class
<?>
declaringClass
=
getDeclaringClass
();
if
(
declaringClass
.
isEnum
()
||
if
(
declaringClass
.
isEnum
()
||
declaringClass
.
isAnonymousClass
()
||
declaringClass
.
isAnonymousClass
()
||
declaringClass
.
isLocalClass
()
)
declaringClass
.
isLocalClass
()
)
;
// Can't do reliable parameter counting
return
;
// Can't do reliable parameter counting
else
{
else
{
if
(!
declaringClass
.
isMemberClass
()
||
// top-level
if
(!
declaringClass
.
isMemberClass
()
||
// top-level
// Check for the enclosing instance parameter for
// Check for the enclosing instance parameter for
// non-static member classes
// non-static member classes
(
declaringClass
.
isMemberClass
()
&&
(
declaringClass
.
isMemberClass
()
&&
((
declaringClass
.
getModifiers
()
&
Modifier
.
STATIC
)
==
0
)
&&
((
declaringClass
.
getModifiers
()
&
Modifier
.
STATIC
)
==
0
)
&&
result
.
l
ength
+
1
!=
numParameters
)
)
{
resultL
ength
+
1
!=
numParameters
)
)
{
throw
new
AnnotationFormatError
(
throw
new
AnnotationFormatError
(
"Parameter annotations don't match number of parameters"
);
"Parameter annotations don't match number of parameters"
);
}
}
}
}
}
}
return
result
;
}
}
}
src/share/classes/java/lang/reflect/Executable.java
0 → 100644
浏览文件 @
92fd97c5
/*
* 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package
java.lang.reflect
;
import
java.lang.annotation.*
;
import
java.util.Map
;
import
sun.reflect.annotation.AnnotationParser
;
import
sun.reflect.generics.repository.ConstructorRepository
;
import
sun.reflect.generics.factory.CoreReflectionFactory
;
import
sun.reflect.generics.factory.GenericsFactory
;
import
sun.reflect.generics.scope.ConstructorScope
;
/**
* A shared superclass for the common functionality of {@link Method}
* and {@link Constructor}.
*
* @since 1.8
*/
public
abstract
class
Executable
extends
AccessibleObject
implements
Member
,
GenericDeclaration
{
/*
* Only grant package-visibility to the constructor.
*/
Executable
()
{}
/**
* Accessor method to allow code sharing
*/
abstract
byte
[]
getAnnotationBytes
();
/**
* Does the Executable have generic information.
*/
abstract
boolean
hasGenericInformation
();
abstract
ConstructorRepository
getGenericInfo
();
boolean
equalParamTypes
(
Class
<?>[]
params1
,
Class
<?>[]
params2
)
{
/* Avoid unnecessary cloning */
if
(
params1
.
length
==
params2
.
length
)
{
for
(
int
i
=
0
;
i
<
params1
.
length
;
i
++)
{
if
(
params1
[
i
]
!=
params2
[
i
])
return
false
;
}
}
return
true
;
}
Annotation
[][]
parseParameterAnnotations
(
byte
[]
parameterAnnotations
)
{
return
AnnotationParser
.
parseParameterAnnotations
(
parameterAnnotations
,
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
getConstantPool
(
getDeclaringClass
()),
getDeclaringClass
());
}
void
separateWithCommas
(
Class
<?>[]
types
,
StringBuilder
sb
)
{
for
(
int
j
=
0
;
j
<
types
.
length
;
j
++)
{
sb
.
append
(
Field
.
getTypeName
(
types
[
j
]));
if
(
j
<
(
types
.
length
-
1
))
sb
.
append
(
","
);
}
}
void
printModifiersIfNonzero
(
StringBuilder
sb
,
int
mask
)
{
int
mod
=
getModifiers
()
&
mask
;
if
(
mod
!=
0
)
{
sb
.
append
(
Modifier
.
toString
(
mod
)).
append
(
' '
);
}
}
String
sharedToString
(
int
modifierMask
,
Class
<?>[]
parameterTypes
,
Class
<?>[]
exceptionTypes
)
{
try
{
StringBuilder
sb
=
new
StringBuilder
();
printModifiersIfNonzero
(
sb
,
modifierMask
);
specificToStringHeader
(
sb
);
sb
.
append
(
'('
);
separateWithCommas
(
parameterTypes
,
sb
);
sb
.
append
(
')'
);
if
(
exceptionTypes
.
length
>
0
)
{
sb
.
append
(
" throws "
);
separateWithCommas
(
exceptionTypes
,
sb
);
}
return
sb
.
toString
();
}
catch
(
Exception
e
)
{
return
"<"
+
e
+
">"
;
}
}
/**
* Generate toString header information specific to a method or
* constructor.
*/
abstract
void
specificToStringHeader
(
StringBuilder
sb
);
String
sharedToGenericString
(
int
modifierMask
)
{
try
{
StringBuilder
sb
=
new
StringBuilder
();
printModifiersIfNonzero
(
sb
,
modifierMask
);
TypeVariable
<?>[]
typeparms
=
getTypeParameters
();
if
(
typeparms
.
length
>
0
)
{
boolean
first
=
true
;
sb
.
append
(
'<'
);
for
(
TypeVariable
<?>
typeparm:
typeparms
)
{
if
(!
first
)
sb
.
append
(
','
);
// Class objects can't occur here; no need to test
// and call Class.getName().
sb
.
append
(
typeparm
.
toString
());
first
=
false
;
}
sb
.
append
(
"> "
);
}
specificToGenericStringHeader
(
sb
);
sb
.
append
(
'('
);
Type
[]
params
=
getGenericParameterTypes
();
for
(
int
j
=
0
;
j
<
params
.
length
;
j
++)
{
String
param
=
(
params
[
j
]
instanceof
Class
)?
Field
.
getTypeName
((
Class
)
params
[
j
]):
(
params
[
j
].
toString
());
if
(
isVarArgs
()
&&
(
j
==
params
.
length
-
1
))
// replace T[] with T...
param
=
param
.
replaceFirst
(
"\\[\\]$"
,
"..."
);
sb
.
append
(
param
);
if
(
j
<
(
params
.
length
-
1
))
sb
.
append
(
','
);
}
sb
.
append
(
')'
);
Type
[]
exceptions
=
getGenericExceptionTypes
();
if
(
exceptions
.
length
>
0
)
{
sb
.
append
(
" throws "
);
for
(
int
k
=
0
;
k
<
exceptions
.
length
;
k
++)
{
sb
.
append
((
exceptions
[
k
]
instanceof
Class
)?
((
Class
)
exceptions
[
k
]).
getName
():
exceptions
[
k
].
toString
());
if
(
k
<
(
exceptions
.
length
-
1
))
sb
.
append
(
','
);
}
}
return
sb
.
toString
();
}
catch
(
Exception
e
)
{
return
"<"
+
e
+
">"
;
}
}
/**
* Generate toGenericString header information specific to a
* method or constructor.
*/
abstract
void
specificToGenericStringHeader
(
StringBuilder
sb
);
/**
* Returns the {@code Class} object representing the class or interface
* that declares the method represented by this executable object.
*/
public
abstract
Class
<?>
getDeclaringClass
();
/**
* Returns the name of the executable represented by this object.
*/
public
abstract
String
getName
();
/**
* Returns the Java language {@linkplain Modifier modifiers} for
* the executable represented by this object.
*/
public
abstract
int
getModifiers
();
/**
* Returns an array of {@code TypeVariable} objects that represent the
* type variables declared by the generic declaration represented by this
* {@code GenericDeclaration} object, in declaration order. Returns an
* array of length 0 if the underlying generic declaration declares no type
* variables.
*
* @return an array of {@code TypeVariable} objects that represent
* the type variables declared by this generic declaration
* @throws GenericSignatureFormatError if the generic
* signature of this generic declaration does not conform to
* the format specified in
* <cite>The Java™ Virtual Machine Specification</cite>
*/
public
abstract
TypeVariable
<?>[]
getTypeParameters
();
/**
* Returns an array of {@code Class} objects that represent the formal
* parameter types, in declaration order, of the executable
* represented by this object. Returns an array of length
* 0 if the underlying method takes no parameters.
*
* @return the parameter types for the method this object
* represents
*/
public
abstract
Class
<?>[]
getParameterTypes
();
/**
* Returns an array of {@code Type} objects that represent the formal
* parameter types, in declaration order, of the method represented by
* this executable object. Returns an array of length 0 if the
* underlying method takes no parameters.
*
* <p>If a formal parameter type is a parameterized type,
* the {@code Type} object returned for it must accurately reflect
* the actual type parameters used in the source code.
*
* <p>If a formal parameter type is a type variable or a parameterized
* type, it is created. Otherwise, it is resolved.
*
* @return an array of {@code Type}s that represent the formal
* parameter types of the underlying method, in declaration order
* @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format
* specified in
* <cite>The Java™ Virtual Machine Specification</cite>
* @throws TypeNotPresentException if any of the parameter
* types of the underlying method refers to a non-existent type
* declaration
* @throws MalformedParameterizedTypeException if any of
* the underlying method's parameter types refer to a parameterized
* type that cannot be instantiated for any reason
*/
public
Type
[]
getGenericParameterTypes
()
{
if
(
hasGenericInformation
())
return
getGenericInfo
().
getParameterTypes
();
else
return
getParameterTypes
();
}
/**
* Returns an array of {@code Class} objects that represent the
* types of exceptions declared to be thrown by the underlying
* executable represented by this object. Returns an array of
* length 0 if the executable declares no exceptions in its {@code
* throws} clause.
*
* @return the exception types declared as being thrown by the
* executable this object represents
*/
public
abstract
Class
<?>[]
getExceptionTypes
();
/**
* Returns an array of {@code Type} objects that represent the
* exceptions declared to be thrown by this executable object.
* Returns an array of length 0 if the underlying executable declares
* no exceptions in its {@code throws} clause.
*
* <p>If an exception type is a type variable or a parameterized
* type, it is created. Otherwise, it is resolved.
*
* @return an array of Types that represent the exception types
* thrown by the underlying method
* @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format
* specified in
* <cite>The Java™ Virtual Machine Specification</cite>
* @throws TypeNotPresentException if the underlying method's
* {@code throws} clause refers to a non-existent type declaration
* @throws MalformedParameterizedTypeException if
* the underlying method's {@code throws} clause refers to a
* parameterized type that cannot be instantiated for any reason
*/
public
Type
[]
getGenericExceptionTypes
()
{
Type
[]
result
;
if
(
hasGenericInformation
()
&&
((
result
=
getGenericInfo
().
getExceptionTypes
()).
length
>
0
))
return
result
;
else
return
getExceptionTypes
();
}
/**
* Returns a string describing this {@code Executable}, including
* any type parameters.
*/
public
abstract
String
toGenericString
();
/**
* Returns {@code true} if this executable was declared to take a
* variable number of arguments; returns {@code false} otherwise.
*
* @return {@code true} if an only if this executable was declared
* to take a variable number of arguments.
*/
public
boolean
isVarArgs
()
{
return
(
getModifiers
()
&
Modifier
.
VARARGS
)
!=
0
;
}
/**
* Returns {@code true} if this executable is a synthetic
* construct; returns {@code false} otherwise.
*
* @return true if and only if this executable is a synthetic
* construct as defined by
* <cite>The Java™ Language Specification</cite>.
*/
public
boolean
isSynthetic
()
{
return
Modifier
.
isSynthetic
(
getModifiers
());
}
/**
* Returns an array of arrays that represent the annotations on
* the formal parameters, in declaration order, of the executable
* represented by this object. (Returns an array of length zero if
* the underlying method is parameterless. If the executable has
* one or more parameters, a nested array of length zero is
* returned for each parameter with no annotations.) The
* annotation objects contained in the returned arrays are
* serializable. The caller of this method is free to modify the
* returned arrays; it will have no effect on the arrays returned
* to other callers.
*
* @return an array of arrays that represent the annotations on the formal
* parameters, in declaration order, of the exectuable represented by this
* object
*/
public
abstract
Annotation
[][]
getParameterAnnotations
();
Annotation
[][]
sharedGetParameterAnnotations
(
Class
<?>[]
parameterTypes
,
byte
[]
parameterAnnotations
)
{
int
numParameters
=
parameterTypes
.
length
;
if
(
parameterAnnotations
==
null
)
return
new
Annotation
[
numParameters
][
0
];
Annotation
[][]
result
=
parseParameterAnnotations
(
parameterAnnotations
);
if
(
result
.
length
!=
numParameters
)
handleParameterNumberMismatch
(
result
.
length
,
numParameters
);
return
result
;
}
abstract
void
handleParameterNumberMismatch
(
int
resultLength
,
int
numParameters
);
/**
* {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
*/
public
<
T
extends
Annotation
>
T
getAnnotation
(
Class
<
T
>
annotationClass
)
{
if
(
annotationClass
==
null
)
throw
new
NullPointerException
();
return
(
T
)
declaredAnnotations
().
get
(
annotationClass
);
}
/**
* {@inheritDoc}
*/
public
Annotation
[]
getDeclaredAnnotations
()
{
return
AnnotationParser
.
toArray
(
declaredAnnotations
());
}
private
transient
Map
<
Class
<?
extends
Annotation
>,
Annotation
>
declaredAnnotations
;
private
synchronized
Map
<
Class
<?
extends
Annotation
>,
Annotation
>
declaredAnnotations
()
{
if
(
declaredAnnotations
==
null
)
{
declaredAnnotations
=
AnnotationParser
.
parseAnnotations
(
getAnnotationBytes
(),
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
getConstantPool
(
getDeclaringClass
()),
getDeclaringClass
());
}
return
declaredAnnotations
;
}
}
src/share/classes/java/lang/reflect/Method.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1996, 20
06
, 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
...
@@ -36,7 +36,6 @@ import sun.reflect.annotation.AnnotationParser;
...
@@ -36,7 +36,6 @@ import sun.reflect.annotation.AnnotationParser;
import
java.lang.annotation.Annotation
;
import
java.lang.annotation.Annotation
;
import
java.lang.annotation.AnnotationFormatError
;
import
java.lang.annotation.AnnotationFormatError
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.util.Map
;
/**
/**
* A {@code Method} provides information about, and access to, a single method
* A {@code Method} provides information about, and access to, a single method
...
@@ -58,9 +57,7 @@ import java.util.Map;
...
@@ -58,9 +57,7 @@ import java.util.Map;
* @author Kenneth Russell
* @author Kenneth Russell
* @author Nakul Saraiya
* @author Nakul Saraiya
*/
*/
public
final
public
final
class
Method
extends
Executable
{
class
Method
extends
AccessibleObject
implements
GenericDeclaration
,
Member
{
private
Class
<?>
clazz
;
private
Class
<?>
clazz
;
private
int
slot
;
private
int
slot
;
// This is guaranteed to be interned by the VM in the 1.4
// This is guaranteed to be interned by the VM in the 1.4
...
@@ -83,8 +80,8 @@ public final
...
@@ -83,8 +80,8 @@ public final
// potentially many Method objects pointing to it.)
// potentially many Method objects pointing to it.)
private
Method
root
;
private
Method
root
;
// Generics infrastructure
// Generics infrastructure
private
String
getGenericSignature
()
{
return
signature
;}
private
String
getGenericSignature
()
{
return
signature
;}
// Accessor for factory
// Accessor for factory
...
@@ -94,7 +91,8 @@ public final
...
@@ -94,7 +91,8 @@ public final
}
}
// Accessor for generic info repository
// Accessor for generic info repository
private
MethodRepository
getGenericInfo
()
{
@Override
MethodRepository
getGenericInfo
()
{
// lazily initialize repository if necessary
// lazily initialize repository if necessary
if
(
genericInfo
==
null
)
{
if
(
genericInfo
==
null
)
{
// create and cache generic info repository
// create and cache generic info repository
...
@@ -119,8 +117,7 @@ public final
...
@@ -119,8 +117,7 @@ public final
String
signature
,
String
signature
,
byte
[]
annotations
,
byte
[]
annotations
,
byte
[]
parameterAnnotations
,
byte
[]
parameterAnnotations
,
byte
[]
annotationDefault
)
byte
[]
annotationDefault
)
{
{
this
.
clazz
=
declaringClass
;
this
.
clazz
=
declaringClass
;
this
.
name
=
name
;
this
.
name
=
name
;
this
.
parameterTypes
=
parameterTypes
;
this
.
parameterTypes
=
parameterTypes
;
...
@@ -156,10 +153,20 @@ public final
...
@@ -156,10 +153,20 @@ public final
return
res
;
return
res
;
}
}
@Override
boolean
hasGenericInformation
()
{
return
(
getGenericSignature
()
!=
null
);
}
@Override
byte
[]
getAnnotationBytes
()
{
return
annotations
;
}
/**
/**
* Returns the {@code Class} object representing the class or interface
* {@inheritDoc}
* that declares the method represented by this {@code Method} object.
*/
*/
@Override
public
Class
<?>
getDeclaringClass
()
{
public
Class
<?>
getDeclaringClass
()
{
return
clazz
;
return
clazz
;
}
}
...
@@ -168,36 +175,25 @@ public final
...
@@ -168,36 +175,25 @@ public final
* Returns the name of the method represented by this {@code Method}
* Returns the name of the method represented by this {@code Method}
* object, as a {@code String}.
* object, as a {@code String}.
*/
*/
@Override
public
String
getName
()
{
public
String
getName
()
{
return
name
;
return
name
;
}
}
/**
/**
* Returns the Java language modifiers for the method represented
* {@inheritDoc}
* by this {@code Method} object, as an integer. The {@code Modifier} class should
* be used to decode the modifiers.
*
* @see Modifier
*/
*/
@Override
public
int
getModifiers
()
{
public
int
getModifiers
()
{
return
modifiers
;
return
modifiers
;
}
}
/**
/**
* Returns an array of {@code TypeVariable} objects that represent the
* {@inheritDoc}
* type variables declared by the generic declaration represented by this
* @throws GenericSignatureFormatError {@inheritDoc}
* {@code GenericDeclaration} object, in declaration order. Returns an
* array of length 0 if the underlying generic declaration declares no type
* variables.
*
* @return an array of {@code TypeVariable} objects that represent
* the type variables declared by this generic declaration
* @throws GenericSignatureFormatError if the generic
* signature of this generic declaration does not conform to
* the format specified in
* <cite>The Java™ Virtual Machine Specification</cite>
* @since 1.5
* @since 1.5
*/
*/
@Override
public
TypeVariable
<
Method
>[]
getTypeParameters
()
{
public
TypeVariable
<
Method
>[]
getTypeParameters
()
{
if
(
getGenericSignature
()
!=
null
)
if
(
getGenericSignature
()
!=
null
)
return
(
TypeVariable
<
Method
>[])
getGenericInfo
().
getTypeParameters
();
return
(
TypeVariable
<
Method
>[])
getGenericInfo
().
getTypeParameters
();
...
@@ -245,98 +241,44 @@ public final
...
@@ -245,98 +241,44 @@ public final
}
else
{
return
getReturnType
();}
}
else
{
return
getReturnType
();}
}
}
/**
/**
* Returns an array of {@code Class} objects that represent the formal
* {@inheritDoc}
* parameter types, in declaration order, of the method
* represented by this {@code Method} object. Returns an array of length
* 0 if the underlying method takes no parameters.
*
* @return the parameter types for the method this object
* represents
*/
*/
@Override
public
Class
<?>[]
getParameterTypes
()
{
public
Class
<?>[]
getParameterTypes
()
{
return
(
Class
<?>[])
parameterTypes
.
clone
();
return
(
Class
<?>[])
parameterTypes
.
clone
();
}
}
/**
/**
* Returns an array of {@code Type} objects that represent the formal
* {@inheritDoc}
* parameter types, in declaration order, of the method represented by
* @throws GenericSignatureFormatError {@inheritDoc}
* this {@code Method} object. Returns an array of length 0 if the
* @throws TypeNotPresentException {@inheritDoc}
* underlying method takes no parameters.
* @throws MalformedParameterizedTypeException {@inheritDoc}
*
* <p>If a formal parameter type is a parameterized type,
* the {@code Type} object returned for it must accurately reflect
* the actual type parameters used in the source code.
*
* <p>If a formal parameter type is a type variable or a parameterized
* type, it is created. Otherwise, it is resolved.
*
* @return an array of Types that represent the formal
* parameter types of the underlying method, in declaration order
* @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format
* specified in
* <cite>The Java™ Virtual Machine Specification</cite>
* @throws TypeNotPresentException if any of the parameter
* types of the underlying method refers to a non-existent type
* declaration
* @throws MalformedParameterizedTypeException if any of
* the underlying method's parameter types refer to a parameterized
* type that cannot be instantiated for any reason
* @since 1.5
* @since 1.5
*/
*/
@Override
public
Type
[]
getGenericParameterTypes
()
{
public
Type
[]
getGenericParameterTypes
()
{
if
(
getGenericSignature
()
!=
null
)
return
super
.
getGenericParameterTypes
();
return
getGenericInfo
().
getParameterTypes
();
else
return
getParameterTypes
();
}
}
/**
/**
* Returns an array of {@code Class} objects that represent
* {@inheritDoc}
* the types of the exceptions declared to be thrown
* by the underlying method
* represented by this {@code Method} object. Returns an array of length
* 0 if the method declares no exceptions in its {@code throws} clause.
*
* @return the exception types declared as being thrown by the
* method this object represents
*/
*/
@Override
public
Class
<?>[]
getExceptionTypes
()
{
public
Class
<?>[]
getExceptionTypes
()
{
return
(
Class
<?>[])
exceptionTypes
.
clone
();
return
(
Class
<?>[])
exceptionTypes
.
clone
();
}
}
/**
/**
* Returns an array of {@code Type} objects that represent the
* {@inheritDoc}
* exceptions declared to be thrown by this {@code Method} object.
* @throws GenericSignatureFormatError {@inheritDoc}
* Returns an array of length 0 if the underlying method declares
* @throws TypeNotPresentException {@inheritDoc}
* no exceptions in its {@code throws} clause.
* @throws MalformedParameterizedTypeException {@inheritDoc}
*
* <p>If an exception type is a type variable or a parameterized
* type, it is created. Otherwise, it is resolved.
*
* @return an array of Types that represent the exception types
* thrown by the underlying method
* @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format
* specified in
* <cite>The Java™ Virtual Machine Specification</cite>
* @throws TypeNotPresentException if the underlying method's
* {@code throws} clause refers to a non-existent type declaration
* @throws MalformedParameterizedTypeException if
* the underlying method's {@code throws} clause refers to a
* parameterized type that cannot be instantiated for any reason
* @since 1.5
* @since 1.5
*/
*/
@Override
public
Type
[]
getGenericExceptionTypes
()
{
public
Type
[]
getGenericExceptionTypes
()
{
Type
[]
result
;
return
super
.
getGenericExceptionTypes
();
if
(
getGenericSignature
()
!=
null
&&
((
result
=
getGenericInfo
().
getExceptionTypes
()).
length
>
0
))
return
result
;
else
return
getExceptionTypes
();
}
}
/**
/**
...
@@ -352,16 +294,7 @@ public final
...
@@ -352,16 +294,7 @@ public final
&&
(
getName
()
==
other
.
getName
()))
{
&&
(
getName
()
==
other
.
getName
()))
{
if
(!
returnType
.
equals
(
other
.
getReturnType
()))
if
(!
returnType
.
equals
(
other
.
getReturnType
()))
return
false
;
return
false
;
/* Avoid unnecessary cloning */
return
equalParamTypes
(
parameterTypes
,
other
.
parameterTypes
);
Class
<?>[]
params1
=
parameterTypes
;
Class
<?>[]
params2
=
other
.
parameterTypes
;
if
(
params1
.
length
==
params2
.
length
)
{
for
(
int
i
=
0
;
i
<
params1
.
length
;
i
++)
{
if
(
params1
[
i
]
!=
params2
[
i
])
return
false
;
}
return
true
;
}
}
}
}
}
return
false
;
return
false
;
...
@@ -399,35 +332,16 @@ public final
...
@@ -399,35 +332,16 @@ public final
* {@code synchronized}, {@code native}, {@code strictfp}.
* {@code synchronized}, {@code native}, {@code strictfp}.
*/
*/
public
String
toString
()
{
public
String
toString
()
{
try
{
return
sharedToString
(
Modifier
.
methodModifiers
(),
StringBuilder
sb
=
new
StringBuilder
();
parameterTypes
,
int
mod
=
getModifiers
()
&
Modifier
.
methodModifiers
();
exceptionTypes
);
if
(
mod
!=
0
)
{
sb
.
append
(
Modifier
.
toString
(
mod
)).
append
(
' '
);
}
}
@Override
void
specificToStringHeader
(
StringBuilder
sb
)
{
sb
.
append
(
Field
.
getTypeName
(
getReturnType
())).
append
(
' '
);
sb
.
append
(
Field
.
getTypeName
(
getReturnType
())).
append
(
' '
);
sb
.
append
(
Field
.
getTypeName
(
getDeclaringClass
())).
append
(
'.'
);
sb
.
append
(
Field
.
getTypeName
(
getDeclaringClass
())).
append
(
'.'
);
sb
.
append
(
getName
()).
append
(
'('
);
sb
.
append
(
getName
());
Class
<?>[]
params
=
parameterTypes
;
// avoid clone
for
(
int
j
=
0
;
j
<
params
.
length
;
j
++)
{
sb
.
append
(
Field
.
getTypeName
(
params
[
j
]));
if
(
j
<
(
params
.
length
-
1
))
sb
.
append
(
','
);
}
sb
.
append
(
')'
);
Class
<?>[]
exceptions
=
exceptionTypes
;
// avoid clone
if
(
exceptions
.
length
>
0
)
{
sb
.
append
(
" throws "
);
for
(
int
k
=
0
;
k
<
exceptions
.
length
;
k
++)
{
sb
.
append
(
exceptions
[
k
].
getName
());
if
(
k
<
(
exceptions
.
length
-
1
))
sb
.
append
(
','
);
}
}
return
sb
.
toString
();
}
catch
(
Exception
e
)
{
return
"<"
+
e
+
">"
;
}
}
}
/**
/**
...
@@ -468,62 +382,20 @@ public final
...
@@ -468,62 +382,20 @@ public final
*
*
* @since 1.5
* @since 1.5
*/
*/
@Override
public
String
toGenericString
()
{
public
String
toGenericString
()
{
try
{
return
sharedToGenericString
(
Modifier
.
methodModifiers
());
StringBuilder
sb
=
new
StringBuilder
();
int
mod
=
getModifiers
()
&
Modifier
.
methodModifiers
();
if
(
mod
!=
0
)
{
sb
.
append
(
Modifier
.
toString
(
mod
)).
append
(
' '
);
}
TypeVariable
<?>[]
typeparms
=
getTypeParameters
();
if
(
typeparms
.
length
>
0
)
{
boolean
first
=
true
;
sb
.
append
(
'<'
);
for
(
TypeVariable
<?>
typeparm:
typeparms
)
{
if
(!
first
)
sb
.
append
(
','
);
// Class objects can't occur here; no need to test
// and call Class.getName().
sb
.
append
(
typeparm
.
toString
());
first
=
false
;
}
sb
.
append
(
"> "
);
}
}
@Override
void
specificToGenericStringHeader
(
StringBuilder
sb
)
{
Type
genRetType
=
getGenericReturnType
();
Type
genRetType
=
getGenericReturnType
();
sb
.
append
(
((
genRetType
instanceof
Class
<?>)?
sb
.
append
(
((
genRetType
instanceof
Class
<?>)?
Field
.
getTypeName
((
Class
<?>)
genRetType
):
genRetType
.
toString
()))
Field
.
getTypeName
((
Class
<?>)
genRetType
):
genRetType
.
toString
()))
.
append
(
' '
);
.
append
(
' '
);
sb
.
append
(
Field
.
getTypeName
(
getDeclaringClass
())).
append
(
'.'
);
sb
.
append
(
Field
.
getTypeName
(
getDeclaringClass
())).
append
(
'.'
);
sb
.
append
(
getName
()).
append
(
'('
);
sb
.
append
(
getName
());
Type
[]
params
=
getGenericParameterTypes
();
for
(
int
j
=
0
;
j
<
params
.
length
;
j
++)
{
String
param
=
(
params
[
j
]
instanceof
Class
)?
Field
.
getTypeName
((
Class
)
params
[
j
]):
(
params
[
j
].
toString
());
if
(
isVarArgs
()
&&
(
j
==
params
.
length
-
1
))
// replace T[] with T...
param
=
param
.
replaceFirst
(
"\\[\\]$"
,
"..."
);
sb
.
append
(
param
);
if
(
j
<
(
params
.
length
-
1
))
sb
.
append
(
','
);
}
sb
.
append
(
')'
);
Type
[]
exceptions
=
getGenericExceptionTypes
();
if
(
exceptions
.
length
>
0
)
{
sb
.
append
(
" throws "
);
for
(
int
k
=
0
;
k
<
exceptions
.
length
;
k
++)
{
sb
.
append
((
exceptions
[
k
]
instanceof
Class
)?
((
Class
)
exceptions
[
k
]).
getName
():
exceptions
[
k
].
toString
());
if
(
k
<
(
exceptions
.
length
-
1
))
sb
.
append
(
','
);
}
}
return
sb
.
toString
();
}
catch
(
Exception
e
)
{
return
"<"
+
e
+
">"
;
}
}
}
/**
/**
...
@@ -614,28 +486,21 @@ public final
...
@@ -614,28 +486,21 @@ public final
}
}
/**
/**
* Returns {@code true} if this method was declared to take
* {@inheritDoc}
* a variable number of arguments; returns {@code false}
* otherwise.
*
* @return {@code true} if an only if this method was declared to
* take a variable number of arguments.
* @since 1.5
* @since 1.5
*/
*/
@Override
public
boolean
isVarArgs
()
{
public
boolean
isVarArgs
()
{
return
(
getModifiers
()
&
Modifier
.
VARARGS
)
!=
0
;
return
super
.
isVarArgs
()
;
}
}
/**
/**
* Returns {@code true} if this method is a synthetic
* {@inheritDoc}
* method; returns {@code false} otherwise.
*
* @return true if and only if this method is a synthetic
* method as defined by the Java Language Specification.
* @since 1.5
* @since 1.5
*/
*/
@Override
public
boolean
isSynthetic
()
{
public
boolean
isSynthetic
()
{
return
Modifier
.
isSynthetic
(
getModifiers
()
);
return
super
.
isSynthetic
(
);
}
}
// NOTE that there is no synchronization used here. It is correct
// NOTE that there is no synchronization used here. It is correct
...
@@ -674,36 +539,6 @@ public final
...
@@ -674,36 +539,6 @@ public final
}
}
}
}
/**
* @throws NullPointerException {@inheritDoc}
* @since 1.5
*/
public
<
T
extends
Annotation
>
T
getAnnotation
(
Class
<
T
>
annotationClass
)
{
if
(
annotationClass
==
null
)
throw
new
NullPointerException
();
return
(
T
)
declaredAnnotations
().
get
(
annotationClass
);
}
/**
* @since 1.5
*/
public
Annotation
[]
getDeclaredAnnotations
()
{
return
AnnotationParser
.
toArray
(
declaredAnnotations
());
}
private
transient
Map
<
Class
<?
extends
Annotation
>,
Annotation
>
declaredAnnotations
;
private
synchronized
Map
<
Class
<?
extends
Annotation
>,
Annotation
>
declaredAnnotations
()
{
if
(
declaredAnnotations
==
null
)
{
declaredAnnotations
=
AnnotationParser
.
parseAnnotations
(
annotations
,
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
getConstantPool
(
getDeclaringClass
()),
getDeclaringClass
());
}
return
declaredAnnotations
;
}
/**
/**
* Returns the default value for the annotation member represented by
* Returns the default value for the annotation member represented by
* this {@code Method} instance. If the member is of a primitive type,
* this {@code Method} instance. If the member is of a primitive type,
...
@@ -734,34 +569,33 @@ public final
...
@@ -734,34 +569,33 @@ public final
}
}
/**
/**
* Returns an array of arrays that represent the annotations on the formal
* {@inheritDoc}
* parameters, in declaration order, of the method represented by
* @throws NullPointerException {@inheritDoc}
* this {@code Method} object. (Returns an array of length zero if the
* underlying method is parameterless. If the method has one or more
* parameters, a nested array of length zero is returned for each parameter
* with no annotations.) The annotation objects contained in the returned
* arrays are serializable. The caller of this method is free to modify
* the returned arrays; it will have no effect on the arrays returned to
* other callers.
*
* @return an array of arrays that represent the annotations on the formal
* parameters, in declaration order, of the method represented by this
* Method object
* @since 1.5
* @since 1.5
*/
*/
public
<
T
extends
Annotation
>
T
getAnnotation
(
Class
<
T
>
annotationClass
)
{
return
super
.
getAnnotation
(
annotationClass
);
}
/**
* {@inheritDoc}
* @since 1.5
*/
public
Annotation
[]
getDeclaredAnnotations
()
{
return
super
.
getDeclaredAnnotations
();
}
/**
* {@inheritDoc}
* @since 1.5
*/
@Override
public
Annotation
[][]
getParameterAnnotations
()
{
public
Annotation
[][]
getParameterAnnotations
()
{
int
numParameters
=
parameterTypes
.
length
;
return
sharedGetParameterAnnotations
(
parameterTypes
,
parameterAnnotations
);
if
(
parameterAnnotations
==
null
)
}
return
new
Annotation
[
numParameters
][
0
];
Annotation
[][]
result
=
AnnotationParser
.
parseParameterAnnotations
(
@Override
parameterAnnotations
,
void
handleParameterNumberMismatch
(
int
resultLength
,
int
numParameters
)
{
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
throw
new
AnnotationFormatError
(
"Parameter annotations don't match number of parameters"
);
getConstantPool
(
getDeclaringClass
()),
getDeclaringClass
());
if
(
result
.
length
!=
numParameters
)
throw
new
java
.
lang
.
annotation
.
AnnotationFormatError
(
"Parameter annotations don't match number of parameters"
);
return
result
;
}
}
}
}
src/share/classes/java/net/SocketPermission.java
浏览文件 @
92fd97c5
...
@@ -956,11 +956,17 @@ implements java.io.Serializable
...
@@ -956,11 +956,17 @@ implements java.io.Serializable
String
thisHost
=
hostname
;
String
thisHost
=
hostname
;
String
thatHost
=
that
.
hostname
;
String
thatHost
=
that
.
hostname
;
if
(
thisHost
==
null
)
if
(
thisHost
==
null
)
{
return
false
;
return
false
;
else
}
else
if
(
this
.
wildcard
)
{
final
int
cnameLength
=
this
.
cname
.
length
();
return
thatHost
.
regionMatches
(
true
,
(
thatHost
.
length
()
-
cnameLength
),
this
.
cname
,
0
,
cnameLength
);
}
else
{
return
thisHost
.
equalsIgnoreCase
(
thatHost
);
return
thisHost
.
equalsIgnoreCase
(
thatHost
);
}
}
}
/**
/**
* Checks two SocketPermission objects for equality.
* Checks two SocketPermission objects for equality.
...
...
src/share/classes/java/security/KeyStore.java
浏览文件 @
92fd97c5
...
@@ -113,14 +113,8 @@ import javax.security.auth.callback.*;
...
@@ -113,14 +113,8 @@ import javax.security.auth.callback.*;
* // get user password and file input stream
* // get user password and file input stream
* char[] password = getPassword();
* char[] password = getPassword();
*
*
* java.io.FileInputStream fis = null;
* try (FileInputStream fis = new FileInputStream("keyStoreName")) {
* try {
* fis = new java.io.FileInputStream("keyStoreName");
* ks.load(fis, password);
* ks.load(fis, password);
* } finally {
* if (fis != null) {
* fis.close();
* }
* }
* }
* </pre>
* </pre>
*
*
...
@@ -146,14 +140,8 @@ import javax.security.auth.callback.*;
...
@@ -146,14 +140,8 @@ import javax.security.auth.callback.*;
* ks.setEntry("secretKeyAlias", skEntry, protParam);
* ks.setEntry("secretKeyAlias", skEntry, protParam);
*
*
* // store away the keystore
* // store away the keystore
* java.io.FileOutputStream fos = null;
* try (FileOutputStream fos = new FileOutputStream("newKeyStoreName")) {
* try {
* fos = new java.io.FileOutputStream("newKeyStoreName");
* ks.store(fos, password);
* ks.store(fos, password);
* } finally {
* if (fos != null) {
* fos.close();
* }
* }
* }
* </pre>
* </pre>
*
*
...
...
src/share/classes/java/security/cert/X509CRL.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1997, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
...
@@ -94,15 +94,9 @@ import sun.security.x509.X509CRLImpl;
...
@@ -94,15 +94,9 @@ import sun.security.x509.X509CRLImpl;
* CRLs are instantiated using a certificate factory. The following is an
* CRLs are instantiated using a certificate factory. The following is an
* example of how to instantiate an X.509 CRL:
* example of how to instantiate an X.509 CRL:
* <pre><code>
* <pre><code>
* InputStream inStream = null;
* try (InputStream inStream = new FileInputStream("fileName-of-crl")) {
* try {
* inStream = new FileInputStream("fileName-of-crl");
* CertificateFactory cf = CertificateFactory.getInstance("X.509");
* CertificateFactory cf = CertificateFactory.getInstance("X.509");
* X509CRL crl = (X509CRL)cf.generateCRL(inStream);
* X509CRL crl = (X509CRL)cf.generateCRL(inStream);
* } finally {
* if (inStream != null) {
* inStream.close();
* }
* }
* }
* </code></pre>
* </code></pre>
*
*
...
...
src/share/classes/java/security/cert/X509Certificate.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1997, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
...
@@ -89,15 +89,9 @@ import sun.security.x509.X509CertImpl;
...
@@ -89,15 +89,9 @@ import sun.security.x509.X509CertImpl;
* Certificates are instantiated using a certificate factory. The following is
* Certificates are instantiated using a certificate factory. The following is
* an example of how to instantiate an X.509 certificate:
* an example of how to instantiate an X.509 certificate:
* <pre>
* <pre>
* InputStream inStream = null;
* try (InputStream inStream = new FileInputStream("fileName-of-cert")) {
* try {
* inStream = new FileInputStream("fileName-of-cert");
* CertificateFactory cf = CertificateFactory.getInstance("X.509");
* CertificateFactory cf = CertificateFactory.getInstance("X.509");
* X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream);
* X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream);
* } finally {
* if (inStream != null) {
* inStream.close();
* }
* }
* }
* </pre>
* </pre>
*
*
...
...
src/share/classes/java/security/cert/X509Extension.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 1997, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
...
@@ -85,16 +85,10 @@ public interface X509Extension {
...
@@ -85,16 +85,10 @@ public interface X509Extension {
* Here is sample code to get a Set of critical extensions from an
* Here is sample code to get a Set of critical extensions from an
* X509Certificate and print the OIDs:
* X509Certificate and print the OIDs:
* <pre><code>
* <pre><code>
* InputStream inStrm = null;
* X509Certificate cert = null;
* X509Certificate cert = null;
* try {
* try (InputStream inStrm = new FileInputStream("DER-encoded-Cert")) {
* inStrm = new FileInputStream("DER-encoded-Cert");
* CertificateFactory cf = CertificateFactory.getInstance("X.509");
* CertificateFactory cf = CertificateFactory.getInstance("X.509");
* cert = (X509Certificate)cf.generateCertificate(inStrm);
* cert = (X509Certificate)cf.generateCertificate(inStrm);
* } finally {
* if (inStrm != null) {
* inStrm.close();
* }
* }<p>
* }<p>
*
*
* Set<String> critSet = cert.getCriticalExtensionOIDs();
* Set<String> critSet = cert.getCriticalExtensionOIDs();
...
@@ -120,23 +114,16 @@ public interface X509Extension {
...
@@ -120,23 +114,16 @@ public interface X509Extension {
* Here is sample code to get a Set of non-critical extensions from an
* Here is sample code to get a Set of non-critical extensions from an
* X509CRL revoked certificate entry and print the OIDs:
* X509CRL revoked certificate entry and print the OIDs:
* <pre><code>
* <pre><code>
* InputStream inStrm = null;
* CertificateFactory cf = null;
* CertificateFactory cf = null;
* X509CRL crl = null;
* X509CRL crl = null;
* try {
* try (InputStream inStrm = new FileInputStream("DER-encoded-CRL")) {
* inStrm = new FileInputStream("DER-encoded-CRL");
* cf = CertificateFactory.getInstance("X.509");
* cf = CertificateFactory.getInstance("X.509");
* crl = (X509CRL)cf.generateCRL(inStrm);
* crl = (X509CRL)cf.generateCRL(inStrm);
* } finally {
* if (inStrm != null) {
* inStrm.close();
* }
* }<p>
* }<p>
*
*
* byte[] certData = <DER-encoded certificate data>
* byte[] certData = <DER-encoded certificate data>
* ByteArrayInputStream bais = new ByteArrayInputStream(certData);
* ByteArrayInputStream bais = new ByteArrayInputStream(certData);
* X509Certificate cert = (X509Certificate)cf.generateCertificate(bais);
* X509Certificate cert = (X509Certificate)cf.generateCertificate(bais);
* bais.close();
* X509CRLEntry badCert =
* X509CRLEntry badCert =
* crl.getRevokedCertificate(cert.getSerialNumber());<p>
* crl.getRevokedCertificate(cert.getSerialNumber());<p>
*
*
...
...
src/share/classes/sun/launcher/LauncherHelper.java
浏览文件 @
92fd97c5
...
@@ -396,7 +396,11 @@ public enum LauncherHelper {
...
@@ -396,7 +396,11 @@ public enum LauncherHelper {
if
(
mainAttrs
==
null
)
{
if
(
mainAttrs
==
null
)
{
abort
(
ostream
,
null
,
"java.launcher.jar.error3"
,
jarname
);
abort
(
ostream
,
null
,
"java.launcher.jar.error3"
,
jarname
);
}
}
return
mainAttrs
.
getValue
(
MAIN_CLASS
).
trim
();
String
mainValue
=
mainAttrs
.
getValue
(
MAIN_CLASS
);
if
(
mainValue
==
null
)
{
abort
(
ostream
,
null
,
"java.launcher.jar.error3"
,
jarname
);
}
return
mainValue
.
trim
();
}
finally
{
}
finally
{
if
(
jarFile
!=
null
)
{
if
(
jarFile
!=
null
)
{
jarFile
.
close
();
jarFile
.
close
();
...
...
src/share/classes/sun/launcher/resources/launcher.properties
浏览文件 @
92fd97c5
...
@@ -72,7 +72,7 @@ java.launcher.opt.footer =\ -cp <class search path of directories and zip
...
@@ -72,7 +72,7 @@ java.launcher.opt.footer =\ -cp <class search path of directories and zip
\
load Java programming language agent, see java.lang.instrument
\n\
\
load Java programming language agent, see java.lang.instrument
\n\
\
-splash:<imagepath>
\n\
\
-splash:<imagepath>
\n\
\
show splash screen with specified image
\n\
\
show splash screen with specified image
\n\
See http://
java.sun.com/javase/reference
for more details.
See http://
www.oracle.com/technetwork/java/javase/documentation/index.html
for more details.
# Translators please note do not translate the options themselves
# Translators please note do not translate the options themselves
java.launcher.X.usage
=
\
java.launcher.X.usage
=
\
...
...
src/share/classes/sun/net/httpserver/ServerConfig.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
src/share/classes/sun/net/httpserver/ServerImpl.java
浏览文件 @
92fd97c5
...
@@ -27,8 +27,6 @@ package sun.net.httpserver;
...
@@ -27,8 +27,6 @@ package sun.net.httpserver;
import
java.net.*
;
import
java.net.*
;
import
java.io.*
;
import
java.io.*
;
import
java.nio.*
;
import
java.security.*
;
import
java.nio.channels.*
;
import
java.nio.channels.*
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.*
;
import
java.util.concurrent.*
;
...
@@ -36,7 +34,6 @@ import java.util.logging.Logger;
...
@@ -36,7 +34,6 @@ import java.util.logging.Logger;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
javax.net.ssl.*
;
import
javax.net.ssl.*
;
import
com.sun.net.httpserver.*
;
import
com.sun.net.httpserver.*
;
import
com.sun.net.httpserver.spi.*
;
import
sun.net.httpserver.HttpConnection.State
;
import
sun.net.httpserver.HttpConnection.State
;
/**
/**
...
@@ -358,6 +355,12 @@ class ServerImpl implements TimeSource {
...
@@ -358,6 +355,12 @@ class ServerImpl implements TimeSource {
continue
;
continue
;
}
}
SocketChannel
chan
=
schan
.
accept
();
SocketChannel
chan
=
schan
.
accept
();
// Set TCP_NODELAY, if appropriate
if
(
ServerConfig
.
noDelay
())
{
chan
.
socket
().
setTcpNoDelay
(
true
);
}
if
(
chan
==
null
)
{
if
(
chan
==
null
)
{
continue
;
/* cancel something ? */
continue
;
/* cancel something ? */
}
}
...
...
src/share/classes/sun/reflect/generics/reflectiveObjects/NotImplementedException.java
浏览文件 @
92fd97c5
/*
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003,
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
...
@@ -26,4 +26,6 @@
...
@@ -26,4 +26,6 @@
package
sun.reflect.generics.reflectiveObjects
;
package
sun.reflect.generics.reflectiveObjects
;
/** Temporary class used to indicate missing functionality */
/** Temporary class used to indicate missing functionality */
public
class
NotImplementedException
extends
RuntimeException
{}
public
class
NotImplementedException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
-
9177857708926624790L
;
}
src/share/classes/sun/reflect/misc/ConstructorUtil.java
浏览文件 @
92fd97c5
/*
/*
* 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
...
@@ -32,13 +32,13 @@ public final class ConstructorUtil {
...
@@ -32,13 +32,13 @@ public final class ConstructorUtil {
private
ConstructorUtil
()
{
private
ConstructorUtil
()
{
}
}
public
static
Constructor
getConstructor
(
Class
cls
,
Class
[]
params
)
public
static
Constructor
<?>
getConstructor
(
Class
<?>
cls
,
Class
<?>
[]
params
)
throws
NoSuchMethodException
{
throws
NoSuchMethodException
{
ReflectUtil
.
checkPackageAccess
(
cls
);
ReflectUtil
.
checkPackageAccess
(
cls
);
return
cls
.
getConstructor
(
params
);
return
cls
.
getConstructor
(
params
);
}
}
public
static
Constructor
[]
getConstructors
(
Class
cls
)
{
public
static
Constructor
<?>[]
getConstructors
(
Class
<?>
cls
)
{
ReflectUtil
.
checkPackageAccess
(
cls
);
ReflectUtil
.
checkPackageAccess
(
cls
);
return
cls
.
getConstructors
();
return
cls
.
getConstructors
();
}
}
...
...
src/share/classes/sun/reflect/misc/FieldUtil.java
浏览文件 @
92fd97c5
/*
/*
* 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
...
@@ -35,18 +35,18 @@ public final class FieldUtil {
...
@@ -35,18 +35,18 @@ public final class FieldUtil {
private
FieldUtil
()
{
private
FieldUtil
()
{
}
}
public
static
Field
getField
(
Class
cls
,
String
name
)
public
static
Field
getField
(
Class
<?>
cls
,
String
name
)
throws
NoSuchFieldException
{
throws
NoSuchFieldException
{
ReflectUtil
.
checkPackageAccess
(
cls
);
ReflectUtil
.
checkPackageAccess
(
cls
);
return
cls
.
getField
(
name
);
return
cls
.
getField
(
name
);
}
}
public
static
Field
[]
getFields
(
Class
cls
)
{
public
static
Field
[]
getFields
(
Class
<?>
cls
)
{
ReflectUtil
.
checkPackageAccess
(
cls
);
ReflectUtil
.
checkPackageAccess
(
cls
);
return
cls
.
getFields
();
return
cls
.
getFields
();
}
}
public
static
Field
[]
getDeclaredFields
(
Class
cls
)
{
public
static
Field
[]
getDeclaredFields
(
Class
<?>
cls
)
{
ReflectUtil
.
checkPackageAccess
(
cls
);
ReflectUtil
.
checkPackageAccess
(
cls
);
return
cls
.
getDeclaredFields
();
return
cls
.
getDeclaredFields
();
}
}
...
...
src/share/classes/sun/reflect/misc/MethodUtil.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
src/share/classes/sun/reflect/misc/ReflectUtil.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
src/share/classes/sun/security/ssl/SSLContextImpl.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
src/share/classes/sun/security/ssl/SSLSocketImpl.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
src/share/classes/sun/util/locale/LocaleObjectCache.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
test/ProblemList.txt
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
test/com/sun/crypto/provider/Cipher/DES/PaddingTest.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
test/com/sun/jndi/ldap/InvalidLdapFilters.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
test/com/sun/net/httpserver/Test1.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
test/java/net/SocketPermission/Wildcard.java
0 → 100644
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
test/java/util/Locale/LocaleCategory.sh
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
test/java/util/concurrent/Executors/AutoShutdown.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
test/java/util/concurrent/Phaser/Arrive.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
test/tools/launcher/Arrrghs.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
test/tools/launcher/TestHelper.java
浏览文件 @
92fd97c5
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录