Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
aacc1372
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看板
提交
aacc1372
编写于
5月 02, 2012
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
1d152375
353359eb
变更
130
展开全部
隐藏空白更改
内联
并排
Showing
130 changed file
with
3815 addition
and
3701 deletion
+3815
-3701
make/common/Defs-macosx.gmk
make/common/Defs-macosx.gmk
+6
-6
make/common/shared/Platform.gmk
make/common/shared/Platform.gmk
+2
-2
make/launchers/Makefile.launcher
make/launchers/Makefile.launcher
+1
-0
src/macosx/bin/x86_64/jvm.cfg
src/macosx/bin/x86_64/jvm.cfg
+0
-0
src/macosx/classes/apple/launcher/JavaAppLauncher.java
src/macosx/classes/apple/launcher/JavaAppLauncher.java
+7
-2
src/macosx/classes/apple/security/KeychainStore.java
src/macosx/classes/apple/security/KeychainStore.java
+7
-1
src/macosx/classes/com/apple/concurrent/LibDispatchNative.java
...acosx/classes/com/apple/concurrent/LibDispatchNative.java
+17
-11
src/macosx/classes/com/apple/eawt/Application.java
src/macosx/classes/com/apple/eawt/Application.java
+7
-2
src/macosx/classes/com/apple/eio/FileManager.java
src/macosx/classes/com/apple/eio/FileManager.java
+7
-1
src/macosx/classes/com/apple/laf/AquaFileView.java
src/macosx/classes/com/apple/laf/AquaFileView.java
+7
-2
src/macosx/classes/com/apple/laf/AquaLookAndFeel.java
src/macosx/classes/com/apple/laf/AquaLookAndFeel.java
+9
-3
src/macosx/classes/com/apple/laf/AquaNativeResources.java
src/macosx/classes/com/apple/laf/AquaNativeResources.java
+7
-2
src/macosx/classes/com/apple/laf/ScreenMenu.java
src/macosx/classes/com/apple/laf/ScreenMenu.java
+7
-2
src/macosx/classes/com/apple/laf/ScreenPopupFactory.java
src/macosx/classes/com/apple/laf/ScreenPopupFactory.java
+7
-3
src/macosx/classes/java/util/prefs/MacOSXPreferences.java
src/macosx/classes/java/util/prefs/MacOSXPreferences.java
+11
-2
src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java
...macosx/classes/java/util/prefs/MacOSXPreferencesFile.java
+40
-1
src/macosx/classes/sun/awt/CGraphicsEnvironment.java
src/macosx/classes/sun/awt/CGraphicsEnvironment.java
+9
-3
src/macosx/classes/sun/lwawt/macosx/CAccessibility.java
src/macosx/classes/sun/lwawt/macosx/CAccessibility.java
+7
-2
src/share/bin/java.c
src/share/bin/java.c
+7
-0
src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
...classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
+6
-1
src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
...classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
+6
-1
src/share/classes/com/sun/java/util/jar/pack/Attribute.java
src/share/classes/com/sun/java/util/jar/pack/Attribute.java
+31
-15
src/share/classes/com/sun/java/util/jar/pack/BandStructure.java
...are/classes/com/sun/java/util/jar/pack/BandStructure.java
+49
-18
src/share/classes/com/sun/java/util/jar/pack/ClassReader.java
...share/classes/com/sun/java/util/jar/pack/ClassReader.java
+112
-17
src/share/classes/com/sun/java/util/jar/pack/ClassWriter.java
...share/classes/com/sun/java/util/jar/pack/ClassWriter.java
+45
-4
src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java
...hare/classes/com/sun/java/util/jar/pack/ConstantPool.java
+462
-50
src/share/classes/com/sun/java/util/jar/pack/Constants.java
src/share/classes/com/sun/java/util/jar/pack/Constants.java
+40
-11
src/share/classes/com/sun/java/util/jar/pack/Instruction.java
...share/classes/com/sun/java/util/jar/pack/Instruction.java
+10
-8
src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
...hare/classes/com/sun/java/util/jar/pack/NativeUnpack.java
+6
-1
src/share/classes/com/sun/java/util/jar/pack/Package.java
src/share/classes/com/sun/java/util/jar/pack/Package.java
+46
-11
src/share/classes/com/sun/java/util/jar/pack/PackageReader.java
...are/classes/com/sun/java/util/jar/pack/PackageReader.java
+156
-24
src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java
...are/classes/com/sun/java/util/jar/pack/PackageWriter.java
+106
-52
src/share/classes/com/sun/java/util/jar/pack/TLGlobals.java
src/share/classes/com/sun/java/util/jar/pack/TLGlobals.java
+29
-1
src/share/classes/com/sun/java/util/jar/pack/Utils.java
src/share/classes/com/sun/java/util/jar/pack/Utils.java
+15
-28
src/share/classes/java/awt/SplashScreen.java
src/share/classes/java/awt/SplashScreen.java
+6
-1
src/share/classes/java/awt/Toolkit.java
src/share/classes/java/awt/Toolkit.java
+6
-1
src/share/classes/java/awt/event/NativeLibLoader.java
src/share/classes/java/awt/event/NativeLibLoader.java
+6
-1
src/share/classes/java/awt/image/ColorModel.java
src/share/classes/java/awt/image/ColorModel.java
+6
-1
src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
...are/classes/java/net/AbstractPlainDatagramSocketImpl.java
+8
-3
src/share/classes/java/net/AbstractPlainSocketImpl.java
src/share/classes/java/net/AbstractPlainSocketImpl.java
+6
-1
src/share/classes/java/net/DatagramPacket.java
src/share/classes/java/net/DatagramPacket.java
+6
-1
src/share/classes/java/net/InetAddress.java
src/share/classes/java/net/InetAddress.java
+7
-1
src/share/classes/java/net/NetworkInterface.java
src/share/classes/java/net/NetworkInterface.java
+8
-1
src/share/classes/java/nio/Bits.java
src/share/classes/java/nio/Bits.java
+2
-2
src/share/classes/java/nio/file/Path.java
src/share/classes/java/nio/file/Path.java
+1
-1
src/share/classes/java/text/DateFormatSymbols.java
src/share/classes/java/text/DateFormatSymbols.java
+19
-5
src/share/classes/java/util/prefs/Preferences.java
src/share/classes/java/util/prefs/Preferences.java
+2
-2
src/share/classes/javax/net/ssl/SSLContext.java
src/share/classes/javax/net/ssl/SSLContext.java
+3
-3
src/share/classes/sun/awt/NativeLibLoader.java
src/share/classes/sun/awt/NativeLibLoader.java
+6
-1
src/share/classes/sun/awt/OSInfo.java
src/share/classes/sun/awt/OSInfo.java
+2
-2
src/share/classes/sun/awt/image/JPEGImageDecoder.java
src/share/classes/sun/awt/image/JPEGImageDecoder.java
+6
-1
src/share/classes/sun/awt/image/NativeLibLoader.java
src/share/classes/sun/awt/image/NativeLibLoader.java
+7
-2
src/share/classes/sun/font/FontUtilities.java
src/share/classes/sun/font/FontUtilities.java
+2
-2
src/share/classes/sun/java2d/Disposer.java
src/share/classes/sun/java2d/Disposer.java
+6
-1
src/share/classes/sun/launcher/LauncherHelper.java
src/share/classes/sun/launcher/LauncherHelper.java
+2
-2
src/share/classes/sun/management/ManagementFactoryHelper.java
...share/classes/sun/management/ManagementFactoryHelper.java
+7
-2
src/share/classes/sun/net/sdp/SdpSupport.java
src/share/classes/sun/net/sdp/SdpSupport.java
+6
-1
src/share/classes/sun/net/spi/DefaultProxySelector.java
src/share/classes/sun/net/spi/DefaultProxySelector.java
+6
-1
src/share/classes/sun/nio/ch/DatagramChannelImpl.java
src/share/classes/sun/nio/ch/DatagramChannelImpl.java
+3
-2
src/share/classes/sun/nio/ch/Util.java
src/share/classes/sun/nio/ch/Util.java
+9
-4
src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
+2
-2
src/share/classes/sun/print/PSPrinterJob.java
src/share/classes/sun/print/PSPrinterJob.java
+2
-2
src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
.../classes/sun/security/jgss/wrapper/SunNativeProvider.java
+2
-2
src/share/classes/sun/security/krb5/Config.java
src/share/classes/sun/security/krb5/Config.java
+2
-2
src/share/classes/sun/security/krb5/Credentials.java
src/share/classes/sun/security/krb5/Credentials.java
+3
-3
src/share/classes/sun/security/krb5/SCDynamicStoreConfig.java
...share/classes/sun/security/krb5/SCDynamicStoreConfig.java
+7
-1
src/share/classes/sun/security/provider/ByteArrayAccess.java
src/share/classes/sun/security/provider/ByteArrayAccess.java
+3
-2
src/share/classes/sun/security/smartcardio/PCSC.java
src/share/classes/sun/security/smartcardio/PCSC.java
+0
-2
src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java
...asses/sun/security/util/DisabledAlgorithmConstraints.java
+6
-4
src/share/classes/sun/tracing/dtrace/JVM.java
src/share/classes/sun/tracing/dtrace/JVM.java
+7
-2
src/share/native/com/sun/java/util/jar/pack/bands.cpp
src/share/native/com/sun/java/util/jar/pack/bands.cpp
+20
-13
src/share/native/com/sun/java/util/jar/pack/bands.h
src/share/native/com/sun/java/util/jar/pack/bands.h
+21
-3
src/share/native/com/sun/java/util/jar/pack/constants.h
src/share/native/com/sun/java/util/jar/pack/constants.h
+78
-52
src/share/native/com/sun/java/util/jar/pack/defines.h
src/share/native/com/sun/java/util/jar/pack/defines.h
+3
-2
src/share/native/com/sun/java/util/jar/pack/unpack.cpp
src/share/native/com/sun/java/util/jar/pack/unpack.cpp
+454
-154
src/share/native/com/sun/java/util/jar/pack/unpack.h
src/share/native/com/sun/java/util/jar/pack/unpack.h
+30
-11
src/share/native/java/util/zip/ZipFile.c
src/share/native/java/util/zip/ZipFile.c
+1
-0
src/share/native/java/util/zip/zip_util.c
src/share/native/java/util/zip/zip_util.c
+19
-12
src/solaris/classes/sun/management/FileSystemImpl.java
src/solaris/classes/sun/management/FileSystemImpl.java
+7
-2
src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java
...olaris/classes/sun/net/dns/ResolverConfigurationImpl.java
+6
-1
src/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
...lasses/sun/nio/ch/DefaultAsynchronousChannelProvider.java
+2
-2
src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java
src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java
+6
-1
src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java
...solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java
+6
-1
src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
...olaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
+6
-1
src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
...solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
+2
-2
src/solaris/classes/sun/nio/fs/SolarisWatchService.java
src/solaris/classes/sun/nio/fs/SolarisWatchService.java
+32
-34
src/solaris/classes/sun/print/CUPSPrinter.java
src/solaris/classes/sun/print/CUPSPrinter.java
+6
-1
src/solaris/classes/sun/print/UnixPrintServiceLookup.java
src/solaris/classes/sun/print/UnixPrintServiceLookup.java
+2
-2
src/solaris/native/java/net/PlainDatagramSocketImpl.c
src/solaris/native/java/net/PlainDatagramSocketImpl.c
+6
-1
src/solaris/native/java/net/net_util_md.c
src/solaris/native/java/net/net_util_md.c
+18
-0
src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
+2
-2
src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
...ndows/classes/sun/awt/shell/Win32ShellFolderManager2.java
+7
-3
src/windows/classes/sun/awt/windows/WToolkit.java
src/windows/classes/sun/awt/windows/WToolkit.java
+6
-1
src/windows/classes/sun/management/FileSystemImpl.java
src/windows/classes/sun/management/FileSystemImpl.java
+7
-2
src/windows/classes/sun/net/dns/ResolverConfigurationImpl.java
...indows/classes/sun/net/dns/ResolverConfigurationImpl.java
+6
-1
src/windows/classes/sun/print/Win32PrintServiceLookup.java
src/windows/classes/sun/print/Win32PrintServiceLookup.java
+6
-1
src/windows/classes/sun/security/smartcardio/PlatformPCSC.java
...indows/classes/sun/security/smartcardio/PlatformPCSC.java
+7
-3
src/windows/native/java/net/NetworkInterface.c
src/windows/native/java/net/NetworkInterface.c
+14
-8
src/windows/native/java/net/NetworkInterface.h
src/windows/native/java/net/NetworkInterface.h
+5
-0
src/windows/native/sun/nio/ch/DatagramChannelImpl.c
src/windows/native/sun/nio/ch/DatagramChannelImpl.c
+1
-1
test/ProblemList.txt
test/ProblemList.txt
+3
-3
test/com/sun/crypto/provider/Mac/MacClone.java
test/com/sun/crypto/provider/Mac/MacClone.java
+3
-3
test/demo/jvmti/DemoRun.java
test/demo/jvmti/DemoRun.java
+2
-2
test/java/io/File/GetXSpace.java
test/java/io/File/GetXSpace.java
+2
-2
test/java/lang/ProcessBuilder/Basic.java
test/java/lang/ProcessBuilder/Basic.java
+2
-2
test/java/lang/ProcessBuilder/Zombies.java
test/java/lang/ProcessBuilder/Zombies.java
+2
-2
test/java/lang/invoke/InvokeGenericTest.java
test/java/lang/invoke/InvokeGenericTest.java
+2
-2
test/java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java
...anagement/OperatingSystemMXBean/GetSystemLoadAverage.java
+3
-3
test/java/nio/channels/DatagramChannel/Disconnect.java
test/java/nio/channels/DatagramChannel/Disconnect.java
+77
-0
test/java/nio/channels/FileChannel/Size.java
test/java/nio/channels/FileChannel/Size.java
+2
-2
test/java/nio/channels/FileChannel/Transfer.java
test/java/nio/channels/FileChannel/Transfer.java
+2
-2
test/java/nio/file/FileSystem/Basic.java
test/java/nio/file/FileSystem/Basic.java
+2
-2
test/java/nio/file/WatchService/MayFlies.java
test/java/nio/file/WatchService/MayFlies.java
+181
-0
test/java/util/prefs/RemoveNullKeyCheck.java
test/java/util/prefs/RemoveNullKeyCheck.java
+44
-0
test/sun/net/www/protocol/jar/B4957695.java
test/sun/net/www/protocol/jar/B4957695.java
+2
-1
test/sun/nio/ch/SelProvider.java
test/sun/nio/ch/SelProvider.java
+2
-2
test/tools/launcher/Arrrghs.java
test/tools/launcher/Arrrghs.java
+8
-1
test/tools/launcher/TestHelper.java
test/tools/launcher/TestHelper.java
+34
-21
test/tools/pack200/AttributeTests.java
test/tools/pack200/AttributeTests.java
+2
-34
test/tools/pack200/PackageVersionTest.java
test/tools/pack200/PackageVersionTest.java
+6
-4
test/tools/pack200/Utils.java
test/tools/pack200/Utils.java
+9
-5
test/tools/pack200/dyn.jar
test/tools/pack200/dyn.jar
+0
-0
test/tools/pack200/pack200-verifier/data/README
test/tools/pack200/pack200-verifier/data/README
+11
-10
test/tools/pack200/pack200-verifier/data/golden.jar
test/tools/pack200/pack200-verifier/data/golden.jar
+0
-0
test/tools/pack200/pack200-verifier/make/build.xml
test/tools/pack200/pack200-verifier/make/build.xml
+3
-3
test/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java
...ools/pack200/pack200-verifier/src/xmlkit/ClassReader.java
+1159
-641
test/tools/pack200/pack200-verifier/src/xmlkit/ClassSyntax.java
...ools/pack200/pack200-verifier/src/xmlkit/ClassSyntax.java
+0
-518
test/tools/pack200/pack200-verifier/src/xmlkit/ClassWriter.java
...ools/pack200/pack200-verifier/src/xmlkit/ClassWriter.java
+0
-818
test/tools/pack200/pack200-verifier/src/xmlkit/InstructionAssembler.java
...200/pack200-verifier/src/xmlkit/InstructionAssembler.java
+0
-464
test/tools/pack200/pack200-verifier/src/xmlkit/InstructionSyntax.java
...ack200/pack200-verifier/src/xmlkit/InstructionSyntax.java
+0
-483
未找到文件。
make/common/Defs-macosx.gmk
浏览文件 @
aacc1372
#
# Copyright (c) 1999, 201
1
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 201
2
, 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
...
...
@@ -111,10 +111,10 @@ CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL))
# For all platforms, do not omit the frame pointer register usage.
# We need this frame pointer to make it easy to walk the stacks.
# This should be the default on X86, but ia64
and amd64 may not have this
# as the default.
CFLAGS_REQUIRED_
amd64
+= -m64 -fno-omit-frame-pointer -D_LITTLE_ENDIAN
LDFLAGS_COMMON_
amd64
+= -m64
# This should be the default on X86, but ia64
, and x86_64
#
may not have this
as the default.
CFLAGS_REQUIRED_
x86_64
+= -m64 -fno-omit-frame-pointer -D_LITTLE_ENDIAN
LDFLAGS_COMMON_
x86_64
+= -m64
CFLAGS_REQUIRED_i586 += -m32 -fno-omit-frame-pointer -D_LITTLE_ENDIAN
LDFLAGS_COMMON_i586 += -m32
CFLAGS_REQUIRED_ia64 += -m64 -fno-omit-frame-pointer -D_LITTLE_ENDIAN
...
...
@@ -168,7 +168,7 @@ PIC_CODE_LARGE = -fPIC
PIC_CODE_SMALL = -fpic
GLOBAL_KPIC = $(PIC_CODE_LARGE)
CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS)
ifeq ($(ARCH),
amd
64)
ifeq ($(ARCH),
x86_
64)
CFLAGS_COMMON += -pipe
endif
...
...
make/common/shared/Platform.gmk
浏览文件 @
aacc1372
#
# Copyright (c) 1997, 201
1
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 201
2
, 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
...
...
@@ -264,7 +264,7 @@ ifeq ($(PLATFORM), macosx)
echo sparc \
;; \
x86_64) \
echo
amd
64 \
echo
x86_
64 \
;; \
universal) \
echo universal \
...
...
make/launchers/Makefile.launcher
浏览文件 @
aacc1372
...
...
@@ -81,6 +81,7 @@ endif
# SA tools
ifeq
($(PROGRAM),jstack)
SA_TOOL
=
true
INFO_PLIST_FILE
=
Info-privileged.plist
endif
ifeq
($(PROGRAM),jsadebugd)
SA_TOOL
=
true
...
...
src/macosx/bin/
amd
64/jvm.cfg
→
src/macosx/bin/
x86_
64/jvm.cfg
浏览文件 @
aacc1372
文件已移动
src/macosx/classes/apple/launcher/JavaAppLauncher.java
浏览文件 @
aacc1372
...
...
@@ -27,7 +27,6 @@ package apple.launcher;
import
java.io.*
;
import
java.lang.reflect.*
;
import
java.security.PrivilegedAction
;
import
java.text.MessageFormat
;
import
java.util.*
;
import
java.util.jar.*
;
...
...
@@ -36,7 +35,13 @@ import javax.swing.*;
class
JavaAppLauncher
implements
Runnable
{
static
{
java
.
security
.
AccessController
.
doPrivileged
((
PrivilegedAction
<?>)
new
sun
.
security
.
action
.
LoadLibraryAction
(
"osx"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"osx"
);
return
null
;
}
});
}
private
static
native
<
T
>
T
nativeConvertAndRelease
(
final
long
ptr
);
...
...
src/macosx/classes/apple/security/KeychainStore.java
浏览文件 @
aacc1372
...
...
@@ -103,7 +103,13 @@ public final class KeychainStore extends KeyStoreSpi {
private
static
final
int
SALT_LEN
=
20
;
static
{
java
.
security
.
AccessController
.
doPrivileged
((
PrivilegedAction
<?>)
new
sun
.
security
.
action
.
LoadLibraryAction
(
"osx"
));
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"osx"
);
return
null
;
}
});
try
{
PKCS8ShroudedKeyBag_OID
=
new
ObjectIdentifier
(
keyBag
);
pbeWithSHAAnd3KeyTripleDESCBC_OID
=
new
ObjectIdentifier
(
pbeWithSHAAnd3KeyTripleDESCBC
);
...
...
src/macosx/classes/com/apple/concurrent/LibDispatchNative.java
浏览文件 @
aacc1372
...
...
@@ -26,17 +26,23 @@
package
com.apple.concurrent
;
final
class
LibDispatchNative
{
static
{
java
.
security
.
AccessController
.
doPrivileged
((
java
.
security
.
PrivilegedAction
<?>)
new
sun
.
security
.
action
.
LoadLibraryAction
(
"osx"
));
}
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"osx"
);
return
null
;
}
});
}
static
native
boolean
nativeIsDispatchSupported
();
static
native
long
nativeGetMainQueue
();
static
native
long
nativeCreateConcurrentQueue
(
int
priority
);
static
native
long
nativeCreateSerialQueue
(
String
name
);
static
native
void
nativeReleaseQueue
(
long
nativeQueue
);
static
native
void
nativeExecuteAsync
(
long
nativeQueue
,
Runnable
task
);
static
native
void
nativeExecuteSync
(
long
nativeQueue
,
Runnable
task
);
static
native
boolean
nativeIsDispatchSupported
();
static
native
long
nativeGetMainQueue
();
static
native
long
nativeCreateConcurrentQueue
(
int
priority
);
static
native
long
nativeCreateSerialQueue
(
String
name
);
static
native
void
nativeReleaseQueue
(
long
nativeQueue
);
static
native
void
nativeExecuteAsync
(
long
nativeQueue
,
Runnable
task
);
static
native
void
nativeExecuteSync
(
long
nativeQueue
,
Runnable
task
);
private
LibDispatchNative
()
{
}
private
LibDispatchNative
()
{
}
}
src/macosx/classes/com/apple/eawt/Application.java
浏览文件 @
aacc1372
...
...
@@ -28,7 +28,6 @@ package com.apple.eawt;
import
java.awt.*
;
import
java.awt.peer.*
;
import
java.beans.Beans
;
import
java.security.PrivilegedAction
;
import
javax.swing.JMenuBar
;
...
...
@@ -59,7 +58,13 @@ public class Application {
static
Application
sApplication
=
null
;
static
{
java
.
security
.
AccessController
.
doPrivileged
((
PrivilegedAction
<?>)
new
sun
.
security
.
action
.
LoadLibraryAction
(
"awt"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"awt"
);
return
null
;
}
});
checkSecurity
();
if
(!
Beans
.
isDesignTime
())
{
...
...
src/macosx/classes/com/apple/eio/FileManager.java
浏览文件 @
aacc1372
...
...
@@ -55,7 +55,13 @@ import java.io.*;
*/
public
class
FileManager
{
static
{
java
.
security
.
AccessController
.
doPrivileged
((
java
.
security
.
PrivilegedAction
<?>)
new
sun
.
security
.
action
.
LoadLibraryAction
(
"osx"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"osx"
);
return
null
;
}
});
}
/**
...
...
src/macosx/classes/com/apple/laf/AquaFileView.java
浏览文件 @
aacc1372
...
...
@@ -26,7 +26,6 @@
package
com.apple.laf
;
import
java.io.*
;
import
java.security.PrivilegedAction
;
import
java.util.*
;
import
java.util.Map.Entry
;
...
...
@@ -57,7 +56,13 @@ class AquaFileView extends FileView {
static
final
int
kLSItemInfoExtensionIsHidden
=
0x00100000
;
/* Item has a hidden extension*/
static
{
java
.
security
.
AccessController
.
doPrivileged
((
PrivilegedAction
<?>)
new
sun
.
security
.
action
.
LoadLibraryAction
(
"osxui"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"osxui"
);
return
null
;
}
});
}
// TODO: Un-comment this out when the native version exists
...
...
src/macosx/classes/com/apple/laf/AquaLookAndFeel.java
浏览文件 @
aacc1372
...
...
@@ -134,10 +134,16 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
* @see UIManager#setLookAndFeel
*/
public
void
initialize
()
{
java
.
security
.
AccessController
.
doPrivileged
((
PrivilegedAction
<?>)
new
sun
.
security
.
action
.
LoadLibraryAction
(
"osxui"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Object
>(){
java
.
security
.
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"osxui"
);
return
null
;
}
});
java
.
security
.
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Void
>(){
@Override
public
Object
run
()
{
public
Void
run
()
{
JRSUIControl
.
initJRSUI
();
return
null
;
}
...
...
src/macosx/classes/com/apple/laf/AquaNativeResources.java
浏览文件 @
aacc1372
...
...
@@ -27,7 +27,6 @@ package com.apple.laf;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.security.PrivilegedAction
;
import
javax.swing.plaf.UIResource
;
...
...
@@ -35,7 +34,13 @@ import com.apple.laf.AquaUtils.RecyclableSingleton;
public
class
AquaNativeResources
{
static
{
java
.
security
.
AccessController
.
doPrivileged
((
PrivilegedAction
<?>)
new
sun
.
security
.
action
.
LoadLibraryAction
(
"osxui"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"osxui"
);
return
null
;
}
});
}
// TODO: removing CColorPaint for now
...
...
src/macosx/classes/com/apple/laf/ScreenMenu.java
浏览文件 @
aacc1372
...
...
@@ -28,7 +28,6 @@ package com.apple.laf;
import
java.awt.*
;
import
java.awt.event.*
;
import
java.awt.peer.MenuComponentPeer
;
import
java.security.PrivilegedAction
;
import
java.util.Hashtable
;
import
javax.swing.*
;
...
...
@@ -38,7 +37,13 @@ import sun.lwawt.macosx.*;
class
ScreenMenu
extends
Menu
implements
ContainerListener
,
ComponentListener
,
ScreenMenuPropertyHandler
{
static
{
java
.
security
.
AccessController
.
doPrivileged
((
PrivilegedAction
<?>)
new
sun
.
security
.
action
.
LoadLibraryAction
(
"awt"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"awt"
);
return
null
;
}
});
}
// screen menu stuff
...
...
src/macosx/classes/com/apple/laf/ScreenPopupFactory.java
浏览文件 @
aacc1372
...
...
@@ -26,15 +26,19 @@
package
com.apple.laf
;
import
java.awt.*
;
import
java.security.PrivilegedAction
;
import
javax.swing.*
;
import
sun.lwawt.macosx.CPlatformWindow
;
class
ScreenPopupFactory
extends
PopupFactory
{
static
{
java
.
security
.
AccessController
.
doPrivileged
((
PrivilegedAction
<?>)
new
sun
.
security
.
action
.
LoadLibraryAction
(
"osxui"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"osxui"
);
return
null
;
}
});
}
static
final
Float
TRANSLUCENT
=
new
Float
(
248
f
/
255
f
);
...
...
src/macosx/classes/java/util/prefs/MacOSXPreferences.java
浏览文件 @
aacc1372
...
...
@@ -25,6 +25,8 @@
package
java.util.prefs
;
import
java.util.Objects
;
class
MacOSXPreferences
extends
AbstractPreferences
{
// fixme need security checks?
...
...
@@ -147,6 +149,7 @@ class MacOSXPreferences extends AbstractPreferences {
// AbstractPreferences implementation
protected
void
removeSpi
(
String
key
)
{
Objects
.
requireNonNull
(
key
,
"Specified key cannot be null"
);
file
.
removeKeyFromNode
(
path
,
key
);
}
...
...
@@ -228,8 +231,14 @@ class MacOSXPreferences extends AbstractPreferences {
if
(
isRemoved
())
throw
new
IllegalStateException
(
"Node has been removed"
);
// fixme! overkill
if
(!
MacOSXPreferencesFile
.
syncWorld
())
{
throw
new
BackingStoreException
(
"Synchronization failed for node '"
+
path
+
"'"
);
if
(
isUser
)
{
if
(!
MacOSXPreferencesFile
.
syncUser
())
{
throw
new
BackingStoreException
(
"Synchronization failed for node '"
+
path
+
"'"
);
}
}
else
{
if
(!
MacOSXPreferencesFile
.
syncWorld
())
{
throw
new
BackingStoreException
(
"Synchronization failed for node '"
+
path
+
"'"
);
}
}
}
}
...
...
src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java
浏览文件 @
aacc1372
...
...
@@ -79,7 +79,13 @@ import java.lang.ref.WeakReference;
class
MacOSXPreferencesFile
{
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"osx"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"osx"
);
return
null
;
}
});
}
private
class
FlushTask
extends
TimerTask
{
...
...
@@ -192,6 +198,39 @@ class MacOSXPreferencesFile {
}
// Sync only current user preferences
static
synchronized
boolean
syncUser
()
{
boolean
ok
=
true
;
if
(
cachedFiles
!=
null
&&
!
cachedFiles
.
isEmpty
())
{
Iterator
<
WeakReference
>
iter
=
cachedFiles
.
values
().
iterator
();
while
(
iter
.
hasNext
())
{
WeakReference
ref
=
iter
.
next
();
MacOSXPreferencesFile
f
=
(
MacOSXPreferencesFile
)
ref
.
get
();
if
(
f
!=
null
&&
f
.
user
==
cfCurrentUser
)
{
if
(!
f
.
synchronize
())
{
ok
=
false
;
}
}
else
{
iter
.
remove
();
}
}
}
// Remove synchronized file from changed file list. The changed files were
// guaranteed to have been in the cached file list (because there was a strong
// reference from changedFiles.
if
(
changedFiles
!=
null
)
{
Iterator
<
MacOSXPreferencesFile
>
iterChanged
=
changedFiles
.
iterator
();
while
(
iterChanged
.
hasNext
())
{
MacOSXPreferencesFile
f
=
iterChanged
.
next
();
if
(
f
!=
null
&&
f
.
user
==
cfCurrentUser
)
iterChanged
.
remove
();
}
}
return
ok
;
}
// Write all prefs changes to disk, but do not clear all cached prefs
// values. Also kills any scheduled flush task.
// There's no CFPreferencesFlush() (<rdar://problem/3049129>), so lots of cached prefs
...
...
src/macosx/classes/sun/awt/CGraphicsEnvironment.java
浏览文件 @
aacc1372
...
...
@@ -58,9 +58,15 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
public
static
void
init
()
{
}
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"awt"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Object
>()
{
public
Object
run
()
{
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"awt"
);
return
null
;
}
});
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
if
(
isHeadless
())
return
null
;
initCocoa
();
return
null
;
...
...
src/macosx/classes/sun/lwawt/macosx/CAccessibility.java
浏览文件 @
aacc1372
...
...
@@ -29,7 +29,6 @@ import java.awt.*;
import
java.beans.*
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.InvocationTargetException
;
import
java.security.PrivilegedAction
;
import
java.util.*
;
import
java.util.concurrent.Callable
;
...
...
@@ -41,7 +40,13 @@ class CAccessibility implements PropertyChangeListener {
static
{
// Need to load the native library for this code.
java
.
security
.
AccessController
.
doPrivileged
((
PrivilegedAction
<?>)
new
sun
.
security
.
action
.
LoadLibraryAction
(
"awt"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"awt"
);
return
null
;
}
});
}
static
CAccessibility
sAccessibility
;
...
...
src/share/bin/java.c
浏览文件 @
aacc1372
...
...
@@ -695,6 +695,13 @@ SetClassPath(const char *s)
char
*
def
;
const
char
*
orig
=
s
;
static
const
char
format
[]
=
"-Djava.class.path=%s"
;
/*
* usually we should not get a null pointer, but there are cases where
* we might just get one, in which case we simply ignore it, and let the
* caller deal with it
*/
if
(
s
==
NULL
)
return
;
s
=
JLI_WildcardExpandClasspath
(
s
);
def
=
JLI_MemAlloc
(
sizeof
(
format
)
-
2
/* strlen("%s") */
...
...
src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
浏览文件 @
aacc1372
...
...
@@ -87,7 +87,12 @@ public class JPEGImageReader extends ImageReader {
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"jpeg"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"jpeg"
);
return
null
;
}
});
initReaderIDs
(
ImageInputStream
.
class
,
JPEGQTable
.
class
,
JPEGHuffmanTable
.
class
);
...
...
src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
浏览文件 @
aacc1372
...
...
@@ -177,7 +177,12 @@ public class JPEGImageWriter extends ImageWriter {
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"jpeg"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"jpeg"
);
return
null
;
}
});
initWriterIDs
(
ImageOutputStream
.
class
,
JPEGQTable
.
class
,
JPEGHuffmanTable
.
class
);
...
...
src/share/classes/com/sun/java/util/jar/pack/Attribute.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2003, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
2
, 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
...
...
@@ -166,6 +166,7 @@ class Attribute implements Comparable<Attribute> {
define
(
sd
,
ATTR_CONTEXT_CLASS
,
"SourceFile"
,
"RUH"
);
define
(
sd
,
ATTR_CONTEXT_CLASS
,
"EnclosingMethod"
,
"RCHRDNH"
);
define
(
sd
,
ATTR_CONTEXT_CLASS
,
"InnerClasses"
,
"NH[RCHRCNHRUNHFH]"
);
define
(
sd
,
ATTR_CONTEXT_CLASS
,
"BootstrapMethods"
,
"NH[RMHNH[KLH]]"
);
define
(
sd
,
ATTR_CONTEXT_FIELD
,
"Signature"
,
"RSH"
);
define
(
sd
,
ATTR_CONTEXT_FIELD
,
"Synthetic"
,
""
);
...
...
@@ -203,6 +204,8 @@ class Attribute implements Comparable<Attribute> {
// Their layout specs. are given here for completeness.
// The Code spec is incomplete, in that it does not distinguish
// bytecode bytes or locate CP references.
// The BootstrapMethods attribute is also special-cased
// elsewhere as an appendix to the local constant pool.
}
// Metadata.
...
...
@@ -822,9 +825,9 @@ class Attribute implements Comparable<Attribute> {
reference_type:
( constant_ref | schema_ref | utf8_ref | untyped_ref )
constant_ref:
( 'KI' | 'KJ' | 'KF' | 'KD' | 'KS' | 'KQ' )
( 'KI' | 'KJ' | 'KF' | 'KD' | 'KS' | 'KQ'
| 'KM' | 'KT' | 'KL'
)
schema_ref:
( 'RC' | 'RS' | 'RD' | 'RF' | 'RM' | 'RI' )
( 'RC' | 'RS' | 'RD' | 'RF' | 'RM' | 'RI'
| 'RY' | 'RB' | 'RN'
)
utf8_ref:
'RU'
untyped_ref:
...
...
@@ -1012,7 +1015,12 @@ class Attribute implements Comparable<Attribute> {
case
'F'
:
e
.
refKind
=
CONSTANT_Float
;
break
;
case
'D'
:
e
.
refKind
=
CONSTANT_Double
;
break
;
case
'S'
:
e
.
refKind
=
CONSTANT_String
;
break
;
case
'Q'
:
e
.
refKind
=
CONSTANT_Literal
;
break
;
case
'Q'
:
e
.
refKind
=
CONSTANT_FieldSpecific
;
break
;
// new in 1.7:
case
'M'
:
e
.
refKind
=
CONSTANT_MethodHandle
;
break
;
case
'T'
:
e
.
refKind
=
CONSTANT_MethodType
;
break
;
case
'L'
:
e
.
refKind
=
CONSTANT_LoadableValue
;
break
;
default
:
{
i
=
-
i
;
continue
;
}
// fail
}
break
;
...
...
@@ -1029,6 +1037,11 @@ class Attribute implements Comparable<Attribute> {
case
'U'
:
e
.
refKind
=
CONSTANT_Utf8
;
break
;
//utf8_ref
case
'Q'
:
e
.
refKind
=
CONSTANT_All
;
break
;
//untyped_ref
// new in 1.7:
case
'Y'
:
e
.
refKind
=
CONSTANT_InvokeDynamic
;
break
;
case
'B'
:
e
.
refKind
=
CONSTANT_BootstrapMethod
;
break
;
case
'N'
:
e
.
refKind
=
CONSTANT_AnyMember
;
break
;
default
:
{
i
=
-
i
;
continue
;
}
// fail
}
break
;
...
...
@@ -1279,10 +1292,12 @@ class Attribute implements Comparable<Attribute> {
// Cf. ClassReader.readSignatureRef.
String
typeName
=
globalRef
.
stringValue
();
globalRef
=
ConstantPool
.
getSignatureEntry
(
typeName
);
}
else
if
(
e
.
refKind
==
CONSTANT_
Literal
)
{
}
else
if
(
e
.
refKind
==
CONSTANT_
FieldSpecific
)
{
assert
(
globalRef
.
getTag
()
>=
CONSTANT_Integer
);
assert
(
globalRef
.
getTag
()
<=
CONSTANT_String
);
}
else
if
(
e
.
refKind
!=
CONSTANT_All
)
{
assert
(
globalRef
.
getTag
()
<=
CONSTANT_String
||
globalRef
.
getTag
()
>=
CONSTANT_MethodHandle
);
assert
(
globalRef
.
getTag
()
<=
CONSTANT_MethodType
);
}
else
if
(
e
.
refKind
<
CONSTANT_GroupFirst
)
{
assert
(
e
.
refKind
==
globalRef
.
getTag
());
}
}
...
...
@@ -1462,27 +1477,29 @@ class Attribute implements Comparable<Attribute> {
"NH[PHPOHIIH]", // CharacterRangeTable
"NH[PHHII]", // CoverageTable
"NH[RCHRCNHRUNHFH]", // InnerClasses
"NH[RMHNH[KLH]]", // BootstrapMethods
"HHNI[B]NH[PHPOHPOHRCNH]NH[RUHNI[B]]", // Code
"=AnnotationDefault",
// Like metadata, but with a compact tag set:
"[NH[(1)]]"
+"[NH[(
2
)]]"
+"[RSHNH[RUH(
3
)]]"
+"[TB(0,1,3)[KIH](2)[KDH](5)[KFH](4)[KJH](7)[RSH](8)[RSHRUH](9)[RUH](10)[(
2)](6)[NH[(3
)]]()[]]",
+"[NH[(
1
)]]"
+"[RSHNH[RUH(
1
)]]"
+"[TB(0,1,3)[KIH](2)[KDH](5)[KFH](4)[KJH](7)[RSH](8)[RSHRUH](9)[RUH](10)[(
-1)](6)[NH[(0
)]]()[]]",
""
};
ap = 0;
}
Utils.currentInstance.set(new PackerImpl());
final int[][] counts = new int[2][3]; // int bci ref
final Entry[] cpMap = new Entry[maxVal+1];
for (int i = 0; i < cpMap.length; i++) {
if (i == 0) continue; // 0 => null
cpMap[i] = ConstantPool.getLiteralEntry(new Integer(i));
}
Class cls = new Package().new Class("");
Package.
Class cls = new Package().new Class("");
cls.cpMap = cpMap;
class TestValueStream extends ValueStream {
Random rand = new
Random(0);
java.util.Random rand = new java.util.
Random(0);
ArrayList history = new ArrayList();
int ckidx = 0;
int maxVal;
...
...
@@ -1570,8 +1587,7 @@ class Attribute implements Comparable<Attribute> {
String layout = av[i];
if (layout.startsWith("=")) {
String name = layout.substring(1);
for (Iterator j = standardDefs.values().iterator(); j.hasNext(); ) {
Attribute a = (Attribute) j.next();
for (Attribute a : standardDefs.values()) {
if (a.name().equals(name)) {
layout = a.layout().layout();
break;
...
...
@@ -1604,7 +1620,7 @@ class Attribute implements Comparable<Attribute> {
if (verbose) {
System.out.print(" parse: {");
}
self.parse(
0,
cls, bytes, 0, bytes.length, tts);
self.parse(cls, bytes, 0, bytes.length, tts);
if (verbose) {
System.out.println("}");
}
...
...
src/share/classes/com/sun/java/util/jar/pack/BandStructure.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2001, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
2
, 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
...
...
@@ -1372,17 +1372,17 @@ class BandStructure {
protected
long
archiveSize1
;
// size reported in archive_header
protected
int
archiveNextCount
;
// reported in archive_header
static
final
int
AH_LENGTH_0
=
3
;
//minver, majver, options
static
final
int
AH_ARCHIVE_SIZE_HI
=
0
;
static
final
int
AH_ARCHIVE_SIZE_LO
=
1
;
static
final
int
AH_LENGTH_S
=
2
;
//optional size hi/lo
static
final
int
AH_LENGTH
=
26
;
// mentioned in spec
static
final
int
AH_LENGTH_0
=
3
;
// archive_header_0 = {minver, majver, options}
static
final
int
AH_LENGTH_MIN
=
15
;
// observed in spec {header_0[3], cp_counts[8], class_counts[4]}
// Length contributions from optional archive size fields:
static
final
int
AH_LENGTH_S
=
2
;
// archive_header_S = optional {size_hi, size_lo}
static
final
int
AH_ARCHIVE_SIZE_HI
=
0
;
// offset in archive_header_S
static
final
int
AH_ARCHIVE_SIZE_LO
=
1
;
// offset in archive_header_S
// Length contributions from optional header fields:
static
final
int
AH_FILE_HEADER_LEN
=
5
;
// sizehi/lo/next/modtime/files
static
final
int
AH_SPECIAL_FORMAT_LEN
=
2
;
// layouts/band-headers
static
final
int
AH_CP_NUMBER_LEN
=
4
;
// int/float/long/double
static
final
int
AH_LENGTH_MIN
=
AH_LENGTH
-(
AH_SPECIAL_FORMAT_LEN
+
AH_FILE_HEADER_LEN
+
AH_CP_NUMBER_LEN
);
static
final
int
AH_FILE_HEADER_LEN
=
5
;
// file_counts = {{size_hi, size_lo}, next, modtime, files}
static
final
int
AH_SPECIAL_FORMAT_LEN
=
2
;
// special_counts = {layouts, band_headers}
static
final
int
AH_CP_NUMBER_LEN
=
4
;
// cp_number_counts = {int, float, long, double}
static
final
int
AH_CP_EXTRA_LEN
=
4
;
// cp_attr_counts = {MH, MT, InDy, BSM}
// Common structure of attribute band groups:
static
final
int
AB_FLAGS_HI
=
0
;
...
...
@@ -1446,6 +1446,14 @@ class BandStructure {
CPRefBand
cp_Method_desc
=
cp_bands
.
newCPRefBand
(
"cp_Method_desc"
,
UDELTA5
,
CONSTANT_NameandType
);
CPRefBand
cp_Imethod_class
=
cp_bands
.
newCPRefBand
(
"cp_Imethod_class"
,
CONSTANT_Class
);
CPRefBand
cp_Imethod_desc
=
cp_bands
.
newCPRefBand
(
"cp_Imethod_desc"
,
UDELTA5
,
CONSTANT_NameandType
);
IntBand
cp_MethodHandle_refkind
=
cp_bands
.
newIntBand
(
"cp_MethodHandle_refkind"
,
DELTA5
);
CPRefBand
cp_MethodHandle_member
=
cp_bands
.
newCPRefBand
(
"cp_MethodHandle_member"
,
UDELTA5
,
CONSTANT_AnyMember
);
CPRefBand
cp_MethodType
=
cp_bands
.
newCPRefBand
(
"cp_MethodType"
,
UDELTA5
,
CONSTANT_Signature
);
CPRefBand
cp_BootstrapMethod_ref
=
cp_bands
.
newCPRefBand
(
"cp_BootstrapMethod_ref"
,
DELTA5
,
CONSTANT_MethodHandle
);
IntBand
cp_BootstrapMethod_arg_count
=
cp_bands
.
newIntBand
(
"cp_BootstrapMethod_arg_count"
,
UDELTA5
);
CPRefBand
cp_BootstrapMethod_arg
=
cp_bands
.
newCPRefBand
(
"cp_BootstrapMethod_arg"
,
DELTA5
,
CONSTANT_LoadableValue
);
CPRefBand
cp_InvokeDynamic_spec
=
cp_bands
.
newCPRefBand
(
"cp_InvokeDynamic_spec"
,
DELTA5
,
CONSTANT_BootstrapMethod
);
CPRefBand
cp_InvokeDynamic_desc
=
cp_bands
.
newCPRefBand
(
"cp_InvokeDynamic_desc"
,
UDELTA5
,
CONSTANT_NameandType
);
// bands for carrying attribute definitions:
MultiBand
attr_definition_bands
=
all_bands
.
newMultiBand
(
"(attr_definition_bands)"
,
UNSIGNED5
);
...
...
@@ -1481,7 +1489,7 @@ class BandStructure {
IntBand
field_attr_calls
=
field_attr_bands
.
newIntBand
(
"field_attr_calls"
);
// bands for predefined field attributes
CPRefBand
field_ConstantValue_KQ
=
field_attr_bands
.
newCPRefBand
(
"field_ConstantValue_KQ"
,
CONSTANT_
Literal
);
CPRefBand
field_ConstantValue_KQ
=
field_attr_bands
.
newCPRefBand
(
"field_ConstantValue_KQ"
,
CONSTANT_
FieldSpecific
);
CPRefBand
field_Signature_RS
=
field_attr_bands
.
newCPRefBand
(
"field_Signature_RS"
,
CONSTANT_Signature
);
MultiBand
field_metadata_bands
=
field_attr_bands
.
newMultiBand
(
"(field_metadata_bands)"
,
UNSIGNED5
);
...
...
@@ -1585,12 +1593,14 @@ class BandStructure {
CPRefBand
bc_longref
=
bc_bands
.
newCPRefBand
(
"bc_longref"
,
DELTA5
,
CONSTANT_Long
);
CPRefBand
bc_doubleref
=
bc_bands
.
newCPRefBand
(
"bc_doubleref"
,
DELTA5
,
CONSTANT_Double
);
CPRefBand
bc_stringref
=
bc_bands
.
newCPRefBand
(
"bc_stringref"
,
DELTA5
,
CONSTANT_String
);
CPRefBand
bc_loadablevalueref
=
bc_bands
.
newCPRefBand
(
"bc_loadablevalueref"
,
DELTA5
,
CONSTANT_LoadableValue
);
// nulls produced by bc_classref are taken to mean the current class
CPRefBand
bc_classref
=
bc_bands
.
newCPRefBand
(
"bc_classref"
,
UNSIGNED5
,
CONSTANT_Class
,
NULL_IS_OK
);
// new, *anew*, c*cast, i*of, ldc
CPRefBand
bc_fieldref
=
bc_bands
.
newCPRefBand
(
"bc_fieldref"
,
DELTA5
,
CONSTANT_Fieldref
);
// get*, put*
CPRefBand
bc_methodref
=
bc_bands
.
newCPRefBand
(
"bc_methodref"
,
CONSTANT_Methodref
);
// invoke[vs]*
CPRefBand
bc_imethodref
=
bc_bands
.
newCPRefBand
(
"bc_imethodref"
,
DELTA5
,
CONSTANT_InterfaceMethodref
);
// invokeinterface
CPRefBand
bc_indyref
=
bc_bands
.
newCPRefBand
(
"bc_indyref"
,
DELTA5
,
CONSTANT_InvokeDynamic
);
// invokedynamic
// _self_linker_op family
CPRefBand
bc_thisfield
=
bc_bands
.
newCPRefBand
(
"bc_thisfield"
,
CONSTANT_None
);
// any field within cur. class
...
...
@@ -1633,7 +1643,7 @@ class BandStructure {
protected
void
setBandIndex
(
CPRefBand
b
,
byte
which
)
{
Object
[]
need
=
{
b
,
Byte
.
valueOf
(
which
)
};
if
(
which
==
CONSTANT_
Literal
)
{
if
(
which
==
CONSTANT_
FieldSpecific
)
{
// I.e., attribute layouts KQ (no null) or KQN (null ok).
allKQBands
.
add
(
b
);
}
else
if
(
needPredefIndex
!=
null
)
{
...
...
@@ -1856,12 +1866,20 @@ class BandStructure {
attrClassFileVersionMask
=
(
1
<<
CLASS_ATTR_ClassFile_version
);
}
private
void
adjustToMajver
()
{
private
void
adjustToMajver
()
throws
IOException
{
if
(
getPackageMajver
()
<
JAVA6_PACKAGE_MAJOR_VERSION
)
{
if
(
verbose
>
0
)
Utils
.
log
.
fine
(
"Legacy package version"
);
// Revoke definition of pre-1.6 attribute type.
undefineAttribute
(
CODE_ATTR_StackMapTable
,
ATTR_CONTEXT_CODE
);
}
if
(
getPackageMajver
()
<
JAVA7_PACKAGE_MAJOR_VERSION
)
{
if
(
testBit
(
archiveOptions
,
AO_HAVE_CP_EXTRAS
))
// this bit was reserved for future use in previous versions
throw
new
IOException
(
"Format bits for Java 7 must be zero in previous releases"
);
}
if
(
testBit
(
archiveOptions
,
AO_UNUSED_MBZ
))
{
throw
new
IOException
(
"High archive option bits are reserved and must be zero: "
+
Integer
.
toHexString
(
archiveOptions
));
}
}
protected
void
initAttrIndexLimit
()
{
...
...
@@ -2323,7 +2341,9 @@ class BandStructure {
return
bc_methodref
;
case
CONSTANT_InterfaceMethodref:
return
bc_imethodref
;
case
CONSTANT_Literal:
case
CONSTANT_InvokeDynamic:
return
bc_indyref
;
case
CONSTANT_LoadableValue:
switch
(
bc
)
{
case
_ildc:
case
_ildc_w:
return
bc_intref
;
...
...
@@ -2333,10 +2353,12 @@ class BandStructure {
return
bc_longref
;
case
_dldc2_w:
return
bc_doubleref
;
case
_
aldc:
case
_a
ldc_w:
case
_
sldc:
case
_s
ldc_w:
return
bc_stringref
;
case
_cldc:
case
_cldc_w:
return
bc_classref
;
case
_qldc:
case
_qldc_w:
return
bc_loadablevalueref
;
}
break
;
}
...
...
@@ -2623,15 +2645,23 @@ class BandStructure {
}
static
void
printArrayTo
(
PrintStream
ps
,
Entry
[]
cpMap
,
int
start
,
int
end
)
{
printArrayTo
(
ps
,
cpMap
,
start
,
end
,
false
);
}
static
void
printArrayTo
(
PrintStream
ps
,
Entry
[]
cpMap
,
int
start
,
int
end
,
boolean
showTags
)
{
StringBuffer
buf
=
new
StringBuffer
();
int
len
=
end
-
start
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
String
s
=
cpMap
[
start
+
i
].
stringValue
();
Entry
e
=
cpMap
[
start
+
i
];
ps
.
print
(
start
+
i
);
ps
.
print
(
"="
);
if
(
showTags
)
{
ps
.
print
(
e
.
tag
);
ps
.
print
(
":"
);
}
String
s
=
e
.
stringValue
();
buf
.
setLength
(
0
);
for
(
int
j
=
0
;
j
<
s
.
length
();
j
++)
{
char
ch
=
s
.
charAt
(
j
);
if
(!(
ch
<
' '
||
ch
>
'~'
||
ch
==
'\\'
))
{
buf
.
append
(
ch
);
}
else
if
(
ch
==
'\\'
)
{
buf
.
append
(
"\\\\"
);
}
else
if
(
ch
==
'\n'
)
{
buf
.
append
(
"\\n"
);
}
else
if
(
ch
==
'\t'
)
{
...
...
@@ -2639,7 +2669,8 @@ class BandStructure {
}
else
if
(
ch
==
'\r'
)
{
buf
.
append
(
"\\r"
);
}
else
{
buf
.
append
(
"\\x"
+
Integer
.
toHexString
(
ch
));
String
str
=
"000"
+
Integer
.
toHexString
(
ch
);
buf
.
append
(
"\\u"
+
str
.
substring
(
str
.
length
()-
4
));
}
}
ps
.
println
(
buf
);
...
...
src/share/classes/com/sun/java/util/jar/pack/ClassReader.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2001, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
2
, 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
...
...
@@ -29,6 +29,9 @@ import com.sun.java.util.jar.pack.ConstantPool.ClassEntry;
import
com.sun.java.util.jar.pack.ConstantPool.DescriptorEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.Entry
;
import
com.sun.java.util.jar.pack.ConstantPool.SignatureEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.MemberEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.MethodHandleEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.BootstrapMethodEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.Utf8Entry
;
import
com.sun.java.util.jar.pack.Package.Class
;
import
com.sun.java.util.jar.pack.Package.InnerClass
;
...
...
@@ -37,6 +40,7 @@ import java.io.FilterInputStream;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Map
;
import
static
com
.
sun
.
java
.
util
.
jar
.
pack
.
Constants
.*;
...
...
@@ -114,6 +118,7 @@ class ClassReader {
private
Entry
readRef
(
byte
tag
)
throws
IOException
{
Entry
e
=
readRef
();
assert
(
e
!=
null
);
assert
(!(
e
instanceof
UnresolvedEntry
));
assert
(
e
.
tagMatches
(
tag
));
return
e
;
}
...
...
@@ -151,6 +156,7 @@ class ClassReader {
readMembers
(
false
);
// fields
readMembers
(
true
);
// methods
readAttributes
(
ATTR_CONTEXT_CLASS
,
cls
);
fixUnresolvedEntries
();
cls
.
finishReading
();
assert
(
0
>=
in
.
read
(
new
byte
[
1
]));
ok
=
true
;
...
...
@@ -236,6 +242,7 @@ class ClassReader {
// just read the refs; do not attempt to resolve while reading
case
CONSTANT_Class:
case
CONSTANT_String:
case
CONSTANT_MethodType:
fixups
[
fptr
++]
=
i
;
fixups
[
fptr
++]
=
tag
;
fixups
[
fptr
++]
=
in
.
readUnsignedShort
();
...
...
@@ -250,6 +257,18 @@ class ClassReader {
fixups
[
fptr
++]
=
in
.
readUnsignedShort
();
fixups
[
fptr
++]
=
in
.
readUnsignedShort
();
break
;
case
CONSTANT_InvokeDynamic:
fixups
[
fptr
++]
=
i
;
fixups
[
fptr
++]
=
tag
;
fixups
[
fptr
++]
=
-
1
^
in
.
readUnsignedShort
();
// not a ref
fixups
[
fptr
++]
=
in
.
readUnsignedShort
();
break
;
case
CONSTANT_MethodHandle:
fixups
[
fptr
++]
=
i
;
fixups
[
fptr
++]
=
tag
;
fixups
[
fptr
++]
=
-
1
^
in
.
readUnsignedByte
();
fixups
[
fptr
++]
=
in
.
readUnsignedShort
();
break
;
default
:
throw
new
ClassFormatException
(
"Bad constant pool tag "
+
tag
+
" in File: "
+
cls
.
file
.
nameString
+
...
...
@@ -270,7 +289,7 @@ class ClassReader {
int
ref2
=
fixups
[
fi
++];
if
(
verbose
>
3
)
Utils
.
log
.
fine
(
" cp["
+
cpi
+
"] = "
+
ConstantPool
.
tagName
(
tag
)+
"{"
+
ref
+
","
+
ref2
+
"}"
);
if
(
cpMap
[
ref
]
==
null
||
ref2
>=
0
&&
cpMap
[
ref2
]
==
null
)
{
if
(
ref
>=
0
&&
cpMap
[
ref
]
==
null
||
ref2
>=
0
&&
cpMap
[
ref2
]
==
null
)
{
// Defer.
fixups
[
fptr
++]
=
cpi
;
fixups
[
fptr
++]
=
tag
;
...
...
@@ -297,6 +316,19 @@ class ClassReader {
Utf8Entry
mtype
=
(
Utf8Entry
)
cpMap
[
ref2
];
cpMap
[
cpi
]
=
ConstantPool
.
getDescriptorEntry
(
mname
,
mtype
);
break
;
case
CONSTANT_MethodType:
cpMap
[
cpi
]
=
ConstantPool
.
getMethodTypeEntry
((
Utf8Entry
)
cpMap
[
ref
]);
break
;
case
CONSTANT_MethodHandle:
byte
refKind
=
(
byte
)(-
1
^
ref
);
MemberEntry
memRef
=
(
MemberEntry
)
cpMap
[
ref2
];
cpMap
[
cpi
]
=
ConstantPool
.
getMethodHandleEntry
(
refKind
,
memRef
);
break
;
case
CONSTANT_InvokeDynamic:
DescriptorEntry
idescr
=
(
DescriptorEntry
)
cpMap
[
ref2
];
cpMap
[
cpi
]
=
new
UnresolvedEntry
((
byte
)
tag
,
(-
1
^
ref
),
idescr
);
// Note that ref must be resolved later, using the BootstrapMethods attribute.
break
;
default
:
assert
(
false
);
}
...
...
@@ -307,6 +339,50 @@ class ClassReader {
cls
.
cpMap
=
cpMap
;
}
private
/*non-static*/
class
UnresolvedEntry
extends
Entry
{
final
Object
[]
refsOrIndexes
;
UnresolvedEntry
(
byte
tag
,
Object
...
refsOrIndexes
)
{
super
(
tag
);
this
.
refsOrIndexes
=
refsOrIndexes
;
ClassReader
.
this
.
haveUnresolvedEntry
=
true
;
}
Entry
resolve
()
{
Class
cls
=
ClassReader
.
this
.
cls
;
Entry
res
;
switch
(
tag
)
{
case
CONSTANT_InvokeDynamic:
BootstrapMethodEntry
iboots
=
cls
.
bootstrapMethods
.
get
((
Integer
)
refsOrIndexes
[
0
]);
DescriptorEntry
idescr
=
(
DescriptorEntry
)
refsOrIndexes
[
1
];
res
=
ConstantPool
.
getInvokeDynamicEntry
(
iboots
,
idescr
);
break
;
default
:
throw
new
AssertionError
();
}
return
res
;
}
private
void
unresolved
()
{
throw
new
RuntimeException
(
"unresolved entry has no string"
);
}
public
int
compareTo
(
Object
x
)
{
unresolved
();
return
0
;
}
public
boolean
equals
(
Object
x
)
{
unresolved
();
return
false
;
}
protected
int
computeValueHash
()
{
unresolved
();
return
0
;
}
public
String
stringValue
()
{
unresolved
();
return
toString
();
}
public
String
toString
()
{
return
"(unresolved "
+
ConstantPool
.
tagName
(
tag
)+
")"
;
}
}
boolean
haveUnresolvedEntry
;
private
void
fixUnresolvedEntries
()
{
if
(!
haveUnresolvedEntry
)
return
;
Entry
[]
cpMap
=
cls
.
getCPMap
();
for
(
int
i
=
0
;
i
<
cpMap
.
length
;
i
++)
{
Entry
e
=
cpMap
[
i
];
if
(
e
instanceof
UnresolvedEntry
)
{
cpMap
[
i
]
=
e
=
((
UnresolvedEntry
)
e
).
resolve
();
assert
(!(
e
instanceof
UnresolvedEntry
));
}
}
haveUnresolvedEntry
=
false
;
}
void
readHeader
()
throws
IOException
{
cls
.
flags
=
readUnsignedShort
();
cls
.
thisClass
=
readClassRef
();
...
...
@@ -416,25 +492,31 @@ class ClassReader {
unknownAttrCommand
);
}
}
if
(
a
.
layout
()
==
Package
.
attrCodeEmpty
||
a
.
layout
()
==
Package
.
attrInnerClasses
Empty
)
{
long
pos0
=
inPos
;
// in case we want to check it
if
(
a
.
layout
()
==
Package
.
attrCode
Empty
)
{
// These are hardwired.
long
pos0
=
inPos
;
if
(
"Code"
.
equals
(
a
.
name
()))
{
Class
.
Method
m
=
(
Class
.
Method
)
h
;
m
.
code
=
new
Code
(
m
);
try
{
readCode
(
m
.
code
);
}
catch
(
Instruction
.
FormatException
iie
)
{
String
message
=
iie
.
getMessage
()
+
" in "
+
h
;
throw
new
ClassReader
.
ClassFormatException
(
message
,
iie
);
}
}
else
{
assert
(
h
==
cls
);
readInnerClasses
(
cls
);
Class
.
Method
m
=
(
Class
.
Method
)
h
;
m
.
code
=
new
Code
(
m
);
try
{
readCode
(
m
.
code
);
}
catch
(
Instruction
.
FormatException
iie
)
{
String
message
=
iie
.
getMessage
()
+
" in "
+
h
;
throw
new
ClassReader
.
ClassFormatException
(
message
,
iie
);
}
assert
(
length
==
inPos
-
pos0
);
// Keep empty attribute a...
}
else
if
(
a
.
layout
()
==
Package
.
attrBootstrapMethodsEmpty
)
{
assert
(
h
==
cls
);
readBootstrapMethods
(
cls
);
assert
(
length
==
inPos
-
pos0
);
// Delete the attribute; it is logically part of the constant pool.
continue
;
}
else
if
(
a
.
layout
()
==
Package
.
attrInnerClassesEmpty
)
{
// These are hardwired also.
assert
(
h
==
cls
);
readInnerClasses
(
cls
);
assert
(
length
==
inPos
-
pos0
);
// Keep empty attribute a...
}
else
if
(
length
>
0
)
{
byte
[]
bytes
=
new
byte
[
length
];
in
.
readFully
(
bytes
);
...
...
@@ -467,6 +549,19 @@ class ClassReader {
readAttributes
(
ATTR_CONTEXT_CODE
,
code
);
}
void
readBootstrapMethods
(
Class
cls
)
throws
IOException
{
BootstrapMethodEntry
[]
bsms
=
new
BootstrapMethodEntry
[
readUnsignedShort
()];
for
(
int
i
=
0
;
i
<
bsms
.
length
;
i
++)
{
MethodHandleEntry
bsmRef
=
(
MethodHandleEntry
)
readRef
(
CONSTANT_MethodHandle
);
Entry
[]
argRefs
=
new
Entry
[
readUnsignedShort
()];
for
(
int
j
=
0
;
j
<
argRefs
.
length
;
j
++)
{
argRefs
[
j
]
=
readRef
();
}
bsms
[
i
]
=
ConstantPool
.
getBootstrapMethodEntry
(
bsmRef
,
argRefs
);
}
cls
.
setBootstrapMethods
(
Arrays
.
asList
(
bsms
));
}
void
readInnerClasses
(
Class
cls
)
throws
IOException
{
int
nc
=
readUnsignedShort
();
ArrayList
<
InnerClass
>
ics
=
new
ArrayList
<>(
nc
);
...
...
src/share/classes/com/sun/java/util/jar/pack/ClassWriter.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2001, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
2
, 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
...
...
@@ -29,6 +29,8 @@ package com.sun.java.util.jar.pack;
import
com.sun.java.util.jar.pack.ConstantPool.Entry
;
import
com.sun.java.util.jar.pack.ConstantPool.Index
;
import
com.sun.java.util.jar.pack.ConstantPool.NumberEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.MethodHandleEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.BootstrapMethodEntry
;
import
com.sun.java.util.jar.pack.Package.Class
;
import
com.sun.java.util.jar.pack.Package.InnerClass
;
import
java.io.BufferedOutputStream
;
...
...
@@ -49,6 +51,7 @@ class ClassWriter {
Class
cls
;
DataOutputStream
out
;
Index
cpIndex
;
Index
bsmIndex
;
ClassWriter
(
Class
cls
,
OutputStream
out
)
throws
IOException
{
this
.
pkg
=
cls
.
getPackage
();
...
...
@@ -57,6 +60,10 @@ class ClassWriter {
this
.
out
=
new
DataOutputStream
(
new
BufferedOutputStream
(
out
));
this
.
cpIndex
=
ConstantPool
.
makeIndex
(
cls
.
toString
(),
cls
.
getCPMap
());
this
.
cpIndex
.
flattenSigs
=
true
;
if
(
cls
.
hasBootstrapMethods
())
{
this
.
bsmIndex
=
ConstantPool
.
makeIndex
(
cpIndex
.
debugName
+
".BootstrapMethods"
,
cls
.
getBootstrapMethodMap
());
}
if
(
verbose
>
1
)
Utils
.
log
.
fine
(
"local CP="
+(
verbose
>
2
?
cpIndex
.
dumpString
()
:
cpIndex
.
toString
()));
}
...
...
@@ -71,6 +78,11 @@ class ClassWriter {
/** Write a 2-byte int representing a CP entry, using the local cpIndex. */
private
void
writeRef
(
Entry
e
)
throws
IOException
{
writeRef
(
e
,
cpIndex
);
}
/** Write a 2-byte int representing a CP entry, using the given cpIndex. */
private
void
writeRef
(
Entry
e
,
Index
cpIndex
)
throws
IOException
{
int
i
=
(
e
==
null
)
?
0
:
cpIndex
.
indexOf
(
e
);
writeShort
(
i
);
}
...
...
@@ -117,8 +129,7 @@ class ClassWriter {
out
.
write
(
tag
);
switch
(
tag
)
{
case
CONSTANT_Signature:
assert
(
false
);
// should not reach here
break
;
throw
new
AssertionError
(
"CP should have Signatures remapped to Utf8"
);
case
CONSTANT_Utf8:
out
.
writeUTF
(
e
.
stringValue
());
break
;
...
...
@@ -138,8 +149,14 @@ class ClassWriter {
break
;
case
CONSTANT_Class:
case
CONSTANT_String:
case
CONSTANT_MethodType:
writeRef
(
e
.
getRef
(
0
));
break
;
case
CONSTANT_MethodHandle:
MethodHandleEntry
mhe
=
(
MethodHandleEntry
)
e
;
out
.
writeByte
(
mhe
.
refKind
);
writeRef
(
mhe
.
getRef
(
0
));
break
;
case
CONSTANT_Fieldref:
case
CONSTANT_Methodref:
case
CONSTANT_InterfaceMethodref:
...
...
@@ -147,6 +164,12 @@ class ClassWriter {
writeRef
(
e
.
getRef
(
0
));
writeRef
(
e
.
getRef
(
1
));
break
;
case
CONSTANT_InvokeDynamic:
writeRef
(
e
.
getRef
(
0
),
bsmIndex
);
writeRef
(
e
.
getRef
(
1
));
break
;
case
CONSTANT_BootstrapMethod:
throw
new
AssertionError
(
"CP should have BootstrapMethods moved to side-table"
);
default
:
throw
new
IOException
(
"Bad constant pool tag "
+
tag
);
}
...
...
@@ -198,6 +221,7 @@ class ClassWriter {
a
.
finishRefs
(
cpIndex
);
writeRef
(
a
.
getNameRef
());
if
(
a
.
layout
()
==
Package
.
attrCodeEmpty
||
a
.
layout
()
==
Package
.
attrBootstrapMethodsEmpty
||
a
.
layout
()
==
Package
.
attrInnerClassesEmpty
)
{
// These are hardwired.
DataOutputStream
savedOut
=
out
;
...
...
@@ -207,9 +231,14 @@ class ClassWriter {
if
(
"Code"
.
equals
(
a
.
name
()))
{
Class
.
Method
m
=
(
Class
.
Method
)
h
;
writeCode
(
m
.
code
);
}
else
{
}
else
if
(
"BootstrapMethods"
.
equals
(
a
.
name
()))
{
assert
(
h
==
cls
);
writeBootstrapMethods
(
cls
);
}
else
if
(
"InnerClasses"
.
equals
(
a
.
name
()))
{
assert
(
h
==
cls
);
writeInnerClasses
(
cls
);
}
else
{
throw
new
AssertionError
();
}
out
=
savedOut
;
if
(
verbose
>
2
)
...
...
@@ -242,6 +271,18 @@ class ClassWriter {
writeAttributes
(
ATTR_CONTEXT_CODE
,
code
);
}
void
writeBootstrapMethods
(
Class
cls
)
throws
IOException
{
List
<
BootstrapMethodEntry
>
bsms
=
cls
.
getBootstrapMethods
();
writeShort
(
bsms
.
size
());
for
(
BootstrapMethodEntry
e
:
bsms
)
{
writeRef
(
e
.
bsmRef
);
writeShort
(
e
.
argRefs
.
length
);
for
(
Entry
argRef
:
e
.
argRefs
)
{
writeRef
(
argRef
);
}
}
}
void
writeInnerClasses
(
Class
cls
)
throws
IOException
{
List
<
InnerClass
>
ics
=
cls
.
getInnerClasses
();
writeShort
(
ics
.
size
());
...
...
src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/share/classes/com/sun/java/util/jar/pack/Constants.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2001, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
2
, 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
...
...
@@ -65,6 +65,9 @@ class Constants {
public
final
static
int
JAVA6_PACKAGE_MAJOR_VERSION
=
160
;
public
final
static
int
JAVA6_PACKAGE_MINOR_VERSION
=
1
;
public
final
static
int
JAVA7_PACKAGE_MAJOR_VERSION
=
170
;
public
final
static
int
JAVA7_PACKAGE_MINOR_VERSION
=
1
;
public
final
static
int
CONSTANT_POOL_INDEX_LIMIT
=
0x10000
;
public
final
static
int
CONSTANT_POOL_NARROW_LIMIT
=
0x00100
;
...
...
@@ -82,14 +85,36 @@ class Constants {
public
final
static
byte
CONSTANT_Methodref
=
10
;
public
final
static
byte
CONSTANT_InterfaceMethodref
=
11
;
public
final
static
byte
CONSTANT_NameandType
=
12
;
public
final
static
byte
CONSTANT_unused13
=
13
;
public
final
static
byte
CONSTANT_unused14
=
14
;
public
final
static
byte
CONSTANT_MethodHandle
=
15
;
public
final
static
byte
CONSTANT_MethodType
=
16
;
public
final
static
byte
CONSTANT_unused17
=
17
;
// unused
public
final
static
byte
CONSTANT_InvokeDynamic
=
18
;
// pseudo-constants:
public
final
static
byte
CONSTANT_None
=
0
;
public
final
static
byte
CONSTANT_Signature
=
13
;
public
final
static
byte
CONSTANT_Limit
=
14
;
public
final
static
byte
CONSTANT_All
=
19
;
// combined global map
public
final
static
byte
CONSTANT_Literal
=
20
;
// used only for ldc fields
public
final
static
byte
CONSTANT_Signature
=
CONSTANT_unused13
;
public
final
static
byte
CONSTANT_BootstrapMethod
=
CONSTANT_unused17
;
// used only in InvokeDynamic constants
public
final
static
byte
CONSTANT_Limit
=
19
;
public
final
static
byte
CONSTANT_All
=
50
;
// combined global map
public
final
static
byte
CONSTANT_LoadableValue
=
51
;
// used for 'KL' and qldc operands
public
final
static
byte
CONSTANT_AnyMember
=
52
;
// union of refs to field or (interface) method
public
final
static
byte
CONSTANT_FieldSpecific
=
53
;
// used only for 'KQ' ConstantValue attrs
public
final
static
byte
CONSTANT_GroupFirst
=
CONSTANT_All
;
public
final
static
byte
CONSTANT_GroupLimit
=
CONSTANT_FieldSpecific
+
1
;
// CONSTANT_MethodHandle reference kinds
public
final
static
byte
REF_getField
=
1
;
public
final
static
byte
REF_getStatic
=
2
;
public
final
static
byte
REF_putField
=
3
;
public
final
static
byte
REF_putStatic
=
4
;
public
final
static
byte
REF_invokeVirtual
=
5
;
public
final
static
byte
REF_invokeStatic
=
6
;
public
final
static
byte
REF_invokeSpecial
=
7
;
public
final
static
byte
REF_newInvokeSpecial
=
8
;
public
final
static
byte
REF_invokeInterface
=
9
;
// pseudo-access bits
public
final
static
int
ACC_IC_LONG_FORM
=
(
1
<<
16
);
//for ic_flags
...
...
@@ -133,7 +158,7 @@ class Constants {
public
static
final
int
AO_HAVE_SPECIAL_FORMATS
=
1
<<
0
;
public
static
final
int
AO_HAVE_CP_NUMBERS
=
1
<<
1
;
public
static
final
int
AO_HAVE_ALL_CODE_FLAGS
=
1
<<
2
;
public
static
final
int
AO_
3_UNUSED_MBZ
=
1
<<
3
;
public
static
final
int
AO_
HAVE_CP_EXTRAS
=
1
<<
3
;
public
static
final
int
AO_HAVE_FILE_HEADERS
=
1
<<
4
;
public
static
final
int
AO_DEFLATE_HINT
=
1
<<
5
;
public
static
final
int
AO_HAVE_FILE_MODTIME
=
1
<<
6
;
...
...
@@ -143,6 +168,7 @@ class Constants {
public
static
final
int
AO_HAVE_FIELD_FLAGS_HI
=
1
<<
10
;
public
static
final
int
AO_HAVE_METHOD_FLAGS_HI
=
1
<<
11
;
public
static
final
int
AO_HAVE_CODE_FLAGS_HI
=
1
<<
12
;
public
static
final
int
AO_UNUSED_MBZ
=
(-
1
)<<
13
;
// option bits reserved for future use
public
static
final
int
LG_AO_HAVE_XXX_FLAGS_HI
=
9
;
...
...
@@ -357,7 +383,7 @@ class Constants {
_invokespecial
=
183
,
// 0xb7
_invokestatic
=
184
,
// 0xb8
_invokeinterface
=
185
,
// 0xb9
_
xxxunusedxxx
=
186
,
// 0xba
_
invokedynamic
=
186
,
// 0xba
_new
=
187
,
// 0xbb
_newarray
=
188
,
// 0xbc
_anewarray
=
189
,
// 0xbd
...
...
@@ -422,15 +448,18 @@ class Constants {
// Ldc variants gain us only 0.007% improvement in compression ratio,
// but they simplify the file format greatly.
public
final
static
int
_xldc_op
=
_invokeinit_limit
;
public
final
static
int
_
aldc
=
_ldc
;
public
final
static
int
_
sldc
=
_ldc
;
// previously named _aldc
public
final
static
int
_cldc
=
_xldc_op
+
0
;
public
final
static
int
_ildc
=
_xldc_op
+
1
;
public
final
static
int
_fldc
=
_xldc_op
+
2
;
public
final
static
int
_
aldc_w
=
_ldc_w
;
public
final
static
int
_
sldc_w
=
_ldc_w
;
// previously named _aldc_w
public
final
static
int
_cldc_w
=
_xldc_op
+
3
;
public
final
static
int
_ildc_w
=
_xldc_op
+
4
;
public
final
static
int
_fldc_w
=
_xldc_op
+
5
;
public
final
static
int
_lldc2_w
=
_ldc2_w
;
public
final
static
int
_dldc2_w
=
_xldc_op
+
6
;
public
final
static
int
_xldc_limit
=
_xldc_op
+
7
;
// anything other than primitive, string, or class must be handled with qldc:
public
final
static
int
_qldc
=
_xldc_op
+
7
;
public
final
static
int
_qldc_w
=
_xldc_op
+
8
;
public
final
static
int
_xldc_limit
=
_xldc_op
+
9
;
}
src/share/classes/com/sun/java/util/jar/pack/Instruction.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2001, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
2
, 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
...
...
@@ -451,7 +451,7 @@ class Instruction {
public
static
byte
getCPRefOpTag
(
int
bc
)
{
if
(
bc
<
BC_INDEX
[
0
].
length
&&
BC_INDEX
[
0
][
bc
]
>
0
)
return
BC_TAG
[
0
][
bc
];
if
(
bc
>=
_xldc_op
&&
bc
<
_xldc_limit
)
return
CONSTANT_L
iteral
;
if
(
bc
>=
_xldc_op
&&
bc
<
_xldc_limit
)
return
CONSTANT_L
oadableValue
;
return
CONSTANT_None
;
}
...
...
@@ -500,7 +500,7 @@ class Instruction {
def
(
"bkf"
,
_getstatic
,
_putfield
);
// pack kf (base=Field)
def
(
"bkm"
,
_invokevirtual
,
_invokestatic
);
// pack kn (base=Method)
def
(
"bkixx"
,
_invokeinterface
);
// pack ki (base=IMethod), omit xx
def
(
"
"
,
_xxxunusedxxx
);
def
(
"
bkyxx"
,
_invokedynamic
);
// pack ky (base=Any), omit xx
def
(
"bkc"
,
_new
);
// pack kc
def
(
"bx"
,
_newarray
);
def
(
"bkc"
,
_anewarray
);
// pack kc
...
...
@@ -515,7 +515,6 @@ class Instruction {
//System.out.println(i+": l="+BC_LENGTH[0][i]+" i="+BC_INDEX[0][i]);
//assert(BC_LENGTH[0][i] != -1);
if
(
BC_LENGTH
[
0
][
i
]
==
-
1
)
{
assert
(
i
==
_xxxunusedxxx
);
continue
;
// unknown opcode
}
...
...
@@ -543,7 +542,7 @@ class Instruction {
"if_icmpne if_icmplt if_icmpge if_icmpgt if_icmple if_acmpeq if_acmpne "
+
"goto jsr ret tableswitch lookupswitch ireturn lreturn freturn dreturn "
+
"areturn return getstatic putstatic getfield putfield invokevirtual "
+
"invokespecial invokestatic invokeinterface
xxxunusedxxx
new newarray "
+
"invokespecial invokestatic invokeinterface
invokedynamic
new newarray "
+
"anewarray arraylength athrow checkcast instanceof monitorenter "
+
"monitorexit wide multianewarray ifnull ifnonnull goto_w jsr_w "
;
for
(
int
bc
=
0
;
names
.
length
()
>
0
;
bc
++)
{
...
...
@@ -588,6 +587,8 @@ class Instruction {
case
_dldc2_w:
iname
=
"*dldc2_w"
;
break
;
case
_cldc:
iname
=
"*cldc"
;
break
;
case
_cldc_w:
iname
=
"*cldc_w"
;
break
;
case
_qldc:
iname
=
"*qldc"
;
break
;
case
_qldc_w:
iname
=
"*qldc_w"
;
break
;
case
_byte_escape:
iname
=
"*byte_escape"
;
break
;
case
_ref_escape:
iname
=
"*ref_escape"
;
break
;
case
_end_marker:
iname
=
"*end"
;
break
;
...
...
@@ -618,15 +619,16 @@ class Instruction {
if
(
index
>
0
&&
index
+
1
<
length
)
{
switch
(
fmt
.
charAt
(
index
+
1
))
{
case
'c'
:
tag
=
CONSTANT_Class
;
break
;
case
'k'
:
tag
=
CONSTANT_L
iteral
;
break
;
case
'k'
:
tag
=
CONSTANT_L
oadableValue
;
break
;
case
'f'
:
tag
=
CONSTANT_Fieldref
;
break
;
case
'm'
:
tag
=
CONSTANT_Methodref
;
break
;
case
'i'
:
tag
=
CONSTANT_InterfaceMethodref
;
break
;
case
'y'
:
tag
=
CONSTANT_InvokeDynamic
;
break
;
}
assert
(
tag
!=
CONSTANT_None
);
}
else
if
(
index
>
0
&&
length
==
2
)
{
assert
(
from_bc
==
_ldc
);
tag
=
CONSTANT_L
iteral
;
// _ldc opcode only
tag
=
CONSTANT_L
oadableValue
;
// _ldc opcode only
}
for
(
int
bc
=
from_bc
;
bc
<=
to_bc
;
bc
++)
{
BC_FORMAT
[
w
][
bc
]
=
fmt
;
...
...
@@ -649,7 +651,7 @@ class Instruction {
Instruction
i
=
at
(
code
,
0
);
while
(
i
!=
null
)
{
int
opcode
=
i
.
getBC
();
if
(
opcode
==
_xxxunusedxxx
||
opcode
<
_nop
||
opcode
>
_jsr_w
)
{
if
(
opcode
<
_nop
||
opcode
>
_jsr_w
)
{
String
message
=
"illegal opcode: "
+
opcode
+
" "
+
i
;
throw
new
FormatException
(
message
);
}
...
...
src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
浏览文件 @
aacc1372
...
...
@@ -87,7 +87,12 @@ class NativeUnpack {
// If loading from stand alone build uncomment this.
// System.loadLibrary("unpack");
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"unpack"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"unpack"
);
return
null
;
}
});
initIDs
();
}
...
...
src/share/classes/com/sun/java/util/jar/pack/Package.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2001, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
2
, 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
...
...
@@ -28,6 +28,7 @@ package com.sun.java.util.jar.pack;
import
com.sun.java.util.jar.pack.Attribute.Layout
;
import
com.sun.java.util.jar.pack.ConstantPool.ClassEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.DescriptorEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.BootstrapMethodEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.Index
;
import
com.sun.java.util.jar.pack.ConstantPool.LiteralEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.Utf8Entry
;
...
...
@@ -100,6 +101,8 @@ class Package {
classes
.
clear
();
files
.
clear
();
BandStructure
.
nextSeqForDebug
=
0
;
package_minver
=
-
1
;
// fill in later
package_majver
=
0
;
// fill in later
}
int
getPackageVersion
()
{
...
...
@@ -108,6 +111,7 @@ class Package {
// Special empty versions of Code and InnerClasses, used for markers.
public
static
final
Attribute
.
Layout
attrCodeEmpty
;
public
static
final
Attribute
.
Layout
attrBootstrapMethodsEmpty
;
public
static
final
Attribute
.
Layout
attrInnerClassesEmpty
;
public
static
final
Attribute
.
Layout
attrSourceFileSpecial
;
public
static
final
Map
<
Attribute
.
Layout
,
Attribute
>
attrDefs
;
...
...
@@ -115,6 +119,8 @@ class Package {
Map
<
Layout
,
Attribute
>
ad
=
new
HashMap
<>(
3
);
attrCodeEmpty
=
Attribute
.
define
(
ad
,
ATTR_CONTEXT_METHOD
,
"Code"
,
""
).
layout
();
attrBootstrapMethodsEmpty
=
Attribute
.
define
(
ad
,
ATTR_CONTEXT_CLASS
,
"BootstrapMethods"
,
""
).
layout
();
attrInnerClassesEmpty
=
Attribute
.
define
(
ad
,
ATTR_CONTEXT_CLASS
,
"InnerClasses"
,
""
).
layout
();
attrSourceFileSpecial
=
Attribute
.
define
(
ad
,
ATTR_CONTEXT_CLASS
,
...
...
@@ -153,9 +159,8 @@ class Package {
package_minver
=
JAVA6_PACKAGE_MINOR_VERSION
;
}
else
{
// Normal case. Use the newest archive format, when available
// TODO: replace the following with JAVA7* when the need arises
package_majver
=
JAVA6_PACKAGE_MAJOR_VERSION
;
package_minver
=
JAVA6_PACKAGE_MINOR_VERSION
;
package_majver
=
JAVA7_PACKAGE_MAJOR_VERSION
;
package_minver
=
JAVA7_PACKAGE_MINOR_VERSION
;
}
}
...
...
@@ -168,13 +173,22 @@ class Package {
String
expMag
=
Integer
.
toHexString
(
JAVA_PACKAGE_MAGIC
);
throw
new
IOException
(
"Unexpected package magic number: got "
+
gotMag
+
"; expected "
+
expMag
);
}
if
((
package_majver
!=
JAVA6_PACKAGE_MAJOR_VERSION
&&
package_majver
!=
JAVA5_PACKAGE_MAJOR_VERSION
)
||
(
package_minver
!=
JAVA6_PACKAGE_MINOR_VERSION
&&
package_minver
!=
JAVA5_PACKAGE_MINOR_VERSION
))
{
int
[]
majminFound
=
null
;
for
(
int
[]
majmin
:
new
int
[][]{
{
JAVA7_PACKAGE_MAJOR_VERSION
,
JAVA7_PACKAGE_MINOR_VERSION
},
{
JAVA6_PACKAGE_MAJOR_VERSION
,
JAVA6_PACKAGE_MINOR_VERSION
},
{
JAVA5_PACKAGE_MAJOR_VERSION
,
JAVA5_PACKAGE_MINOR_VERSION
}
})
{
if
(
package_majver
==
majmin
[
0
]
&&
package_minver
==
majmin
[
1
])
{
majminFound
=
majmin
;
break
;
}
}
if
(
majminFound
==
null
)
{
String
gotVer
=
package_majver
+
"."
+
package_minver
;
String
expVer
=
JAVA6_PACKAGE_MAJOR_VERSION
+
"."
+
JAVA6_PACKAGE_MINOR_VERSION
+
String
expVer
=
JAVA7_PACKAGE_MAJOR_VERSION
+
"."
+
JAVA7_PACKAGE_MINOR_VERSION
+
" OR "
+
JAVA6_PACKAGE_MAJOR_VERSION
+
"."
+
JAVA6_PACKAGE_MINOR_VERSION
+
" OR "
+
JAVA5_PACKAGE_MAJOR_VERSION
+
"."
+
JAVA5_PACKAGE_MINOR_VERSION
;
throw
new
IOException
(
"Unexpected package minor version: got "
+
gotVer
+
"; expected "
+
expVer
);
...
...
@@ -213,6 +227,7 @@ class Package {
//ArrayList attributes; // in Attribute.Holder.this.attributes
// Note that InnerClasses may be collected at the package level.
ArrayList
<
InnerClass
>
innerClasses
;
ArrayList
<
BootstrapMethodEntry
>
bootstrapMethods
;
Class
(
int
flags
,
ClassEntry
thisClass
,
ClassEntry
superClass
,
ClassEntry
[]
interfaces
)
{
this
.
magic
=
JAVA_MAGIC
;
...
...
@@ -313,6 +328,25 @@ class Package {
this
.
cpMap
=
cpMap
;
}
boolean
hasBootstrapMethods
()
{
return
bootstrapMethods
!=
null
&&
!
bootstrapMethods
.
isEmpty
();
}
List
<
BootstrapMethodEntry
>
getBootstrapMethods
()
{
return
bootstrapMethods
;
}
BootstrapMethodEntry
[]
getBootstrapMethodMap
()
{
return
(
hasBootstrapMethods
())
?
bootstrapMethods
.
toArray
(
new
BootstrapMethodEntry
[
bootstrapMethods
.
size
()])
:
null
;
}
void
setBootstrapMethods
(
Collection
<
BootstrapMethodEntry
>
bsms
)
{
assert
(
bootstrapMethods
==
null
);
// do not do this twice
bootstrapMethods
=
new
ArrayList
<>(
bsms
);
}
boolean
hasInnerClasses
()
{
return
innerClasses
!=
null
;
}
...
...
@@ -1283,7 +1317,8 @@ class Package {
byTagU
[
tag
]
=
null
;
// done with it
}
for
(
int
i
=
0
;
i
<
byTagU
.
length
;
i
++)
{
assert
(
byTagU
[
i
]
==
null
);
// all consumed
Index
ix
=
byTagU
[
i
];
assert
(
ix
==
null
);
// all consumed
}
for
(
int
i
=
0
;
i
<
ConstantPool
.
TAGS_IN_ORDER
.
length
;
i
++)
{
byte
tag
=
ConstantPool
.
TAGS_IN_ORDER
[
i
];
...
...
src/share/classes/com/sun/java/util/jar/pack/PackageReader.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2001, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
2
, 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
...
...
@@ -25,13 +25,7 @@
package
com.sun.java.util.jar.pack
;
import
com.sun.java.util.jar.pack.ConstantPool.ClassEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.DescriptorEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.Entry
;
import
com.sun.java.util.jar.pack.ConstantPool.Index
;
import
com.sun.java.util.jar.pack.ConstantPool.MemberEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.SignatureEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.Utf8Entry
;
import
com.sun.java.util.jar.pack.ConstantPool.*
;
import
com.sun.java.util.jar.pack.Package.Class
;
import
com.sun.java.util.jar.pack.Package.File
;
import
com.sun.java.util.jar.pack.Package.InnerClass
;
...
...
@@ -46,6 +40,7 @@ import java.util.ArrayList;
import
java.util.Map
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashSet
;
import
java.util.HashMap
;
...
...
@@ -266,7 +261,6 @@ class PackageReader extends BandStructure {
// #band_headers_size :UNSIGNED5[1]
// #attr_definition_count :UNSIGNED5[1]
//
assert
(
AH_LENGTH
==
8
+(
ConstantPool
.
TAGS_IN_ORDER
.
length
)+
6
);
archive_header_0
.
expectLength
(
AH_LENGTH_0
);
archive_header_0
.
readFrom
(
in
);
...
...
@@ -282,6 +276,7 @@ class PackageReader extends BandStructure {
boolean
haveSpecial
=
testBit
(
archiveOptions
,
AO_HAVE_SPECIAL_FORMATS
);
boolean
haveFiles
=
testBit
(
archiveOptions
,
AO_HAVE_FILE_HEADERS
);
boolean
haveNumbers
=
testBit
(
archiveOptions
,
AO_HAVE_CP_NUMBERS
);
boolean
haveCPExtra
=
testBit
(
archiveOptions
,
AO_HAVE_CP_EXTRAS
);
initAttrIndexLimit
();
// now we are ready to use the data:
...
...
@@ -300,11 +295,11 @@ class PackageReader extends BandStructure {
archive_header_S
.
doneDisbursing
();
archiveSize0
=
in
.
getBytesServed
();
int
remainingHeaders
=
AH_LENGTH
-
AH_LENGTH_0
-
AH_LENGTH_S
;
if
(
!
haveFiles
)
remainingHeaders
-=
AH_FILE_HEADER_LEN
-
AH_LENGTH_S
;
if
(
!
haveSpecial
)
remainingHeaders
-
=
AH_SPECIAL_FORMAT_LEN
;
if
(
!
haveNumbers
)
remainingHeaders
-
=
AH_CP_NUMBER_LEN
;
assert
(
remainingHeaders
>=
AH_LENGTH_MIN
-
AH_LENGTH_0
)
;
int
remainingHeaders
=
AH_LENGTH
_MIN
-
AH_LENGTH_0
-
AH_LENGTH_S
;
if
(
haveFiles
)
remainingHeaders
+=
AH_FILE_HEADER_LEN
;
if
(
haveSpecial
)
remainingHeaders
+
=
AH_SPECIAL_FORMAT_LEN
;
if
(
haveNumbers
)
remainingHeaders
+
=
AH_CP_NUMBER_LEN
;
if
(
haveCPExtra
)
remainingHeaders
+=
AH_CP_EXTRA_LEN
;
archive_header_1
.
expectLength
(
remainingHeaders
);
archive_header_1
.
readFrom
(
in
);
...
...
@@ -325,7 +320,7 @@ class PackageReader extends BandStructure {
numAttrDefs
=
0
;
}
readConstantPoolCounts
(
haveNumbers
);
readConstantPoolCounts
(
haveNumbers
,
haveCPExtra
);
numInnerClasses
=
archive_header_1
.
getInt
();
...
...
@@ -351,7 +346,7 @@ class PackageReader extends BandStructure {
band_headers
.
doneDisbursing
();
}
void
readConstantPoolCounts
(
boolean
haveNumbers
)
throws
IOException
{
void
readConstantPoolCounts
(
boolean
haveNumbers
,
boolean
haveCPExtra
)
throws
IOException
{
// size the constant pools:
for
(
int
k
=
0
;
k
<
ConstantPool
.
TAGS_IN_ORDER
.
length
;
k
++)
{
// cp_counts:
...
...
@@ -364,6 +359,7 @@ class PackageReader extends BandStructure {
// #cp_Field_count :UNSIGNED5[1]
// #cp_Method_count :UNSIGNED5[1]
// #cp_Imethod_count :UNSIGNED5[1]
// (cp_attr_counts) ** (#have_cp_attr_counts)
//
// cp_number_counts:
// #cp_Int_count :UNSIGNED5[1]
...
...
@@ -371,6 +367,12 @@ class PackageReader extends BandStructure {
// #cp_Long_count :UNSIGNED5[1]
// #cp_Double_count :UNSIGNED5[1]
//
// cp_extra_counts:
// #cp_MethodHandle_count :UNSIGNED5[1]
// #cp_MethodType_count :UNSIGNED5[1]
// #cp_InvokeDynamic_count :UNSIGNED5[1]
// #cp_BootstrapMethod_count :UNSIGNED5[1]
//
byte
tag
=
ConstantPool
.
TAGS_IN_ORDER
[
k
];
if
(!
haveNumbers
)
{
// These four counts are optional.
...
...
@@ -382,6 +384,16 @@ class PackageReader extends BandStructure {
continue
;
}
}
if
(!
haveCPExtra
)
{
// These four counts are optional.
switch
(
tag
)
{
case
CONSTANT_MethodHandle:
case
CONSTANT_MethodType:
case
CONSTANT_InvokeDynamic:
case
CONSTANT_BootstrapMethod:
continue
;
}
}
tagCount
[
tag
]
=
archive_header_1
.
getInt
();
}
}
...
...
@@ -401,6 +413,11 @@ class PackageReader extends BandStructure {
return
index
;
}
void
checkLegacy
(
String
bandname
)
{
if
(
this
.
pkg
.
package_majver
<
JAVA7_PACKAGE_MAJOR_VERSION
)
{
throw
new
RuntimeException
(
"unexpected band "
+
bandname
);
}
}
void
readConstantPool
()
throws
IOException
{
// cp_bands:
// cp_Utf8
...
...
@@ -533,8 +550,82 @@ class PackageReader extends BandStructure {
case
CONSTANT_InterfaceMethodref:
readMemberRefs
(
tag
,
cpMap
,
cp_Imethod_class
,
cp_Imethod_desc
);
break
;
case
CONSTANT_MethodHandle:
if
(
cpMap
.
length
>
0
)
{
checkLegacy
(
cp_MethodHandle_refkind
.
name
());
}
cp_MethodHandle_refkind
.
expectLength
(
cpMap
.
length
);
cp_MethodHandle_refkind
.
readFrom
(
in
);
cp_MethodHandle_member
.
expectLength
(
cpMap
.
length
);
cp_MethodHandle_member
.
readFrom
(
in
);
cp_MethodHandle_member
.
setIndex
(
getCPIndex
(
CONSTANT_AnyMember
));
for
(
int
i
=
0
;
i
<
cpMap
.
length
;
i
++)
{
byte
refKind
=
(
byte
)
cp_MethodHandle_refkind
.
getInt
();
MemberEntry
memRef
=
(
MemberEntry
)
cp_MethodHandle_member
.
getRef
();
cpMap
[
i
]
=
ConstantPool
.
getMethodHandleEntry
(
refKind
,
memRef
);
}
cp_MethodHandle_refkind
.
doneDisbursing
();
cp_MethodHandle_member
.
doneDisbursing
();
break
;
case
CONSTANT_MethodType:
if
(
cpMap
.
length
>
0
)
{
checkLegacy
(
cp_MethodType
.
name
());
}
cp_MethodType
.
expectLength
(
cpMap
.
length
);
cp_MethodType
.
readFrom
(
in
);
cp_MethodType
.
setIndex
(
getCPIndex
(
CONSTANT_Signature
));
for
(
int
i
=
0
;
i
<
cpMap
.
length
;
i
++)
{
SignatureEntry
typeRef
=
(
SignatureEntry
)
cp_MethodType
.
getRef
();
cpMap
[
i
]
=
ConstantPool
.
getMethodTypeEntry
(
typeRef
);
}
cp_MethodType
.
doneDisbursing
();
break
;
case
CONSTANT_InvokeDynamic:
if
(
cpMap
.
length
>
0
)
{
checkLegacy
(
cp_InvokeDynamic_spec
.
name
());
}
cp_InvokeDynamic_spec
.
expectLength
(
cpMap
.
length
);
cp_InvokeDynamic_spec
.
readFrom
(
in
);
cp_InvokeDynamic_spec
.
setIndex
(
getCPIndex
(
CONSTANT_BootstrapMethod
));
cp_InvokeDynamic_desc
.
expectLength
(
cpMap
.
length
);
cp_InvokeDynamic_desc
.
readFrom
(
in
);
cp_InvokeDynamic_desc
.
setIndex
(
getCPIndex
(
CONSTANT_NameandType
));
for
(
int
i
=
0
;
i
<
cpMap
.
length
;
i
++)
{
BootstrapMethodEntry
bss
=
(
BootstrapMethodEntry
)
cp_InvokeDynamic_spec
.
getRef
();
DescriptorEntry
descr
=
(
DescriptorEntry
)
cp_InvokeDynamic_desc
.
getRef
();
cpMap
[
i
]
=
ConstantPool
.
getInvokeDynamicEntry
(
bss
,
descr
);
}
cp_InvokeDynamic_spec
.
doneDisbursing
();
cp_InvokeDynamic_desc
.
doneDisbursing
();
break
;
case
CONSTANT_BootstrapMethod:
if
(
cpMap
.
length
>
0
)
{
checkLegacy
(
cp_BootstrapMethod_ref
.
name
());
}
cp_BootstrapMethod_ref
.
expectLength
(
cpMap
.
length
);
cp_BootstrapMethod_ref
.
readFrom
(
in
);
cp_BootstrapMethod_ref
.
setIndex
(
getCPIndex
(
CONSTANT_MethodHandle
));
cp_BootstrapMethod_arg_count
.
expectLength
(
cpMap
.
length
);
cp_BootstrapMethod_arg_count
.
readFrom
(
in
);
int
totalArgCount
=
cp_BootstrapMethod_arg_count
.
getIntTotal
();
cp_BootstrapMethod_arg
.
expectLength
(
totalArgCount
);
cp_BootstrapMethod_arg
.
readFrom
(
in
);
cp_BootstrapMethod_arg
.
setIndex
(
getCPIndex
(
CONSTANT_LoadableValue
));
for
(
int
i
=
0
;
i
<
cpMap
.
length
;
i
++)
{
MethodHandleEntry
bsm
=
(
MethodHandleEntry
)
cp_BootstrapMethod_ref
.
getRef
();
int
argc
=
cp_BootstrapMethod_arg_count
.
getInt
();
Entry
[]
argRefs
=
new
Entry
[
argc
];
for
(
int
j
=
0
;
j
<
argc
;
j
++)
{
argRefs
[
j
]
=
cp_BootstrapMethod_arg
.
getRef
();
}
cpMap
[
i
]
=
ConstantPool
.
getBootstrapMethodEntry
(
bsm
,
argRefs
);
}
cp_BootstrapMethod_ref
.
doneDisbursing
();
cp_BootstrapMethod_arg_count
.
doneDisbursing
();
cp_BootstrapMethod_arg
.
doneDisbursing
();
break
;
default
:
assert
(
false
);
throw
new
AssertionError
(
"unexpected CP tag in package"
);
}
Index
index
=
initCPIndex
(
tag
,
cpMap
);
...
...
@@ -548,6 +639,21 @@ class PackageReader extends BandStructure {
cp_bands
.
doneDisbursing
();
if
(
optDumpBands
||
verbose
>
1
)
{
for
(
byte
tag
=
CONSTANT_GroupFirst
;
tag
<
CONSTANT_GroupLimit
;
tag
++)
{
Index
index
=
pkg
.
cp
.
getIndexByTag
(
tag
);
if
(
index
==
null
||
index
.
isEmpty
())
continue
;
Entry
[]
cpMap
=
index
.
cpMap
;
if
(
verbose
>
1
)
Utils
.
log
.
info
(
"Index group "
+
ConstantPool
.
tagName
(
tag
)+
" contains "
+
cpMap
.
length
+
" entries."
);
if
(
optDumpBands
)
{
try
(
PrintStream
ps
=
new
PrintStream
(
getDumpStream
(
index
.
debugName
,
tag
,
".gidx"
,
index
)))
{
printArrayTo
(
ps
,
cpMap
,
0
,
cpMap
.
length
,
true
);
}
}
}
}
setBandIndexes
();
}
...
...
@@ -1056,8 +1162,16 @@ class PackageReader extends BandStructure {
// look for constant pool entries:
cls
.
visitRefs
(
VRM_CLASSIC
,
cpRefs
);
ArrayList
<
BootstrapMethodEntry
>
bsms
=
new
ArrayList
<>();
/*
* BootstrapMethod(BSMs) are added here before InnerClasses(ICs),
* so as to ensure the order. Noting that the BSMs may be
* removed if they are not found in the CP, after the ICs expansion.
*/
cls
.
addAttribute
(
Package
.
attrBootstrapMethodsEmpty
.
canonicalInstance
());
// flesh out the local constant pool
ConstantPool
.
completeReferencesIn
(
cpRefs
,
true
);
ConstantPool
.
completeReferencesIn
(
cpRefs
,
true
,
bsms
);
// Now that we know all our local class references,
// compute the InnerClasses attribute.
...
...
@@ -1074,14 +1188,23 @@ class PackageReader extends BandStructure {
}
// flesh out the local constant pool, again
ConstantPool
.
completeReferencesIn
(
cpRefs
,
true
);
ConstantPool
.
completeReferencesIn
(
cpRefs
,
true
,
bsms
);
}
// remove the attr previously set, otherwise add the bsm and
// references as required
if
(
bsms
.
isEmpty
())
{
cls
.
attributes
.
remove
(
Package
.
attrBootstrapMethodsEmpty
.
canonicalInstance
());
}
else
{
cpRefs
.
add
(
Package
.
getRefString
(
"BootstrapMethods"
));
Collections
.
sort
(
bsms
);
cls
.
setBootstrapMethods
(
bsms
);
}
// construct a local constant pool
int
numDoubles
=
0
;
for
(
Entry
e
:
cpRefs
)
{
if
(
e
.
isDoubleWord
())
numDoubles
++;
assert
(
e
.
tag
!=
CONSTANT_Signature
)
:
(
e
);
}
Entry
[]
cpMap
=
new
Entry
[
1
+
numDoubles
+
cpRefs
.
size
()];
int
fillp
=
1
;
...
...
@@ -1154,7 +1277,8 @@ class PackageReader extends BandStructure {
int
totalNM
=
class_method_count
.
getIntTotal
();
field_descr
.
expectLength
(
totalNF
);
method_descr
.
expectLength
(
totalNM
);
if
(
verbose
>
1
)
Utils
.
log
.
fine
(
"expecting #fields="
+
totalNF
+
" and #methods="
+
totalNM
+
" in #classes="
+
numClasses
);
if
(
verbose
>
1
)
Utils
.
log
.
fine
(
"expecting #fields="
+
totalNF
+
" and #methods="
+
totalNM
+
" in #classes="
+
numClasses
);
List
<
Class
.
Field
>
fields
=
new
ArrayList
<>(
totalNF
);
field_descr
.
readFrom
(
in
);
...
...
@@ -1393,7 +1517,8 @@ class PackageReader extends BandStructure {
MultiBand
xxx_attr_bands
=
attrBands
[
ctype
];
long
flagMask
=
attrFlagMask
[
ctype
];
if
(
verbose
>
1
)
{
Utils
.
log
.
fine
(
"scanning flags and attrs for "
+
Attribute
.
contextName
(
ctype
)+
"["
+
holders
.
size
()+
"]"
);
Utils
.
log
.
fine
(
"scanning flags and attrs for "
+
Attribute
.
contextName
(
ctype
)+
"["
+
holders
.
size
()+
"]"
);
}
// Fetch the attribute layout definitions which govern the bands
...
...
@@ -1751,8 +1876,10 @@ class PackageReader extends BandStructure {
bc_local
,
bc_label
,
bc_intref
,
bc_floatref
,
bc_longref
,
bc_doubleref
,
bc_stringref
,
bc_loadablevalueref
,
bc_classref
,
bc_fieldref
,
bc_methodref
,
bc_imethodref
,
bc_indyref
,
bc_thisfield
,
bc_superfield
,
bc_thismethod
,
bc_supermethod
,
bc_initref
,
...
...
@@ -2099,7 +2226,8 @@ class PackageReader extends BandStructure {
case
_ildc:
case
_cldc:
case
_fldc:
case
_aldc:
case
_sldc:
case
_qldc:
origBC
=
_ldc
;
size
=
1
;
ldcRefSet
.
add
(
ref
);
...
...
@@ -2107,7 +2235,8 @@ class PackageReader extends BandStructure {
case
_ildc_w:
case
_cldc_w:
case
_fldc_w:
case
_aldc_w:
case
_sldc_w:
case
_qldc_w:
origBC
=
_ldc_w
;
break
;
case
_lldc2_w:
...
...
@@ -2136,6 +2265,9 @@ class PackageReader extends BandStructure {
int
argSize
=
((
MemberEntry
)
ref
).
descRef
.
typeRef
.
computeSize
(
true
);
buf
[
pc
++]
=
(
byte
)(
1
+
argSize
);
buf
[
pc
++]
=
0
;
}
else
if
(
origBC
==
_invokedynamic
)
{
buf
[
pc
++]
=
0
;
buf
[
pc
++]
=
0
;
}
assert
(
Instruction
.
opLength
(
origBC
)
==
(
pc
-
curPC
));
continue
;
...
...
src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2001, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
2
, 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
...
...
@@ -25,15 +25,7 @@
package
com.sun.java.util.jar.pack
;
import
com.sun.java.util.jar.pack.ConstantPool.ClassEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.DescriptorEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.Entry
;
import
com.sun.java.util.jar.pack.ConstantPool.Index
;
import
com.sun.java.util.jar.pack.ConstantPool.IndexGroup
;
import
com.sun.java.util.jar.pack.ConstantPool.MemberEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.NumberEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.SignatureEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.StringEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.*
;
import
com.sun.java.util.jar.pack.Package.Class
;
import
com.sun.java.util.jar.pack.Package.File
;
import
com.sun.java.util.jar.pack.Package.InnerClass
;
...
...
@@ -281,7 +273,7 @@ class PackageWriter extends BandStructure {
void
writeArchiveHeader
()
throws
IOException
{
// for debug only: number of words optimized away
int
header
DiscountForDebug
=
0
;
int
header
SizeForDebug
=
AH_LENGTH_MIN
;
// AO_HAVE_SPECIAL_FORMATS is set if non-default
// coding techniques are used, or if there are
...
...
@@ -293,8 +285,8 @@ class PackageWriter extends BandStructure {
if
(
haveSpecial
)
archiveOptions
|=
AO_HAVE_SPECIAL_FORMATS
;
}
if
(
!
haveSpecial
)
header
Discount
ForDebug
+=
AH_SPECIAL_FORMAT_LEN
;
if
(
haveSpecial
)
header
Size
ForDebug
+=
AH_SPECIAL_FORMAT_LEN
;
// AO_HAVE_FILE_HEADERS is set if there is any
// file or segment envelope information present.
...
...
@@ -305,8 +297,8 @@ class PackageWriter extends BandStructure {
if
(
haveFiles
)
archiveOptions
|=
AO_HAVE_FILE_HEADERS
;
}
if
(
!
haveFiles
)
header
Discount
ForDebug
+=
AH_FILE_HEADER_LEN
;
if
(
haveFiles
)
header
Size
ForDebug
+=
AH_FILE_HEADER_LEN
;
// AO_HAVE_CP_NUMBERS is set if there are any numbers
// in the global constant pool. (Numbers are in 15% of classes.)
...
...
@@ -316,8 +308,19 @@ class PackageWriter extends BandStructure {
if
(
haveNumbers
)
archiveOptions
|=
AO_HAVE_CP_NUMBERS
;
}
if
(!
haveNumbers
)
headerDiscountForDebug
+=
AH_CP_NUMBER_LEN
;
if
(
haveNumbers
)
headerSizeForDebug
+=
AH_CP_NUMBER_LEN
;
// AO_HAVE_CP_EXTRAS is set if there are constant pool entries
// beyond the Java 6 version of the class file format.
boolean
haveCPExtra
=
testBit
(
archiveOptions
,
AO_HAVE_CP_EXTRAS
);
if
(!
haveCPExtra
)
{
haveCPExtra
|=
pkg
.
cp
.
haveExtraTags
();
if
(
haveCPExtra
)
archiveOptions
|=
AO_HAVE_CP_EXTRAS
;
}
if
(
haveCPExtra
)
headerSizeForDebug
+=
AH_CP_EXTRA_LEN
;
assert
(
pkg
.
package_majver
>
0
);
// caller must specify!
archive_header_0
.
putInt
(
pkg
.
package_minver
);
...
...
@@ -355,18 +358,18 @@ class PackageWriter extends BandStructure {
assert
(
attrDefsWritten
.
length
==
0
);
}
writeConstantPoolCounts
(
haveNumbers
);
writeConstantPoolCounts
(
haveNumbers
,
haveCPExtra
);
archive_header_1
.
putInt
(
pkg
.
getAllInnerClasses
().
size
());
archive_header_1
.
putInt
(
pkg
.
default_class_minver
);
archive_header_1
.
putInt
(
pkg
.
default_class_majver
);
archive_header_1
.
putInt
(
pkg
.
classes
.
size
());
// Sanity: Make sure we came out to 2
6
(less optional fields):
// Sanity: Make sure we came out to 2
9
(less optional fields):
assert
(
archive_header_0
.
length
()
+
archive_header_S
.
length
()
+
archive_header_1
.
length
()
==
AH_LENGTH
-
headerDiscount
ForDebug
);
==
headerSize
ForDebug
);
// Figure out all the sizes now, first cut:
archiveSize0
=
0
;
...
...
@@ -394,9 +397,8 @@ class PackageWriter extends BandStructure {
assert
(
all_bands
.
outputSize
()
==
archiveSize0
+
archiveSize1
);
}
void
writeConstantPoolCounts
(
boolean
haveNumbers
)
throws
IOException
{
for
(
int
k
=
0
;
k
<
ConstantPool
.
TAGS_IN_ORDER
.
length
;
k
++)
{
byte
tag
=
ConstantPool
.
TAGS_IN_ORDER
[
k
];
void
writeConstantPoolCounts
(
boolean
haveNumbers
,
boolean
haveCPExtra
)
throws
IOException
{
for
(
byte
tag
:
ConstantPool
.
TAGS_IN_ORDER
)
{
int
count
=
pkg
.
cp
.
getIndexByTag
(
tag
).
size
();
switch
(
tag
)
{
case
CONSTANT_Utf8:
...
...
@@ -416,6 +418,17 @@ class PackageWriter extends BandStructure {
continue
;
}
break
;
case
CONSTANT_MethodHandle:
case
CONSTANT_MethodType:
case
CONSTANT_InvokeDynamic:
case
CONSTANT_BootstrapMethod:
// Omit counts for newer entities if possible.
if
(!
haveCPExtra
)
{
assert
(
count
==
0
);
continue
;
}
break
;
}
archive_header_1
.
putInt
(
count
);
}
...
...
@@ -449,8 +462,7 @@ class PackageWriter extends BandStructure {
if
(
verbose
>
0
)
Utils
.
log
.
info
(
"Writing CP"
);
for
(
int
k
=
0
;
k
<
ConstantPool
.
TAGS_IN_ORDER
.
length
;
k
++)
{
byte
tag
=
ConstantPool
.
TAGS_IN_ORDER
[
k
];
for
(
byte
tag
:
ConstantPool
.
TAGS_IN_ORDER
)
{
Index
index
=
cp
.
getIndexByTag
(
tag
);
Entry
[]
cpMap
=
index
.
cpMap
;
...
...
@@ -530,8 +542,52 @@ class PackageWriter extends BandStructure {
case
CONSTANT_InterfaceMethodref:
writeMemberRefs
(
tag
,
cpMap
,
cp_Imethod_class
,
cp_Imethod_desc
);
break
;
case
CONSTANT_MethodHandle:
for
(
int
i
=
0
;
i
<
cpMap
.
length
;
i
++)
{
MethodHandleEntry
e
=
(
MethodHandleEntry
)
cpMap
[
i
];
cp_MethodHandle_refkind
.
putInt
(
e
.
refKind
);
cp_MethodHandle_member
.
putRef
(
e
.
memRef
);
}
break
;
case
CONSTANT_MethodType:
for
(
int
i
=
0
;
i
<
cpMap
.
length
;
i
++)
{
MethodTypeEntry
e
=
(
MethodTypeEntry
)
cpMap
[
i
];
cp_MethodType
.
putRef
(
e
.
typeRef
);
}
break
;
case
CONSTANT_InvokeDynamic:
for
(
int
i
=
0
;
i
<
cpMap
.
length
;
i
++)
{
InvokeDynamicEntry
e
=
(
InvokeDynamicEntry
)
cpMap
[
i
];
cp_InvokeDynamic_spec
.
putRef
(
e
.
bssRef
);
cp_InvokeDynamic_desc
.
putRef
(
e
.
descRef
);
}
break
;
case
CONSTANT_BootstrapMethod:
for
(
int
i
=
0
;
i
<
cpMap
.
length
;
i
++)
{
BootstrapMethodEntry
e
=
(
BootstrapMethodEntry
)
cpMap
[
i
];
cp_BootstrapMethod_ref
.
putRef
(
e
.
bsmRef
);
cp_BootstrapMethod_arg_count
.
putInt
(
e
.
argRefs
.
length
);
for
(
Entry
argRef
:
e
.
argRefs
)
{
cp_BootstrapMethod_arg
.
putRef
(
argRef
);
}
}
break
;
default
:
assert
(
false
);
throw
new
AssertionError
(
"unexpected CP tag in package"
);
}
}
if
(
optDumpBands
||
verbose
>
1
)
{
for
(
byte
tag
=
CONSTANT_GroupFirst
;
tag
<
CONSTANT_GroupLimit
;
tag
++)
{
Index
index
=
cp
.
getIndexByTag
(
tag
);
if
(
index
==
null
||
index
.
isEmpty
())
continue
;
Entry
[]
cpMap
=
index
.
cpMap
;
if
(
verbose
>
1
)
Utils
.
log
.
info
(
"Index group "
+
ConstantPool
.
tagName
(
tag
)+
" contains "
+
cpMap
.
length
+
" entries."
);
if
(
optDumpBands
)
{
try
(
PrintStream
ps
=
new
PrintStream
(
getDumpStream
(
index
.
debugName
,
tag
,
".gidx"
,
index
)))
{
printArrayTo
(
ps
,
cpMap
,
0
,
cpMap
.
length
,
true
);
}
}
}
}
}
...
...
@@ -988,6 +1044,8 @@ class PackageWriter extends BandStructure {
for
(
Class
cls
:
pkg
.
classes
)
{
// Replace "obvious" SourceFile attrs by null.
cls
.
minimizeSourceFile
();
// BootstrapMethods should never have been inserted.
assert
(
cls
.
getAttribute
(
Package
.
attrBootstrapMethodsEmpty
)
==
null
);
}
}
...
...
@@ -1325,9 +1383,7 @@ class PackageWriter extends BandStructure {
// %%% Add a stress mode which issues _ref/_byte_escape.
if
(
verbose
>
3
)
Utils
.
log
.
fine
(
i
.
toString
());
if
(
i
.
isNonstandard
()
&&
(!
p200
.
getBoolean
(
Utils
.
COM_PREFIX
+
"invokedynamic"
)
||
i
.
getBC
()
!=
_xxxunusedxxx
))
{
if
(
i
.
isNonstandard
())
{
// Crash and burn with a complaint if there are funny
// bytecodes in this class file.
String
complaint
=
code
.
getMethod
()
...
...
@@ -1427,24 +1483,6 @@ class PackageWriter extends BandStructure {
continue
;
}
switch
(
bc
)
{
case
_xxxunusedxxx:
// %%% pretend this is invokedynamic
{
i
.
setNonstandardLength
(
3
);
int
refx
=
i
.
getShortAt
(
1
);
Entry
ref
=
(
refx
==
0
)?
null
:
curCPMap
[
refx
];
// transmit the opcode, carefully:
bc_codes
.
putByte
(
_byte_escape
);
bc_escsize
.
putInt
(
1
);
// one byte of opcode
bc_escbyte
.
putByte
(
bc
);
// the opcode
// transmit the CP reference, carefully:
bc_codes
.
putByte
(
_ref_escape
);
bc_escrefsize
.
putInt
(
2
);
// two bytes of ref
bc_escref
.
putRef
(
ref
);
// the ref
continue
;
}
}
int
branch
=
i
.
getBranchLabel
();
if
(
branch
>=
0
)
{
bc_codes
.
putByte
(
bc
);
...
...
@@ -1458,7 +1496,7 @@ class PackageWriter extends BandStructure {
CPRefBand
bc_which
;
int
vbc
=
bc
;
switch
(
i
.
getCPTag
())
{
case
CONSTANT_L
iteral
:
case
CONSTANT_L
oadableValue
:
switch
(
ref
.
tag
)
{
case
CONSTANT_Integer:
bc_which
=
bc_intref
;
...
...
@@ -1489,8 +1527,8 @@ class PackageWriter extends BandStructure {
case
CONSTANT_String:
bc_which
=
bc_stringref
;
switch
(
bc
)
{
case
_ldc:
vbc
=
_
a
ldc
;
break
;
case
_ldc_w:
vbc
=
_
a
ldc_w
;
break
;
case
_ldc:
vbc
=
_
s
ldc
;
break
;
case
_ldc_w:
vbc
=
_
s
ldc_w
;
break
;
default
:
assert
(
false
);
}
break
;
...
...
@@ -1503,8 +1541,16 @@ class PackageWriter extends BandStructure {
}
break
;
default
:
bc_which
=
null
;
assert
(
false
);
// CONSTANT_MethodHandle, etc.
if
(
getPackageMajver
()
<
JAVA7_PACKAGE_MAJOR_VERSION
)
{
throw
new
IOException
(
"bad package major version for Java 7 ldc"
);
}
bc_which
=
bc_loadablevalueref
;
switch
(
bc
)
{
case
_ldc:
vbc
=
_qldc
;
break
;
case
_ldc_w:
vbc
=
_qldc_w
;
break
;
default
:
assert
(
false
);
}
}
break
;
case
CONSTANT_Class:
...
...
@@ -1517,6 +1563,8 @@ class PackageWriter extends BandStructure {
bc_which
=
bc_methodref
;
break
;
case
CONSTANT_InterfaceMethodref:
bc_which
=
bc_imethodref
;
break
;
case
CONSTANT_InvokeDynamic:
bc_which
=
bc_indyref
;
break
;
default
:
bc_which
=
null
;
assert
(
false
);
...
...
@@ -1532,6 +1580,12 @@ class PackageWriter extends BandStructure {
assert
(
i
.
getLength
()
==
5
);
// Make sure the discarded bytes are sane:
assert
(
i
.
getConstant
()
==
(
1
+((
MemberEntry
)
ref
).
descRef
.
typeRef
.
computeSize
(
true
))
<<
8
);
}
else
if
(
bc
==
_invokedynamic
)
{
if
(
getPackageMajver
()
<
JAVA7_PACKAGE_MAJOR_VERSION
)
{
throw
new
IOException
(
"bad package major version for Java 7 invokedynamic"
);
}
assert
(
i
.
getLength
()
==
5
);
assert
(
i
.
getConstant
()
==
0
);
// last 2 bytes MBZ
}
else
{
// Make sure there is nothing else to write.
assert
(
i
.
getLength
()
==
((
bc
==
_ldc
)?
2
:
3
));
...
...
src/share/classes/com/sun/java/util/jar/pack/TLGlobals.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2010, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 201
2
, 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
...
...
@@ -28,6 +28,10 @@ import com.sun.java.util.jar.pack.ConstantPool.ClassEntry;
import
com.sun.java.util.jar.pack.ConstantPool.DescriptorEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.LiteralEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.MemberEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.MethodHandleEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.MethodTypeEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.InvokeDynamicEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.BootstrapMethodEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.SignatureEntry
;
import
com.sun.java.util.jar.pack.ConstantPool.Utf8Entry
;
import
java.util.HashMap
;
...
...
@@ -56,6 +60,10 @@ class TLGlobals {
private
final
Map
<
String
,
SignatureEntry
>
signatureEntries
;
private
final
Map
<
String
,
DescriptorEntry
>
descriptorEntries
;
private
final
Map
<
String
,
MemberEntry
>
memberEntries
;
private
final
Map
<
String
,
MethodHandleEntry
>
methodHandleEntries
;
private
final
Map
<
String
,
MethodTypeEntry
>
methodTypeEntries
;
private
final
Map
<
String
,
InvokeDynamicEntry
>
invokeDynamicEntries
;
private
final
Map
<
String
,
BootstrapMethodEntry
>
bootstrapMethodEntries
;
TLGlobals
()
{
utf8Entries
=
new
HashMap
<>();
...
...
@@ -64,6 +72,10 @@ class TLGlobals {
signatureEntries
=
new
HashMap
<>();
descriptorEntries
=
new
HashMap
<>();
memberEntries
=
new
HashMap
<>();
methodHandleEntries
=
new
HashMap
<>();
methodTypeEntries
=
new
HashMap
<>();
invokeDynamicEntries
=
new
HashMap
<>();
bootstrapMethodEntries
=
new
HashMap
<>();
props
=
new
PropMap
();
}
...
...
@@ -94,4 +106,20 @@ class TLGlobals {
Map
<
String
,
MemberEntry
>
getMemberEntries
()
{
return
memberEntries
;
}
Map
<
String
,
MethodHandleEntry
>
getMethodHandleEntries
()
{
return
methodHandleEntries
;
}
Map
<
String
,
MethodTypeEntry
>
getMethodTypeEntries
()
{
return
methodTypeEntries
;
}
Map
<
String
,
InvokeDynamicEntry
>
getInvokeDynamicEntries
()
{
return
invokeDynamicEntries
;
}
Map
<
String
,
BootstrapMethodEntry
>
getBootstrapMethodEntries
()
{
return
bootstrapMethodEntries
;
}
}
src/share/classes/com/sun/java/util/jar/pack/Utils.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2003, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
2
, 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
...
...
@@ -60,7 +60,7 @@ class Utils {
* If >3, print tons of comments (e.g., processing of references).
* (installer only)
*/
static
final
String
DEBUG_VERBOSE
=
Utils
.
COM_PREFIX
+
"verbose"
;
static
final
String
DEBUG_VERBOSE
=
COM_PREFIX
+
"verbose"
;
/*
* Disables use of native code, prefers the Java-coded implementation.
...
...
@@ -134,35 +134,11 @@ class Utils {
// to the engine code, especially the native code.
static
final
ThreadLocal
<
TLGlobals
>
currentInstance
=
new
ThreadLocal
<>();
// convenience method
s
to access the TL globals
// convenience method to access the TL globals
static
TLGlobals
getTLGlobals
()
{
return
currentInstance
.
get
();
}
static
Map
<
String
,
Utf8Entry
>
getUtf8Entries
()
{
return
getTLGlobals
().
getUtf8Entries
();
}
static
Map
<
String
,
ClassEntry
>
getClassEntries
()
{
return
getTLGlobals
().
getClassEntries
();
}
static
Map
<
Object
,
LiteralEntry
>
getLiteralEntries
()
{
return
getTLGlobals
().
getLiteralEntries
();
}
static
Map
<
String
,
DescriptorEntry
>
getDescriptorEntries
()
{
return
getTLGlobals
().
getDescriptorEntries
();
}
static
Map
<
String
,
SignatureEntry
>
getSignatureEntries
()
{
return
getTLGlobals
().
getSignatureEntries
();
}
static
Map
<
String
,
MemberEntry
>
getMemberEntries
()
{
return
getTLGlobals
().
getMemberEntries
();
}
static
PropMap
currentPropMap
()
{
Object
obj
=
currentInstance
.
get
();
if
(
obj
instanceof
PackerImpl
)
...
...
@@ -173,8 +149,19 @@ class Utils {
}
static
final
boolean
nolog
=
Boolean
.
getBoolean
(
Utils
.
COM_PREFIX
+
"nolog"
);
=
Boolean
.
getBoolean
(
COM_PREFIX
+
"nolog"
);
static
final
boolean
SORT_MEMBERS_DESCR_MAJOR
=
Boolean
.
getBoolean
(
COM_PREFIX
+
"sort.members.descr.major"
);
static
final
boolean
SORT_HANDLES_KIND_MAJOR
=
Boolean
.
getBoolean
(
COM_PREFIX
+
"sort.handles.kind.major"
);
static
final
boolean
SORT_INDY_BSS_MAJOR
=
Boolean
.
getBoolean
(
COM_PREFIX
+
"sort.indy.bss.major"
);
static
final
boolean
SORT_BSS_BSM_MAJOR
=
Boolean
.
getBoolean
(
COM_PREFIX
+
"sort.bss.bsm.major"
);
static
class
Pack200Logger
{
private
final
String
name
;
...
...
src/share/classes/java/awt/SplashScreen.java
浏览文件 @
aacc1372
...
...
@@ -119,7 +119,12 @@ public final class SplashScreen {
// SplashScreen class is now a singleton
if
(!
wasClosed
&&
theInstance
==
null
)
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"splashscreen"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"splashscreen"
);
return
null
;
}
});
long
ptr
=
_getInstance
();
if
(
ptr
!=
0
&&
_isVisible
(
ptr
))
{
theInstance
=
new
SplashScreen
(
ptr
);
...
...
src/share/classes/java/awt/Toolkit.java
浏览文件 @
aacc1372
...
...
@@ -1646,7 +1646,12 @@ public abstract class Toolkit {
static
void
loadLibraries
()
{
if
(!
loaded
)
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"awt"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"awt"
);
return
null
;
}
});
loaded
=
true
;
}
}
...
...
src/share/classes/java/awt/event/NativeLibLoader.java
浏览文件 @
aacc1372
...
...
@@ -54,6 +54,11 @@ class NativeLibLoader {
*/
static
void
loadLibraries
()
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"awt"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"awt"
);
return
null
;
}
});
}
}
src/share/classes/java/awt/image/ColorModel.java
浏览文件 @
aacc1372
...
...
@@ -204,7 +204,12 @@ public abstract class ColorModel implements Transparency{
static
void
loadLibraries
()
{
if
(!
loaded
)
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"awt"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"awt"
);
return
null
;
}
});
loaded
=
true
;
}
}
...
...
src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
浏览文件 @
aacc1372
/*
* Copyright (c) 1996, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
2
, 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
...
...
@@ -60,14 +60,19 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
/**
* flag set if the native connect() call not to be used
*/
private
final
static
boolean
connectDisabled
=
os
.
startsWith
(
"Mac OS
"
);
private
final
static
boolean
connectDisabled
=
os
.
contains
(
"OS X
"
);
/**
* Load net library into runtime.
*/
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"net"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"net"
);
return
null
;
}
});
}
/**
...
...
src/share/classes/java/net/AbstractPlainSocketImpl.java
浏览文件 @
aacc1372
...
...
@@ -78,7 +78,12 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
*/
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"net"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"net"
);
return
null
;
}
});
}
/**
...
...
src/share/classes/java/net/DatagramPacket.java
浏览文件 @
aacc1372
...
...
@@ -47,7 +47,12 @@ class DatagramPacket {
*/
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"net"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"net"
);
return
null
;
}
});
init
();
}
...
...
src/share/classes/java/net/InetAddress.java
浏览文件 @
aacc1372
...
...
@@ -234,7 +234,13 @@ class InetAddress implements java.io.Serializable {
static
{
preferIPv6Address
=
java
.
security
.
AccessController
.
doPrivileged
(
new
GetBooleanAction
(
"java.net.preferIPv6Addresses"
)).
booleanValue
();
AccessController
.
doPrivileged
(
new
LoadLibraryAction
(
"net"
));
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"net"
);
return
null
;
}
});
init
();
}
...
...
src/share/classes/java/net/NetworkInterface.java
浏览文件 @
aacc1372
...
...
@@ -53,7 +53,14 @@ public final class NetworkInterface {
private
static
final
int
defaultIndex
;
/* index of defaultInterface */
static
{
AccessController
.
doPrivileged
(
new
LoadLibraryAction
(
"net"
));
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"net"
);
return
null
;
}
});
init
();
defaultInterface
=
DefaultInterface
.
getDefault
();
if
(
defaultInterface
!=
null
)
{
...
...
src/share/classes/java/nio/Bits.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2000, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
2
, 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
...
...
@@ -609,7 +609,7 @@ class Bits { // package-private
String
arch
=
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"os.arch"
));
unaligned
=
arch
.
equals
(
"i386"
)
||
arch
.
equals
(
"x86"
)
||
arch
.
equals
(
"amd64"
);
||
arch
.
equals
(
"amd64"
)
||
arch
.
equals
(
"x86_64"
)
;
unalignedKnown
=
true
;
return
unaligned
;
}
...
...
src/share/classes/java/nio/file/Path.java
浏览文件 @
aacc1372
...
...
@@ -54,7 +54,7 @@ import java.util.Iterator;
* resolveSibling} methods to combine paths. The {@link #relativize relativize}
* method that can be used to construct a relative path between two paths.
* Paths can be {@link #compareTo compared}, and tested against each other using
* the {@link #startsWith startsWith} and {@link #endsWith endWith} methods.
* the {@link #startsWith startsWith} and {@link #endsWith end
s
With} methods.
*
* <p> This interface extends {@link Watchable} interface so that a directory
* located by a path can be {@link #register registered} with a {@link
...
...
src/share/classes/java/text/DateFormatSymbols.java
浏览文件 @
aacc1372
...
...
@@ -647,6 +647,8 @@ public class DateFormatSymbols implements Serializable, Cloneable {
private
static
final
ConcurrentMap
<
Locale
,
SoftReference
<
DateFormatSymbols
>>
cachedInstances
=
new
ConcurrentHashMap
<
Locale
,
SoftReference
<
DateFormatSymbols
>>(
3
);
private
transient
int
lastZoneIndex
=
0
;
private
void
initializeData
(
Locale
desiredLocale
)
{
locale
=
desiredLocale
;
...
...
@@ -692,12 +694,24 @@ public class DateFormatSymbols implements Serializable, Cloneable {
* the given time zone ID can't be located in the DateFormatSymbols object.
* @see java.util.SimpleTimeZone
*/
final
int
getZoneIndex
(
String
ID
)
{
final
int
getZoneIndex
(
String
ID
)
{
String
[][]
zoneStrings
=
getZoneStringsWrapper
();
for
(
int
index
=
0
;
index
<
zoneStrings
.
length
;
index
++)
{
if
(
ID
.
equals
(
zoneStrings
[
index
][
0
]))
return
index
;
/*
* getZoneIndex has been re-written for performance reasons. instead of
* traversing the zoneStrings array every time, we cache the last used zone
* index
*/
if
(
lastZoneIndex
<
zoneStrings
.
length
&&
ID
.
equals
(
zoneStrings
[
lastZoneIndex
][
0
]))
{
return
lastZoneIndex
;
}
/* slow path, search entire list */
for
(
int
index
=
0
;
index
<
zoneStrings
.
length
;
index
++)
{
if
(
ID
.
equals
(
zoneStrings
[
index
][
0
]))
{
lastZoneIndex
=
index
;
return
index
;
}
}
return
-
1
;
...
...
src/share/classes/java/util/prefs/Preferences.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2000, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
12
, 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
...
...
@@ -293,7 +293,7 @@ public abstract class Preferences {
String
platformFactory
;
if
(
osName
.
startsWith
(
"Windows"
))
{
platformFactory
=
"java.util.prefs.WindowsPreferencesFactory"
;
}
else
if
(
osName
.
startsWith
(
"Mac
OS X"
))
{
}
else
if
(
osName
.
contains
(
"
OS X"
))
{
platformFactory
=
"java.util.prefs.MacOSXPreferencesFactory"
;
}
else
{
platformFactory
=
"java.util.prefs.FileSystemPreferencesFactory"
;
...
...
src/share/classes/javax/net/ssl/SSLContext.java
浏览文件 @
aacc1372
...
...
@@ -145,7 +145,7 @@ public class SSLContext {
* @return the new <code>SSLContext</code> object.
*
* @exception NoSuchAlgorithmException if no Provider supports a
*
TrustManagerFactory
Spi implementation for the
*
SSLContext
Spi implementation for the
* specified protocol.
* @exception NullPointerException if protocol is null.
*
...
...
@@ -222,11 +222,11 @@ public class SSLContext {
*
* @return the new <code>SSLContext</code> object.
*
* @throws NoSuchAlgorithmException if a
KeyManagerFactory
Spi
* @throws NoSuchAlgorithmException if a
SSLContext
Spi
* implementation for the specified protocol is not available
* from the specified Provider object.
*
* @throws IllegalArgumentException if the provider
name
is null.
* @throws IllegalArgumentException if the provider is null.
* @throws NullPointerException if protocol is null.
*
* @see java.security.Provider
...
...
src/share/classes/sun/awt/NativeLibLoader.java
浏览文件 @
aacc1372
...
...
@@ -54,6 +54,11 @@ class NativeLibLoader {
*/
static
void
loadLibraries
()
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"awt"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"awt"
);
return
null
;
}
});
}
}
src/share/classes/sun/awt/OSInfo.java
浏览文件 @
aacc1372
/*
* Copyright (c) 1997, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
12
, 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
...
...
@@ -101,7 +101,7 @@ public class OSInfo {
return
SOLARIS
;
}
if
(
osName
.
startsWith
(
"Mac
OS X"
))
{
if
(
osName
.
contains
(
"
OS X"
))
{
return
MACOSX
;
}
...
...
src/share/classes/sun/awt/image/JPEGImageDecoder.java
浏览文件 @
aacc1372
...
...
@@ -54,7 +54,12 @@ public class JPEGImageDecoder extends ImageDecoder {
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"jpeg"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"jpeg"
);
return
null
;
}
});
initIDs
(
InputStreamClass
);
RGBcolormodel
=
new
DirectColorModel
(
24
,
0xff0000
,
0xff00
,
0xff
);
ARGBcolormodel
=
ColorModel
.
getRGBdefault
();
...
...
src/share/classes/sun/awt/image/NativeLibLoader.java
浏览文件 @
aacc1372
...
...
@@ -53,7 +53,12 @@ class NativeLibLoader {
* that the name of the library is "awt". -br.
*/
static
void
loadLibraries
()
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"awt"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"awt"
);
return
null
;
}
});
}
}
src/share/classes/sun/font/FontUtilities.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2008, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
2
, 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
...
...
@@ -78,7 +78,7 @@ public final class FontUtilities {
isLinux
=
osName
.
startsWith
(
"Linux"
);
isMacOSX
=
osName
.
startsWith
(
"Mac
OS X"
);
// TODO: MacOSX
isMacOSX
=
osName
.
contains
(
"
OS X"
);
// TODO: MacOSX
String
t2kStr
=
System
.
getProperty
(
"sun.java2d.font.scaler"
);
if
(
t2kStr
!=
null
)
{
...
...
src/share/classes/sun/java2d/Disposer.java
浏览文件 @
aacc1372
...
...
@@ -57,7 +57,12 @@ public class Disposer implements Runnable {
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"awt"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"awt"
);
return
null
;
}
});
initIDs
();
String
type
=
(
String
)
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"sun.java2d.reftype"
));
...
...
src/share/classes/sun/launcher/LauncherHelper.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2007, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 201
2
, 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
...
...
@@ -381,7 +381,7 @@ public enum LauncherHelper {
PrintStream
ostream
=
(
printToStderr
)
?
System
.
err
:
System
.
out
;
ostream
.
println
(
getLocalizedMessage
(
"java.launcher.X.usage"
,
File
.
pathSeparator
));
if
(
System
.
getProperty
(
"os.name"
).
startsWith
(
"Mac OS
"
))
{
if
(
System
.
getProperty
(
"os.name"
).
contains
(
"OS X
"
))
{
ostream
.
println
(
getLocalizedMessage
(
"java.launcher.X.macosx.usage"
,
File
.
pathSeparator
));
}
...
...
src/share/classes/sun/management/ManagementFactoryHelper.java
浏览文件 @
aacc1372
...
...
@@ -37,7 +37,6 @@ import javax.management.RuntimeOperationsException;
import
java.security.AccessController
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedExceptionAction
;
import
sun.security.action.LoadLibraryAction
;
import
sun.util.logging.LoggingSupport
;
...
...
@@ -422,7 +421,13 @@ public class ManagementFactoryHelper {
}
static
{
AccessController
.
doPrivileged
(
new
LoadLibraryAction
(
"management"
));
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"management"
);
return
null
;
}
});
jvm
=
new
VMManagementImpl
();
}
...
...
src/share/classes/sun/net/sdp/SdpSupport.java
浏览文件 @
aacc1372
...
...
@@ -76,6 +76,11 @@ public final class SdpSupport {
static
{
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"net"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"net"
);
return
null
;
}
});
}
}
src/share/classes/sun/net/spi/DefaultProxySelector.java
浏览文件 @
aacc1372
...
...
@@ -95,7 +95,12 @@ public class DefaultProxySelector extends ProxySelector {
}});
if
(
b
!=
null
&&
b
.
booleanValue
())
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"net"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"net"
);
return
null
;
}
});
hasSystemProxies
=
init
();
}
}
...
...
src/share/classes/sun/nio/ch/DatagramChannelImpl.java
浏览文件 @
aacc1372
...
...
@@ -744,7 +744,8 @@ class DatagramChannelImpl
if
(
sm
!=
null
)
sm
.
checkConnect
(
isa
.
getAddress
().
getHostAddress
(),
isa
.
getPort
());
disconnect0
(
fd
);
boolean
isIPv6
=
(
family
==
StandardProtocolFamily
.
INET6
);
disconnect0
(
fd
,
isIPv6
);
remoteAddress
=
null
;
state
=
ST_UNCONNECTED
;
...
...
@@ -1079,7 +1080,7 @@ class DatagramChannelImpl
private
static
native
void
initIDs
();
private
static
native
void
disconnect0
(
FileDescriptor
fd
)
private
static
native
void
disconnect0
(
FileDescriptor
fd
,
boolean
isIPv6
)
throws
IOException
;
private
native
int
receive0
(
FileDescriptor
fd
,
long
address
,
int
len
,
...
...
src/share/classes/sun/nio/ch/Util.java
浏览文件 @
aacc1372
...
...
@@ -472,10 +472,15 @@ public class Util {
if
(
loaded
)
return
;
loaded
=
true
;
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"net"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"nio"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"net"
);
System
.
loadLibrary
(
"nio"
);
return
null
;
}
});
// IOUtil must be initialized; Its native methods are called from
// other places in native nio code so they must be set up.
IOUtil
.
initIDs
();
...
...
src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2002, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 201
2
, 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
...
...
@@ -1280,7 +1280,7 @@ public class ExtendedCharsets
String
osName
=
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"os.name"
));
if
(
"SunOS"
.
equals
(
osName
)
||
"Linux"
.
equals
(
osName
)
||
osName
.
startsWith
(
"Mac OS
"
))
{
||
osName
.
contains
(
"OS X
"
))
{
charset
(
"x-COMPOUND_TEXT"
,
"COMPOUND_TEXT"
,
new
String
[]
{
"COMPOUND_TEXT"
,
// JDK historical
...
...
src/share/classes/sun/print/PSPrinterJob.java
浏览文件 @
aacc1372
/*
* Copyright (c) 1998, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 20
12
, 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
...
...
@@ -1567,7 +1567,7 @@ public class PSPrinterJob extends RasterPrinterJob {
}
String
osname
=
System
.
getProperty
(
"os.name"
);
if
(
osname
.
equals
(
"Linux"
)
||
osname
.
startsWith
(
"Mac
OS X"
))
{
if
(
osname
.
equals
(
"Linux"
)
||
osname
.
contains
(
"
OS X"
))
{
execCmd
=
new
String
[
ncomps
];
execCmd
[
n
++]
=
"/usr/bin/lpr"
;
if
((
pFlags
&
PRINTER
)
!=
0
)
{
...
...
src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2005, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 201
2
, 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
...
...
@@ -90,7 +90,7 @@ public final class SunNativeProvider extends Provider {
"libgssapi_krb5.so"
,
"libgssapi_krb5.so.2"
,
};
}
else
if
(
osname
.
startsWith
(
"Mac
OS X"
))
{
}
else
if
(
osname
.
contains
(
"
OS X"
))
{
gssLibs
=
new
String
[]{
"/usr/lib/sasl2/libgssapiv2.2.so"
,
};
...
...
src/share/classes/sun/security/krb5/Config.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2000, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
2
, 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
...
...
@@ -737,7 +737,7 @@ public class Config {
}
}
else
if
(
osname
.
startsWith
(
"SunOS"
))
{
name
=
"/etc/krb5/krb5.conf"
;
}
else
if
(
osname
.
startsWith
(
"Mac
"
))
{
}
else
if
(
osname
.
contains
(
"OS X
"
))
{
if
(
isMacosLionOrBetter
())
return
""
;
name
=
findMacosConfigFile
();
}
else
{
...
...
src/share/classes/sun/security/krb5/Credentials.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2000, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
2
, 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
...
...
@@ -289,7 +289,7 @@ public class Credentials {
String
os
=
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"os.name"
));
if
(
os
.
toUpperCase
(
Locale
.
ENGLISH
).
startsWith
(
"WINDOWS"
)
||
os
.
toUpperCase
(
Locale
.
ENGLISH
).
startsWith
(
"MAC
"
))
{
os
.
toUpperCase
(
Locale
.
ENGLISH
).
contains
(
"OS X
"
))
{
Credentials
creds
=
acquireDefaultCreds
();
if
(
creds
==
null
)
{
if
(
DEBUG
)
{
...
...
@@ -478,7 +478,7 @@ public class Credentials {
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>
()
{
public
Void
run
()
{
if
(
System
.
getProperty
(
"os.name"
).
startsWith
(
"Mac
"
))
{
if
(
System
.
getProperty
(
"os.name"
).
contains
(
"OS X
"
))
{
System
.
loadLibrary
(
"osxkrb5"
);
}
else
{
System
.
loadLibrary
(
"w2k_lsa_auth"
);
...
...
src/share/classes/sun/security/krb5/SCDynamicStoreConfig.java
浏览文件 @
aacc1372
...
...
@@ -36,7 +36,13 @@ public class SCDynamicStoreConfig {
private
static
native
Hashtable
<
String
,
Object
>
getKerberosConfig
();
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"osx"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"osx"
);
return
null
;
}
});
installNotificationCallback
();
}
...
...
src/share/classes/sun/security/provider/ByteArrayAccess.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006,
2012,
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
...
...
@@ -95,7 +95,8 @@ final class ByteArrayAccess {
private
static
boolean
unaligned
()
{
String
arch
=
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"os.arch"
,
""
));
return
arch
.
equals
(
"i386"
)
||
arch
.
equals
(
"x86"
)
||
arch
.
equals
(
"amd64"
);
return
arch
.
equals
(
"i386"
)
||
arch
.
equals
(
"x86"
)
||
arch
.
equals
(
"amd64"
)
||
arch
.
equals
(
"x86_64"
);
}
/**
...
...
src/share/classes/sun/security/smartcardio/PCSC.java
浏览文件 @
aacc1372
...
...
@@ -27,8 +27,6 @@ package sun.security.smartcardio;
import
java.security.AccessController
;
import
sun.security.action.LoadLibraryAction
;
/**
* Access to native PC/SC functions and definition of PC/SC constants.
* Initialization and platform specific PC/SC constants are handled in
...
...
src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java
浏览文件 @
aacc1372
...
...
@@ -59,10 +59,10 @@ public class DisabledAlgorithmConstraints implements AlgorithmConstraints {
public
final
static
String
PROPERTY_TLS_DISABLED_ALGS
=
"jdk.tls.disabledAlgorithms"
;
private
static
Map
<
String
,
String
[]>
disabledAlgorithmsMap
=
Collections
.
synchronizedMap
(
new
HashMap
<
String
,
String
[]>()
);
private
static
Map
<
String
,
KeySizeConstraints
>
keySizeConstraintsMap
=
Collections
.
synchronizedMap
(
new
HashMap
<
String
,
KeySizeConstraints
>()
);
private
final
static
Map
<
String
,
String
[]>
disabledAlgorithmsMap
=
new
HashMap
<>(
);
private
final
static
Map
<
String
,
KeySizeConstraints
>
keySizeConstraintsMap
=
new
HashMap
<>(
);
private
String
[]
disabledAlgorithms
;
private
KeySizeConstraints
keySizeConstraints
;
...
...
@@ -74,6 +74,8 @@ public class DisabledAlgorithmConstraints implements AlgorithmConstraints {
* algorithm constraints
*/
public
DisabledAlgorithmConstraints
(
String
propertyName
)
{
// Both disabledAlgorithmsMap and keySizeConstraintsMap are
// synchronized with the lock of disabledAlgorithmsMap.
synchronized
(
disabledAlgorithmsMap
)
{
if
(!
disabledAlgorithmsMap
.
containsKey
(
propertyName
))
{
loadDisabledAlgorithmsMap
(
propertyName
);
...
...
src/share/classes/sun/tracing/dtrace/JVM.java
浏览文件 @
aacc1372
...
...
@@ -35,8 +35,13 @@ import java.lang.reflect.Method;
class
JVM
{
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"jsdt"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"jsdt"
);
return
null
;
}
});
}
static
long
activate
(
String
moduleName
,
DTraceProvider
[]
providers
)
{
...
...
src/share/native/com/sun/java/util/jar/pack/bands.cpp
浏览文件 @
aacc1372
/*
* Copyright (c) 2002, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
12
, 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
...
...
@@ -188,9 +188,13 @@ void band::setIndexByTag(byte tag) {
entry
*
band
::
getRefCommon
(
cpindex
*
ix_
,
bool
nullOKwithCaller
)
{
CHECK_0
;
assert
(
ix_
->
ixTag
==
ixTag
||
(
ixTag
==
CONSTANT_Literal
&&
ix_
->
ixTag
>=
CONSTANT_Integer
&&
ix_
->
ixTag
<=
CONSTANT_String
));
||
((
ixTag
==
CONSTANT_All
||
ixTag
==
CONSTANT_LoadableValue
||
ixTag
==
CONSTANT_AnyMember
)
||
(
ixTag
==
CONSTANT_FieldSpecific
&&
ix_
->
ixTag
>=
CONSTANT_Integer
&&
ix_
->
ixTag
<=
CONSTANT_String
))
);
int
n
=
vs
[
0
].
getInt
()
-
nullOK
;
// Note: band-local nullOK means null encodes as 0.
// But nullOKwithCaller means caller is willing to tolerate a null.
...
...
@@ -270,22 +274,15 @@ int band::getIntCount(int tag) {
#define NO_INDEX 0
struct
band_init
{
#ifndef PRODUCT
int
bn
;
const
char
*
name
;
#endif
int
defc
;
int
index
;
};
#ifdef PRODUCT
#define BAND_INIT(name, cspec, ix) \
{ cspec, ix }
#else
#define BAND_INIT(name, cspec, ix) \
{ e_##name, #name,
/*debug only*/
\
cspec, ix }
#endif
const
band_init
all_band_inits
[]
=
{
//BAND_INIT(archive_magic, BYTE1_spec, 0),
...
...
@@ -314,6 +311,14 @@ const band_init all_band_inits[] = {
BAND_INIT
(
cp_Method_desc
,
UDELTA5_spec
,
INDEX
(
CONSTANT_NameandType
)),
BAND_INIT
(
cp_Imethod_class
,
DELTA5_spec
,
INDEX
(
CONSTANT_Class
)),
BAND_INIT
(
cp_Imethod_desc
,
UDELTA5_spec
,
INDEX
(
CONSTANT_NameandType
)),
BAND_INIT
(
cp_MethodHandle_refkind
,
DELTA5_spec
,
0
),
BAND_INIT
(
cp_MethodHandle_member
,
UDELTA5_spec
,
INDEX
(
CONSTANT_AnyMember
)),
BAND_INIT
(
cp_MethodType
,
UDELTA5_spec
,
INDEX
(
CONSTANT_Signature
)),
BAND_INIT
(
cp_BootstrapMethod_ref
,
DELTA5_spec
,
INDEX
(
CONSTANT_MethodHandle
)),
BAND_INIT
(
cp_BootstrapMethod_arg_count
,
UDELTA5_spec
,
0
),
BAND_INIT
(
cp_BootstrapMethod_arg
,
DELTA5_spec
,
INDEX
(
CONSTANT_LoadableValue
)),
BAND_INIT
(
cp_InvokeDynamic_spec
,
DELTA5_spec
,
INDEX
(
CONSTANT_BootstrapMethod
)),
BAND_INIT
(
cp_InvokeDynamic_desc
,
UDELTA5_spec
,
INDEX
(
CONSTANT_NameandType
)),
BAND_INIT
(
attr_definition_headers
,
BYTE1_spec
,
0
),
BAND_INIT
(
attr_definition_name
,
UNSIGNED5_spec
,
INDEX
(
CONSTANT_Utf8
)),
BAND_INIT
(
attr_definition_layout
,
UNSIGNED5_spec
,
INDEX
(
CONSTANT_Utf8
)),
...
...
@@ -333,7 +338,7 @@ const band_init all_band_inits[] = {
BAND_INIT
(
field_attr_count
,
UNSIGNED5_spec
,
0
),
BAND_INIT
(
field_attr_indexes
,
UNSIGNED5_spec
,
0
),
BAND_INIT
(
field_attr_calls
,
UNSIGNED5_spec
,
0
),
BAND_INIT
(
field_ConstantValue_KQ
,
UNSIGNED5_spec
,
INDEX
(
CONSTANT_
Literal
)),
BAND_INIT
(
field_ConstantValue_KQ
,
UNSIGNED5_spec
,
INDEX
(
CONSTANT_
FieldSpecific
)),
BAND_INIT
(
field_Signature_RS
,
UNSIGNED5_spec
,
INDEX
(
CONSTANT_Signature
)),
BAND_INIT
(
field_metadata_bands
,
-
1
,
-
1
),
BAND_INIT
(
field_attr_bands
,
-
1
,
-
1
),
...
...
@@ -415,10 +420,12 @@ const band_init all_band_inits[] = {
BAND_INIT
(
bc_longref
,
DELTA5_spec
,
INDEX
(
CONSTANT_Long
)),
BAND_INIT
(
bc_doubleref
,
DELTA5_spec
,
INDEX
(
CONSTANT_Double
)),
BAND_INIT
(
bc_stringref
,
DELTA5_spec
,
INDEX
(
CONSTANT_String
)),
BAND_INIT
(
bc_loadablevalueref
,
DELTA5_spec
,
INDEX
(
CONSTANT_LoadableValue
)),
BAND_INIT
(
bc_classref
,
UNSIGNED5_spec
,
NULL_OR_INDEX
(
CONSTANT_Class
)),
BAND_INIT
(
bc_fieldref
,
DELTA5_spec
,
INDEX
(
CONSTANT_Fieldref
)),
BAND_INIT
(
bc_methodref
,
UNSIGNED5_spec
,
INDEX
(
CONSTANT_Methodref
)),
BAND_INIT
(
bc_imethodref
,
DELTA5_spec
,
INDEX
(
CONSTANT_InterfaceMethodref
)),
BAND_INIT
(
bc_indyref
,
DELTA5_spec
,
INDEX
(
CONSTANT_InvokeDynamic
)),
BAND_INIT
(
bc_thisfield
,
UNSIGNED5_spec
,
SUB_INDEX
(
CONSTANT_Fieldref
)),
BAND_INIT
(
bc_superfield
,
UNSIGNED5_spec
,
SUB_INDEX
(
CONSTANT_Fieldref
)),
BAND_INIT
(
bc_thismethod
,
UNSIGNED5_spec
,
SUB_INDEX
(
CONSTANT_Methodref
)),
...
...
@@ -471,7 +478,7 @@ void band::initIndexes(unpacker* u) {
for
(
int
i
=
0
;
i
<
BAND_LIMIT
;
i
++
)
{
band
*
scan
=
&
tmp_all_bands
[
i
];
uint
tag
=
scan
->
ixTag
;
// Cf. #define INDEX(tag) above
if
(
tag
!=
0
&&
tag
!=
CONSTANT_
Literal
&&
(
tag
&
SUBINDEX_BIT
)
==
0
)
{
if
(
tag
!=
0
&&
tag
!=
CONSTANT_
FieldSpecific
&&
(
tag
&
SUBINDEX_BIT
)
==
0
)
{
scan
->
setIndex
(
u
->
cp
.
getIndex
(
tag
));
}
}
...
...
src/share/native/com/sun/java/util/jar/pack/bands.h
浏览文件 @
aacc1372
/*
* Copyright (c) 2002, 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
12
, 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
...
...
@@ -29,9 +29,7 @@ struct cpindex;
struct
unpacker
;
struct
band
{
#ifndef PRODUCT
const
char
*
name
;
#endif
int
bn
;
// band_number of this band
coding
*
defc
;
// default coding method
cpindex
*
ix
;
// CP entry mapping, if CPRefBand
...
...
@@ -162,6 +160,14 @@ enum band_number {
e_cp_Method_desc
,
e_cp_Imethod_class
,
e_cp_Imethod_desc
,
e_cp_MethodHandle_refkind
,
e_cp_MethodHandle_member
,
e_cp_MethodType
,
e_cp_BootstrapMethod_ref
,
e_cp_BootstrapMethod_arg_count
,
e_cp_BootstrapMethod_arg
,
e_cp_InvokeDynamic_spec
,
e_cp_InvokeDynamic_desc
,
// bands which define transmission of attributes
e_attr_definition_headers
,
...
...
@@ -284,11 +290,13 @@ enum band_number {
e_bc_longref
,
e_bc_doubleref
,
e_bc_stringref
,
e_bc_loadablevalueref
,
e_bc_classref
,
e_bc_fieldref
,
e_bc_methodref
,
e_bc_imethodref
,
e_bc_indyref
,
// _self_linker_op family
e_bc_thisfield
,
...
...
@@ -343,6 +351,14 @@ enum band_number {
#define cp_Method_desc all_bands[e_cp_Method_desc]
#define cp_Imethod_class all_bands[e_cp_Imethod_class]
#define cp_Imethod_desc all_bands[e_cp_Imethod_desc]
#define cp_MethodHandle_refkind all_bands[e_cp_MethodHandle_refkind]
#define cp_MethodHandle_member all_bands[e_cp_MethodHandle_member]
#define cp_MethodType all_bands[e_cp_MethodType]
#define cp_BootstrapMethod_ref all_bands[e_cp_BootstrapMethod_ref]
#define cp_BootstrapMethod_arg_count all_bands[e_cp_BootstrapMethod_arg_count]
#define cp_BootstrapMethod_arg all_bands[e_cp_BootstrapMethod_arg]
#define cp_InvokeDynamic_spec all_bands[e_cp_InvokeDynamic_spec]
#define cp_InvokeDynamic_desc all_bands[e_cp_InvokeDynamic_desc]
#define attr_definition_headers all_bands[e_attr_definition_headers]
#define attr_definition_name all_bands[e_attr_definition_name]
#define attr_definition_layout all_bands[e_attr_definition_layout]
...
...
@@ -437,10 +453,12 @@ enum band_number {
#define bc_longref all_bands[e_bc_longref]
#define bc_doubleref all_bands[e_bc_doubleref]
#define bc_stringref all_bands[e_bc_stringref]
#define bc_loadablevalueref all_bands[e_bc_loadablevalueref]
#define bc_classref all_bands[e_bc_classref]
#define bc_fieldref all_bands[e_bc_fieldref]
#define bc_methodref all_bands[e_bc_methodref]
#define bc_imethodref all_bands[e_bc_imethodref]
#define bc_indyref all_bands[e_bc_indyref]
#define bc_thisfield all_bands[e_bc_thisfield]
#define bc_superfield all_bands[e_bc_superfield]
#define bc_thismethod all_bands[e_bc_thismethod]
...
...
src/share/native/com/sun/java/util/jar/pack/constants.h
浏览文件 @
aacc1372
/*
* Copyright (c) 2001, 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 20
12
, 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
...
...
@@ -49,61 +49,82 @@
#define JAVA6_PACKAGE_MAJOR_VERSION 160
#define JAVA6_PACKAGE_MINOR_VERSION 1
#define JAVA7_PACKAGE_MAJOR_VERSION 170
#define JAVA7_PACKAGE_MINOR_VERSION 1
// magic number for gzip streams (for processing pack200-gzip data)
#define GZIP_MAGIC 0x1F8B0800
#define GZIP_MAGIC_MASK 0xFFFFFF00 // last byte is variable "flg" field
enum
{
CONSTANT_None
,
CONSTANT_Utf8
,
CONSTANT_unused2
,
/* unused, was Unicode */
CONSTANT_Integer
,
CONSTANT_Float
,
CONSTANT_Long
,
CONSTANT_Double
,
CONSTANT_Class
,
CONSTANT_String
,
CONSTANT_Fieldref
,
CONSTANT_Methodref
,
CONSTANT_InterfaceMethodref
,
CONSTANT_NameandType
,
CONSTANT_None
=
0
,
CONSTANT_Utf8
=
1
,
CONSTANT_unused
=
2
,
/* unused, was Unicode */
CONSTANT_Integer
=
3
,
CONSTANT_Float
=
4
,
CONSTANT_Long
=
5
,
CONSTANT_Double
=
6
,
CONSTANT_Class
=
7
,
CONSTANT_String
=
8
,
CONSTANT_Fieldref
=
9
,
CONSTANT_Methodref
=
10
,
CONSTANT_InterfaceMethodref
=
11
,
CONSTANT_NameandType
=
12
,
CONSTANT_unused13
=
13
,
CONSTANT_unused14
=
14
,
CONSTANT_MethodHandle
=
15
,
CONSTANT_MethodType
=
16
,
CONSTANT_unused17
=
17
,
CONSTANT_InvokeDynamic
=
18
,
CONSTANT_Limit
=
19
,
CONSTANT_Signature
=
CONSTANT_unused13
,
CONSTANT_BootstrapMethod
=
CONSTANT_unused17
,
// used only for InvokeDynamic
CONSTANT_All
=
50
,
// combined global map
CONSTANT_LoadableValue
=
51
,
// used for 'KL' and qldc operands
CONSTANT_AnyMember
=
52
,
// union of refs to field or (interface) method
CONSTANT_FieldSpecific
=
53
,
// used only for 'KQ' ConstantValue attrs
CONSTANT_GroupFirst
=
CONSTANT_All
,
// start group marker
CONSTANT_GroupLimit
=
54
,
// end group marker
CONSTANT_Signature
=
13
,
CONSTANT_All
=
14
,
CONSTANT_Limit
=
15
,
CONSTANT_NONE
=
0
,
CONSTANT_Literal
=
20
,
//pseudo-tag for debugging
CONSTANT_Member
=
21
,
//pseudo-tag for debugging
// CONSTANT_MethodHandle reference kinds
REF_getField
=
1
,
REF_getStatic
=
2
,
REF_putField
=
3
,
REF_putStatic
=
4
,
REF_invokeVirtual
=
5
,
REF_invokeStatic
=
6
,
REF_invokeSpecial
=
7
,
REF_newInvokeSpecial
=
8
,
REF_invokeInterface
=
9
,
SUBINDEX_BIT
=
64
,
// combined with CONSTANT_xxx for ixTag
ACC_STATIC
=
0x0008
,
ACC_IC_LONG_FORM
=
(
1
<<
16
),
//for ic_flags
CLASS_ATTR_SourceFile
=
17
,
CLASS_ATTR_EnclosingMethod
=
18
,
CLASS_ATTR_InnerClasses
=
23
,
CLASS_ATTR_ClassFile_version
=
24
,
FIELD_ATTR_ConstantValue
=
17
,
METHOD_ATTR_Code
=
17
,
METHOD_ATTR_Exceptions
=
18
,
METHOD_ATTR_RuntimeVisibleParameterAnnotations
=
23
,
CLASS_ATTR_SourceFile
=
17
,
CLASS_ATTR_EnclosingMethod
=
18
,
CLASS_ATTR_InnerClasses
=
23
,
CLASS_ATTR_ClassFile_version
=
24
,
CLASS_ATTR_BootstrapMethods
=
25
,
FIELD_ATTR_ConstantValue
=
17
,
METHOD_ATTR_Code
=
17
,
METHOD_ATTR_Exceptions
=
18
,
METHOD_ATTR_RuntimeVisibleParameterAnnotations
=
23
,
METHOD_ATTR_RuntimeInvisibleParameterAnnotations
=
24
,
METHOD_ATTR_AnnotationDefault
=
25
,
CODE_ATTR_StackMapTable
=
0
,
CODE_ATTR_LineNumberTable
=
1
,
CODE_ATTR_LocalVariableTable
=
2
,
METHOD_ATTR_AnnotationDefault
=
25
,
CODE_ATTR_StackMapTable
=
0
,
CODE_ATTR_LineNumberTable
=
1
,
CODE_ATTR_LocalVariableTable
=
2
,
CODE_ATTR_LocalVariableTypeTable
=
3
,
//X_ATTR_Synthetic = 12, // ACC_SYNTHETIC; not predefined
X_ATTR_Signature
=
19
,
X_ATTR_Deprecated
=
20
,
X_ATTR_RuntimeVisibleAnnotations
=
21
,
X_ATTR_Signature
=
19
,
X_ATTR_Deprecated
=
20
,
X_ATTR_RuntimeVisibleAnnotations
=
21
,
X_ATTR_RuntimeInvisibleAnnotations
=
22
,
X_ATTR_OVERFLOW
=
16
,
X_ATTR_LIMIT_NO_FLAGS_HI
=
32
,
X_ATTR_LIMIT_FLAGS_HI
=
63
,
X_ATTR_OVERFLOW
=
16
,
X_ATTR_LIMIT_NO_FLAGS_HI
=
32
,
X_ATTR_LIMIT_FLAGS_HI
=
63
,
#define O_ATTR_DO(F) \
F(X_ATTR_OVERFLOW,01) \
...
...
@@ -121,6 +142,7 @@ enum {
F(CLASS_ATTR_InnerClasses,InnerClasses) \
F(CLASS_ATTR_EnclosingMethod,EnclosingMethod) \
F(CLASS_ATTR_ClassFile_version,02) \
F(CLASS_ATTR_BootstrapMethods,BootstrapMethods) \
/*(end)*/
#define FIELD_ATTR_DO(F) \
F(FIELD_ATTR_ConstantValue,ConstantValue) \
...
...
@@ -175,7 +197,7 @@ enum {
AO_HAVE_SPECIAL_FORMATS
=
1
<<
0
,
AO_HAVE_CP_NUMBERS
=
1
<<
1
,
AO_HAVE_ALL_CODE_FLAGS
=
1
<<
2
,
AO_
3_UNUSED_MBZ
=
1
<<
3
,
AO_
HAVE_CP_EXTRAS
=
1
<<
3
,
AO_HAVE_FILE_HEADERS
=
1
<<
4
,
AO_DEFLATE_HINT
=
1
<<
5
,
AO_HAVE_FILE_MODTIME
=
1
<<
6
,
...
...
@@ -185,11 +207,13 @@ enum {
AO_HAVE_FIELD_FLAGS_HI
=
1
<<
10
,
AO_HAVE_METHOD_FLAGS_HI
=
1
<<
11
,
AO_HAVE_CODE_FLAGS_HI
=
1
<<
12
,
AO_UNUSED_MBZ
=
(
-
1
)
<<
13
,
// options bits reserved for future use.
#define ARCHIVE_BIT_DO(F) \
F(AO_HAVE_SPECIAL_FORMATS) \
F(AO_HAVE_CP_NUMBERS) \
F(AO_HAVE_ALL_CODE_FLAGS) \
/*F(AO_3_UNUSED_MBZ)*/
\
F(AO_HAVE_CP_EXTRAS)
\
F(AO_HAVE_FILE_HEADERS) \
F(AO_DEFLATE_HINT) \
F(AO_HAVE_FILE_MODTIME) \
...
...
@@ -215,14 +239,14 @@ enum {
NO_MODTIME
=
0
,
// null modtime value
// meta-coding
_meta_default
=
0
,
_meta_default
=
0
,
_meta_canon_min
=
1
,
_meta_canon_max
=
115
,
_meta_arb
=
116
,
_meta_run
=
117
,
_meta_pop
=
141
,
_meta_limit
=
189
,
_meta_error
=
255
,
_meta_arb
=
116
,
_meta_run
=
117
,
_meta_pop
=
141
,
_meta_limit
=
189
,
_meta_error
=
255
,
_xxx_1_end
};
...
...
@@ -416,7 +440,7 @@ enum {
bc_invokespecial
=
183
,
// 0xb7
bc_invokestatic
=
184
,
// 0xb8
bc_invokeinterface
=
185
,
// 0xb9
bc_
xxxunusedxxx
=
186
,
// 0xba
bc_
invokedynamic
=
186
,
// 0xba
bc_new
=
187
,
// 0xbb
bc_newarray
=
188
,
// 0xbc
bc_anewarray
=
189
,
// 0xbd
...
...
@@ -455,17 +479,19 @@ enum {
_invokeinit_limit
=
_invokeinit_op
+
3
,
_xldc_op
=
_invokeinit_limit
,
bc_
aldc
=
bc_ldc
,
bc_
sldc
=
bc_ldc
,
// previously named bc_aldc
bc_cldc
=
_xldc_op
+
0
,
bc_ildc
=
_xldc_op
+
1
,
bc_fldc
=
_xldc_op
+
2
,
bc_
aldc_w
=
bc_ldc_w
,
bc_
sldc_w
=
bc_ldc_w
,
// previously named bc_aldc_w
bc_cldc_w
=
_xldc_op
+
3
,
bc_ildc_w
=
_xldc_op
+
4
,
bc_fldc_w
=
_xldc_op
+
5
,
bc_lldc2_w
=
bc_ldc2_w
,
bc_dldc2_w
=
_xldc_op
+
6
,
_xldc_limit
=
_xldc_op
+
7
,
// anything other primitive, string, or class must be handled with qldc:
bc_qldc
=
_xldc_op
+
7
,
bc_qldc_w
=
_xldc_op
+
8
,
_xldc_limit
=
_xldc_op
+
9
,
_xxx_3_end
};
src/share/native/com/sun/java/util/jar/pack/defines.h
浏览文件 @
aacc1372
/*
* Copyright (c) 2001, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 20
12
, 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
...
...
@@ -109,7 +109,8 @@ typedef DWORDLONG julong;
#define dup2(a,b) _dup2(a,b)
#define strcasecmp(s1, s2) _stricmp(s1,s2)
#define tempname _tempname
#define sleep Sleep
#define sleep Sleep
#define snprintf _snprintf
#else
typedef
signed
char
byte
;
#ifdef _LP64
...
...
src/share/native/com/sun/java/util/jar/pack/unpack.cpp
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/share/native/com/sun/java/util/jar/pack/unpack.h
浏览文件 @
aacc1372
/*
* Copyright (c) 2002, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
12
, 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
...
...
@@ -22,9 +22,6 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// Global Structures
struct
jar
;
struct
gunzip
;
...
...
@@ -70,6 +67,9 @@ struct cpool {
cpindex
tag_index
[
CONSTANT_Limit
];
ptrlist
tag_extras
[
CONSTANT_Limit
];
int
tag_group_count
[
CONSTANT_GroupLimit
-
CONSTANT_GroupFirst
];
cpindex
tag_group_index
[
CONSTANT_GroupLimit
-
CONSTANT_GroupFirst
];
cpindex
*
member_indexes
;
// indexed by 2*CONSTANT_Class.inord
cpindex
*
getFieldIndex
(
entry
*
classRef
);
cpindex
*
getMethodIndex
(
entry
*
classRef
);
...
...
@@ -82,6 +82,7 @@ struct cpool {
int
outputIndexLimit
;
// index limit after renumbering
ptrlist
outputEntries
;
// list of entry* needing output idx assigned
ptrlist
requested_bsms
;
// which bsms need output?
entry
**
hashTab
;
uint
hashTabLength
;
...
...
@@ -100,24 +101,36 @@ struct cpool {
entry
*
sym
[
s_LIMIT
];
// read counts from hdr, allocate main arrays
enum
{
NUM_COUNTS
=
12
};
void
init
(
unpacker
*
u
,
int
counts
[
NUM_COUNTS
]);
void
init
(
unpacker
*
u
,
int
counts
[
CONSTANT_Limit
]);
// pointer to outer unpacker, for error checks etc.
unpacker
*
u
;
int
getCount
(
byte
tag
)
{
assert
((
uint
)
tag
<
CONSTANT_Limit
);
return
tag_count
[
tag
];
if
((
uint
)
tag
>=
CONSTANT_GroupFirst
)
{
assert
((
uint
)
tag
<
CONSTANT_GroupLimit
);
return
tag_group_count
[(
uint
)
tag
-
CONSTANT_GroupFirst
];
}
else
{
assert
((
uint
)
tag
<
CONSTANT_Limit
);
return
tag_count
[(
uint
)
tag
];
}
}
cpindex
*
getIndex
(
byte
tag
)
{
assert
((
uint
)
tag
<
CONSTANT_Limit
);
return
&
tag_index
[
tag
];
if
((
uint
)
tag
>=
CONSTANT_GroupFirst
)
{
assert
((
uint
)
tag
<
CONSTANT_GroupLimit
);
return
&
tag_group_index
[(
uint
)
tag
-
CONSTANT_GroupFirst
];
}
else
{
assert
((
uint
)
tag
<
CONSTANT_Limit
);
return
&
tag_index
[(
uint
)
tag
];
}
}
cpindex
*
getKQIndex
();
// uses cur_descr
void
expandSignatures
();
void
initGroupIndexes
();
void
initMemberIndexes
();
int
initLoadableValues
(
entry
**
loadable_entries
);
void
computeOutputOrder
();
void
computeOutputIndexes
();
...
...
@@ -234,6 +247,7 @@ struct unpacker {
int
cur_descr_flags
;
// flags corresponding to cur_descr
int
cur_class_minver
,
cur_class_majver
;
bool
cur_class_has_local_ics
;
int
cur_class_local_bsm_count
;
fillbytes
cur_classfile_head
;
fillbytes
cur_classfile_tail
;
int
files_written
;
// also tells which file we're working on
...
...
@@ -412,7 +426,7 @@ struct unpacker {
void
abort
(
const
char
*
s
=
null
);
bool
aborting
()
{
return
abort_message
!=
null
;
}
static
unpacker
*
current
();
// find current instance
void
checkLegacy
(
const
char
*
name
);
// Output management
void
set_output
(
fillbytes
*
which
)
{
assert
(
wp
==
null
);
...
...
@@ -464,6 +478,8 @@ struct unpacker {
void
write_bc_ops
();
void
write_members
(
int
num
,
int
attrc
);
// attrc=ATTR_CONTEXT_FIELD/METHOD
int
write_attrs
(
int
attrc
,
julong
indexBits
);
int
write_ics
(
int
naOffset
,
int
na
);
int
write_bsms
(
int
naOffset
,
int
na
);
// The readers
void
read_bands
();
...
...
@@ -484,6 +500,9 @@ struct unpacker {
void
read_single_refs
(
band
&
cp_band
,
byte
refTag
,
entry
*
cpMap
,
int
len
);
void
read_double_refs
(
band
&
cp_band
,
byte
ref1Tag
,
byte
ref2Tag
,
entry
*
cpMap
,
int
len
);
void
read_signature_values
(
entry
*
cpMap
,
int
len
);
void
read_method_handle
(
entry
*
cpMap
,
int
len
);
void
read_method_type
(
entry
*
cpMap
,
int
len
);
void
read_bootstrap_methods
(
entry
*
cpMap
,
int
len
);
};
inline
void
cpool
::
abort
(
const
char
*
msg
)
{
u
->
abort
(
msg
);
}
...
...
src/share/native/java/util/zip/ZipFile.c
浏览文件 @
aacc1372
...
...
@@ -117,6 +117,7 @@ Java_java_util_zip_ZipFile_open(JNIEnv *env, jclass cls, jstring name,
result
=
ptr_to_jlong
(
zip
);
}
else
if
(
msg
!=
0
)
{
ThrowZipException
(
env
,
msg
);
free
(
msg
);
}
else
if
(
errno
==
ENOMEM
)
{
JNU_ThrowOutOfMemoryError
(
env
,
0
);
}
else
{
...
...
src/share/native/java/util/zip/zip_util.c
浏览文件 @
aacc1372
...
...
@@ -726,7 +726,7 @@ readCEN(jzfile *zip, jint knownTotal)
* Opens a zip file with the specified mode. Returns the jzfile object
* or NULL if an error occurred. If a zip error occurred then *pmsg will
* be set to the error message text if pmsg != 0. Otherwise, *pmsg will be
* set to NULL.
* set to NULL.
Caller is responsible to free the error message.
*/
jzfile
*
ZIP_Open_Generic
(
const
char
*
name
,
char
**
pmsg
,
int
mode
,
jlong
lastModified
)
...
...
@@ -751,12 +751,12 @@ ZIP_Open_Generic(const char *name, char **pmsg, int mode, jlong lastModified)
* Returns the jzfile corresponding to the given file name from the cache of
* zip files, or NULL if the file is not in the cache. If the name is longer
* than PATH_MAX or a zip error occurred then *pmsg will be set to the error
* message text if pmsg != 0. Otherwise, *pmsg will be set to NULL.
* message text if pmsg != 0. Otherwise, *pmsg will be set to NULL. Caller
* is responsible to free the error message.
*/
jzfile
*
ZIP_Get_From_Cache
(
const
char
*
name
,
char
**
pmsg
,
jlong
lastModified
)
{
static
char
errbuf
[
256
];
char
buf
[
PATH_MAX
];
jzfile
*
zip
;
...
...
@@ -771,7 +771,7 @@ ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified)
if
(
strlen
(
name
)
>=
PATH_MAX
)
{
if
(
pmsg
)
{
*
pmsg
=
"zip file name too long"
;
*
pmsg
=
strdup
(
"zip file name too long"
)
;
}
return
NULL
;
}
...
...
@@ -796,7 +796,8 @@ ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified)
* Reads data from the given file descriptor to create a jzfile, puts the
* jzfile in a cache, and returns that jzfile. Returns NULL in case of error.
* If a zip error occurs, then *pmsg will be set to the error message text if
* pmsg != 0. Otherwise, *pmsg will be set to NULL.
* pmsg != 0. Otherwise, *pmsg will be set to NULL. Caller is responsible to
* free the error message.
*/
jzfile
*
...
...
@@ -809,7 +810,7 @@ jzfile *
ZIP_Put_In_Cache0
(
const
char
*
name
,
ZFILE
zfd
,
char
**
pmsg
,
jlong
lastModified
,
jboolean
usemmap
)
{
static
char
errbuf
[
256
];
char
errbuf
[
256
];
jlong
len
;
jzfile
*
zip
;
...
...
@@ -825,7 +826,7 @@ ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified,
if
(
zfd
==
-
1
)
{
if
(
pmsg
&&
JVM_GetLastErrorString
(
errbuf
,
sizeof
(
errbuf
))
>
0
)
*
pmsg
=
errbuf
;
*
pmsg
=
strdup
(
errbuf
)
;
freeZip
(
zip
);
return
NULL
;
}
...
...
@@ -834,11 +835,11 @@ ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified,
if
(
len
<=
0
)
{
if
(
len
==
0
)
{
/* zip file is empty */
if
(
pmsg
)
{
*
pmsg
=
"zip file is empty"
;
*
pmsg
=
strdup
(
"zip file is empty"
)
;
}
}
else
{
/* error */
if
(
pmsg
&&
JVM_GetLastErrorString
(
errbuf
,
sizeof
(
errbuf
))
>
0
)
*
pmsg
=
errbuf
;
*
pmsg
=
strdup
(
errbuf
)
;
}
ZFILE_Close
(
zfd
);
freeZip
(
zip
);
...
...
@@ -850,7 +851,8 @@ ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified,
/* An error occurred while trying to read the zip file */
if
(
pmsg
!=
0
)
{
/* Set the zip error message */
*
pmsg
=
zip
->
msg
;
if
(
zip
->
msg
!=
NULL
)
*
pmsg
=
strdup
(
zip
->
msg
);
}
freeZip
(
zip
);
return
NULL
;
...
...
@@ -867,12 +869,17 @@ ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified,
* Opens a zip file for reading. Returns the jzfile object or NULL
* if an error occurred. If a zip error occurred then *msg will be
* set to the error message text if msg != 0. Otherwise, *msg will be
* set to NULL.
* set to NULL.
Caller doesn't need to free the error message.
*/
jzfile
*
JNICALL
ZIP_Open
(
const
char
*
name
,
char
**
pmsg
)
{
return
ZIP_Open_Generic
(
name
,
pmsg
,
O_RDONLY
,
0
);
jzfile
*
file
=
ZIP_Open_Generic
(
name
,
pmsg
,
O_RDONLY
,
0
);
if
(
file
==
NULL
&&
pmsg
!=
NULL
&&
*
pmsg
!=
NULL
)
{
free
(
*
pmsg
);
*
pmsg
=
"Zip file open error"
;
}
return
file
;
}
/*
...
...
src/solaris/classes/sun/management/FileSystemImpl.java
浏览文件 @
aacc1372
...
...
@@ -48,7 +48,12 @@ public class FileSystemImpl extends FileSystem {
// Initialization
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"management"
));
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"management"
);
return
null
;
}
});
}
}
src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java
浏览文件 @
aacc1372
...
...
@@ -251,7 +251,12 @@ public class ResolverConfigurationImpl
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"net"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"net"
);
return
null
;
}
});
}
}
...
...
src/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2008, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 20
12
, 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
...
...
@@ -50,7 +50,7 @@ public class DefaultAsynchronousChannelProvider {
return
new
SolarisAsynchronousChannelProvider
();
if
(
osname
.
equals
(
"Linux"
))
return
new
LinuxAsynchronousChannelProvider
();
if
(
osname
.
startsWith
(
"Mac OS
"
))
if
(
osname
.
contains
(
"OS X
"
))
return
new
BsdAsynchronousChannelProvider
();
throw
new
InternalError
(
"platform not recognized"
);
}
...
...
src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java
浏览文件 @
aacc1372
...
...
@@ -1100,7 +1100,12 @@ public class SctpChannelImpl extends SctpChannel
static
{
Util
.
load
();
/* loads nio & net native libraries */
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"sctp"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"sctp"
);
return
null
;
}
});
initIDs
();
}
}
src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java
浏览文件 @
aacc1372
...
...
@@ -989,6 +989,11 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
static
{
Util
.
load
();
/* loads nio & net native libraries */
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"sctp"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"sctp"
);
return
null
;
}
});
}
}
src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
浏览文件 @
aacc1372
...
...
@@ -428,7 +428,12 @@ public class SctpServerChannelImpl extends SctpServerChannel
static
{
Util
.
load
();
// loads nio & net native libraries
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"sctp"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"sctp"
);
return
null
;
}
});
initIDs
();
}
}
src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2008, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 20
12
, 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
...
...
@@ -68,7 +68,7 @@ public class DefaultFileSystemProvider {
return
createProvider
(
"sun.nio.fs.SolarisFileSystemProvider"
);
if
(
osname
.
equals
(
"Linux"
))
return
createProvider
(
"sun.nio.fs.LinuxFileSystemProvider"
);
if
(
osname
.
equals
(
"Darwin"
)
||
osname
.
startsWith
(
"Mac
OS X"
))
if
(
osname
.
equals
(
"Darwin"
)
||
osname
.
contains
(
"
OS X"
))
return
createProvider
(
"sun.nio.fs.BsdFileSystemProvider"
);
throw
new
AssertionError
(
"Platform not recognized"
);
}
...
...
src/solaris/classes/sun/nio/fs/SolarisWatchService.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/solaris/classes/sun/print/CUPSPrinter.java
浏览文件 @
aacc1372
...
...
@@ -77,7 +77,12 @@ public class CUPSPrinter {
static
{
// load awt library to access native code
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
LoadLibraryAction
(
"awt"
));
new
java
.
security
.
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
System
.
loadLibrary
(
"awt"
);
return
null
;
}
});
libFound
=
initIDs
();
if
(
libFound
)
{
cupsServer
=
getCupsServer
();
...
...
src/solaris/classes/sun/print/UnixPrintServiceLookup.java
浏览文件 @
aacc1372
/*
* Copyright (c) 2000, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
12
, 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
...
...
@@ -120,7 +120,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
static
boolean
isBSD
()
{
return
(
osname
.
equals
(
"Linux"
)
||
osname
.
startsWith
(
"Mac
OS X"
));
osname
.
contains
(
"
OS X"
));
}
static
final
int
UNINITIALIZED
=
-
1
;
...
...
src/solaris/native/java/net/PlainDatagramSocketImpl.c
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/solaris/native/java/net/net_util_md.c
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/windows/classes/sun/awt/windows/WToolkit.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/windows/classes/sun/management/FileSystemImpl.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/windows/classes/sun/net/dns/ResolverConfigurationImpl.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/windows/classes/sun/print/Win32PrintServiceLookup.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/windows/classes/sun/security/smartcardio/PlatformPCSC.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/windows/native/java/net/NetworkInterface.c
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/windows/native/java/net/NetworkInterface.h
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/windows/native/sun/nio/ch/DatagramChannelImpl.c
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/ProblemList.txt
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/com/sun/crypto/provider/Mac/MacClone.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/demo/jvmti/DemoRun.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/java/io/File/GetXSpace.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/java/lang/ProcessBuilder/Basic.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/java/lang/ProcessBuilder/Zombies.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/java/lang/invoke/InvokeGenericTest.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/java/nio/channels/DatagramChannel/Disconnect.java
0 → 100644
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/java/nio/channels/FileChannel/Size.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/java/nio/channels/FileChannel/Transfer.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/java/nio/file/FileSystem/Basic.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/java/nio/file/WatchService/MayFlies.java
0 → 100644
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
src/share/classes/sun/security/action/LoadLibraryAction
.java
→
test/java/util/prefs/RemoveNullKeyCheck
.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/sun/net/www/protocol/jar/B4957695.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/sun/nio/ch/SelProvider.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/tools/launcher/Arrrghs.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/tools/launcher/TestHelper.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/tools/pack200/AttributeTests.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/tools/pack200/PackageVersionTest.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/tools/pack200/Utils.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/tools/pack200/dyn.jar
已删除
100644 → 0
浏览文件 @
1d152375
此差异已折叠。
点击以展开。
test/tools/pack200/pack200-verifier/data/README
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/tools/pack200/pack200-verifier/data/golden.jar
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/tools/pack200/pack200-verifier/make/build.xml
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java
浏览文件 @
aacc1372
此差异已折叠。
点击以展开。
test/tools/pack200/pack200-verifier/src/xmlkit/ClassSyntax.java
已删除
100644 → 0
浏览文件 @
1d152375
此差异已折叠。
点击以展开。
test/tools/pack200/pack200-verifier/src/xmlkit/ClassWriter.java
已删除
100644 → 0
浏览文件 @
1d152375
此差异已折叠。
点击以展开。
test/tools/pack200/pack200-verifier/src/xmlkit/InstructionAssembler.java
已删除
100644 → 0
浏览文件 @
1d152375
此差异已折叠。
点击以展开。
test/tools/pack200/pack200-verifier/src/xmlkit/InstructionSyntax.java
已删除
100644 → 0
浏览文件 @
1d152375
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录