Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
7a7eed0f
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看板
提交
7a7eed0f
编写于
6月 03, 2013
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
d4f5f9a3
f4762f48
变更
162
展开全部
隐藏空白更改
内联
并排
Showing
162 changed file
with
6537 addition
and
3335 deletion
+6537
-3335
make/sun/awt/FILES_c_unix.gmk
make/sun/awt/FILES_c_unix.gmk
+10
-0
make/sun/awt/FILES_export_unix.gmk
make/sun/awt/FILES_export_unix.gmk
+11
-0
make/sun/awt/mawt.gmk
make/sun/awt/mawt.gmk
+18
-2
makefiles/CompileNativeLibraries.gmk
makefiles/CompileNativeLibraries.gmk
+27
-1
src/macosx/bin/java_md_macosx.c
src/macosx/bin/java_md_macosx.c
+42
-11
src/macosx/classes/sun/lwawt/macosx/CDropTargetContextPeer.java
...cosx/classes/sun/lwawt/macosx/CDropTargetContextPeer.java
+1
-1
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+10
-1
src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
+55
-31
src/macosx/native/sun/awt/AWTWindow.m
src/macosx/native/sun/awt/AWTWindow.m
+6
-2
src/macosx/native/sun/font/AWTFont.m
src/macosx/native/sun/font/AWTFont.m
+2
-0
src/share/classes/com/sun/beans/finder/AbstractFinder.java
src/share/classes/com/sun/beans/finder/AbstractFinder.java
+20
-26
src/share/classes/com/sun/beans/finder/ConstructorFinder.java
...share/classes/com/sun/beans/finder/ConstructorFinder.java
+1
-41
src/share/classes/com/sun/beans/finder/MethodFinder.java
src/share/classes/com/sun/beans/finder/MethodFinder.java
+2
-29
src/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java
src/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java
+6
-4
src/share/classes/com/sun/jndi/toolkit/dir/LazySearchEnumerationImpl.java
...s/com/sun/jndi/toolkit/dir/LazySearchEnumerationImpl.java
+4
-2
src/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java
...e/classes/com/sun/jndi/toolkit/url/GenericURLContext.java
+6
-8
src/share/classes/java/io/FileInputStream.java
src/share/classes/java/io/FileInputStream.java
+12
-9
src/share/classes/java/io/InputStream.java
src/share/classes/java/io/InputStream.java
+5
-3
src/share/classes/java/lang/Class.java
src/share/classes/java/lang/Class.java
+5
-4
src/share/classes/java/lang/String.java
src/share/classes/java/lang/String.java
+12
-11
src/share/classes/java/lang/StringBuffer.java
src/share/classes/java/lang/StringBuffer.java
+2
-4
src/share/classes/java/lang/Thread.java
src/share/classes/java/lang/Thread.java
+6
-6
src/share/classes/java/lang/ref/Reference.java
src/share/classes/java/lang/ref/Reference.java
+17
-2
src/share/classes/java/lang/reflect/GenericDeclaration.java
src/share/classes/java/lang/reflect/GenericDeclaration.java
+2
-2
src/share/classes/java/nio/charset/Charset-X-Coder.java.template
...re/classes/java/nio/charset/Charset-X-Coder.java.template
+11
-2
src/share/classes/java/nio/file/FileTreeIterator.java
src/share/classes/java/nio/file/FileTreeIterator.java
+124
-0
src/share/classes/java/nio/file/FileTreeWalker.java
src/share/classes/java/nio/file/FileTreeWalker.java
+14
-2
src/share/classes/java/nio/file/Files.java
src/share/classes/java/nio/file/Files.java
+356
-42
src/share/classes/java/text/DateFormatSymbols.java
src/share/classes/java/text/DateFormatSymbols.java
+1
-1
src/share/classes/java/util/Arrays.java
src/share/classes/java/util/Arrays.java
+947
-821
src/share/classes/java/util/ArraysParallelSortHelpers.java
src/share/classes/java/util/ArraysParallelSortHelpers.java
+864
-1077
src/share/classes/java/util/ComparableTimSort.java
src/share/classes/java/util/ComparableTimSort.java
+53
-42
src/share/classes/java/util/DualPivotQuicksort.java
src/share/classes/java/util/DualPivotQuicksort.java
+216
-156
src/share/classes/java/util/ListResourceBundle.java
src/share/classes/java/util/ListResourceBundle.java
+1
-1
src/share/classes/java/util/PropertyResourceBundle.java
src/share/classes/java/util/PropertyResourceBundle.java
+4
-0
src/share/classes/java/util/Spliterator.java
src/share/classes/java/util/Spliterator.java
+54
-70
src/share/classes/java/util/TimSort.java
src/share/classes/java/util/TimSort.java
+60
-52
src/share/classes/java/util/concurrent/ConcurrentHashMap.java
...share/classes/java/util/concurrent/ConcurrentHashMap.java
+53
-55
src/share/classes/java/util/function/BiConsumer.java
src/share/classes/java/util/function/BiConsumer.java
+28
-2
src/share/classes/java/util/function/BiFunction.java
src/share/classes/java/util/function/BiFunction.java
+23
-3
src/share/classes/java/util/function/BiPredicate.java
src/share/classes/java/util/function/BiPredicate.java
+15
-26
src/share/classes/java/util/function/BooleanSupplier.java
src/share/classes/java/util/function/BooleanSupplier.java
+1
-1
src/share/classes/java/util/function/Consumer.java
src/share/classes/java/util/function/Consumer.java
+23
-1
src/share/classes/java/util/function/DoubleBinaryOperator.java
...hare/classes/java/util/function/DoubleBinaryOperator.java
+1
-1
src/share/classes/java/util/function/DoubleConsumer.java
src/share/classes/java/util/function/DoubleConsumer.java
+24
-1
src/share/classes/java/util/function/DoubleFunction.java
src/share/classes/java/util/function/DoubleFunction.java
+1
-1
src/share/classes/java/util/function/DoublePredicate.java
src/share/classes/java/util/function/DoublePredicate.java
+21
-24
src/share/classes/java/util/function/DoubleSupplier.java
src/share/classes/java/util/function/DoubleSupplier.java
+1
-1
src/share/classes/java/util/function/DoubleUnaryOperator.java
...share/classes/java/util/function/DoubleUnaryOperator.java
+44
-1
src/share/classes/java/util/function/Function.java
src/share/classes/java/util/function/Function.java
+49
-3
src/share/classes/java/util/function/IntBinaryOperator.java
src/share/classes/java/util/function/IntBinaryOperator.java
+1
-1
src/share/classes/java/util/function/IntConsumer.java
src/share/classes/java/util/function/IntConsumer.java
+24
-1
src/share/classes/java/util/function/IntFunction.java
src/share/classes/java/util/function/IntFunction.java
+1
-1
src/share/classes/java/util/function/IntPredicate.java
src/share/classes/java/util/function/IntPredicate.java
+20
-23
src/share/classes/java/util/function/IntSupplier.java
src/share/classes/java/util/function/IntSupplier.java
+1
-1
src/share/classes/java/util/function/IntUnaryOperator.java
src/share/classes/java/util/function/IntUnaryOperator.java
+45
-2
src/share/classes/java/util/function/LongBinaryOperator.java
src/share/classes/java/util/function/LongBinaryOperator.java
+1
-1
src/share/classes/java/util/function/LongConsumer.java
src/share/classes/java/util/function/LongConsumer.java
+24
-1
src/share/classes/java/util/function/LongFunction.java
src/share/classes/java/util/function/LongFunction.java
+1
-1
src/share/classes/java/util/function/LongPredicate.java
src/share/classes/java/util/function/LongPredicate.java
+20
-24
src/share/classes/java/util/function/LongSupplier.java
src/share/classes/java/util/function/LongSupplier.java
+1
-1
src/share/classes/java/util/function/LongUnaryOperator.java
src/share/classes/java/util/function/LongUnaryOperator.java
+44
-1
src/share/classes/java/util/function/ObjDoubleConsumer.java
src/share/classes/java/util/function/ObjDoubleConsumer.java
+1
-1
src/share/classes/java/util/function/ObjIntConsumer.java
src/share/classes/java/util/function/ObjIntConsumer.java
+2
-2
src/share/classes/java/util/function/ObjLongConsumer.java
src/share/classes/java/util/function/ObjLongConsumer.java
+2
-2
src/share/classes/java/util/function/Predicate.java
src/share/classes/java/util/function/Predicate.java
+28
-16
src/share/classes/java/util/function/Supplier.java
src/share/classes/java/util/function/Supplier.java
+1
-1
src/share/classes/java/util/function/ToDoubleBiFunction.java
src/share/classes/java/util/function/ToDoubleBiFunction.java
+1
-1
src/share/classes/java/util/function/ToDoubleFunction.java
src/share/classes/java/util/function/ToDoubleFunction.java
+1
-1
src/share/classes/java/util/function/ToIntBiFunction.java
src/share/classes/java/util/function/ToIntBiFunction.java
+5
-5
src/share/classes/java/util/function/ToIntFunction.java
src/share/classes/java/util/function/ToIntFunction.java
+1
-1
src/share/classes/java/util/function/ToLongBiFunction.java
src/share/classes/java/util/function/ToLongBiFunction.java
+1
-1
src/share/classes/java/util/function/ToLongFunction.java
src/share/classes/java/util/function/ToLongFunction.java
+1
-1
src/share/classes/java/util/function/UnaryOperator.java
src/share/classes/java/util/function/UnaryOperator.java
+9
-0
src/share/classes/javax/swing/JToolTip.java
src/share/classes/javax/swing/JToolTip.java
+6
-0
src/share/classes/javax/swing/text/View.java
src/share/classes/javax/swing/text/View.java
+2
-1
src/share/classes/javax/swing/text/html/parser/Parser.java
src/share/classes/javax/swing/text/html/parser/Parser.java
+10
-2
src/share/classes/sun/management/Agent.java
src/share/classes/sun/management/Agent.java
+1
-1
src/share/classes/sun/management/jdp/package-info.java
src/share/classes/sun/management/jdp/package-info.java
+1
-1
src/share/classes/sun/nio/cs/UTF_8.java
src/share/classes/sun/nio/cs/UTF_8.java
+6
-1
src/share/classes/sun/nio/cs/ext/DoubleByte.java
src/share/classes/sun/nio/cs/ext/DoubleByte.java
+5
-2
src/share/classes/sun/nio/cs/ext/HKSCS.java
src/share/classes/sun/nio/cs/ext/HKSCS.java
+5
-1
src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java
...share/classes/sun/security/krb5/internal/ktab/KeyTab.java
+1
-1
src/share/classes/sun/security/provider/certpath/OCSPResponse.java
.../classes/sun/security/provider/certpath/OCSPResponse.java
+1
-1
src/share/classes/sun/security/tools/policytool/PolicyTool.java
...are/classes/sun/security/tools/policytool/PolicyTool.java
+15
-0
src/share/classes/sun/security/tools/policytool/Resources.java
...hare/classes/sun/security/tools/policytool/Resources.java
+3
-0
src/share/classes/sun/text/resources/mt/FormatData_mt.java
src/share/classes/sun/text/resources/mt/FormatData_mt.java
+2
-2
src/share/classes/sun/tools/jconsole/AboutDialog.java
src/share/classes/sun/tools/jconsole/AboutDialog.java
+10
-4
src/share/classes/sun/tools/jconsole/VMPanel.java
src/share/classes/sun/tools/jconsole/VMPanel.java
+7
-0
src/share/classes/sun/tools/jconsole/resources/messages.properties
.../classes/sun/tools/jconsole/resources/messages.properties
+1
-1
src/share/classes/sun/tools/jconsole/resources/messages_ja.properties
...asses/sun/tools/jconsole/resources/messages_ja.properties
+1
-1
src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties
...es/sun/tools/jconsole/resources/messages_zh_CN.properties
+1
-1
src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java
...e/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java
+3
-3
src/share/native/java/io/FileInputStream.c
src/share/native/java/io/FileInputStream.c
+3
-1
src/share/native/sun/java2d/cmm/lcms/cmscgats.c
src/share/native/sun/java2d/cmm/lcms/cmscgats.c
+2
-0
src/share/native/sun/java2d/cmm/lcms/cmslut.c
src/share/native/sun/java2d/cmm/lcms/cmslut.c
+2
-0
src/solaris/bin/arm/jvm.cfg
src/solaris/bin/arm/jvm.cfg
+1
-1
src/solaris/classes/sun/awt/X11/MotifDnDConstants.java
src/solaris/classes/sun/awt/X11/MotifDnDConstants.java
+21
-21
src/solaris/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java
...laris/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java
+20
-20
src/solaris/classes/sun/awt/X11/WindowPropertyGetter.java
src/solaris/classes/sun/awt/X11/WindowPropertyGetter.java
+3
-3
src/solaris/classes/sun/awt/X11/XConstants.java
src/solaris/classes/sun/awt/X11/XConstants.java
+6
-1
src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java
src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java
+9
-9
src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java
src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java
+44
-50
src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java
src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java
+12
-12
src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java
src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java
+19
-19
src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java
src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java
+6
-6
src/solaris/classes/sun/awt/X11/XErrorHandler.java
src/solaris/classes/sun/awt/X11/XErrorHandler.java
+72
-2
src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java
src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java
+162
-0
src/solaris/classes/sun/awt/X11/XQueryTree.java
src/solaris/classes/sun/awt/X11/XQueryTree.java
+3
-3
src/solaris/classes/sun/awt/X11/XToolkit.java
src/solaris/classes/sun/awt/X11/XToolkit.java
+1
-76
src/solaris/classes/sun/awt/X11/XTranslateCoordinates.java
src/solaris/classes/sun/awt/X11/XTranslateCoordinates.java
+3
-3
src/solaris/classes/sun/awt/X11/XWM.java
src/solaris/classes/sun/awt/X11/XWM.java
+7
-6
src/solaris/classes/sun/awt/X11/XlibUtil.java
src/solaris/classes/sun/awt/X11/XlibUtil.java
+7
-7
src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java
...laris/classes/sun/awt/X11/generator/WrapperGenerator.java
+3
-3
src/solaris/classes/sun/print/IPPPrintService.java
src/solaris/classes/sun/print/IPPPrintService.java
+7
-0
src/solaris/native/sun/awt/awt_GraphicsEnv.c
src/solaris/native/sun/awt/awt_GraphicsEnv.c
+23
-27
src/solaris/native/sun/awt/awt_GraphicsEnv.h
src/solaris/native/sun/awt/awt_GraphicsEnv.h
+2
-3
src/solaris/native/sun/awt/awt_util.c
src/solaris/native/sun/awt/awt_util.c
+1
-13
src/solaris/native/sun/awt/awt_util.h
src/solaris/native/sun/awt/awt_util.h
+35
-30
src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c
src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c
+10
-21
src/solaris/native/sun/java2d/x11/X11SurfaceData.c
src/solaris/native/sun/java2d/x11/X11SurfaceData.c
+6
-6
src/solaris/native/sun/xawt/XlibWrapper.c
src/solaris/native/sun/xawt/XlibWrapper.c
+3
-3
src/windows/bin/cmdtoargs.c
src/windows/bin/cmdtoargs.c
+12
-2
src/windows/classes/sun/awt/windows/WPathGraphics.java
src/windows/classes/sun/awt/windows/WPathGraphics.java
+2
-0
src/windows/classes/sun/nio/fs/WindowsConstants.java
src/windows/classes/sun/nio/fs/WindowsConstants.java
+1
-0
src/windows/classes/sun/nio/fs/WindowsNativeDispatcher.java
src/windows/classes/sun/nio/fs/WindowsNativeDispatcher.java
+7
-7
src/windows/classes/sun/nio/fs/WindowsWatchService.java
src/windows/classes/sun/nio/fs/WindowsWatchService.java
+55
-47
src/windows/classes/sun/security/krb5/internal/tools/Ktab.java
...indows/classes/sun/security/krb5/internal/tools/Ktab.java
+14
-32
src/windows/native/java/io/WinNTFileSystem_md.c
src/windows/native/java/io/WinNTFileSystem_md.c
+32
-27
src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
+18
-10
test/Makefile
test/Makefile
+4
-1
test/ProblemList.txt
test/ProblemList.txt
+2
-14
test/com/sun/jmx/remote/NotificationMarshalVersions/Client/Client.java
...jmx/remote/NotificationMarshalVersions/Client/Client.java
+48
-17
test/com/sun/jmx/remote/NotificationMarshalVersions/Server/Server.java
...jmx/remote/NotificationMarshalVersions/Server/Server.java
+4
-9
test/com/sun/jmx/remote/NotificationMarshalVersions/TestSerializationMismatch.java
...otificationMarshalVersions/TestSerializationMismatch.java
+123
-0
test/java/awt/WMSpecificTests/Metacity/FullscreenDialogModality.java
...wt/WMSpecificTests/Metacity/FullscreenDialogModality.java
+2
-0
test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java
...Window/TranslucentJAppletTest/TranslucentJAppletTest.java
+23
-1
test/java/awt/print/PrinterJob/Collate2DPrintingTest.java
test/java/awt/print/PrinterJob/Collate2DPrintingTest.java
+1
-1
test/java/awt/print/PrinterJob/PrintLatinCJKTest.java
test/java/awt/print/PrinterJob/PrintLatinCJKTest.java
+102
-0
test/java/beans/XMLEncoder/Test8013416.java
test/java/beans/XMLEncoder/Test8013416.java
+90
-0
test/java/io/File/IsHidden.java
test/java/io/File/IsHidden.java
+11
-1
test/java/io/FileInputStream/LargeFileAvailable.java
test/java/io/FileInputStream/LargeFileAvailable.java
+15
-13
test/java/io/FileInputStream/NegativeAvailable.java
test/java/io/FileInputStream/NegativeAvailable.java
+12
-7
test/java/io/pathNames/General.java
test/java/io/pathNames/General.java
+10
-7
test/java/io/pathNames/GeneralWin32.java
test/java/io/pathNames/GeneralWin32.java
+52
-25
test/java/lang/String/StringContentEqualsBug.java
test/java/lang/String/StringContentEqualsBug.java
+107
-0
test/java/lang/StringBuffer/ToStringCache.java
test/java/lang/StringBuffer/ToStringCache.java
+23
-1
test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java
...va/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java
+6
-1
test/java/lang/ref/OOMEInReferenceHandler.java
test/java/lang/ref/OOMEInReferenceHandler.java
+112
-0
test/java/nio/file/Files/FaultyFileSystem.java
test/java/nio/file/Files/FaultyFileSystem.java
+499
-0
test/java/nio/file/Files/PassThroughFileSystem.java
test/java/nio/file/Files/PassThroughFileSystem.java
+2
-2
test/java/nio/file/Files/StreamTest.java
test/java/nio/file/Files/StreamTest.java
+621
-0
test/java/util/Arrays/ParallelSorting.java
test/java/util/Arrays/ParallelSorting.java
+2
-2
test/javax/swing/text/View/8014863/bug8014863.java
test/javax/swing/text/View/8014863/bug8014863.java
+146
-0
test/javax/swing/text/html/parser/Parser/7011777/bug7011777.java
...vax/swing/text/html/parser/Parser/7011777/bug7011777.java
+63
-0
test/sun/awt/datatransfer/SuplementaryCharactersTransferTest.java
.../awt/datatransfer/SuplementaryCharactersTransferTest.java
+4
-5
test/sun/management/jdp/JdpTest.sh
test/sun/management/jdp/JdpTest.sh
+59
-56
test/sun/security/krb5/tools/KtabZero.java
test/sun/security/krb5/tools/KtabZero.java
+78
-0
test/sun/security/krb5/tools/ktzero.sh
test/sun/security/krb5/tools/ktzero.sh
+74
-0
test/sun/text/resources/LocaleData
test/sun/text/resources/LocaleData
+4
-0
test/sun/text/resources/LocaleDataTest.java
test/sun/text/resources/LocaleDataTest.java
+1
-1
test/tools/launcher/Arrrghs.java
test/tools/launcher/Arrrghs.java
+15
-1
未找到文件。
make/sun/awt/FILES_c_unix.gmk
浏览文件 @
7a7eed0f
...
@@ -171,3 +171,13 @@ FILES_NO_MOTIF_c = \
...
@@ -171,3 +171,13 @@ FILES_NO_MOTIF_c = \
GLXSurfaceData.c \
GLXSurfaceData.c \
AccelGlyphCache.c \
AccelGlyphCache.c \
CUPSfuncs.c
CUPSfuncs.c
ifeq ($(PLATFORM), macosx)
FILES_NO_MOTIF_objc = \
AWTFont.m \
AWTStrike.m \
CCharToGlyphMapper.m \
CGGlyphImages.m \
CGGlyphOutlines.m \
CoreTextSupport.m
endif # PLATFORM
make/sun/awt/FILES_export_unix.gmk
浏览文件 @
7a7eed0f
...
@@ -187,3 +187,14 @@ FILES_export2 = \
...
@@ -187,3 +187,14 @@ FILES_export2 = \
java/awt/dnd/DnDConstants.java \
java/awt/dnd/DnDConstants.java \
sun/awt/CausedFocusEvent.java
sun/awt/CausedFocusEvent.java
ifeq ($(PLATFORM), macosx)
ifeq ($(HEADLESS), true)
FILES_export += \
sun/awt/SunHints.java \
sun/font/CCharToGlyphMapper.java \
sun/font/CFont.java \
sun/font/CFontManager.java \
sun/font/CStrike.java \
sun/font/CStrikeDisposer.java
endif # HEADLESS
endif # PLATFORM
make/sun/awt/mawt.gmk
浏览文件 @
7a7eed0f
...
@@ -43,6 +43,10 @@ include $(BUILDDIR)/sun/awt/FILES_export_unix.gmk
...
@@ -43,6 +43,10 @@ include $(BUILDDIR)/sun/awt/FILES_export_unix.gmk
# compiled based on the motif version.
# compiled based on the motif version.
FILES_c = $(FILES_NO_MOTIF_c)
FILES_c = $(FILES_NO_MOTIF_c)
ifeq ($(PLATFORM), macosx)
FILES_objc = $(FILES_NO_MOTIF_objc)
endif # PLATFORM
ifeq ($(PLATFORM), solaris)
ifeq ($(PLATFORM), solaris)
ifneq ($(ARCH), amd64)
ifneq ($(ARCH), amd64)
FILES_reorder += reorder-$(ARCH)
FILES_reorder += reorder-$(ARCH)
...
@@ -97,6 +101,10 @@ vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/../java2d/pipe
...
@@ -97,6 +101,10 @@ vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/../java2d/pipe
vpath %.cpp $(SHARE_SRC)/native/$(PKGDIR)/image
vpath %.cpp $(SHARE_SRC)/native/$(PKGDIR)/image
vpath %.c $(PLATFORM_SRC)/native/$(PKGDIR)/robot_child
vpath %.c $(PLATFORM_SRC)/native/$(PKGDIR)/robot_child
ifeq ($(PLATFORM), macosx)
vpath %.m $(call NativeSrcDirList,,native/sun/font)
endif # PLATFORM
#
#
# Libraries to link in.
# Libraries to link in.
#
#
...
@@ -192,13 +200,21 @@ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/debug \
...
@@ -192,13 +200,21 @@ CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/debug \
$(EVENT_MODEL)
$(EVENT_MODEL)
ifeq ($(PLATFORM), macosx)
ifeq ($(PLATFORM), macosx)
CPPFLAGS += -I$(CUPS_HEADERS_PATH)
CPPFLAGS += -I$(CUPS_HEADERS_PATH) \
$(call NativeSrcDirList,-I,native/sun/awt) \
$(call NativeSrcDirList,-I,native/sun/font)
ifndef HEADLESS
ifndef HEADLESS
CPPFLAGS += -I$(MOTIF_DIR)/include \
CPPFLAGS += -I$(MOTIF_DIR)/include \
-I$(OPENWIN_HOME)/include
-I$(OPENWIN_HOME)/include
LDFLAGS += -L$(MOTIF_LIB) -L$(OPENWIN_LIB)
LDFLAGS += -L$(MOTIF_LIB) -L$(OPENWIN_LIB)
else
LDFLAGS += -framework Accelerate \
-framework ApplicationServices \
-framework Cocoa \
-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-framework JavaNativeFoundation \
-framework JavaRuntimeSupport
endif # !HEADLESS
endif # !HEADLESS
endif # PLATFORM
endif # PLATFORM
...
...
makefiles/CompileNativeLibraries.gmk
浏览文件 @
7a7eed0f
...
@@ -2314,6 +2314,10 @@ LIBAWT_HEADLESS_DIRS:=$(JDK_TOPDIR)/src/share/native/sun/font \
...
@@ -2314,6 +2314,10 @@ LIBAWT_HEADLESS_DIRS:=$(JDK_TOPDIR)/src/share/native/sun/font \
$(JDK_TOPDIR)/src/solaris/native/sun/java2d/opengl \
$(JDK_TOPDIR)/src/solaris/native/sun/java2d/opengl \
$(JDK_TOPDIR)/src/solaris/native/sun/java2d/x11
$(JDK_TOPDIR)/src/solaris/native/sun/java2d/x11
ifeq ($(OPENJDK_TARGET_OS),macosx)
LIBAWT_HEADLESS_DIRS+=$(JDK_TOPDIR)/src/macosx/native/sun/font
endif
LIBAWT_HEADLESS_CFLAGS:=-DHEADLESS=true \
LIBAWT_HEADLESS_CFLAGS:=-DHEADLESS=true \
-DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
-DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
$(CUPS_CFLAGS) \
$(CUPS_CFLAGS) \
...
@@ -2328,6 +2332,12 @@ LIBAWT_HEADLESS_CFLAGS:=-DHEADLESS=true \
...
@@ -2328,6 +2332,12 @@ LIBAWT_HEADLESS_CFLAGS:=-DHEADLESS=true \
-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga \
-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga \
$(foreach dir,$(LIBAWT_HEADLESS_DIRS),-I$(dir))
$(foreach dir,$(LIBAWT_HEADLESS_DIRS),-I$(dir))
ifeq ($(OPENJDK_TARGET_OS),macosx)
LIBAWT_HEADLESS_CFLAGS+=\
-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-F/System/Library/Frameworks/ApplicationServices.framework/Frameworks
endif
LIBAWT_HEADLESS_FILES:=\
LIBAWT_HEADLESS_FILES:=\
awt_Font.c \
awt_Font.c \
HeadlessToolkit.c \
HeadlessToolkit.c \
...
@@ -2356,6 +2366,16 @@ LIBAWT_HEADLESS_FILES:=\
...
@@ -2356,6 +2366,16 @@ LIBAWT_HEADLESS_FILES:=\
AccelGlyphCache.c \
AccelGlyphCache.c \
CUPSfuncs.c
CUPSfuncs.c
ifeq ($(OPENJDK_TARGET_OS),macosx)
LIBAWT_HEADLESS_FILES+=\
AWTFont.m \
AWTStrike.m \
CCharToGlyphMapper.m \
CGGlyphImages.m \
CGGlyphOutlines.m \
CoreTextSupport.m
endif
LIBAWT_HEADLESS_REORDER:=
LIBAWT_HEADLESS_REORDER:=
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
...
@@ -2382,7 +2402,13 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS,\
...
@@ -2382,7 +2402,13 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS,\
REORDER:=$(LIBAWT_HEADLESS_REORDER), \
REORDER:=$(LIBAWT_HEADLESS_REORDER), \
LDFLAGS_SUFFIX_linux:=-ljvm -lawt -lm $(LIBDL) -ljava,\
LDFLAGS_SUFFIX_linux:=-ljvm -lawt -lm $(LIBDL) -ljava,\
LDFLAGS_SUFFIX_solaris:=$(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc,\
LDFLAGS_SUFFIX_solaris:=$(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc,\
LDFLAGS_SUFFIX_macosx:=-ljvm $(LIBCXX) -lawt $(LIBDL) -ljava,\
LDFLAGS_SUFFIX_macosx:=-ljvm $(LIBCXX) -lawt $(LIBDL) -ljava \
-framework Accelerate \
-framework ApplicationServices \
-framework Cocoa \
-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-framework JavaNativeFoundation \
-framework JavaRuntimeSupport,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_headless,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_headless,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
...
...
src/macosx/bin/java_md_macosx.c
浏览文件 @
7a7eed0f
...
@@ -44,7 +44,6 @@
...
@@ -44,7 +44,6 @@
#include <Cocoa/Cocoa.h>
#include <Cocoa/Cocoa.h>
#include <objc/objc-runtime.h>
#include <objc/objc-runtime.h>
#include <objc/objc-auto.h>
#include <objc/objc-auto.h>
#include <dispatch/dispatch.h>
#include <errno.h>
#include <errno.h>
#include <spawn.h>
#include <spawn.h>
...
@@ -1001,6 +1000,32 @@ SetXStartOnFirstThreadArg()
...
@@ -1001,6 +1000,32 @@ SetXStartOnFirstThreadArg()
setenv
(
envVar
,
"1"
,
1
);
setenv
(
envVar
,
"1"
,
1
);
}
}
/* This class is made for performSelectorOnMainThread when java main
* should be launched on main thread.
* We cannot use dispatch_sync here, because it blocks the main dispatch queue
* which is used inside Cocoa
*/
@
interface
JavaLaunchHelper
:
NSObject
{
int
_returnValue
;
}
-
(
void
)
launchJava
:
(
NSValue
*
)
argsValue
;
-
(
int
)
getReturnValue
;
@
end
@
implementation
JavaLaunchHelper
-
(
void
)
launchJava
:
(
NSValue
*
)
argsValue
{
_returnValue
=
JavaMain
([
argsValue
pointerValue
]);
}
-
(
int
)
getReturnValue
{
return
_returnValue
;
}
@
end
// MacOSX we may continue in the same thread
// MacOSX we may continue in the same thread
int
int
JVMInit
(
InvocationFunctions
*
ifn
,
jlong
threadStackSize
,
JVMInit
(
InvocationFunctions
*
ifn
,
jlong
threadStackSize
,
...
@@ -1010,16 +1035,22 @@ JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
...
@@ -1010,16 +1035,22 @@ JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
JLI_TraceLauncher
(
"In same thread
\n
"
);
JLI_TraceLauncher
(
"In same thread
\n
"
);
// need to block this thread against the main thread
// need to block this thread against the main thread
// so signals get caught correctly
// so signals get caught correctly
__block
int
rslt
;
JavaMainArgs
args
;
dispatch_sync
(
dispatch_get_main_queue
(),
^
(
void
)
{
args
.
argc
=
argc
;
JavaMainArgs
args
;
args
.
argv
=
argv
;
args
.
argc
=
argc
;
args
.
mode
=
mode
;
args
.
argv
=
argv
;
args
.
what
=
what
;
args
.
mode
=
mode
;
args
.
ifn
=
*
ifn
;
args
.
what
=
what
;
int
rslt
;
args
.
ifn
=
*
ifn
;
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
rslt
=
JavaMain
((
void
*
)
&
args
);
{
});
JavaLaunchHelper
*
launcher
=
[[[
JavaLaunchHelper
alloc
]
init
]
autorelease
];
[
launcher
performSelectorOnMainThread
:
@
selector
(
launchJava
:
)
withObject:
[
NSValue
valueWithPointer
:
(
void
*
)
&
args
]
waitUntilDone:
YES
];
rslt
=
[
launcher
getReturnValue
];
}
[
pool
drain
];
return
rslt
;
return
rslt
;
}
else
{
}
else
{
return
ContinueInNewThread
(
ifn
,
threadStackSize
,
argc
,
argv
,
mode
,
what
,
ret
);
return
ContinueInNewThread
(
ifn
,
threadStackSize
,
argc
,
argv
,
mode
,
what
,
ret
);
...
...
src/macosx/classes/sun/lwawt/macosx/CDropTargetContextPeer.java
浏览文件 @
7a7eed0f
...
@@ -38,7 +38,7 @@ final class CDropTargetContextPeer extends SunDropTargetContextPeer {
...
@@ -38,7 +38,7 @@ final class CDropTargetContextPeer extends SunDropTargetContextPeer {
private
long
fNativeDropTransfer
=
0
;
private
long
fNativeDropTransfer
=
0
;
private
long
fNativeDataAvailable
=
0
;
private
long
fNativeDataAvailable
=
0
;
private
Object
fNativeData
=
null
;
private
Object
fNativeData
=
null
;
private
boolean
insideTarget
=
fals
e
;
private
boolean
insideTarget
=
tru
e
;
Object
awtLockAccess
=
new
Object
();
Object
awtLockAccess
=
new
Object
();
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
7a7eed0f
/*
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -115,6 +115,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -115,6 +115,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
static
final
int
RESIZABLE
=
1
<<
9
;
// both a style bit and prop bit
static
final
int
RESIZABLE
=
1
<<
9
;
// both a style bit and prop bit
static
final
int
NONACTIVATING
=
1
<<
24
;
static
final
int
NONACTIVATING
=
1
<<
24
;
static
final
int
IS_DIALOG
=
1
<<
25
;
static
final
int
IS_MODAL
=
1
<<
26
;
static
final
int
_STYLE_PROP_BITMASK
=
DECORATED
|
TEXTURED
|
UNIFIED
|
UTILITY
|
HUD
|
SHEET
|
CLOSEABLE
|
MINIMIZABLE
|
RESIZABLE
;
static
final
int
_STYLE_PROP_BITMASK
=
DECORATED
|
TEXTURED
|
UNIFIED
|
UTILITY
|
HUD
|
SHEET
|
CLOSEABLE
|
MINIMIZABLE
|
RESIZABLE
;
...
@@ -374,6 +376,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -374,6 +376,13 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
}
}
}
if
(
isDialog
)
{
styleBits
=
SET
(
styleBits
,
IS_DIALOG
,
true
);
if
(((
Dialog
)
target
).
isModal
())
{
styleBits
=
SET
(
styleBits
,
IS_MODAL
,
true
);
}
}
peer
.
setTextured
(
IS
(
TEXTURED
,
styleBits
));
peer
.
setTextured
(
IS
(
TEXTURED
,
styleBits
));
return
styleBits
;
return
styleBits
;
...
...
src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
浏览文件 @
7a7eed0f
...
@@ -36,6 +36,7 @@ import java.security.PrivilegedAction;
...
@@ -36,6 +36,7 @@ import java.security.PrivilegedAction;
import
javax.print.*
;
import
javax.print.*
;
import
javax.print.attribute.PrintRequestAttributeSet
;
import
javax.print.attribute.PrintRequestAttributeSet
;
import
javax.print.attribute.HashPrintRequestAttributeSet
;
import
javax.print.attribute.HashPrintRequestAttributeSet
;
import
javax.print.attribute.standard.PageRanges
;
import
sun.java2d.*
;
import
sun.java2d.*
;
import
sun.print.*
;
import
sun.print.*
;
...
@@ -173,6 +174,19 @@ public class CPrinterJob extends RasterPrinterJob {
...
@@ -173,6 +174,19 @@ public class CPrinterJob extends RasterPrinterJob {
if
(
nsPrintInfo
!=
null
)
{
if
(
nsPrintInfo
!=
null
)
{
fNSPrintInfo
=
nsPrintInfo
.
getValue
();
fNSPrintInfo
=
nsPrintInfo
.
getValue
();
}
}
PageRanges
pageRangesAttr
=
(
PageRanges
)
attributes
.
get
(
PageRanges
.
class
);
if
(
isSupportedValue
(
pageRangesAttr
,
attributes
))
{
SunPageSelection
rangeSelect
=
(
SunPageSelection
)
attributes
.
get
(
SunPageSelection
.
class
);
// If rangeSelect is not null, we are using AWT's print dialog that has
// All, Selection, and Range radio buttons
if
(
rangeSelect
==
null
||
rangeSelect
==
SunPageSelection
.
RANGE
)
{
int
[][]
range
=
pageRangesAttr
.
getMembers
();
// setPageRange will set firstPage and lastPage as called in getFirstPage
// and getLastPage
setPageRange
(
range
[
0
][
0
]
-
1
,
range
[
0
][
1
]
-
1
);
}
}
}
}
volatile
boolean
onEventThread
;
volatile
boolean
onEventThread
;
...
@@ -225,7 +239,6 @@ public class CPrinterJob extends RasterPrinterJob {
...
@@ -225,7 +239,6 @@ public class CPrinterJob extends RasterPrinterJob {
* the end of the document. Note that firstPage
* the end of the document. Note that firstPage
* and lastPage are 0 based page indices.
* and lastPage are 0 based page indices.
*/
*/
int
numPages
=
mDocument
.
getNumberOfPages
();
int
firstPage
=
getFirstPage
();
int
firstPage
=
getFirstPage
();
int
lastPage
=
getLastPage
();
int
lastPage
=
getLastPage
();
...
@@ -242,42 +255,53 @@ public class CPrinterJob extends RasterPrinterJob {
...
@@ -242,42 +255,53 @@ public class CPrinterJob extends RasterPrinterJob {
userCancelled
=
false
;
userCancelled
=
false
;
}
}
if
(
EventQueue
.
isDispatchThread
())
{
//Add support for PageRange
// This is an AWT EventQueue, and this print rendering loop needs to block it.
PageRanges
pr
=
(
attributes
==
null
)
?
null
:
(
PageRanges
)
attributes
.
get
(
PageRanges
.
class
);
int
[][]
prMembers
=
(
pr
==
null
)
?
new
int
[
0
][
0
]
:
pr
.
getMembers
();
int
loopi
=
0
;
do
{
if
(
EventQueue
.
isDispatchThread
())
{
// This is an AWT EventQueue, and this print rendering loop needs to block it.
onEventThread
=
true
;
printingLoop
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
SecondaryLoop
>()
{
@Override
public
SecondaryLoop
run
()
{
return
Toolkit
.
getDefaultToolkit
()
.
getSystemEventQueue
()
.
createSecondaryLoop
();
}
});
onEventThread
=
true
;
try
{
// Fire off the print rendering loop on the AppKit thread, and don't have
printingLoop
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
SecondaryLoop
>()
{
// it wait and block this thread.
@Override
if
(
printLoop
(
false
,
firstPage
,
lastPage
))
{
public
SecondaryLoop
run
()
{
// Start a secondary loop on EDT until printing operation is finished or cancelled
return
Toolkit
.
getDefaultToolkit
()
printingLoop
.
enter
();
.
getSystemEventQueue
()
}
.
createSecondaryLoop
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
});
}
else
{
// Fire off the print rendering loop on the AppKit, and block this thread
// until it is done.
// But don't actually block... we need to come back here!
onEventThread
=
false
;
try
{
try
{
// Fire off the print rendering loop on the AppKit thread, and don't have
printLoop
(
true
,
firstPage
,
lastPage
);
// it wait and block this thread.
}
catch
(
Exception
e
)
{
if
(
printLoop
(
false
,
firstPage
,
lastPage
))
{
e
.
printStackTrace
();
// Start a secondary loop on EDT until printing operation is finished or cancelled
printingLoop
.
enter
();
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
else
{
if
(++
loopi
<
prMembers
.
length
)
{
// Fire off the print rendering loop on the AppKit, and block this thread
firstPage
=
prMembers
[
loopi
][
0
]-
1
;
// until it is done.
lastPage
=
prMembers
[
loopi
][
1
]
-
1
;
// But don't actually block... we need to come back here!
onEventThread
=
false
;
try
{
printLoop
(
true
,
firstPage
,
lastPage
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
while
(
loopi
<
prMembers
.
length
);
}
finally
{
}
finally
{
synchronized
(
this
)
{
synchronized
(
this
)
{
// NOTE: Native code shouldn't allow exceptions out while
// NOTE: Native code shouldn't allow exceptions out while
...
...
src/macosx/native/sun/awt/AWTWindow.m
浏览文件 @
7a7eed0f
/*
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -536,8 +536,12 @@ AWT_ASSERT_APPKIT_THREAD;
...
@@ -536,8 +536,12 @@ AWT_ASSERT_APPKIT_THREAD;
-
(
void
)
windowDidBecomeKey
:
(
NSNotification
*
)
notification
{
-
(
void
)
windowDidBecomeKey
:
(
NSNotification
*
)
notification
{
AWT_ASSERT_APPKIT_THREAD
;
AWT_ASSERT_APPKIT_THREAD
;
[
AWTToolkit
eventCountPlusPlus
];
[
AWTToolkit
eventCountPlusPlus
];
[
CMenuBar
activate
:
self
.
javaMenuBar
modallyDisabled
:
NO
];
AWTWindow
*
opposite
=
[
AWTWindow
lastKeyWindow
];
AWTWindow
*
opposite
=
[
AWTWindow
lastKeyWindow
];
if
(
!
IS
(
self
.
styleBits
,
IS_DIALOG
))
{
[
CMenuBar
activate
:
self
.
javaMenuBar
modallyDisabled
:
NO
];
}
else
if
(
IS
(
self
.
styleBits
,
IS_MODAL
))
{
[
CMenuBar
activate
:
opposite
->
javaMenuBar
modallyDisabled
:
YES
];
}
[
AWTWindow
setLastKeyWindow
:
nil
];
[
AWTWindow
setLastKeyWindow
:
nil
];
[
self
_deliverWindowFocusEvent
:
YES
oppositeWindow
:
opposite
];
[
self
_deliverWindowFocusEvent
:
YES
oppositeWindow
:
opposite
];
...
...
src/macosx/native/sun/font/AWTFont.m
浏览文件 @
7a7eed0f
...
@@ -395,6 +395,7 @@ JNF_COCOA_EXIT(env);
...
@@ -395,6 +395,7 @@ JNF_COCOA_EXIT(env);
#pragma mark --- Miscellaneous JNI ---
#pragma mark --- Miscellaneous JNI ---
#ifndef HEADLESS
/*
/*
* Class: sun_awt_PlatformFont
* Class: sun_awt_PlatformFont
* Method: initIDs
* Method: initIDs
...
@@ -416,3 +417,4 @@ Java_sun_awt_FontDescriptor_initIDs
...
@@ -416,3 +417,4 @@ Java_sun_awt_FontDescriptor_initIDs
(
JNIEnv
*
env
,
jclass
cls
)
(
JNIEnv
*
env
,
jclass
cls
)
{
{
}
}
#endif
src/share/classes/com/sun/beans/finder/AbstractFinder.java
浏览文件 @
7a7eed0f
/*
/*
* Copyright (c) 2008, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -24,6 +24,9 @@
...
@@ -24,6 +24,9 @@
*/
*/
package
com.sun.beans.finder
;
package
com.sun.beans.finder
;
import
java.lang.reflect.Executable
;
import
java.lang.reflect.Modifier
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -37,7 +40,7 @@ import java.util.Map;
...
@@ -37,7 +40,7 @@ import java.util.Map;
*
*
* @author Sergey A. Malenkov
* @author Sergey A. Malenkov
*/
*/
abstract
class
AbstractFinder
<
T
>
{
abstract
class
AbstractFinder
<
T
extends
Executable
>
{
private
final
Class
<?>[]
args
;
private
final
Class
<?>[]
args
;
/**
/**
...
@@ -52,27 +55,6 @@ abstract class AbstractFinder<T> {
...
@@ -52,27 +55,6 @@ abstract class AbstractFinder<T> {
this
.
args
=
args
;
this
.
args
=
args
;
}
}
/**
* Returns an array of {@code Class} objects
* that represent the formal parameter types of the method.
* Returns an empty array if the method takes no parameters.
*
* @param method the object that represents method
* @return the parameter types of the method
*/
protected
abstract
Class
<?>[]
getParameters
(
T
method
);
/**
* Returns {@code true} if and only if the method
* was declared to take a variable number of arguments.
*
* @param method the object that represents method
* @return {@code true} if the method was declared
* to take a variable number of arguments;
* {@code false} otherwise
*/
protected
abstract
boolean
isVarArgs
(
T
method
);
/**
/**
* Checks validness of the method.
* Checks validness of the method.
* At least the valid method should be public.
* At least the valid method should be public.
...
@@ -81,7 +63,9 @@ abstract class AbstractFinder<T> {
...
@@ -81,7 +63,9 @@ abstract class AbstractFinder<T> {
* @return {@code true} if the method is valid,
* @return {@code true} if the method is valid,
* {@code false} otherwise
* {@code false} otherwise
*/
*/
protected
abstract
boolean
isValid
(
T
method
);
protected
boolean
isValid
(
T
method
)
{
return
Modifier
.
isPublic
(
method
.
getModifiers
());
}
/**
/**
* Performs a search in the {@code methods} array.
* Performs a search in the {@code methods} array.
...
@@ -109,7 +93,7 @@ abstract class AbstractFinder<T> {
...
@@ -109,7 +93,7 @@ abstract class AbstractFinder<T> {
for
(
T
newMethod
:
methods
)
{
for
(
T
newMethod
:
methods
)
{
if
(
isValid
(
newMethod
))
{
if
(
isValid
(
newMethod
))
{
Class
<?>[]
newParams
=
getParameters
(
newMethod
);
Class
<?>[]
newParams
=
newMethod
.
getParameterTypes
(
);
if
(
newParams
.
length
==
this
.
args
.
length
)
{
if
(
newParams
.
length
==
this
.
args
.
length
)
{
PrimitiveWrapperMap
.
replacePrimitivesWithWrappers
(
newParams
);
PrimitiveWrapperMap
.
replacePrimitivesWithWrappers
(
newParams
);
if
(
isAssignable
(
newParams
,
this
.
args
))
{
if
(
isAssignable
(
newParams
,
this
.
args
))
{
...
@@ -120,6 +104,11 @@ abstract class AbstractFinder<T> {
...
@@ -120,6 +104,11 @@ abstract class AbstractFinder<T> {
boolean
useNew
=
isAssignable
(
oldParams
,
newParams
);
boolean
useNew
=
isAssignable
(
oldParams
,
newParams
);
boolean
useOld
=
isAssignable
(
newParams
,
oldParams
);
boolean
useOld
=
isAssignable
(
newParams
,
oldParams
);
if
(
useOld
&&
useNew
)
{
// only if parameters are equal
useNew
=
!
newMethod
.
isSynthetic
();
useOld
=
!
oldMethod
.
isSynthetic
();
}
if
(
useOld
==
useNew
)
{
if
(
useOld
==
useNew
)
{
ambiguous
=
true
;
ambiguous
=
true
;
}
else
if
(
useNew
)
{
}
else
if
(
useNew
)
{
...
@@ -130,7 +119,7 @@ abstract class AbstractFinder<T> {
...
@@ -130,7 +119,7 @@ abstract class AbstractFinder<T> {
}
}
}
}
}
}
if
(
isVarArgs
(
newMethod
))
{
if
(
newMethod
.
isVarArgs
(
))
{
int
length
=
newParams
.
length
-
1
;
int
length
=
newParams
.
length
-
1
;
if
(
length
<=
this
.
args
.
length
)
{
if
(
length
<=
this
.
args
.
length
)
{
Class
<?>[]
array
=
new
Class
<?>[
this
.
args
.
length
];
Class
<?>[]
array
=
new
Class
<?>[
this
.
args
.
length
];
...
@@ -160,6 +149,11 @@ abstract class AbstractFinder<T> {
...
@@ -160,6 +149,11 @@ abstract class AbstractFinder<T> {
boolean
useNew
=
isAssignable
(
oldParams
,
newParams
);
boolean
useNew
=
isAssignable
(
oldParams
,
newParams
);
boolean
useOld
=
isAssignable
(
newParams
,
oldParams
);
boolean
useOld
=
isAssignable
(
newParams
,
oldParams
);
if
(
useOld
&&
useNew
)
{
// only if parameters are equal
useNew
=
!
newMethod
.
isSynthetic
();
useOld
=
!
oldMethod
.
isSynthetic
();
}
if
(
useOld
==
useNew
)
{
if
(
useOld
==
useNew
)
{
if
(
oldParams
==
map
.
get
(
oldMethod
))
{
if
(
oldParams
==
map
.
get
(
oldMethod
))
{
ambiguous
=
true
;
ambiguous
=
true
;
...
...
src/share/classes/com/sun/beans/finder/ConstructorFinder.java
浏览文件 @
7a7eed0f
/*
/*
* Copyright (c) 2008, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -86,44 +86,4 @@ public final class ConstructorFinder extends AbstractFinder<Constructor<?>> {
...
@@ -86,44 +86,4 @@ public final class ConstructorFinder extends AbstractFinder<Constructor<?>> {
private
ConstructorFinder
(
Class
<?>[]
args
)
{
private
ConstructorFinder
(
Class
<?>[]
args
)
{
super
(
args
);
super
(
args
);
}
}
/**
* Returns an array of {@code Class} objects
* that represent the formal parameter types of the constructor.
* Returns an empty array if the constructor takes no parameters.
*
* @param constructor the object that represents constructor
* @return the parameter types of the constructor
*/
@Override
protected
Class
<?>[]
getParameters
(
Constructor
<?>
constructor
)
{
return
constructor
.
getParameterTypes
();
}
/**
* Returns {@code true} if and only if the constructor
* was declared to take a variable number of arguments.
*
* @param constructor the object that represents constructor
* @return {@code true} if the constructor was declared
* to take a variable number of arguments;
* {@code false} otherwise
*/
@Override
protected
boolean
isVarArgs
(
Constructor
<?>
constructor
)
{
return
constructor
.
isVarArgs
();
}
/**
* Checks validness of the constructor.
* The valid constructor should be public.
*
* @param constructor the object that represents constructor
* @return {@code true} if the constructor is valid,
* {@code false} otherwise
*/
@Override
protected
boolean
isValid
(
Constructor
<?>
constructor
)
{
return
Modifier
.
isPublic
(
constructor
.
getModifiers
());
}
}
}
src/share/classes/com/sun/beans/finder/MethodFinder.java
浏览文件 @
7a7eed0f
/*
/*
* Copyright (c) 2008, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -195,33 +195,6 @@ public final class MethodFinder extends AbstractFinder<Method> {
...
@@ -195,33 +195,6 @@ public final class MethodFinder extends AbstractFinder<Method> {
this
.
name
=
name
;
this
.
name
=
name
;
}
}
/**
* Returns an array of {@code Class} objects
* that represent the formal parameter types of the method.
* Returns an empty array if the method takes no parameters.
*
* @param method the object that represents method
* @return the parameter types of the method
*/
@Override
protected
Class
<?>[]
getParameters
(
Method
method
)
{
return
method
.
getParameterTypes
();
}
/**
* Returns {@code true} if and only if the method
* was declared to take a variable number of arguments.
*
* @param method the object that represents method
* @return {@code true} if the method was declared
* to take a variable number of arguments;
* {@code false} otherwise
*/
@Override
protected
boolean
isVarArgs
(
Method
method
)
{
return
method
.
isVarArgs
();
}
/**
/**
* Checks validness of the method.
* Checks validness of the method.
* The valid method should be public and
* The valid method should be public and
...
@@ -233,6 +206,6 @@ public final class MethodFinder extends AbstractFinder<Method> {
...
@@ -233,6 +206,6 @@ public final class MethodFinder extends AbstractFinder<Method> {
*/
*/
@Override
@Override
protected
boolean
isValid
(
Method
method
)
{
protected
boolean
isValid
(
Method
method
)
{
return
!
method
.
isBridge
()
&&
Modifier
.
isPublic
(
method
.
getModifiers
()
)
&&
method
.
getName
().
equals
(
this
.
name
);
return
super
.
isValid
(
method
)
&&
method
.
getName
().
equals
(
this
.
name
);
}
}
}
}
src/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java
浏览文件 @
7a7eed0f
/*
/*
* Copyright (c) 1999, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -90,14 +90,16 @@ public class Continuation extends ResolveResult {
...
@@ -90,14 +90,16 @@ public class Continuation extends ResolveResult {
* Constructs a new instance of Continuation.
* Constructs a new instance of Continuation.
* @param top The name of the object that is to be resolved/operated upon.
* @param top The name of the object that is to be resolved/operated upon.
* This becomes the Continuation's 'starter' and is used to
* This becomes the Continuation's 'starter' and is used to
* calculate the "resolved name" when filling
in a NamingException.
* calculate the "resolved name" when filling in a NamingException.
* @param environment The environment used by the caller. It is used
* @param environment The environment used by the caller. It is used
* when setting the "environment" of a CannotProceedException.
*
when setting the "environment" of a CannotProceedException.
*/
*/
@SuppressWarnings
(
"unchecked"
)
// For Hashtable clone: environment.clone()
public
Continuation
(
Name
top
,
Hashtable
<?,?>
environment
)
{
public
Continuation
(
Name
top
,
Hashtable
<?,?>
environment
)
{
super
();
super
();
starter
=
top
;
starter
=
top
;
this
.
environment
=
environment
;
this
.
environment
=
(
Hashtable
<?,?>)
((
environment
==
null
)
?
null
:
environment
.
clone
());
}
}
/**
/**
...
...
src/share/classes/com/sun/jndi/toolkit/dir/LazySearchEnumerationImpl.java
浏览文件 @
7a7eed0f
/*
/*
* Copyright (c) 1999, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -69,6 +69,7 @@ final public class LazySearchEnumerationImpl
...
@@ -69,6 +69,7 @@ final public class LazySearchEnumerationImpl
}
}
}
}
@SuppressWarnings
(
"unchecked"
)
// For Hashtable clone: env.clone()
public
LazySearchEnumerationImpl
(
NamingEnumeration
<
Binding
>
candidates
,
public
LazySearchEnumerationImpl
(
NamingEnumeration
<
Binding
>
candidates
,
AttrFilter
filter
,
SearchControls
cons
,
AttrFilter
filter
,
SearchControls
cons
,
Context
ctx
,
Hashtable
<
String
,
Object
>
env
,
boolean
useFactory
)
Context
ctx
,
Hashtable
<
String
,
Object
>
env
,
boolean
useFactory
)
...
@@ -76,7 +77,8 @@ final public class LazySearchEnumerationImpl
...
@@ -76,7 +77,8 @@ final public class LazySearchEnumerationImpl
this
.
candidates
=
candidates
;
this
.
candidates
=
candidates
;
this
.
filter
=
filter
;
this
.
filter
=
filter
;
this
.
env
=
env
;
this
.
env
=
(
Hashtable
<
String
,
Object
>)
((
env
==
null
)
?
null
:
env
.
clone
());
this
.
context
=
ctx
;
this
.
context
=
ctx
;
this
.
useFactory
=
useFactory
;
this
.
useFactory
=
useFactory
;
...
...
src/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java
浏览文件 @
7a7eed0f
/*
/*
* Copyright (c) 1999, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -53,7 +53,8 @@ abstract public class GenericURLContext implements Context {
...
@@ -53,7 +53,8 @@ abstract public class GenericURLContext implements Context {
@SuppressWarnings
(
"unchecked"
)
// Expect Hashtable<String, Object>
@SuppressWarnings
(
"unchecked"
)
// Expect Hashtable<String, Object>
public
GenericURLContext
(
Hashtable
<?,?>
env
)
{
public
GenericURLContext
(
Hashtable
<?,?>
env
)
{
// context that is not tied to any specific URL
// context that is not tied to any specific URL
myEnv
=
(
Hashtable
<
String
,
Object
>)
env
;
// copied on write
myEnv
=
(
Hashtable
<
String
,
Object
>)(
env
==
null
?
null
:
env
.
clone
());
}
}
public
void
close
()
throws
NamingException
{
public
void
close
()
throws
NamingException
{
...
@@ -488,22 +489,19 @@ abstract public class GenericURLContext implements Context {
...
@@ -488,22 +489,19 @@ abstract public class GenericURLContext implements Context {
return
result
;
return
result
;
}
}
@SuppressWarnings
(
"unchecked"
)
// clone()
public
Object
removeFromEnvironment
(
String
propName
)
public
Object
removeFromEnvironment
(
String
propName
)
throws
NamingException
{
throws
NamingException
{
if
(
myEnv
==
null
)
{
if
(
myEnv
==
null
)
{
return
null
;
return
null
;
}
}
myEnv
=
(
Hashtable
<
String
,
Object
>)
myEnv
.
clone
();
return
myEnv
.
remove
(
propName
);
return
myEnv
.
remove
(
propName
);
}
}
@SuppressWarnings
(
"unchecked"
)
// clone()
public
Object
addToEnvironment
(
String
propName
,
Object
propVal
)
public
Object
addToEnvironment
(
String
propName
,
Object
propVal
)
throws
NamingException
{
throws
NamingException
{
myEnv
=
(
myEnv
==
null
)
if
(
myEnv
==
null
)
{
?
new
Hashtable
<
String
,
Object
>(
11
,
0.75f
)
myEnv
=
new
Hashtable
<
String
,
Object
>(
11
,
0.75f
);
:
(
Hashtable
<
String
,
Object
>)
myEnv
.
clone
();
}
return
myEnv
.
put
(
propName
,
propVal
);
return
myEnv
.
put
(
propName
,
propVal
);
}
}
...
...
src/share/classes/java/io/FileInputStream.java
浏览文件 @
7a7eed0f
...
@@ -240,13 +240,15 @@ class FileInputStream extends InputStream
...
@@ -240,13 +240,15 @@ class FileInputStream extends InputStream
*
*
* <p>The <code>skip</code> method may, for a variety of
* <p>The <code>skip</code> method may, for a variety of
* reasons, end up skipping over some smaller number of bytes,
* reasons, end up skipping over some smaller number of bytes,
* possibly <code>0</code>. If <code>n</code> is negative, an
* possibly <code>0</code>. If <code>n</code> is negative, the method
* <code>IOException</code> is thrown, even though the <code>skip</code>
* will try to skip backwards. In case the backing file does not support
* method of the {@link InputStream} superclass does nothing in this case.
* backward skip at its current position, an <code>IOException</code> is
* The actual number of bytes skipped is returned.
* thrown. The actual number of bytes skipped is returned. If it skips
* forwards, it returns a positive value. If it skips backwards, it
* returns a negative value.
*
*
* <p>This method may skip more bytes than
are remaining in the backing
* <p>This method may skip more bytes than
what are remaining in the
* file. This produces no exception and the number of bytes skipped
*
backing
file. This produces no exception and the number of bytes skipped
* may include some number of bytes that were beyond the EOF of the
* may include some number of bytes that were beyond the EOF of the
* backing file. Attempting to read from the stream after skipping past
* backing file. Attempting to read from the stream after skipping past
* the end will result in -1 indicating the end of the file.
* the end will result in -1 indicating the end of the file.
...
@@ -261,9 +263,10 @@ class FileInputStream extends InputStream
...
@@ -261,9 +263,10 @@ class FileInputStream extends InputStream
/**
/**
* Returns an estimate of the number of remaining bytes that can be read (or
* Returns an estimate of the number of remaining bytes that can be read (or
* skipped over) from this input stream without blocking by the next
* skipped over) from this input stream without blocking by the next
* invocation of a method for this input stream. The next invocation might be
* invocation of a method for this input stream. Returns 0 when the file
* the same thread or another thread. A single read or skip of this
* position is beyond EOF. The next invocation might be the same thread
* many bytes will not block, but may read or skip fewer bytes.
* or another thread. A single read or skip of this many bytes will not
* block, but may read or skip fewer bytes.
*
*
* <p> In some cases, a non-blocking read (or skip) may appear to be
* <p> In some cases, a non-blocking read (or skip) may appear to be
* blocked when it is merely slow, for example when reading large
* blocked when it is merely slow, for example when reading large
...
...
src/share/classes/java/io/InputStream.java
浏览文件 @
7a7eed0f
/*
/*
* Copyright (c) 1994, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -193,8 +193,10 @@ public abstract class InputStream implements Closeable {
...
@@ -193,8 +193,10 @@ public abstract class InputStream implements Closeable {
* up skipping over some smaller number of bytes, possibly <code>0</code>.
* up skipping over some smaller number of bytes, possibly <code>0</code>.
* This may result from any of a number of conditions; reaching end of file
* This may result from any of a number of conditions; reaching end of file
* before <code>n</code> bytes have been skipped is only one possibility.
* before <code>n</code> bytes have been skipped is only one possibility.
* The actual number of bytes skipped is returned. If <code>n</code> is
* The actual number of bytes skipped is returned. If {@code n} is
* negative, no bytes are skipped.
* negative, the {@code skip} method for class {@code InputStream} always
* returns 0, and no bytes are skipped. Subclasses may handle the negative
* value differently.
*
*
* <p> The <code>skip</code> method of this class creates a
* <p> The <code>skip</code> method of this class creates a
* byte array and then repeatedly reads into it until <code>n</code> bytes
* byte array and then repeatedly reads into it until <code>n</code> bytes
...
...
src/share/classes/java/lang/Class.java
浏览文件 @
7a7eed0f
...
@@ -28,6 +28,7 @@ package java.lang;
...
@@ -28,6 +28,7 @@ package java.lang;
import
java.lang.reflect.AnnotatedElement
;
import
java.lang.reflect.AnnotatedElement
;
import
java.lang.reflect.Array
;
import
java.lang.reflect.Array
;
import
java.lang.reflect.GenericArrayType
;
import
java.lang.reflect.GenericArrayType
;
import
java.lang.reflect.GenericDeclaration
;
import
java.lang.reflect.Member
;
import
java.lang.reflect.Member
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Executable
;
import
java.lang.reflect.Executable
;
...
@@ -115,9 +116,9 @@ import sun.reflect.misc.ReflectUtil;
...
@@ -115,9 +116,9 @@ import sun.reflect.misc.ReflectUtil;
* @since JDK1.0
* @since JDK1.0
*/
*/
public
final
class
Class
<
T
>
implements
java
.
io
.
Serializable
,
public
final
class
Class
<
T
>
implements
java
.
io
.
Serializable
,
java
.
lang
.
reflect
.
GenericDeclaration
,
GenericDeclaration
,
java
.
lang
.
reflect
.
Type
,
Type
,
java
.
lang
.
reflect
.
AnnotatedElement
{
AnnotatedElement
{
private
static
final
int
ANNOTATION
=
0x00002000
;
private
static
final
int
ANNOTATION
=
0x00002000
;
private
static
final
int
ENUM
=
0x00004000
;
private
static
final
int
ENUM
=
0x00004000
;
private
static
final
int
SYNTHETIC
=
0x00001000
;
private
static
final
int
SYNTHETIC
=
0x00001000
;
...
@@ -3182,7 +3183,7 @@ public final class Class<T> implements java.io.Serializable,
...
@@ -3182,7 +3183,7 @@ public final class Class<T> implements java.io.Serializable,
*/
*/
@Override
@Override
public
boolean
isAnnotationPresent
(
Class
<?
extends
Annotation
>
annotationClass
)
{
public
boolean
isAnnotationPresent
(
Class
<?
extends
Annotation
>
annotationClass
)
{
return
AnnotatedElement
.
super
.
isAnnotationPresent
(
annotationClass
);
return
GenericDeclaration
.
super
.
isAnnotationPresent
(
annotationClass
);
}
}
/**
/**
...
...
src/share/classes/java/lang/String.java
浏览文件 @
7a7eed0f
...
@@ -1010,13 +1010,14 @@ public final class String
...
@@ -1010,13 +1010,14 @@ public final class String
private
boolean
nonSyncContentEquals
(
AbstractStringBuilder
sb
)
{
private
boolean
nonSyncContentEquals
(
AbstractStringBuilder
sb
)
{
char
v1
[]
=
value
;
char
v1
[]
=
value
;
char
v2
[]
=
sb
.
getValue
();
char
v2
[]
=
sb
.
getValue
();
int
i
=
0
;
int
n
=
v1
.
length
;
int
n
=
value
.
length
;
if
(
n
!=
sb
.
length
())
{
while
(
n
--
!=
0
)
{
return
false
;
}
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
if
(
v1
[
i
]
!=
v2
[
i
])
{
if
(
v1
[
i
]
!=
v2
[
i
])
{
return
false
;
return
false
;
}
}
i
++;
}
}
return
true
;
return
true
;
}
}
...
@@ -1038,8 +1039,6 @@ public final class String
...
@@ -1038,8 +1039,6 @@ public final class String
* @since 1.5
* @since 1.5
*/
*/
public
boolean
contentEquals
(
CharSequence
cs
)
{
public
boolean
contentEquals
(
CharSequence
cs
)
{
if
(
value
.
length
!=
cs
.
length
())
return
false
;
// Argument is a StringBuffer, StringBuilder
// Argument is a StringBuffer, StringBuilder
if
(
cs
instanceof
AbstractStringBuilder
)
{
if
(
cs
instanceof
AbstractStringBuilder
)
{
if
(
cs
instanceof
StringBuffer
)
{
if
(
cs
instanceof
StringBuffer
)
{
...
@@ -1055,12 +1054,14 @@ public final class String
...
@@ -1055,12 +1054,14 @@ public final class String
return
true
;
return
true
;
// Argument is a generic CharSequence
// Argument is a generic CharSequence
char
v1
[]
=
value
;
char
v1
[]
=
value
;
int
i
=
0
;
int
n
=
v1
.
length
;
int
n
=
value
.
length
;
if
(
n
!=
cs
.
length
())
{
while
(
n
--
!=
0
)
{
return
false
;
if
(
v1
[
i
]
!=
cs
.
charAt
(
i
))
}
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
if
(
v1
[
i
]
!=
cs
.
charAt
(
i
))
{
return
false
;
return
false
;
i
++;
}
}
}
return
true
;
return
true
;
}
}
...
...
src/share/classes/java/lang/StringBuffer.java
浏览文件 @
7a7eed0f
...
@@ -335,10 +335,8 @@ import java.util.Arrays;
...
@@ -335,10 +335,8 @@ import java.util.Arrays;
* @since 1.5
* @since 1.5
*/
*/
@Override
@Override
public
StringBuffer
append
(
CharSequence
s
)
{
public
synchronized
StringBuffer
append
(
CharSequence
s
)
{
// Note, synchronization achieved via invocations of other StringBuffer methods after
toStringCache
=
null
;
// narrowing of s to specific type
// Ditto for toStringCache clearing
super
.
append
(
s
);
super
.
append
(
s
);
return
this
;
return
this
;
}
}
...
...
src/share/classes/java/lang/Thread.java
浏览文件 @
7a7eed0f
...
@@ -145,10 +145,10 @@ class Thread implements Runnable {
...
@@ -145,10 +145,10 @@ class Thread implements Runnable {
registerNatives
();
registerNatives
();
}
}
private
char
name
[];
private
volatile
char
name
[];
private
int
priority
;
private
int
priority
;
private
Thread
threadQ
;
private
Thread
threadQ
;
private
long
eetop
;
private
long
eetop
;
/* Whether or not to single_step this thread. */
/* Whether or not to single_step this thread. */
private
boolean
single_step
;
private
boolean
single_step
;
...
@@ -1135,7 +1135,7 @@ class Thread implements Runnable {
...
@@ -1135,7 +1135,7 @@ class Thread implements Runnable {
* @see #getName
* @see #getName
* @see #checkAccess()
* @see #checkAccess()
*/
*/
public
final
void
setName
(
String
name
)
{
public
final
synchronized
void
setName
(
String
name
)
{
checkAccess
();
checkAccess
();
this
.
name
=
name
.
toCharArray
();
this
.
name
=
name
.
toCharArray
();
if
(
threadStatus
!=
0
)
{
if
(
threadStatus
!=
0
)
{
...
@@ -1150,7 +1150,7 @@ class Thread implements Runnable {
...
@@ -1150,7 +1150,7 @@ class Thread implements Runnable {
* @see #setName(String)
* @see #setName(String)
*/
*/
public
final
String
getName
()
{
public
final
String
getName
()
{
return
String
.
valueOf
(
nam
e
);
return
new
String
(
name
,
tru
e
);
}
}
/**
/**
...
...
src/share/classes/java/lang/ref/Reference.java
浏览文件 @
7a7eed0f
/*
/*
* Copyright (c) 1997, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -138,8 +138,23 @@ public abstract class Reference<T> {
...
@@ -138,8 +138,23 @@ public abstract class Reference<T> {
pending
=
r
.
discovered
;
pending
=
r
.
discovered
;
r
.
discovered
=
null
;
r
.
discovered
=
null
;
}
else
{
}
else
{
// The waiting on the lock may cause an OOME because it may try to allocate
// exception objects, so also catch OOME here to avoid silent exit of the
// reference handler thread.
//
// Explicitly define the order of the two exceptions we catch here
// when waiting for the lock.
//
// We do not want to try to potentially load the InterruptedException class
// (which would be done if this was its first use, and InterruptedException
// were checked first) in this situation.
//
// This may lead to the VM not ever trying to load the InterruptedException
// class again.
try
{
try
{
lock
.
wait
();
try
{
lock
.
wait
();
}
catch
(
OutOfMemoryError
x
)
{
}
}
catch
(
InterruptedException
x
)
{
}
}
catch
(
InterruptedException
x
)
{
}
continue
;
continue
;
}
}
...
...
src/share/classes/java/lang/reflect/GenericDeclaration.java
浏览文件 @
7a7eed0f
/*
/*
* Copyright (c) 2003, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -30,7 +30,7 @@ package java.lang.reflect;
...
@@ -30,7 +30,7 @@ package java.lang.reflect;
*
*
* @since 1.5
* @since 1.5
*/
*/
public
interface
GenericDeclaration
{
public
interface
GenericDeclaration
extends
AnnotatedElement
{
/**
/**
* Returns an array of {@code TypeVariable} objects that
* Returns an array of {@code TypeVariable} objects that
* represent the type variables declared by the generic
* represent the type variables declared by the generic
...
...
src/share/classes/java/nio/charset/Charset-X-Coder.java.template
浏览文件 @
7a7eed0f
...
@@ -34,6 +34,7 @@ import java.nio.BufferOverflowException;
...
@@ -34,6 +34,7 @@ import java.nio.BufferOverflowException;
import
java
.
nio
.
BufferUnderflowException
;
import
java
.
nio
.
BufferUnderflowException
;
import
java
.
lang
.
ref
.
WeakReference
;
import
java
.
lang
.
ref
.
WeakReference
;
import
java
.
nio
.
charset
.
CoderMalfunctionError
;
//
javadoc
import
java
.
nio
.
charset
.
CoderMalfunctionError
;
//
javadoc
import
java
.
util
.
Arrays
;
/**
/**
...
@@ -244,7 +245,12 @@ public abstract class Charset$Coder$ {
...
@@ -244,7 +245,12 @@ public abstract class Charset$Coder$ {
*
which
is
never
<
tt
>
null
</
tt
>
and
is
never
empty
*
which
is
never
<
tt
>
null
</
tt
>
and
is
never
empty
*/
*/
public
final
$
replType
$
replacement
()
{
public
final
$
replType
$
replacement
()
{
#
if
[
decoder
]
return
replacement
;
return
replacement
;
#
end
[
decoder
]
#
if
[
encoder
]
return
Arrays
.
copyOf
(
replacement
,
replacement
.$
replLength
$);
#
end
[
encoder
]
}
}
/**
/**
...
@@ -280,12 +286,15 @@ public abstract class Charset$Coder$ {
...
@@ -280,12 +286,15 @@ public abstract class Charset$Coder$ {
throw new IllegalArgumentException("Empty replacement");
throw new IllegalArgumentException("Empty replacement");
if (len > max$ItypesPerOtype$)
if (len > max$ItypesPerOtype$)
throw new IllegalArgumentException("Replacement too long");
throw new IllegalArgumentException("Replacement too long");
#if[decoder]
this.replacement = newReplacement;
#end[decoder]
#if[encoder]
#if[encoder]
if (!isLegalReplacement(newReplacement))
if (!isLegalReplacement(newReplacement))
throw new IllegalArgumentException("Illegal replacement");
throw new IllegalArgumentException("Illegal replacement");
this.replacement = Arrays.copyOf(newReplacement, newReplacement.$replLength$);
#end[encoder]
#end[encoder]
this.replacement = newReplacement;
implReplaceWith(this.replacement);
implReplaceWith(newReplacement);
return this;
return this;
}
}
...
...
src/share/classes/java/nio/file/FileTreeIterator.java
0 → 100644
浏览文件 @
7a7eed0f
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
java.nio.file
;
import
java.io.Closeable
;
import
java.io.IOException
;
import
java.io.UncheckedIOException
;
import
java.util.Arrays
;
import
java.util.Iterator
;
import
java.util.NoSuchElementException
;
import
java.util.Objects
;
import
java.nio.file.FileTreeWalker.Event
;
/**
* An {@code Iterator to iterate over the nodes of a file tree.
*
* <pre>{@code
* try (FileTreeIterator iterator = new FileTreeIterator(start, maxDepth, options)) {
* while (iterator.hasNext()) {
* Event ev = iterator.next();
* Path path = ev.file();
* BasicFileAttributes attrs = ev.attributes();
* }
* }
* }</pre>
*/
class
FileTreeIterator
implements
Iterator
<
Event
>,
Closeable
{
private
final
FileTreeWalker
walker
;
private
Event
next
;
/**
* Creates a new iterator to walk the file tree starting at the given file.
*
* @throws IllegalArgumentException
* if {@code maxDepth} is negative
* @throws IOException
* if an I/O errors occurs opening the starting file
* @throws SecurityException
* if the security manager denies access to the starting file
* @throws NullPointerException
* if {@code start} or {@code options} is {@ocde null} or
* the options array contains a {@code null} element
*/
FileTreeIterator
(
Path
start
,
int
maxDepth
,
FileVisitOption
...
options
)
throws
IOException
{
this
.
walker
=
new
FileTreeWalker
(
Arrays
.
asList
(
options
),
maxDepth
);
this
.
next
=
walker
.
walk
(
start
);
assert
next
.
type
()
==
FileTreeWalker
.
EventType
.
ENTRY
||
next
.
type
()
==
FileTreeWalker
.
EventType
.
START_DIRECTORY
;
// IOException if there a problem accessing the starting file
IOException
ioe
=
next
.
ioeException
();
if
(
ioe
!=
null
)
throw
ioe
;
}
private
void
fetchNextIfNeeded
()
{
if
(
next
==
null
)
{
FileTreeWalker
.
Event
ev
=
walker
.
next
();
while
(
ev
!=
null
)
{
IOException
ioe
=
ev
.
ioeException
();
if
(
ioe
!=
null
)
throw
new
UncheckedIOException
(
ioe
);
// END_DIRECTORY events are ignored
if
(
ev
.
type
()
!=
FileTreeWalker
.
EventType
.
END_DIRECTORY
)
{
next
=
ev
;
return
;
}
ev
=
walker
.
next
();
}
}
}
@Override
public
boolean
hasNext
()
{
if
(!
walker
.
isOpen
())
throw
new
IllegalStateException
();
fetchNextIfNeeded
();
return
next
!=
null
;
}
@Override
public
Event
next
()
{
if
(!
walker
.
isOpen
())
throw
new
IllegalStateException
();
fetchNextIfNeeded
();
if
(
next
==
null
)
throw
new
NoSuchElementException
();
Event
result
=
next
;
next
=
null
;
return
result
;
}
@Override
public
void
close
()
{
walker
.
close
();
}
}
src/share/classes/java/nio/file/FileTreeWalker.java
浏览文件 @
7a7eed0f
...
@@ -29,8 +29,8 @@ import java.nio.file.attribute.BasicFileAttributes;
...
@@ -29,8 +29,8 @@ import java.nio.file.attribute.BasicFileAttributes;
import
java.io.Closeable
;
import
java.io.Closeable
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayDeque
;
import
java.util.ArrayDeque
;
import
java.util.Collection
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.Set
;
import
sun.nio.fs.BasicFileAttributesHolder
;
import
sun.nio.fs.BasicFileAttributesHolder
;
/**
/**
...
@@ -164,8 +164,17 @@ class FileTreeWalker implements Closeable {
...
@@ -164,8 +164,17 @@ class FileTreeWalker implements Closeable {
/**
/**
* Creates a {@code FileTreeWalker}.
* Creates a {@code FileTreeWalker}.
*
* @throws IllegalArgumentException
* if {@code maxDepth} is negative
* @throws ClassCastException
* if (@code options} contains an element that is not a
* {@code FileVisitOption}
* @throws NullPointerException
* if {@code options} is {@ocde null} or the options
* array contains a {@code null} element
*/
*/
FileTreeWalker
(
Set
<
FileVisitOption
>
options
,
int
maxDepth
)
{
FileTreeWalker
(
Collection
<
FileVisitOption
>
options
,
int
maxDepth
)
{
boolean
fl
=
false
;
boolean
fl
=
false
;
for
(
FileVisitOption
option:
options
)
{
for
(
FileVisitOption
option:
options
)
{
// will throw NPE if options contains null
// will throw NPE if options contains null
...
@@ -175,6 +184,9 @@ class FileTreeWalker implements Closeable {
...
@@ -175,6 +184,9 @@ class FileTreeWalker implements Closeable {
throw
new
AssertionError
(
"Should not get here"
);
throw
new
AssertionError
(
"Should not get here"
);
}
}
}
}
if
(
maxDepth
<
0
)
throw
new
IllegalArgumentException
(
"'maxDepth' is negative"
);
this
.
followLinks
=
fl
;
this
.
followLinks
=
fl
;
this
.
linkOptions
=
(
fl
)
?
new
LinkOption
[
0
]
:
this
.
linkOptions
=
(
fl
)
?
new
LinkOption
[
0
]
:
new
LinkOption
[]
{
LinkOption
.
NOFOLLOW_LINKS
};
new
LinkOption
[]
{
LinkOption
.
NOFOLLOW_LINKS
};
...
...
src/share/classes/java/nio/file/Files.java
浏览文件 @
7a7eed0f
...
@@ -25,10 +25,13 @@
...
@@ -25,10 +25,13 @@
package
java.nio.file
;
package
java.nio.file
;
import
java.nio.ByteBuffer
;
import
java.nio.file.attribute.*
;
import
java.nio.file.attribute.*
;
import
java.nio.file.spi.FileSystemProvider
;
import
java.nio.file.spi.FileSystemProvider
;
import
java.nio.file.spi.FileTypeDetector
;
import
java.nio.file.spi.FileTypeDetector
;
import
java.nio.channels.FileChannel
;
import
java.nio.channels.SeekableByteChannel
;
import
java.nio.channels.SeekableByteChannel
;
import
java.io.Closeable
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.io.Reader
;
import
java.io.Reader
;
...
@@ -38,7 +41,13 @@ import java.io.BufferedWriter;
...
@@ -38,7 +41,13 @@ import java.io.BufferedWriter;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.io.OutputStreamWriter
;
import
java.io.OutputStreamWriter
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.UncheckedIOException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.BiPredicate
;
import
java.util.stream.CloseableStream
;
import
java.util.stream.DelegatingStream
;
import
java.util.stream.Stream
;
import
java.util.stream.StreamSupport
;
import
java.security.AccessController
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.security.PrivilegedAction
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
...
@@ -2587,9 +2596,6 @@ public final class Files {
...
@@ -2587,9 +2596,6 @@ public final class Files {
FileVisitor
<?
super
Path
>
visitor
)
FileVisitor
<?
super
Path
>
visitor
)
throws
IOException
throws
IOException
{
{
if
(
maxDepth
<
0
)
throw
new
IllegalArgumentException
(
"'maxDepth' is negative"
);
/**
/**
* Create a FileTreeWalker to walk the file tree, invoking the visitor
* Create a FileTreeWalker to walk the file tree, invoking the visitor
* for each event.
* for each event.
...
@@ -2940,40 +2946,6 @@ public final class Files {
...
@@ -2940,40 +2946,6 @@ public final class Files {
}
}
}
}
/**
* Read all the bytes from an input stream. The {@code initialSize}
* parameter indicates the initial size of the byte[] to allocate.
*/
private
static
byte
[]
read
(
InputStream
source
,
int
initialSize
)
throws
IOException
{
int
capacity
=
initialSize
;
byte
[]
buf
=
new
byte
[
capacity
];
int
nread
=
0
;
int
rem
=
buf
.
length
;
int
n
;
// read to EOF which may read more or less than initialSize (eg: file
// is truncated while we are reading)
while
((
n
=
source
.
read
(
buf
,
nread
,
rem
))
>
0
)
{
nread
+=
n
;
rem
-=
n
;
assert
rem
>=
0
;
if
(
rem
==
0
)
{
// need larger buffer
int
newCapacity
=
capacity
<<
1
;
if
(
newCapacity
<
0
)
{
if
(
capacity
==
Integer
.
MAX_VALUE
)
throw
new
OutOfMemoryError
(
"Required array size too large"
);
newCapacity
=
Integer
.
MAX_VALUE
;
}
rem
=
newCapacity
-
capacity
;
buf
=
Arrays
.
copyOf
(
buf
,
newCapacity
);
capacity
=
newCapacity
;
}
}
return
(
capacity
==
nread
)
?
buf
:
Arrays
.
copyOf
(
buf
,
nread
);
}
/**
/**
* Read all the bytes from a file. The method ensures that the file is
* Read all the bytes from a file. The method ensures that the file is
* closed when all bytes have been read or an I/O error, or other runtime
* closed when all bytes have been read or an I/O error, or other runtime
...
@@ -2999,12 +2971,22 @@ public final class Files {
...
@@ -2999,12 +2971,22 @@ public final class Files {
* method is invoked to check read access to the file.
* method is invoked to check read access to the file.
*/
*/
public
static
byte
[]
readAllBytes
(
Path
path
)
throws
IOException
{
public
static
byte
[]
readAllBytes
(
Path
path
)
throws
IOException
{
long
size
=
size
(
path
);
try
(
FileChannel
fc
=
FileChannel
.
open
(
path
))
{
if
(
size
>
(
long
)
Integer
.
MAX_VALUE
)
long
size
=
fc
.
size
();
throw
new
OutOfMemoryError
(
"Required array size too large"
);
if
(
size
>
(
long
)
Integer
.
MAX_VALUE
)
throw
new
OutOfMemoryError
(
"Required array size too large"
);
byte
[]
arr
=
new
byte
[(
int
)
size
];
ByteBuffer
bb
=
ByteBuffer
.
wrap
(
arr
);
while
(
bb
.
hasRemaining
())
{
if
(
fc
.
read
(
bb
)
<
0
)
{
// truncated
break
;
}
}
try
(
InputStream
in
=
newInputStream
(
path
))
{
int
nread
=
bb
.
position
();
return
read
(
in
,
(
int
)
size
);
return
(
nread
==
size
)
?
arr
:
Arrays
.
copyOf
(
arr
,
nread
);
}
}
}
}
...
@@ -3177,4 +3159,336 @@ public final class Files {
...
@@ -3177,4 +3159,336 @@ public final class Files {
}
}
return
path
;
return
path
;
}
}
// -- Stream APIs --
/**
* Implementation of CloseableStream
*/
private
static
class
DelegatingCloseableStream
<
T
>
extends
DelegatingStream
<
T
>
implements
CloseableStream
<
T
>
{
private
final
Closeable
closeable
;
DelegatingCloseableStream
(
Closeable
c
,
Stream
<
T
>
delegate
)
{
super
(
delegate
);
this
.
closeable
=
c
;
}
public
void
close
()
{
try
{
closeable
.
close
();
}
catch
(
IOException
ex
)
{
throw
new
UncheckedIOException
(
ex
);
}
}
}
/**
* Return a lazily populated {@code CloseableStream}, the elements of
* which are the entries in the directory. The listing is not recursive.
*
* <p> The elements of the stream are {@link Path} objects that are
* obtained as if by {@link Path#resolve(Path) resolving} the name of the
* directory entry against {@code dir}. Some file systems maintain special
* links to the directory itself and the directory's parent directory.
* Entries representing these links are not included.
*
* <p> The stream is <i>weakly consistent</i>. It is thread safe but does
* not freeze the directory while iterating, so it may (or may not)
* reflect updates to the directory that occur after returning from this
* method.
*
* <p> When not using the try-with-resources construct, then the stream's
* {@link CloseableStream#close close} method should be invoked after the
* operation is completed so as to free any resources held for the open
* directory. Operating on a closed stream behaves as if the end of stream
* has been reached. Due to read-ahead, one or more elements may be
* returned after the stream has been closed.
*
* <p> If an {@link IOException} is thrown when accessing the directory
* after this method has returned, it is wrapped in an {@link
* UncheckedIOException} which will be thrown from the method that caused
* the access to take place.
*
* @param dir The path to the directory
*
* @return The {@code CloseableStream} describing the content of the
* directory
*
* @throws NotDirectoryException
* if the file could not otherwise be opened because it is not
* a directory <i>(optional specific exception)</i>
* @throws IOException
* if an I/O error occurs when opening the directory
* @throws SecurityException
* In the case of the default provider, and a security manager is
* installed, the {@link SecurityManager#checkRead(String) checkRead}
* method is invoked to check read access to the directory.
*
* @see #newDirectoryStream(Path)
* @since 1.8
*/
public
static
CloseableStream
<
Path
>
list
(
Path
dir
)
throws
IOException
{
DirectoryStream
<
Path
>
ds
=
Files
.
newDirectoryStream
(
dir
);
final
Iterator
<
Path
>
delegate
=
ds
.
iterator
();
// Re-wrap DirectoryIteratorException to UncheckedIOException
Iterator
<
Path
>
it
=
new
Iterator
<
Path
>()
{
public
boolean
hasNext
()
{
try
{
return
delegate
.
hasNext
();
}
catch
(
DirectoryIteratorException
e
)
{
throw
new
UncheckedIOException
(
e
.
getCause
());
}
}
public
Path
next
()
{
try
{
return
delegate
.
next
();
}
catch
(
DirectoryIteratorException
e
)
{
throw
new
UncheckedIOException
(
e
.
getCause
());
}
}
};
return
new
DelegatingCloseableStream
<>(
ds
,
StreamSupport
.
stream
(
Spliterators
.
spliteratorUnknownSize
(
it
,
Spliterator
.
DISTINCT
)));
}
/**
* Return a {@code CloseableStream} that is lazily populated with {@code
* Path} by walking the file tree rooted at a given starting file. The
* file tree is traversed <em>depth-first</em>, the elements in the stream
* are {@link Path} objects that are obtained as if by {@link
* Path#resolve(Path) resolving} the relative path against {@code start}.
*
* <p> The {@code stream} walks the file tree as elements are consumed.
* The {@code CloseableStream} returned is guaranteed to have at least one
* element, the starting file itself. For each file visited, the stream
* attempts to read its {@link BasicFileAttributes}. If the file is a
* directory and can be opened successfully, entries in the directory, and
* their <em>descendants</em> will follow the directory in the stream as
* they are encountered. When all entries have been visited, then the
* directory is closed. The file tree walk then continues at the next
* <em>sibling</em> of the directory.
*
* <p> The stream is <i>weakly consistent</i>. It does not freeze the
* file tree while iterating, so it may (or may not) reflect updates to
* the file tree that occur after returned from this method.
*
* <p> By default, symbolic links are not automatically followed by this
* method. If the {@code options} parameter contains the {@link
* FileVisitOption#FOLLOW_LINKS FOLLOW_LINKS} option then symbolic links are
* followed. When following links, and the attributes of the target cannot
* be read, then this method attempts to get the {@code BasicFileAttributes}
* of the link.
*
* <p> If the {@code options} parameter contains the {@link
* FileVisitOption#FOLLOW_LINKS FOLLOW_LINKS} option then the stream keeps
* track of directories visited so that cycles can be detected. A cycle
* arises when there is an entry in a directory that is an ancestor of the
* directory. Cycle detection is done by recording the {@link
* java.nio.file.attribute.BasicFileAttributes#fileKey file-key} of directories,
* or if file keys are not available, by invoking the {@link #isSameFile
* isSameFile} method to test if a directory is the same file as an
* ancestor. When a cycle is detected it is treated as an I/O error with
* an instance of {@link FileSystemLoopException}.
*
* <p> The {@code maxDepth} parameter is the maximum number of levels of
* directories to visit. A value of {@code 0} means that only the starting
* file is visited, unless denied by the security manager. A value of
* {@link Integer#MAX_VALUE MAX_VALUE} may be used to indicate that all
* levels should be visited.
*
* <p> When a security manager is installed and it denies access to a file
* (or directory), then it is ignored and not included in the stream.
*
* <p> When not using the try-with-resources construct, then the stream's
* {@link CloseableStream#close close} method should be invoked after the
* operation is completed so as to free any resources held for the open
* directory. Operate the stream after it is closed will throw an
* {@link java.lang.IllegalStateException}.
*
* <p> If an {@link IOException} is thrown when accessing the directory
* after this method has returned, it is wrapped in an {@link
* UncheckedIOException} which will be thrown from the method that caused
* the access to take place.
*
* @param start
* the starting file
* @param maxDepth
* the maximum number of directory levels to visit
* @param options
* options to configure the traversal
*
* @return the {@link CloseableStream} of {@link Path}
*
* @throws IllegalArgumentException
* if the {@code maxDepth} parameter is negative
* @throws SecurityException
* If the security manager denies access to the starting file.
* In the case of the default provider, the {@link
* SecurityManager#checkRead(String) checkRead} method is invoked
* to check read access to the directory.
* @throws IOException
* if an I/O error is thrown when accessing the starting file.
* @since 1.8
*/
public
static
CloseableStream
<
Path
>
walk
(
Path
start
,
int
maxDepth
,
FileVisitOption
...
options
)
throws
IOException
{
FileTreeIterator
iterator
=
new
FileTreeIterator
(
start
,
maxDepth
,
options
);
return
new
DelegatingCloseableStream
<>(
iterator
,
StreamSupport
.
stream
(
Spliterators
.
spliteratorUnknownSize
(
iterator
,
Spliterator
.
DISTINCT
))
.
map
(
entry
->
entry
.
file
()));
}
/**
* Return a {@code CloseableStream} that is lazily populated with {@code
* Path} by walking the file tree rooted at a given starting file. The
* file tree is traversed <em>depth-first</em>, the elements in the stream
* are {@link Path} objects that are obtained as if by {@link
* Path#resolve(Path) resolving} the relative path against {@code start}.
*
* <p> This method works as if invoking it were equivalent to evaluating the
* expression:
* <blockquote><pre>
* walk(start, Integer.MAX_VALUE, options)
* </pre></blockquote>
* In other words, it visits all levels of the file tree.
*
* @param start
* the starting file
* @param options
* options to configure the traversal
*
* @return the {@link CloseableStream} of {@link Path}
*
* @throws SecurityException
* If the security manager denies access to the starting file.
* In the case of the default provider, the {@link
* SecurityManager#checkRead(String) checkRead} method is invoked
* to check read access to the directory.
* @throws IOException
* if an I/O error is thrown when accessing the starting file.
*
* @see #walk(Path, int, FileVisitOption...)
* @since 1.8
*/
public
static
CloseableStream
<
Path
>
walk
(
Path
start
,
FileVisitOption
...
options
)
throws
IOException
{
return
walk
(
start
,
Integer
.
MAX_VALUE
,
options
);
}
/**
* Return a {@code CloseableStream} that is lazily populated with {@code
* Path} by searching for files in a file tree rooted at a given starting
* file.
*
* <p> This method walks the file tree in exactly the manner specified by
* the {@link #walk walk} method. For each file encountered, the given
* {@link BiPredicate} is invoked with its {@link Path} and {@link
* BasicFileAttributes}. The {@code Path} object is obtained as if by
* {@link Path#resolve(Path) resolving} the relative path against {@code
* start} and is only included in the returned {@link CloseableStream} if
* the {@code BiPredicate} returns true. Compare to calling {@link
* java.util.stream.Stream#filter filter} on the {@code Stream}
* returned by {@code walk} method, this method may be more efficient by
* avoiding redundant retrieval of the {@code BasicFileAttributes}.
*
* <p> If an {@link IOException} is thrown when accessing the directory
* after returned from this method, it is wrapped in an {@link
* UncheckedIOException} which will be thrown from the method that caused
* the access to take place.
*
* @param start
* the starting file
* @param maxDepth
* the maximum number of directory levels to search
* @param matcher
* the function used to decide whether a file should be included
* in the returned stream
* @param options
* options to configure the traversal
*
* @return the {@link CloseableStream} of {@link Path}
*
* @throws IllegalArgumentException
* if the {@code maxDepth} parameter is negative
* @throws SecurityException
* If the security manager denies access to the starting file.
* In the case of the default provider, the {@link
* SecurityManager#checkRead(String) checkRead} method is invoked
* to check read access to the directory.
* @throws IOException
* if an I/O error is thrown when accessing the starting file.
*
* @see #walk(Path, int, FileVisitOption...)
* @since 1.8
*/
public
static
CloseableStream
<
Path
>
find
(
Path
start
,
int
maxDepth
,
BiPredicate
<
Path
,
BasicFileAttributes
>
matcher
,
FileVisitOption
...
options
)
throws
IOException
{
FileTreeIterator
iterator
=
new
FileTreeIterator
(
start
,
maxDepth
,
options
);
return
new
DelegatingCloseableStream
<>(
iterator
,
StreamSupport
.
stream
(
Spliterators
.
spliteratorUnknownSize
(
iterator
,
Spliterator
.
DISTINCT
))
.
filter
(
entry
->
matcher
.
test
(
entry
.
file
(),
entry
.
attributes
()))
.
map
(
entry
->
entry
.
file
()));
}
/**
* Read all lines from a file as a {@code CloseableStream}. Unlike {@link
* #readAllLines(Path, Charset) readAllLines}, this method does not read
* all lines into a {@code List}, but instead populates lazily as the stream
* is consumed.
*
* <p> Bytes from the file are decoded into characters using the specified
* charset and the same line terminators as specified by {@code
* readAllLines} are supported.
*
* <p> After this method returns, then any subsequent I/O exception that
* occurs while reading from the file or when a malformed or unmappable byte
* sequence is read, is wrapped in an {@link UncheckedIOException} that will
* be thrown form the
* {@link java.util.stream.Stream} method that caused the read to take
* place. In case an {@code IOException} is thrown when closing the file,
* it is also wrapped as an {@code UncheckedIOException}.
*
* <p> When not using the try-with-resources construct, then stream's
* {@link CloseableStream#close close} method should be invoked after
* operation is completed so as to free any resources held for the open
* file.
*
* @param path
* the path to the file
* @param cs
* the charset to use for decoding
*
* @return the lines from the file as a {@code CloseableStream}
*
* @throws IOException
* if an I/O error occurs opening the file
* @throws SecurityException
* In the case of the default provider, and a security manager is
* installed, the {@link SecurityManager#checkRead(String) checkRead}
* method is invoked to check read access to the file.
*
* @see #readAllLines(Path, Charset)
* @see #newBufferedReader(Path, Charset)
* @see java.io.BufferedReader#lines()
* @since 1.8
*/
public
static
CloseableStream
<
String
>
lines
(
Path
path
,
Charset
cs
)
throws
IOException
{
BufferedReader
br
=
Files
.
newBufferedReader
(
path
,
cs
);
return
new
DelegatingCloseableStream
<>(
br
,
br
.
lines
());
}
}
}
src/share/classes/java/text/DateFormatSymbols.java
浏览文件 @
7a7eed0f
...
@@ -59,7 +59,7 @@ import sun.util.locale.provider.TimeZoneNameUtility;
...
@@ -59,7 +59,7 @@ import sun.util.locale.provider.TimeZoneNameUtility;
* <code>DateFormatSymbols</code> is a public class for encapsulating
* <code>DateFormatSymbols</code> is a public class for encapsulating
* localizable date-time formatting data, such as the names of the
* localizable date-time formatting data, such as the names of the
* months, the names of the days of the week, and the time zone data.
* months, the names of the days of the week, and the time zone data.
* <code>
DateFormat</code> and <code>SimpleDateFormat</code> both use
* <code>
SimpleDateFormat</code> uses
* <code>DateFormatSymbols</code> to encapsulate this information.
* <code>DateFormatSymbols</code> to encapsulate this information.
*
*
* <p>
* <p>
...
...
src/share/classes/java/util/Arrays.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/ArraysParallelSortHelpers.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/ComparableTimSort.java
浏览文件 @
7a7eed0f
...
@@ -86,9 +86,13 @@ class ComparableTimSort {
...
@@ -86,9 +86,13 @@ class ComparableTimSort {
private
static
final
int
INITIAL_TMP_STORAGE_LENGTH
=
256
;
private
static
final
int
INITIAL_TMP_STORAGE_LENGTH
=
256
;
/**
/**
* Temp storage for merges.
* Temp storage for merges. A workspace array may optionally be
* provided in constructor, and if so will be used as long as it
* is big enough.
*/
*/
private
Object
[]
tmp
;
private
Object
[]
tmp
;
private
int
tmpBase
;
// base of tmp array slice
private
int
tmpLen
;
// length of tmp array slice
/**
/**
* A stack of pending runs yet to be merged. Run i starts at
* A stack of pending runs yet to be merged. Run i starts at
...
@@ -108,15 +112,27 @@ class ComparableTimSort {
...
@@ -108,15 +112,27 @@ class ComparableTimSort {
* Creates a TimSort instance to maintain the state of an ongoing sort.
* Creates a TimSort instance to maintain the state of an ongoing sort.
*
*
* @param a the array to be sorted
* @param a the array to be sorted
* @param work a workspace array (slice)
* @param workBase origin of usable space in work array
* @param workLen usable size of work array
*/
*/
private
ComparableTimSort
(
Object
[]
a
)
{
private
ComparableTimSort
(
Object
[]
a
,
Object
[]
work
,
int
workBase
,
int
workLen
)
{
this
.
a
=
a
;
this
.
a
=
a
;
// Allocate temp storage (which may be increased later if necessary)
// Allocate temp storage (which may be increased later if necessary)
int
len
=
a
.
length
;
int
len
=
a
.
length
;
Object
[]
newArray
=
new
Object
[
len
<
2
*
INITIAL_TMP_STORAGE_LENGTH
?
int
tlen
=
(
len
<
2
*
INITIAL_TMP_STORAGE_LENGTH
)
?
len
>>>
1
:
INITIAL_TMP_STORAGE_LENGTH
];
len
>>>
1
:
INITIAL_TMP_STORAGE_LENGTH
;
tmp
=
newArray
;
if
(
work
==
null
||
workLen
<
tlen
||
workBase
+
tlen
>
work
.
length
)
{
tmp
=
new
Object
[
tlen
];
tmpBase
=
0
;
tmpLen
=
tlen
;
}
else
{
tmp
=
work
;
tmpBase
=
workBase
;
tmpLen
=
workLen
;
}
/*
/*
* Allocate runs-to-be-merged stack (which cannot be expanded). The
* Allocate runs-to-be-merged stack (which cannot be expanded). The
...
@@ -136,17 +152,28 @@ class ComparableTimSort {
...
@@ -136,17 +152,28 @@ class ComparableTimSort {
}
}
/*
/*
* The next two methods (which are package private and static) constitute
* The next method (package private and static) constitutes the
* the entire API of this class. Each of these methods obeys the contract
* entire API of this class.
* of the public method with the same signature in java.util.Arrays.
*/
*/
static
void
sort
(
Object
[]
a
)
{
/**
sort
(
a
,
0
,
a
.
length
);
* Sorts the given range, using the given workspace array slice
}
* for temp storage when possible. This method is designed to be
* invoked from public methods (in class Arrays) after performing
* any necessary array bounds checks and expanding parameters into
* the required forms.
*
* @param a the array to be sorted
* @param lo the index of the first element, inclusive, to be sorted
* @param hi the index of the last element, exclusive, to be sorted
* @param work a workspace array (slice)
* @param workBase origin of usable space in work array
* @param workLen usable size of work array
* @since 1.8
*/
static
void
sort
(
Object
[]
a
,
int
lo
,
int
hi
,
Object
[]
work
,
int
workBase
,
int
workLen
)
{
assert
a
!=
null
&&
lo
>=
0
&&
lo
<=
hi
&&
hi
<=
a
.
length
;
static
void
sort
(
Object
[]
a
,
int
lo
,
int
hi
)
{
rangeCheck
(
a
.
length
,
lo
,
hi
);
int
nRemaining
=
hi
-
lo
;
int
nRemaining
=
hi
-
lo
;
if
(
nRemaining
<
2
)
if
(
nRemaining
<
2
)
return
;
// Arrays of size 0 and 1 are always sorted
return
;
// Arrays of size 0 and 1 are always sorted
...
@@ -163,7 +190,7 @@ class ComparableTimSort {
...
@@ -163,7 +190,7 @@ class ComparableTimSort {
* extending short natural runs to minRun elements, and merging runs
* extending short natural runs to minRun elements, and merging runs
* to maintain stack invariant.
* to maintain stack invariant.
*/
*/
ComparableTimSort
ts
=
new
ComparableTimSort
(
a
);
ComparableTimSort
ts
=
new
ComparableTimSort
(
a
,
work
,
workBase
,
workLen
);
int
minRun
=
minRunLength
(
nRemaining
);
int
minRun
=
minRunLength
(
nRemaining
);
do
{
do
{
// Identify next run
// Identify next run
...
@@ -619,11 +646,11 @@ class ComparableTimSort {
...
@@ -619,11 +646,11 @@ class ComparableTimSort {
// Copy first run into temp array
// Copy first run into temp array
Object
[]
a
=
this
.
a
;
// For performance
Object
[]
a
=
this
.
a
;
// For performance
Object
[]
tmp
=
ensureCapacity
(
len1
);
Object
[]
tmp
=
ensureCapacity
(
len1
);
System
.
arraycopy
(
a
,
base1
,
tmp
,
0
,
len1
);
int
cursor1
=
0
;
// Indexes into tmp array
int
cursor1
=
tmpBase
;
// Indexes into tmp array
int
cursor2
=
base2
;
// Indexes int a
int
cursor2
=
base2
;
// Indexes int a
int
dest
=
base1
;
// Indexes int a
int
dest
=
base1
;
// Indexes int a
System
.
arraycopy
(
a
,
base1
,
tmp
,
cursor1
,
len1
);
// Move first element of second run and deal with degenerate cases
// Move first element of second run and deal with degenerate cases
a
[
dest
++]
=
a
[
cursor2
++];
a
[
dest
++]
=
a
[
cursor2
++];
...
@@ -736,16 +763,17 @@ class ComparableTimSort {
...
@@ -736,16 +763,17 @@ class ComparableTimSort {
// Copy second run into temp array
// Copy second run into temp array
Object
[]
a
=
this
.
a
;
// For performance
Object
[]
a
=
this
.
a
;
// For performance
Object
[]
tmp
=
ensureCapacity
(
len2
);
Object
[]
tmp
=
ensureCapacity
(
len2
);
System
.
arraycopy
(
a
,
base2
,
tmp
,
0
,
len2
);
int
tmpBase
=
this
.
tmpBase
;
System
.
arraycopy
(
a
,
base2
,
tmp
,
tmpBase
,
len2
);
int
cursor1
=
base1
+
len1
-
1
;
// Indexes into a
int
cursor1
=
base1
+
len1
-
1
;
// Indexes into a
int
cursor2
=
len2
-
1
;
// Indexes into tmp array
int
cursor2
=
tmpBase
+
len2
-
1
;
// Indexes into tmp array
int
dest
=
base2
+
len2
-
1
;
// Indexes into a
int
dest
=
base2
+
len2
-
1
;
// Indexes into a
// Move last element of first run and deal with degenerate cases
// Move last element of first run and deal with degenerate cases
a
[
dest
--]
=
a
[
cursor1
--];
a
[
dest
--]
=
a
[
cursor1
--];
if
(--
len1
==
0
)
{
if
(--
len1
==
0
)
{
System
.
arraycopy
(
tmp
,
0
,
a
,
dest
-
(
len2
-
1
),
len2
);
System
.
arraycopy
(
tmp
,
tmpBase
,
a
,
dest
-
(
len2
-
1
),
len2
);
return
;
return
;
}
}
if
(
len2
==
1
)
{
if
(
len2
==
1
)
{
...
@@ -803,7 +831,7 @@ class ComparableTimSort {
...
@@ -803,7 +831,7 @@ class ComparableTimSort {
if
(--
len2
==
1
)
if
(--
len2
==
1
)
break
outer
;
break
outer
;
count2
=
len2
-
gallopLeft
((
Comparable
)
a
[
cursor1
],
tmp
,
0
,
len2
,
len2
-
1
);
count2
=
len2
-
gallopLeft
((
Comparable
)
a
[
cursor1
],
tmp
,
tmpBase
,
len2
,
len2
-
1
);
if
(
count2
!=
0
)
{
if
(
count2
!=
0
)
{
dest
-=
count2
;
dest
-=
count2
;
cursor2
-=
count2
;
cursor2
-=
count2
;
...
@@ -835,7 +863,7 @@ class ComparableTimSort {
...
@@ -835,7 +863,7 @@ class ComparableTimSort {
}
else
{
}
else
{
assert
len1
==
0
;
assert
len1
==
0
;
assert
len2
>
0
;
assert
len2
>
0
;
System
.
arraycopy
(
tmp
,
0
,
a
,
dest
-
(
len2
-
1
),
len2
);
System
.
arraycopy
(
tmp
,
tmpBase
,
a
,
dest
-
(
len2
-
1
),
len2
);
}
}
}
}
...
@@ -848,7 +876,7 @@ class ComparableTimSort {
...
@@ -848,7 +876,7 @@ class ComparableTimSort {
* @return tmp, whether or not it grew
* @return tmp, whether or not it grew
*/
*/
private
Object
[]
ensureCapacity
(
int
minCapacity
)
{
private
Object
[]
ensureCapacity
(
int
minCapacity
)
{
if
(
tmp
.
length
<
minCapacity
)
{
if
(
tmp
Len
<
minCapacity
)
{
// Compute smallest power of 2 > minCapacity
// Compute smallest power of 2 > minCapacity
int
newSize
=
minCapacity
;
int
newSize
=
minCapacity
;
newSize
|=
newSize
>>
1
;
newSize
|=
newSize
>>
1
;
...
@@ -863,30 +891,13 @@ class ComparableTimSort {
...
@@ -863,30 +891,13 @@ class ComparableTimSort {
else
else
newSize
=
Math
.
min
(
newSize
,
a
.
length
>>>
1
);
newSize
=
Math
.
min
(
newSize
,
a
.
length
>>>
1
);
@SuppressWarnings
({
"unchecked"
,
"UnnecessaryLocalVariable"
})
Object
[]
newArray
=
new
Object
[
newSize
];
Object
[]
newArray
=
new
Object
[
newSize
];
tmp
=
newArray
;
tmp
=
newArray
;
tmpLen
=
newSize
;
tmpBase
=
0
;
}
}
return
tmp
;
return
tmp
;
}
}
/**
* Checks that fromIndex and toIndex are in range, and throws an
* appropriate exception if they aren't.
*
* @param arrayLen the length of the array
* @param fromIndex the index of the first element of the range
* @param toIndex the index after the last element of the range
* @throws IllegalArgumentException if fromIndex > toIndex
* @throws ArrayIndexOutOfBoundsException if fromIndex < 0
* or toIndex > arrayLen
*/
private
static
void
rangeCheck
(
int
arrayLen
,
int
fromIndex
,
int
toIndex
)
{
if
(
fromIndex
>
toIndex
)
throw
new
IllegalArgumentException
(
"fromIndex("
+
fromIndex
+
") > toIndex("
+
toIndex
+
")"
);
if
(
fromIndex
<
0
)
throw
new
ArrayIndexOutOfBoundsException
(
fromIndex
);
if
(
toIndex
>
arrayLen
)
throw
new
ArrayIndexOutOfBoundsException
(
toIndex
);
}
}
}
src/share/classes/java/util/DualPivotQuicksort.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/ListResourceBundle.java
浏览文件 @
7a7eed0f
...
@@ -89,7 +89,7 @@ import sun.util.ResourceBundleEnumeration;
...
@@ -89,7 +89,7 @@ import sun.util.ResourceBundleEnumeration;
*
*
* public class MyResources_fr extends ListResourceBundle {
* public class MyResources_fr extends ListResourceBundle {
* protected Object[][] getContents() {
* protected Object[][] getContents() {
* return new Object[][]
=
{
* return new Object[][] {
* // LOCALIZE THIS
* // LOCALIZE THIS
* {"s1", "Le disque \"{1}\" {0}."}, // MessageFormat pattern
* {"s1", "Le disque \"{1}\" {0}."}, // MessageFormat pattern
* {"s2", "1"}, // location of {0} in pattern
* {"s2", "1"}, // location of {0} in pattern
...
...
src/share/classes/java/util/PropertyResourceBundle.java
浏览文件 @
7a7eed0f
...
@@ -124,6 +124,8 @@ public class PropertyResourceBundle extends ResourceBundle {
...
@@ -124,6 +124,8 @@ public class PropertyResourceBundle extends ResourceBundle {
* to read from.
* to read from.
* @throws IOException if an I/O error occurs
* @throws IOException if an I/O error occurs
* @throws NullPointerException if <code>stream</code> is null
* @throws NullPointerException if <code>stream</code> is null
* @throws IllegalArgumentException if {@code stream} contains a
* malformed Unicode escape sequence.
*/
*/
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
public
PropertyResourceBundle
(
InputStream
stream
)
throws
IOException
{
public
PropertyResourceBundle
(
InputStream
stream
)
throws
IOException
{
...
@@ -142,6 +144,8 @@ public class PropertyResourceBundle extends ResourceBundle {
...
@@ -142,6 +144,8 @@ public class PropertyResourceBundle extends ResourceBundle {
* read from.
* read from.
* @throws IOException if an I/O error occurs
* @throws IOException if an I/O error occurs
* @throws NullPointerException if <code>reader</code> is null
* @throws NullPointerException if <code>reader</code> is null
* @throws IllegalArgumentException if a malformed Unicode escape sequence appears
* from {@code reader}.
* @since 1.6
* @since 1.6
*/
*/
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
...
...
src/share/classes/java/util/Spliterator.java
浏览文件 @
7a7eed0f
...
@@ -140,32 +140,32 @@ import java.util.function.LongConsumer;
...
@@ -140,32 +140,32 @@ import java.util.function.LongConsumer;
* (in approximate order of decreasing desirability):
* (in approximate order of decreasing desirability):
* <ul>
* <ul>
* <li>The source cannot be structurally interfered with.
* <li>The source cannot be structurally interfered with.
* <
/
br>For example, an instance of
* <br>For example, an instance of
* {@link java.util.concurrent.CopyOnWriteArrayList} is an immutable source.
* {@link java.util.concurrent.CopyOnWriteArrayList} is an immutable source.
* A Spliterator created from the source reports a characteristic of
* A Spliterator created from the source reports a characteristic of
* {@code IMMUTABLE}.</li>
* {@code IMMUTABLE}.</li>
* <li>The source manages concurrent modifications.
* <li>The source manages concurrent modifications.
* <
/
br>For example, a key set of a {@link java.util.concurrent.ConcurrentHashMap}
* <br>For example, a key set of a {@link java.util.concurrent.ConcurrentHashMap}
* is a concurrent source. A Spliterator created from the source reports a
* is a concurrent source. A Spliterator created from the source reports a
* characteristic of {@code CONCURRENT}.</li>
* characteristic of {@code CONCURRENT}.</li>
* <li>The mutable source provides a late-binding and fail-fast Spliterator.
* <li>The mutable source provides a late-binding and fail-fast Spliterator.
* <
/
br>Late binding narrows the window during which interference can affect
* <br>Late binding narrows the window during which interference can affect
* the calculation; fail-fast detects, on a best-effort basis, that structural
* the calculation; fail-fast detects, on a best-effort basis, that structural
* interference has occurred after traversal has commenced and throws
* interference has occurred after traversal has commenced and throws
* {@link ConcurrentModificationException}. For example, {@link ArrayList},
* {@link ConcurrentModificationException}. For example, {@link ArrayList},
* and many other non-concurrent {@code Collection} classes in the JDK, provide
* and many other non-concurrent {@code Collection} classes in the JDK, provide
* a late-binding, fail-fast spliterator.</li>
* a late-binding, fail-fast spliterator.</li>
* <li>The mutable source provides a non-late-binding but fail-fast Spliterator.
* <li>The mutable source provides a non-late-binding but fail-fast Spliterator.
* <
/
br>The source increases the likelihood of throwing
* <br>The source increases the likelihood of throwing
* {@code ConcurrentModificationException} since the window of potential
* {@code ConcurrentModificationException} since the window of potential
* interference is larger.</li>
* interference is larger.</li>
* <li>The mutable source provides a late-binding and non-fail-fast Spliterator.
* <li>The mutable source provides a late-binding and non-fail-fast Spliterator.
* <
/
br>The source risks arbitrary, non-deterministic behavior after traversal
* <br>The source risks arbitrary, non-deterministic behavior after traversal
* has commenced since interference is not detected.
* has commenced since interference is not detected.
* </li>
* </li>
* <li>The mutable source provides a non-late-binding and non-fail-fast
* <li>The mutable source provides a non-late-binding and non-fail-fast
* Spliterator.
* Spliterator.
* <
/
br>The source increases the risk of arbitrary, non-deterministic behavior
* <br>The source increases the risk of arbitrary, non-deterministic behavior
* since non-detected interference may occur after construction.
* since non-detected interference may occur after construction.
* </li>
* </li>
* </ul>
* </ul>
...
@@ -284,6 +284,8 @@ import java.util.function.LongConsumer;
...
@@ -284,6 +284,8 @@ import java.util.function.LongConsumer;
* is set to {@code true} then diagnostic warnings are reported if boxing of
* is set to {@code true} then diagnostic warnings are reported if boxing of
* primitive values occur when operating on primitive subtype specializations.
* primitive values occur when operating on primitive subtype specializations.
*
*
* @param <T> the type of elements returned by this Spliterator
*
* @see Collection
* @see Collection
* @since 1.8
* @since 1.8
*/
*/
...
@@ -333,9 +335,8 @@ public interface Spliterator<T> {
...
@@ -333,9 +335,8 @@ public interface Spliterator<T> {
* Upon non-null return:
* Upon non-null return:
* <ul>
* <ul>
* <li>the value reported for {@code estimateSize()} before splitting,
* <li>the value reported for {@code estimateSize()} before splitting,
* if not already zero or {@code Long.MAX_VALUE}, must, after splitting, be
* must, after splitting, be greater than or equal to {@code estimateSize()}
* greater than {@code estimateSize()} for this and the returned
* for this and the returned Spliterator; and</li>
* Spliterator; and</li>
* <li>if this Spliterator is {@code SUBSIZED}, then {@code estimateSize()}
* <li>if this Spliterator is {@code SUBSIZED}, then {@code estimateSize()}
* for this spliterator before splitting must be equal to the sum of
* for this spliterator before splitting must be equal to the sum of
* {@code estimateSize()} for this and the returned Spliterator after
* {@code estimateSize()} for this and the returned Spliterator after
...
@@ -566,13 +567,28 @@ public interface Spliterator<T> {
...
@@ -566,13 +567,28 @@ public interface Spliterator<T> {
public
static
final
int
SUBSIZED
=
0x00004000
;
public
static
final
int
SUBSIZED
=
0x00004000
;
/**
/**
* A Spliterator specialized for {@code int} values.
* A Spliterator specialized for primitive values.
*
* @param <T> the type of elements returned by this Spliterator. The
* type must be a wrapper type for a primitive type, such as {@code Integer}
* for the primitive {@code int} type.
* @param <T_CONS> the type of primitive consumer. The type must be a
* primitive specialization of {@link java.util.function.Consumer} for
* {@code T}, such as {@link java.util.function.IntConsumer} for
* {@code Integer}.
* @param <T_SPLITR> the type of primitive Spliterator. The type must be
* a primitive specialization of Spliterator for {@code T}, such as
* {@link Spliterator.OfInt} for {@code Integer}.
*
* @see Spliterator.OfInt
* @see Spliterator.OfLong
* @see Spliterator.OfDouble
* @since 1.8
* @since 1.8
*/
*/
public
interface
Of
Int
extends
Spliterator
<
Integer
>
{
public
interface
Of
Primitive
<
T
,
T_CONS
,
T_SPLITR
extends
Spliterator
.
OfPrimitive
<
T
,
T_CONS
,
T_SPLITR
>>
extends
Spliterator
<
T
>
{
@Override
@Override
OfInt
trySplit
();
T_SPLITR
trySplit
();
/**
/**
* If a remaining element exists, performs the given action on it,
* If a remaining element exists, performs the given action on it,
...
@@ -586,7 +602,7 @@ public interface Spliterator<T> {
...
@@ -586,7 +602,7 @@ public interface Spliterator<T> {
* upon entry to this method, else {@code true}.
* upon entry to this method, else {@code true}.
* @throws NullPointerException if the specified action is null
* @throws NullPointerException if the specified action is null
*/
*/
boolean
tryAdvance
(
IntConsumer
action
);
boolean
tryAdvance
(
T_CONS
action
);
/**
/**
* Performs the given action for each remaining element, sequentially in
* Performs the given action for each remaining element, sequentially in
...
@@ -603,6 +619,24 @@ public interface Spliterator<T> {
...
@@ -603,6 +619,24 @@ public interface Spliterator<T> {
* @param action The action
* @param action The action
* @throws NullPointerException if the specified action is null
* @throws NullPointerException if the specified action is null
*/
*/
default
void
forEachRemaining
(
T_CONS
action
)
{
do
{
}
while
(
tryAdvance
(
action
));
}
}
/**
* A Spliterator specialized for {@code int} values.
* @since 1.8
*/
public
interface
OfInt
extends
OfPrimitive
<
Integer
,
IntConsumer
,
OfInt
>
{
@Override
OfInt
trySplit
();
@Override
boolean
tryAdvance
(
IntConsumer
action
);
@Override
default
void
forEachRemaining
(
IntConsumer
action
)
{
default
void
forEachRemaining
(
IntConsumer
action
)
{
do
{
}
while
(
tryAdvance
(
action
));
do
{
}
while
(
tryAdvance
(
action
));
}
}
...
@@ -658,40 +692,15 @@ public interface Spliterator<T> {
...
@@ -658,40 +692,15 @@ public interface Spliterator<T> {
* A Spliterator specialized for {@code long} values.
* A Spliterator specialized for {@code long} values.
* @since 1.8
* @since 1.8
*/
*/
public
interface
OfLong
extends
Spliterator
<
Long
>
{
public
interface
OfLong
extends
OfPrimitive
<
Long
,
LongConsumer
,
Of
Long
>
{
@Override
@Override
OfLong
trySplit
();
OfLong
trySplit
();
/**
@Override
* If a remaining element exists, performs the given action on it,
* returning {@code true}; else returns {@code false}. If this
* Spliterator is {@link #ORDERED} the action is performed on the
* next element in encounter order. Exceptions thrown by the
* action are relayed to the caller.
*
* @param action The action
* @return {@code false} if no remaining elements existed
* upon entry to this method, else {@code true}.
* @throws NullPointerException if the specified action is null
*/
boolean
tryAdvance
(
LongConsumer
action
);
boolean
tryAdvance
(
LongConsumer
action
);
/**
@Override
* Performs the given action for each remaining element, sequentially in
* the current thread, until all elements have been processed or the
* action throws an exception. If this Spliterator is {@link #ORDERED},
* actions are performed in encounter order. Exceptions thrown by the
* action are relayed to the caller.
*
* @implSpec
* The default implementation repeatedly invokes {@link #tryAdvance}
* until it returns {@code false}. It should be overridden whenever
* possible.
*
* @param action The action
* @throws NullPointerException if the specified action is null
*/
default
void
forEachRemaining
(
LongConsumer
action
)
{
default
void
forEachRemaining
(
LongConsumer
action
)
{
do
{
}
while
(
tryAdvance
(
action
));
do
{
}
while
(
tryAdvance
(
action
));
}
}
...
@@ -747,40 +756,15 @@ public interface Spliterator<T> {
...
@@ -747,40 +756,15 @@ public interface Spliterator<T> {
* A Spliterator specialized for {@code double} values.
* A Spliterator specialized for {@code double} values.
* @since 1.8
* @since 1.8
*/
*/
public
interface
OfDouble
extends
Spliterator
<
Double
>
{
public
interface
OfDouble
extends
OfPrimitive
<
Double
,
DoubleConsumer
,
Of
Double
>
{
@Override
@Override
OfDouble
trySplit
();
OfDouble
trySplit
();
/**
@Override
* If a remaining element exists, performs the given action on it,
* returning {@code true}; else returns {@code false}. If this
* Spliterator is {@link #ORDERED} the action is performed on the
* next element in encounter order. Exceptions thrown by the
* action are relayed to the caller.
*
* @param action The action
* @return {@code false} if no remaining elements existed
* upon entry to this method, else {@code true}.
* @throws NullPointerException if the specified action is null
*/
boolean
tryAdvance
(
DoubleConsumer
action
);
boolean
tryAdvance
(
DoubleConsumer
action
);
/**
@Override
* Performs the given action for each remaining element, sequentially in
* the current thread, until all elements have been processed or the
* action throws an exception. If this Spliterator is {@link #ORDERED},
* actions are performed in encounter order. Exceptions thrown by the
* action are relayed to the caller.
*
* @implSpec
* The default implementation repeatedly invokes {@link #tryAdvance}
* until it returns {@code false}. It should be overridden whenever
* possible.
*
* @param action The action
* @throws NullPointerException if the specified action is null
*/
default
void
forEachRemaining
(
DoubleConsumer
action
)
{
default
void
forEachRemaining
(
DoubleConsumer
action
)
{
do
{
}
while
(
tryAdvance
(
action
));
do
{
}
while
(
tryAdvance
(
action
));
}
}
...
...
src/share/classes/java/util/TimSort.java
浏览文件 @
7a7eed0f
...
@@ -111,9 +111,13 @@ class TimSort<T> {
...
@@ -111,9 +111,13 @@ class TimSort<T> {
private
static
final
int
INITIAL_TMP_STORAGE_LENGTH
=
256
;
private
static
final
int
INITIAL_TMP_STORAGE_LENGTH
=
256
;
/**
/**
* Temp storage for merges.
* Temp storage for merges. A workspace array may optionally be
* provided in constructor, and if so will be used as long as it
* is big enough.
*/
*/
private
T
[]
tmp
;
// Actual runtime type will be Object[], regardless of T
private
T
[]
tmp
;
private
int
tmpBase
;
// base of tmp array slice
private
int
tmpLen
;
// length of tmp array slice
/**
/**
* A stack of pending runs yet to be merged. Run i starts at
* A stack of pending runs yet to be merged. Run i starts at
...
@@ -134,17 +138,31 @@ class TimSort<T> {
...
@@ -134,17 +138,31 @@ class TimSort<T> {
*
*
* @param a the array to be sorted
* @param a the array to be sorted
* @param c the comparator to determine the order of the sort
* @param c the comparator to determine the order of the sort
* @param work a workspace array (slice)
* @param workBase origin of usable space in work array
* @param workLen usable size of work array
*/
*/
private
TimSort
(
T
[]
a
,
Comparator
<?
super
T
>
c
)
{
private
TimSort
(
T
[]
a
,
Comparator
<?
super
T
>
c
,
T
[]
work
,
int
workBase
,
int
workLen
)
{
this
.
a
=
a
;
this
.
a
=
a
;
this
.
c
=
c
;
this
.
c
=
c
;
// Allocate temp storage (which may be increased later if necessary)
// Allocate temp storage (which may be increased later if necessary)
int
len
=
a
.
length
;
int
len
=
a
.
length
;
@SuppressWarnings
({
"unchecked"
,
"UnnecessaryLocalVariable"
})
int
tlen
=
(
len
<
2
*
INITIAL_TMP_STORAGE_LENGTH
)
?
T
[]
newArray
=
(
T
[])
new
Object
[
len
<
2
*
INITIAL_TMP_STORAGE_LENGTH
?
len
>>>
1
:
INITIAL_TMP_STORAGE_LENGTH
;
len
>>>
1
:
INITIAL_TMP_STORAGE_LENGTH
];
if
(
work
==
null
||
workLen
<
tlen
||
workBase
+
tlen
>
work
.
length
)
{
tmp
=
newArray
;
@SuppressWarnings
({
"unchecked"
,
"UnnecessaryLocalVariable"
})
T
[]
newArray
=
(
T
[])
java
.
lang
.
reflect
.
Array
.
newInstance
(
a
.
getClass
().
getComponentType
(),
tlen
);
tmp
=
newArray
;
tmpBase
=
0
;
tmpLen
=
tlen
;
}
else
{
tmp
=
work
;
tmpBase
=
workBase
;
tmpLen
=
workLen
;
}
/*
/*
* Allocate runs-to-be-merged stack (which cannot be expanded). The
* Allocate runs-to-be-merged stack (which cannot be expanded). The
...
@@ -164,22 +182,30 @@ class TimSort<T> {
...
@@ -164,22 +182,30 @@ class TimSort<T> {
}
}
/*
/*
* The next two methods (which are package private and static) constitute
* The next method (package private and static) constitutes the
* the entire API of this class. Each of these methods obeys the contract
* entire API of this class.
* of the public method with the same signature in java.util.Arrays.
*/
*/
static
<
T
>
void
sort
(
T
[]
a
,
Comparator
<?
super
T
>
c
)
{
/**
sort
(
a
,
0
,
a
.
length
,
c
);
* Sorts the given range, using the given workspace array slice
}
* for temp storage when possible. This method is designed to be
* invoked from public methods (in class Arrays) after performing
static
<
T
>
void
sort
(
T
[]
a
,
int
lo
,
int
hi
,
Comparator
<?
super
T
>
c
)
{
* any necessary array bounds checks and expanding parameters into
if
(
c
==
null
)
{
* the required forms.
Arrays
.
sort
(
a
,
lo
,
hi
);
*
return
;
* @param a the array to be sorted
}
* @param lo the index of the first element, inclusive, to be sorted
* @param hi the index of the last element, exclusive, to be sorted
* @param c the comparator to use
* @param work a workspace array (slice)
* @param workBase origin of usable space in work array
* @param workLen usable size of work array
* @since 1.8
*/
static
<
T
>
void
sort
(
T
[]
a
,
int
lo
,
int
hi
,
Comparator
<?
super
T
>
c
,
T
[]
work
,
int
workBase
,
int
workLen
)
{
assert
c
!=
null
&&
a
!=
null
&&
lo
>=
0
&&
lo
<=
hi
&&
hi
<=
a
.
length
;
rangeCheck
(
a
.
length
,
lo
,
hi
);
int
nRemaining
=
hi
-
lo
;
int
nRemaining
=
hi
-
lo
;
if
(
nRemaining
<
2
)
if
(
nRemaining
<
2
)
return
;
// Arrays of size 0 and 1 are always sorted
return
;
// Arrays of size 0 and 1 are always sorted
...
@@ -196,7 +222,7 @@ class TimSort<T> {
...
@@ -196,7 +222,7 @@ class TimSort<T> {
* extending short natural runs to minRun elements, and merging runs
* extending short natural runs to minRun elements, and merging runs
* to maintain stack invariant.
* to maintain stack invariant.
*/
*/
TimSort
<
T
>
ts
=
new
TimSort
<>(
a
,
c
);
TimSort
<
T
>
ts
=
new
TimSort
<>(
a
,
c
,
work
,
workBase
,
workLen
);
int
minRun
=
minRunLength
(
nRemaining
);
int
minRun
=
minRunLength
(
nRemaining
);
do
{
do
{
// Identify next run
// Identify next run
...
@@ -653,11 +679,10 @@ class TimSort<T> {
...
@@ -653,11 +679,10 @@ class TimSort<T> {
// Copy first run into temp array
// Copy first run into temp array
T
[]
a
=
this
.
a
;
// For performance
T
[]
a
=
this
.
a
;
// For performance
T
[]
tmp
=
ensureCapacity
(
len1
);
T
[]
tmp
=
ensureCapacity
(
len1
);
System
.
arraycopy
(
a
,
base1
,
tmp
,
0
,
len1
);
int
cursor1
=
tmpBase
;
// Indexes into tmp array
int
cursor1
=
0
;
// Indexes into tmp array
int
cursor2
=
base2
;
// Indexes int a
int
cursor2
=
base2
;
// Indexes int a
int
dest
=
base1
;
// Indexes int a
int
dest
=
base1
;
// Indexes int a
System
.
arraycopy
(
a
,
base1
,
tmp
,
cursor1
,
len1
);
// Move first element of second run and deal with degenerate cases
// Move first element of second run and deal with degenerate cases
a
[
dest
++]
=
a
[
cursor2
++];
a
[
dest
++]
=
a
[
cursor2
++];
...
@@ -770,16 +795,17 @@ class TimSort<T> {
...
@@ -770,16 +795,17 @@ class TimSort<T> {
// Copy second run into temp array
// Copy second run into temp array
T
[]
a
=
this
.
a
;
// For performance
T
[]
a
=
this
.
a
;
// For performance
T
[]
tmp
=
ensureCapacity
(
len2
);
T
[]
tmp
=
ensureCapacity
(
len2
);
System
.
arraycopy
(
a
,
base2
,
tmp
,
0
,
len2
);
int
tmpBase
=
this
.
tmpBase
;
System
.
arraycopy
(
a
,
base2
,
tmp
,
tmpBase
,
len2
);
int
cursor1
=
base1
+
len1
-
1
;
// Indexes into a
int
cursor1
=
base1
+
len1
-
1
;
// Indexes into a
int
cursor2
=
len2
-
1
;
// Indexes into tmp array
int
cursor2
=
tmpBase
+
len2
-
1
;
// Indexes into tmp array
int
dest
=
base2
+
len2
-
1
;
// Indexes into a
int
dest
=
base2
+
len2
-
1
;
// Indexes into a
// Move last element of first run and deal with degenerate cases
// Move last element of first run and deal with degenerate cases
a
[
dest
--]
=
a
[
cursor1
--];
a
[
dest
--]
=
a
[
cursor1
--];
if
(--
len1
==
0
)
{
if
(--
len1
==
0
)
{
System
.
arraycopy
(
tmp
,
0
,
a
,
dest
-
(
len2
-
1
),
len2
);
System
.
arraycopy
(
tmp
,
tmpBase
,
a
,
dest
-
(
len2
-
1
),
len2
);
return
;
return
;
}
}
if
(
len2
==
1
)
{
if
(
len2
==
1
)
{
...
@@ -838,7 +864,7 @@ class TimSort<T> {
...
@@ -838,7 +864,7 @@ class TimSort<T> {
if
(--
len2
==
1
)
if
(--
len2
==
1
)
break
outer
;
break
outer
;
count2
=
len2
-
gallopLeft
(
a
[
cursor1
],
tmp
,
0
,
len2
,
len2
-
1
,
c
);
count2
=
len2
-
gallopLeft
(
a
[
cursor1
],
tmp
,
tmpBase
,
len2
,
len2
-
1
,
c
);
if
(
count2
!=
0
)
{
if
(
count2
!=
0
)
{
dest
-=
count2
;
dest
-=
count2
;
cursor2
-=
count2
;
cursor2
-=
count2
;
...
@@ -870,7 +896,7 @@ class TimSort<T> {
...
@@ -870,7 +896,7 @@ class TimSort<T> {
}
else
{
}
else
{
assert
len1
==
0
;
assert
len1
==
0
;
assert
len2
>
0
;
assert
len2
>
0
;
System
.
arraycopy
(
tmp
,
0
,
a
,
dest
-
(
len2
-
1
),
len2
);
System
.
arraycopy
(
tmp
,
tmpBase
,
a
,
dest
-
(
len2
-
1
),
len2
);
}
}
}
}
...
@@ -883,7 +909,7 @@ class TimSort<T> {
...
@@ -883,7 +909,7 @@ class TimSort<T> {
* @return tmp, whether or not it grew
* @return tmp, whether or not it grew
*/
*/
private
T
[]
ensureCapacity
(
int
minCapacity
)
{
private
T
[]
ensureCapacity
(
int
minCapacity
)
{
if
(
tmp
.
length
<
minCapacity
)
{
if
(
tmp
Len
<
minCapacity
)
{
// Compute smallest power of 2 > minCapacity
// Compute smallest power of 2 > minCapacity
int
newSize
=
minCapacity
;
int
newSize
=
minCapacity
;
newSize
|=
newSize
>>
1
;
newSize
|=
newSize
>>
1
;
...
@@ -899,30 +925,12 @@ class TimSort<T> {
...
@@ -899,30 +925,12 @@ class TimSort<T> {
newSize
=
Math
.
min
(
newSize
,
a
.
length
>>>
1
);
newSize
=
Math
.
min
(
newSize
,
a
.
length
>>>
1
);
@SuppressWarnings
({
"unchecked"
,
"UnnecessaryLocalVariable"
})
@SuppressWarnings
({
"unchecked"
,
"UnnecessaryLocalVariable"
})
T
[]
newArray
=
(
T
[])
new
Object
[
newSize
];
T
[]
newArray
=
(
T
[])
java
.
lang
.
reflect
.
Array
.
newInstance
(
a
.
getClass
().
getComponentType
(),
newSize
);
tmp
=
newArray
;
tmp
=
newArray
;
tmpLen
=
newSize
;
tmpBase
=
0
;
}
}
return
tmp
;
return
tmp
;
}
}
/**
* Checks that fromIndex and toIndex are in range, and throws an
* appropriate exception if they aren't.
*
* @param arrayLen the length of the array
* @param fromIndex the index of the first element of the range
* @param toIndex the index after the last element of the range
* @throws IllegalArgumentException if fromIndex > toIndex
* @throws ArrayIndexOutOfBoundsException if fromIndex < 0
* or toIndex > arrayLen
*/
private
static
void
rangeCheck
(
int
arrayLen
,
int
fromIndex
,
int
toIndex
)
{
if
(
fromIndex
>
toIndex
)
throw
new
IllegalArgumentException
(
"fromIndex("
+
fromIndex
+
") > toIndex("
+
toIndex
+
")"
);
if
(
fromIndex
<
0
)
throw
new
ArrayIndexOutOfBoundsException
(
fromIndex
);
if
(
toIndex
>
arrayLen
)
throw
new
ArrayIndexOutOfBoundsException
(
toIndex
);
}
}
}
src/share/classes/java/util/concurrent/ConcurrentHashMap.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/BiConsumer.java
浏览文件 @
7a7eed0f
...
@@ -24,14 +24,16 @@
...
@@ -24,14 +24,16 @@
*/
*/
package
java.util.function
;
package
java.util.function
;
import
java.util.Objects
;
/**
/**
* An operation which accepts two input arguments and returns no result. This is
* An operation which accepts two input arguments and returns no result. This is
* the two-arity specialization of {@link Consumer}. Unlike most other
* the two-arity specialization of {@link Consumer}. Unlike most other
* functional interfaces, {@code BiConsumer} is expected to operate via
* functional interfaces, {@code BiConsumer} is expected to operate via
* side-effects.
* side-effects.
*
*
* @param <T> the type of the first argument to the {@code accept} operation
.
* @param <T> the type of the first argument to the {@code accept} operation
* @param <U> the type of the second argument to the {@code accept} operation
.
* @param <U> the type of the second argument to the {@code accept} operation
*
*
* @see Consumer
* @see Consumer
* @since 1.8
* @since 1.8
...
@@ -47,4 +49,28 @@ public interface BiConsumer<T, U> {
...
@@ -47,4 +49,28 @@ public interface BiConsumer<T, U> {
* @param u an input object
* @param u an input object
*/
*/
void
accept
(
T
t
,
U
u
);
void
accept
(
T
t
,
U
u
);
/**
* Returns a {@code BiConsumer} which performs, in sequence, the operation
* represented by this object followed by the operation represented by
* the other {@code BiConsumer}.
*
* <p>Any exceptions thrown by either {@code accept} method are relayed
* to the caller; if performing this operation throws an exception, the
* other operation will not be performed.
*
* @param other a BiConsumer which will be chained after this BiConsumer
* @return a BiConsumer which performs in sequence the {@code accept} method
* of this BiConsumer and the {@code accept} method of the specified
* BiConsumer operation
* @throws NullPointerException if other is null
*/
default
BiConsumer
<
T
,
U
>
chain
(
BiConsumer
<?
super
T
,
?
super
U
>
other
)
{
Objects
.
requireNonNull
(
other
);
return
(
l
,
r
)
->
{
accept
(
l
,
r
);
other
.
accept
(
l
,
r
);
};
}
}
}
src/share/classes/java/util/function/BiFunction.java
浏览文件 @
7a7eed0f
...
@@ -24,15 +24,17 @@
...
@@ -24,15 +24,17 @@
*/
*/
package
java.util.function
;
package
java.util.function
;
import
java.util.Objects
;
/**
/**
* Apply a function to the input arguments, yielding an appropriate result. This
* Apply a function to the input arguments, yielding an appropriate result. This
* is the two-arity specialization of {@link Function}. A function may
* is the two-arity specialization of {@link Function}. A function may
* variously provide a mapping between types, object instances or keys and
* variously provide a mapping between types, object instances or keys and
* values or any other form of transformation upon the input.
* values or any other form of transformation upon the input.
*
*
* @param <T> the type of the first argument to the {@code apply} operation
.
* @param <T> the type of the first argument to the {@code apply} operation
* @param <U> the type of the second argument to the {@code apply} operation
.
* @param <U> the type of the second argument to the {@code apply} operation
* @param <R> the type of results returned by the {@code apply} operation
.
* @param <R> the type of results returned by the {@code apply} operation
*
*
* @see Function
* @see Function
* @since 1.8
* @since 1.8
...
@@ -48,4 +50,22 @@ public interface BiFunction<T, U, R> {
...
@@ -48,4 +50,22 @@ public interface BiFunction<T, U, R> {
* @return the function result
* @return the function result
*/
*/
R
apply
(
T
t
,
U
u
);
R
apply
(
T
t
,
U
u
);
/**
* Returns a new function which applies this function followed by the
* provided function. If either function throws an exception, it is relayed
* to the caller.
*
* @param <V> Type of output objects to the combined function. May be the
* same type as {@code <T>}, {@code <U>} or {@code <R>}
* @param after An additional function to be applied after this function is
* applied
* @return A function which performs this function followed by the provided
* function
* @throws NullPointerException if after is null
*/
default
<
V
>
BiFunction
<
T
,
U
,
V
>
andThen
(
Function
<?
super
R
,
?
extends
V
>
after
)
{
Objects
.
requireNonNull
(
after
);
return
(
T
t
,
U
u
)
->
after
.
apply
(
apply
(
t
,
u
));
}
}
}
src/share/classes/java/util/function/BiPredicate.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/BooleanSupplier.java
浏览文件 @
7a7eed0f
...
@@ -40,5 +40,5 @@ public interface BooleanSupplier {
...
@@ -40,5 +40,5 @@ public interface BooleanSupplier {
*
*
* @return a {@code boolean} value
* @return a {@code boolean} value
*/
*/
public
boolean
getAsBoolean
();
boolean
getAsBoolean
();
}
}
src/share/classes/java/util/function/Consumer.java
浏览文件 @
7a7eed0f
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
*/
*/
package
java.util.function
;
package
java.util.function
;
import
java.util.Objects
;
/**
/**
* An operation which accepts a single input argument and returns no result.
* An operation which accepts a single input argument and returns no result.
* Unlike most other functional interfaces, {@code Consumer} is expected to
* Unlike most other functional interfaces, {@code Consumer} is expected to
...
@@ -41,5 +43,25 @@ public interface Consumer<T> {
...
@@ -41,5 +43,25 @@ public interface Consumer<T> {
*
*
* @param t the input object
* @param t the input object
*/
*/
public
void
accept
(
T
t
);
void
accept
(
T
t
);
/**
* Returns a {@code Consumer} which performs, in sequence, the operation
* represented by this object followed by the operation represented by
* the other {@code Consumer}.
*
* <p>Any exceptions thrown by either {@code accept} method are relayed
* to the caller; if performing this operation throws an exception, the
* other operation will not be performed.
*
* @param other a Consumer which will be chained after this Consumer
* @return a Consumer which performs in sequence the {@code accept} method
* of this Consumer and the {@code accept} method of the specified Consumer
* operation
* @throws NullPointerException if other is null
*/
default
Consumer
<
T
>
chain
(
Consumer
<?
super
T
>
other
)
{
Objects
.
requireNonNull
(
other
);
return
(
T
t
)
->
{
accept
(
t
);
other
.
accept
(
t
);
};
}
}
}
src/share/classes/java/util/function/DoubleBinaryOperator.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/DoubleConsumer.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/DoubleFunction.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/DoublePredicate.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/DoubleSupplier.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/DoubleUnaryOperator.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/Function.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/IntBinaryOperator.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/IntConsumer.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/IntFunction.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/IntPredicate.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/IntSupplier.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/IntUnaryOperator.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/LongBinaryOperator.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/LongConsumer.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/LongFunction.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/LongPredicate.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/LongSupplier.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/LongUnaryOperator.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/ObjDoubleConsumer.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/ObjIntConsumer.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/ObjLongConsumer.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/Predicate.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/Supplier.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/ToDoubleBiFunction.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/ToDoubleFunction.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/ToIntBiFunction.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/ToIntFunction.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/ToLongBiFunction.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/ToLongFunction.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/java/util/function/UnaryOperator.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/javax/swing/JToolTip.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/javax/swing/text/View.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/javax/swing/text/html/parser/Parser.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/management/Agent.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/management/jdp/package-info.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/nio/cs/UTF_8.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/nio/cs/ext/DoubleByte.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/nio/cs/ext/HKSCS.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/security/provider/certpath/OCSPResponse.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/security/tools/policytool/PolicyTool.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/security/tools/policytool/Resources.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/text/resources/mt/FormatData_mt.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/tools/jconsole/AboutDialog.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/tools/jconsole/VMPanel.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/tools/jconsole/resources/messages.properties
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/tools/jconsole/resources/messages_ja.properties
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/native/java/io/FileInputStream.c
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/native/sun/java2d/cmm/lcms/cmscgats.c
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/share/native/sun/java2d/cmm/lcms/cmslut.c
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/bin/arm/jvm.cfg
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/MotifDnDConstants.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/WindowPropertyGetter.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XConstants.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XErrorHandler.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java
0 → 100644
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XQueryTree.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XToolkit.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XTranslateCoordinates.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XWM.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/XlibUtil.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/classes/sun/print/IPPPrintService.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/native/sun/awt/awt_GraphicsEnv.c
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/native/sun/awt/awt_GraphicsEnv.h
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/native/sun/awt/awt_util.c
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/native/sun/awt/awt_util.h
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/native/sun/java2d/x11/X11SurfaceData.c
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/solaris/native/sun/xawt/XlibWrapper.c
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/windows/bin/cmdtoargs.c
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/windows/classes/sun/awt/windows/WPathGraphics.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/windows/classes/sun/nio/fs/WindowsConstants.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/windows/classes/sun/nio/fs/WindowsNativeDispatcher.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/windows/classes/sun/nio/fs/WindowsWatchService.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/windows/classes/sun/security/krb5/internal/tools/Ktab.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/windows/native/java/io/WinNTFileSystem_md.c
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/Makefile
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/ProblemList.txt
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/com/sun/jmx/remote/NotificationMarshalVersions/Client/Client.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/com/sun/jmx/remote/NotificationMarshalVersions/Server/Server.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/com/sun/jmx/remote/NotificationMarshalVersions/TestSerializationMismatch.java
0 → 100644
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/awt/WMSpecificTests/Metacity/FullscreenDialogModality.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/awt/print/PrinterJob/Collate2DPrintingTest.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/awt/print/PrinterJob/PrintLatinCJKTest.java
0 → 100644
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/beans/XMLEncoder/Test8013416.java
0 → 100644
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/io/File/IsHidden.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/io/FileInputStream/LargeFileAvailable.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/io/FileInputStream/NegativeAvailable.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/io/pathNames/General.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/io/pathNames/GeneralWin32.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/lang/String/StringContentEqualsBug.java
0 → 100644
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/lang/StringBuffer/ToStringCache.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/lang/ref/OOMEInReferenceHandler.java
0 → 100644
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/nio/file/Files/FaultyFileSystem.java
0 → 100644
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/nio/file/Files/PassThroughFileSystem.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/nio/file/Files/StreamTest.java
0 → 100644
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/java/util/Arrays/ParallelSorting.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/javax/swing/text/View/8014863/bug8014863.java
0 → 100644
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/javax/swing/text/html/parser/Parser/7011777/bug7011777.java
0 → 100644
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/sun/awt/datatransfer/SuplementaryCharactersTransferTest.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/sun/management/jdp/JdpTest.sh
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/sun/security/krb5/tools/KtabZero.java
0 → 100644
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/
com/sun/jmx/remote/NotificationMarshalVersions/TestSerializationMismatch
.sh
→
test/
sun/security/krb5/tools/ktzero
.sh
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/sun/text/resources/LocaleData
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/sun/text/resources/LocaleDataTest.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
test/tools/launcher/Arrrghs.java
浏览文件 @
7a7eed0f
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录