--- a/jdk/make/Makefile Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-#
-# Copyright (c) 2012, 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.
-#
-
-# Locate this Makefile
-ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), )
- makefile_path := $(CURDIR)/$(lastword $(MAKEFILE_LIST))
-else
- makefile_path := $(lastword $(MAKEFILE_LIST))
-endif
-repo_dir := $(patsubst %/make/Makefile, %, $(makefile_path))
-
-# What is the name of this subsystem (langtools, corba, etc)?
-subsystem_name := $(notdir $(repo_dir))
-
-# Try to locate top-level makefile
-top_level_makefile := $(repo_dir)/../Makefile
-ifneq ($(wildcard $(top_level_makefile)), )
- $(info Will run $(subsystem_name) target on top-level Makefile)
- $(info WARNING: This is a non-recommended way of building!)
- $(info ===================================================)
-else
- $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?)
- $(error Build from top-level Makefile instead)
-endif
-
-all:
- @$(MAKE) -f $(top_level_makefile) $(subsystem_name)
--- a/jdk/make/copy/Copy-java.base.gmk Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/copy/Copy-java.base.gmk Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2015, 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
@@ -98,6 +98,8 @@
JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/macosx/conf/$(JVMCFG_ARCH)/jvm.cfg
else
JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/$(JVMCFG_ARCH)/jvm.cfg
+ # Allow override by ALT_JVMCFG_SRC if it exists
+ JVMCFG_SRC := $(if $(wildcard $(ALT_JVMCFG_SRC)),$(ALT_JVMCFG_SRC),$(JVMCFG_SRC))
endif
JVMCFG_DIR := $(LIB_DST_DIR)$(OPENJDK_TARGET_CPU_LIBDIR)
JVMCFG := $(JVMCFG_DIR)/jvm.cfg
--- a/jdk/make/data/tzdata/VERSION Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/data/tzdata/VERSION Fri Apr 03 16:37:06 2015 -0700
@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
-tzdata2015a
+tzdata2015b
--- a/jdk/make/data/tzdata/asia Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/data/tzdata/asia Fri Apr 03 16:37:06 2015 -0700
@@ -1927,6 +1927,13 @@
# was at the start of 2008-03-31 (the day of Steffen Thorsen's report);
# this is almost surely wrong.
+# From Ganbold Tsagaankhuu (2015-03-10):
+# It seems like yesterday Mongolian Government meeting has concluded to use
+# daylight saving time in Mongolia.... Starting at 2:00AM of last Saturday of
+# March 2015, daylight saving time starts. And 00:00AM of last Saturday of
+# September daylight saving time ends. Source:
+# http://zasag.mn/news/view/8969
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mongol 1983 1984 - Apr 1 0:00 1:00 S
Rule Mongol 1983 only - Oct 1 0:00 0 -
@@ -1947,6 +1954,8 @@
Rule Mongol 2001 only - Apr lastSat 2:00 1:00 S
Rule Mongol 2001 2006 - Sep lastSat 2:00 0 -
Rule Mongol 2002 2006 - Mar lastSat 2:00 1:00 S
+Rule Mongol 2015 max - Mar lastSat 2:00 1:00 S
+Rule Mongol 2015 max - Sep lastSat 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
# Hovd, a.k.a. Chovd, Dund-Us, Dzhargalant, Khovd, Jirgalanta
@@ -2365,13 +2374,19 @@
# official source...:
# http://www.palestinecabinet.gov.ps/ar/Views/ViewDetails.aspx?pid=1252
-# From Paul Eggert (2013-09-24):
-# For future dates, guess the last Thursday in March at 24:00 through
-# the first Friday on or after September 21 at 00:00. This is consistent with
-# the predictions in today's editions of the following URLs,
-# which are for Gaza and Hebron respectively:
-# http://www.timeanddate.com/worldclock/timezone.html?n=702
-# http://www.timeanddate.com/worldclock/timezone.html?n=2364
+# From Steffen Thorsen (2015-03-03):
+# Sources such as http://www.alquds.com/news/article/view/id/548257
+# and http://www.raya.ps/ar/news/890705.html say Palestine areas will
+# start DST on 2015-03-28 00:00 which is one day later than expected.
+#
+# From Paul Eggert (2015-03-03):
+# http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
+# says that the fall 2014 transition was Oct 23 at 24:00.
+# For future dates, guess the last Friday in March at 24:00 through
+# the first Friday on or after October 21 at 00:00. This is consistent with
+# the predictions in today's editions of the following URLs:
+# http://www.timeanddate.com/time/change/gaza-strip/gaza
+# http://www.timeanddate.com/time/change/west-bank/hebron
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
@@ -2397,9 +2412,11 @@
Rule Palestine 2011 only - Aug 1 0:00 0 -
Rule Palestine 2011 only - Aug 30 0:00 1:00 S
Rule Palestine 2011 only - Sep 30 0:00 0 -
-Rule Palestine 2012 max - Mar lastThu 24:00 1:00 S
+Rule Palestine 2012 2014 - Mar lastThu 24:00 1:00 S
Rule Palestine 2012 only - Sep 21 1:00 0 -
-Rule Palestine 2013 max - Sep Fri>=21 0:00 0 -
+Rule Palestine 2013 only - Sep Fri>=21 0:00 0 -
+Rule Palestine 2014 max - Oct Fri>=21 0:00 0 -
+Rule Palestine 2015 max - Mar lastFri 24:00 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
--- a/jdk/make/data/tzdata/australasia Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/data/tzdata/australasia Fri Apr 03 16:37:06 2015 -0700
@@ -396,6 +396,7 @@
9:39:00 - LMT 1901 # Agana
10:00 - GST 2000 Dec 23 # Guam
10:00 - ChST # Chamorro Standard Time
+Link Pacific/Guam Pacific/Saipan # N Mariana Is
# Kiribati
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -411,12 +412,7 @@
14:00 - LINT
# N Mariana Is
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Pacific/Saipan -14:17:00 - LMT 1844 Dec 31
- 9:43:00 - LMT 1901
- 9:00 - MPT 1969 Oct # N Mariana Is Time
- 10:00 - MPT 2000 Dec 23
- 10:00 - ChST # Chamorro Standard Time
+# See Pacific/Guam.
# Marshall Is
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -586,6 +582,7 @@
-11:00 - NST 1967 Apr # N=Nome
-11:00 - BST 1983 Nov 30 # B=Bering
-11:00 - SST # S=Samoa
+Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands
# Samoa (formerly and also known as Western Samoa)
@@ -767,23 +764,7 @@
# uninhabited
# Midway
-#
-# From Mark Brader (2005-01-23):
-# [Fallacies and Fantasies of Air Transport History, by R.E.G. Davies,
-# published 1994 by Paladwr Press, McLean, VA, USA; ISBN 0-9626483-5-3]
-# reproduced a Pan American Airways timetable from 1936, for their weekly
-# "Orient Express" flights between San Francisco and Manila, and connecting
-# flights to Chicago and the US East Coast. As it uses some time zone
-# designations that I've never seen before:....
-# Fri. 6:30A Lv. HONOLOLU (Pearl Harbor), H.I. H.L.T. Ar. 5:30P Sun.
-# " 3:00P Ar. MIDWAY ISLAND . . . . . . . . . M.L.T. Lv. 6:00A "
-#
-Zone Pacific/Midway -11:49:28 - LMT 1901
- -11:00 - NST 1956 Jun 3
- -11:00 1:00 NDT 1956 Sep 2
- -11:00 - NST 1967 Apr # N=Nome
- -11:00 - BST 1983 Nov 30 # B=Bering
- -11:00 - SST # S=Samoa
+# See Pacific/Pago_Pago.
# Palmyra
# uninhabited since World War II; was probably like Pacific/Kiritimati
--- a/jdk/make/data/tzdata/europe Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/data/tzdata/europe Fri Apr 03 16:37:06 2015 -0700
@@ -2423,7 +2423,7 @@
4:00 Russia VOL%sT 1989 Mar 26 2:00s # Volgograd T
3:00 Russia VOL%sT 1991 Mar 31 2:00s
4:00 - VOLT 1992 Mar 29 2:00s
- 3:00 Russia MSK 2011 Mar 27 2:00s
+ 3:00 Russia MSK/MSD 2011 Mar 27 2:00s
4:00 - MSK 2014 Oct 26 2:00s
3:00 - MSK
--- a/jdk/make/data/tzdata/northamerica Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/data/tzdata/northamerica Fri Apr 03 16:37:06 2015 -0700
@@ -2335,8 +2335,24 @@
# "...the new time zone will come into effect at two o'clock on the first Sunday
# of February, when we will have to advance the clock one hour from its current
# time..."
+# Also, the new zone will not use DST.
#
-# Also, the new zone will not use DST.
+# From Carlos Raúl Perasso (2015-02-02):
+# The decree that modifies the Mexican Hour System Law has finally
+# been published at the Diario Oficial de la Federación
+# http://www.dof.gob.mx/nota_detalle.php?codigo=5380123&fecha=31/01/2015
+# It establishes 5 zones for Mexico:
+# 1- Zona Centro (Central Zone): Corresponds to longitude 90 W,
+# includes most of Mexico, excluding what's mentioned below.
+# 2- Zona Pacífico (Pacific Zone): Longitude 105 W, includes the
+# states of Baja California Sur; Chihuahua; Nayarit (excluding Bahía
+# de Banderas which lies in Central Zone); Sinaloa and Sonora.
+# 3- Zona Noroeste (Northwest Zone): Longitude 120 W, includes the
+# state of Baja California.
+# 4- Zona Sureste (Southeast Zone): Longitude 75 W, includes the state
+# of Quintana Roo.
+# 5- The islands, reefs and keys shall take their timezone from the
+# longitude they are located at.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mexico 1939 only - Feb 5 0:00 1:00 D
@@ -2531,14 +2547,9 @@
###############################################################################
# Anguilla
+# Antigua and Barbuda
# See America/Port_of_Spain.
-# Antigua and Barbuda
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Antigua -4:07:12 - LMT 1912 Mar 2
- -5:00 - EST 1951
- -4:00 - AST
-
# Bahamas
#
# For 1899 Milne gives -5:09:29.5; round that.
@@ -2604,10 +2615,7 @@
-4:00 US A%sT
# Cayman Is
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Cayman -5:25:32 - LMT 1890 # Georgetown
- -5:07:11 - KMT 1912 Feb # Kingston Mean Time
- -5:00 - EST
+# See America/Panama.
# Costa Rica
@@ -3130,6 +3138,7 @@
Zone America/Panama -5:18:08 - LMT 1890
-5:19:36 - CMT 1908 Apr 22 # Colón Mean Time
-5:00 - EST
+Link America/Panama America/Cayman
# Puerto Rico
# There are too many San Juans elsewhere, so we'll use 'Puerto_Rico'.
--- a/jdk/make/data/tzdata/southamerica Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/data/tzdata/southamerica Fri Apr 03 16:37:06 2015 -0700
@@ -1229,10 +1229,13 @@
# DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
# http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
-# From Juan Correa (2015-01-28):
-# ... today the Ministry of Energy announced that Chile will drop DST, will keep
-# "summer time" (UTC -3 / UTC -5) all year round....
-# http://www.minenergia.cl/ministerio/noticias/generales/ministerio-de-energia-anuncia.html
+# From Eduardo Romero Urra (2015-03-03):
+# Today has been published officially that Chile will use the DST time
+# permanently until March 25 of 2017
+# http://www.diariooficial.interior.gob.cl/media/2015/03/03/1-large.jpg
+#
+# From Paul Eggert (2015-03-03):
+# For now, assume that the extension will persist indefinitely.
# NOTE: ChileAQ rules for Antarctic bases are stored separately in the
# 'antarctica' file.
@@ -1291,7 +1294,7 @@
-3:00 - CLT
Zone Pacific/Easter -7:17:44 - LMT 1890
-7:17:28 - EMT 1932 Sep # Easter Mean Time
- -7:00 Chile EAS%sT 1982 Mar 13 3:00u # Easter Time
+ -7:00 Chile EAS%sT 1982 Mar 14 3:00u # Easter Time
-6:00 Chile EAS%sT 2015 Apr 26 3:00u
-5:00 - EAST
#
@@ -1626,6 +1629,7 @@
# These all agree with Trinidad and Tobago since 1970.
Link America/Port_of_Spain America/Anguilla
+Link America/Port_of_Spain America/Antigua
Link America/Port_of_Spain America/Dominica
Link America/Port_of_Spain America/Grenada
Link America/Port_of_Spain America/Guadeloupe
--- a/jdk/make/lib/Awt2dLibraries.gmk Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/lib/Awt2dLibraries.gmk Fri Apr 03 16:37:06 2015 -0700
@@ -236,10 +236,6 @@
LIBAWT_VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/java.desktop/windows/native/libawt/windows/awt.rc
endif
-ifeq ($(MILESTONE), internal)
- LIBAWT_CFLAGS += -DINTERNAL_BUILD
-endif
-
LIBAWT_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt/mapfile-vers
ifeq ($(OPENJDK_TARGET_OS), linux)
LIBAWT_MAPFILE :=
@@ -347,10 +343,6 @@
endif
endif
- ifeq ($(MILESTONE), internal)
- LIBAWT_XAWT_CFLAGS += -DINTERNAL_BUILD
- endif
-
LIBAWT_XAWT_LDFLAGS_SUFFIX := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm -lc
ifeq ($(OPENJDK_TARGET_OS), linux)
--- a/jdk/make/lib/CoreLibraries.gmk Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/lib/CoreLibraries.gmk Fri Apr 03 16:37:06 2015 -0700
@@ -269,7 +269,7 @@
LIBJLI_EXCLUDE_FILES += $(notdir $(LIBJLI_EXCLUDE_ERGO))
ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBJLI_EXCLUDE_FILES += java_md_solinux.c ergo.c
+ LIBJLI_EXCLUDE_FILES += java_md_solinux.c ergo.c ergo_i586.c
BUILD_LIBJLI_java_md_macosx.c_CFLAGS := -x objective-c
BUILD_LIBJLI_STATIC_java_md_macosx.c_CFLAGS := -x objective-c
@@ -317,12 +317,7 @@
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(LIBJLI_CFLAGS), \
- DISABLED_WARNINGS_gcc := pointer-to-int-cast sign-compare format-nonliteral \
- parentheses, \
- DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
- int-conversion, \
- DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION E_NEWLINE_NOT_LAST, \
- DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
+ DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -371,7 +366,6 @@
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
- DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@@ -392,8 +386,6 @@
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
- DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
- int-conversion, \
LDFLAGS := -nostdlib -r, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
--- a/jdk/make/mapfiles/libjava/reorder-sparc Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/mapfiles/libjava/reorder-sparc Fri Apr 03 16:37:06 2015 -0700
@@ -1,7 +1,6 @@
data = R0x2000;
text = LOAD ?RXO;
# Test Null
-text: .text%init64IO: OUTPUTDIR/UnixFileSystem_md.o;
text: .text%JNI_OnLoad;
text: .text%Canonicalize;
text: .text%canonicalize;
@@ -38,10 +37,9 @@
text: .text%Java_java_lang_System_identityHashCode;
text: .text%Java_sun_misc_Signal_findSignal;
text: .text%Java_sun_misc_Signal_handle0;
-text: .text%Java_java_io_FileSystem_getFileSystem;
text: .text%JNU_NewObjectByName;
text: .text%Java_java_io_UnixFileSystem_initIDs;
-text: .text%Java_java_io_UnixFileSystem_canonicalize;
+text: .text%Java_java_io_UnixFileSystem_canonicalize0;
text: .text%JNU_GetStringPlatformChars;
text: .text%JNU_ReleaseStringPlatformChars;
text: .text%Java_java_io_FileInputStream_open0;
@@ -52,27 +50,25 @@
text: .text%Java_java_io_FileInputStream_close0;
text: .text%Java_java_lang_System_mapLibraryName;
text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
-text: .text%statMode: OUTPUTDIR/UnixFileSystem_md.o;
text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_load;
-text: .text%Java_java_lang_Compiler_registerNatives;
text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_find;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
text: .text%Java_java_io_UnixFileSystem_list;
text: .text%JNU_ClassString;
text: .text%JNU_CopyObjectArray;
text: .text%Java_java_lang_String_intern;
-text: .text%Java_java_lang_ClassLoader_findLoadedClass;
+text: .text%Java_java_lang_ClassLoader_findLoadedClass0;
text: .text%Java_java_lang_ClassLoader_findBootstrapClass;
text: .text%Java_java_lang_Throwable_fillInStackTrace;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
text: .text%Java_java_io_UnixFileSystem_getLastModifiedTime;
-text: .text%Java_java_lang_Float_floatToIntBits;
-text: .text%Java_java_lang_Double_doubleToLongBits;
+text: .text%Java_java_lang_Float_floatToRawIntBits;
+text: .text%Java_java_lang_Double_doubleToRawLongBits;
text: .text%Java_java_io_UnixFileSystem_getLength;
text: .text%Java_java_lang_ClassLoader_defineClass0;
text: .text%VerifyClassCodes;
# Test Exit
-text: .text%Java_java_lang_Shutdown_halt;
+text: .text%Java_java_lang_Shutdown_halt0;
# Test Hello
text: .text%Java_java_io_FileOutputStream_writeBytes;
text: .text%writeBytes;
@@ -91,9 +87,7 @@
text: .text%JNU_CallMethodByName;
text: .text%JNU_CallMethodByNameV;
text: .text%Java_java_io_UnixFileSystem_createDirectory;
-text: .text%Java_java_util_prefs_FileSystemPreferences_lockFile0;
text: .text%Java_java_io_UnixFileSystem_setLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_unlockFile0;
# Test LoadJFrame
text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
text: .text%Java_java_lang_Class_isInstance;
--- a/jdk/make/mapfiles/libjava/reorder-sparcv9 Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/mapfiles/libjava/reorder-sparcv9 Fri Apr 03 16:37:06 2015 -0700
@@ -1,7 +1,6 @@
data = R0x2000;
text = LOAD ?RXO;
# Test Null
-text: .text%init64IO: OUTPUTDIR/UnixFileSystem_md.o;
text: .text%JNI_OnLoad;
text: .text%Canonicalize;
text: .text%canonicalize;
@@ -30,9 +29,9 @@
text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_String_intern;
-text: .text%Java_java_lang_Float_floatToIntBits;
-text: .text%Java_java_lang_Double_doubleToLongBits;
-text: .text%Java_java_lang_ClassLoader_findLoadedClass;
+text: .text%Java_java_lang_Float_floatToRawIntBits;
+text: .text%Java_java_lang_Double_doubleToRawLongBits;
+text: .text%Java_java_lang_ClassLoader_findLoadedClass0;
text: .text%Java_java_lang_ClassLoader_findBootstrapClass;
text: .text%VerifyClassCodes;
text: .text%Java_java_lang_Throwable_fillInStackTrace;
@@ -41,10 +40,9 @@
text: .text%Java_java_lang_System_identityHashCode;
text: .text%Java_sun_misc_Signal_findSignal;
text: .text%Java_sun_misc_Signal_handle0;
-text: .text%Java_java_io_FileSystem_getFileSystem;
text: .text%JNU_NewObjectByName;
text: .text%Java_java_io_UnixFileSystem_initIDs;
-text: .text%Java_java_io_UnixFileSystem_canonicalize;
+text: .text%Java_java_io_UnixFileSystem_canonicalize0;
text: .text%JNU_GetStringPlatformChars;
text: .text%JNU_ReleaseStringPlatformChars;
text: .text%Java_java_io_FileInputStream_open0;
@@ -53,13 +51,11 @@
text: .text%readBytes;
text: .text%Java_java_io_FileInputStream_available;
text: .text%Java_java_io_FileInputStream_close0;
-text: .text%Java_java_lang_Compiler_registerNatives;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
text: .text%Java_java_io_UnixFileSystem_list;
text: .text%JNU_ClassString;
text: .text%JNU_CopyObjectArray;
text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
-text: .text%statMode: OUTPUTDIR/UnixFileSystem_md.o;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
text: .text%Java_java_lang_System_mapLibraryName;
text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_load;
@@ -68,7 +64,7 @@
text: .text%Java_java_lang_Object_getClass;
text: .text%Java_java_lang_ClassLoader_defineClass0;
# Test Exit
-text: .text%Java_java_lang_Shutdown_halt;
+text: .text%Java_java_lang_Shutdown_halt0;
# Test Hello
text: .text%Java_java_io_FileOutputStream_writeBytes;
text: .text%writeBytes;
@@ -88,9 +84,7 @@
text: .text%JNU_CallMethodByNameV;
text: .text%Java_java_io_UnixFileSystem_createDirectory;
text: .text%Java_java_io_UnixFileSystem_getLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_lockFile0;
text: .text%Java_java_io_UnixFileSystem_setLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_unlockFile0;
# Test LoadJFrame
text: .text%Java_java_lang_Class_isAssignableFrom;
text: .text%Java_java_lang_Class_isInstance;
--- a/jdk/make/mapfiles/libjava/reorder-x86 Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/mapfiles/libjava/reorder-x86 Fri Apr 03 16:37:06 2015 -0700
@@ -2,7 +2,6 @@
text = LOAD ?RXO;
# Test Null
text: .text%_init;
-text: .text%init64IO: OUTPUTDIR/UnixFileSystem_md.o;
text: .text%JNI_OnLoad;
text: .text%Canonicalize;
text: .text%canonicalize;
@@ -36,8 +35,6 @@
text: .text%Java_java_lang_Throwable_fillInStackTrace;
text: .text%Java_java_lang_System_setOut0;
text: .text%Java_java_lang_System_setErr0;
-text: .text%Java_java_lang_Compiler_registerNatives;
-text: .text%Java_java_io_FileSystem_getFileSystem;
text: .text%JNU_NewObjectByName;
text: .text%Java_java_io_UnixFileSystem_initIDs;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
@@ -46,17 +43,17 @@
text: .text%JNU_ReleaseStringPlatformChars;
text: .text%JNU_ClassString;
text: .text%JNU_CopyObjectArray;
-text: .text%Java_java_io_UnixFileSystem_canonicalize;
+text: .text%Java_java_io_UnixFileSystem_canonicalize0;
text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
-text: .text%Java_java_lang_ClassLoader_findLoadedClass;
+text: .text%Java_java_lang_ClassLoader_findLoadedClass0;
text: .text%Java_java_lang_ClassLoader_findBootstrapClass;
text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
text: .text%Java_java_lang_System_mapLibraryName;
text: .text%cpchars: OUTPUTDIR/System.o;
text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_load;
text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_find;
-text: .text%Java_java_lang_Float_floatToIntBits;
-text: .text%Java_java_lang_Double_doubleToLongBits;
+text: .text%Java_java_lang_Float_floatToRawIntBits;
+text: .text%Java_java_lang_Double_doubleToRawLongBits;
text: .text%Java_java_io_FileInputStream_open0;
text: .text%fileOpen;
text: .text%Java_java_io_UnixFileSystem_getLength;
@@ -67,7 +64,7 @@
text: .text%Java_java_lang_ClassLoader_defineClass0;
text: .text%VerifyClassCodes;
# Test Exit
-text: .text%Java_java_lang_Shutdown_halt;
+text: .text%Java_java_lang_Shutdown_halt0;
# Test Hello
text: .text%Java_java_io_FileOutputStream_writeBytes;
text: .text%writeBytes;
@@ -93,9 +90,7 @@
text: .text%Java_java_io_FileOutputStream_open0;
text: .text%Java_java_io_UnixFileSystem_createDirectory;
text: .text%Java_java_io_UnixFileSystem_getLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_lockFile0;
text: .text%Java_java_io_UnixFileSystem_setLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_unlockFile0;
text: .text%Java_java_io_FileOutputStream_close0;
text: .text%Java_java_util_logging_FileHandler_unlockFile;
# Test LoadJFrame
--- a/jdk/make/mapfiles/libzip/reorder-sparcv9 Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/mapfiles/libzip/reorder-sparcv9 Fri Apr 03 16:37:06 2015 -0700
@@ -12,7 +12,6 @@
text: .text%ZIP_FindEntry;
text: .text%ZIP_GetEntry;
text: .text%ZIP_Lock;
-text: .text%readLOC: OUTPUTDIR/zip_util.o;
text: .text%ZIP_Unlock;
text: .text%ZIP_FreeEntry;
text: .text%Java_java_util_zip_ZipFile_initIDs;
@@ -37,7 +36,6 @@
text: .text%inflate;
text: .text%Java_java_util_zip_ZipFile_read;
text: .text%ZIP_Read;
-text: .text%huft_build: OUTPUTDIR/inftrees.o;
text: .text%zcfree;
text: .text%Java_java_util_jar_JarFile_getMetaInfEntryNames;
text: .text%ZIP_ReadEntry;
--- a/jdk/make/mapfiles/libzip/reorder-x86 Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/make/mapfiles/libzip/reorder-x86 Fri Apr 03 16:37:06 2015 -0700
@@ -13,7 +13,6 @@
text: .text%ZIP_FindEntry;
text: .text%ZIP_GetEntry;
text: .text%ZIP_Lock;
-text: .text%readLOC: OUTPUTDIR/zip_util.o;
text: .text%ZIP_Unlock;
text: .text%ZIP_FreeEntry;
text: .text%Java_java_util_zip_ZipFile_initIDs;
@@ -38,7 +37,6 @@
text: .text%inflate;
text: .text%Java_java_util_zip_ZipFile_read;
text: .text%ZIP_Read;
-text: .text%huft_build: OUTPUTDIR/inftrees.o;
text: .text%zcfree;
text: .text%Java_java_util_jar_JarFile_getMetaInfEntryNames;
text: .text%ZIP_ReadEntry;
--- a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c Fri Apr 03 16:37:06 2015 -0700
@@ -852,7 +852,7 @@
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
void * tmp;
pthread_join(tid, &tmp);
- rslt = (int)tmp;
+ rslt = (int)(intptr_t)tmp;
} else {
/*
* Continue execution in current thread if for some reason (e.g. out of
--- a/jdk/src/java.base/share/classes/java/io/ObjectStreamException.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/io/ObjectStreamException.java Fri Apr 03 16:37:06 2015 -0700
@@ -38,10 +38,10 @@
/**
* Create an ObjectStreamException with the specified argument.
*
- * @param classname the detailed message for the exception
+ * @param message the detailed message for the exception
*/
- protected ObjectStreamException(String classname) {
- super(classname);
+ protected ObjectStreamException(String message) {
+ super(message);
}
/**
--- a/jdk/src/java.base/share/classes/java/net/ProtocolException.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/net/ProtocolException.java Fri Apr 03 16:37:06 2015 -0700
@@ -42,10 +42,10 @@
* Constructs a new {@code ProtocolException} with the
* specified detail message.
*
- * @param host the detail message.
+ * @param message the detail message.
*/
- public ProtocolException(String host) {
- super(host);
+ public ProtocolException(String message) {
+ super(message);
}
/**
--- a/jdk/src/java.base/share/classes/java/net/UnknownHostException.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/net/UnknownHostException.java Fri Apr 03 16:37:06 2015 -0700
@@ -41,10 +41,10 @@
* Constructs a new {@code UnknownHostException} with the
* specified detail message.
*
- * @param host the detail message.
+ * @param message the detail message.
*/
- public UnknownHostException(String host) {
- super(host);
+ public UnknownHostException(String message) {
+ super(message);
}
/**
--- a/jdk/src/java.base/share/classes/java/time/chrono/HijrahChronology.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/time/chrono/HijrahChronology.java Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -478,7 +478,6 @@
if (prolepticYear < getMinimumYear() || prolepticYear > getMaximumYear()) {
return false;
}
- int epochMonth = yearToEpochMonth((int) prolepticYear);
int len = getYearLength((int) prolepticYear);
return (len > 354);
}
@@ -659,7 +658,7 @@
}
/**
- * Return the maximum supported Hijrah ear.
+ * Return the maximum supported Hijrah year.
*
* @return the minimum
*/
--- a/jdk/src/java.base/share/classes/java/util/Calendar.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Calendar.java Fri Apr 03 16:37:06 2015 -0700
@@ -2083,17 +2083,33 @@
return null;
}
+ String calendarType = getCalendarType();
+ int fieldValue = get(field);
// the standalone and narrow styles are supported only through CalendarDataProviders.
- if (isStandaloneStyle(style) || isNarrowStyle(style)) {
- return CalendarDataUtility.retrieveFieldValueName(getCalendarType(),
- field, get(field),
- style, locale);
+ if (isStandaloneStyle(style) || isNarrowFormatStyle(style)) {
+ String val = CalendarDataUtility.retrieveFieldValueName(calendarType,
+ field, fieldValue,
+ style, locale);
+ // Perform fallback here to follow the CLDR rules
+ if (val == null) {
+ if (isNarrowFormatStyle(style)) {
+ val = CalendarDataUtility.retrieveFieldValueName(calendarType,
+ field, fieldValue,
+ toStandaloneStyle(style),
+ locale);
+ } else if (isStandaloneStyle(style)) {
+ val = CalendarDataUtility.retrieveFieldValueName(calendarType,
+ field, fieldValue,
+ getBaseStyle(style),
+ locale);
+ }
+ }
+ return val;
}
DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale);
String[] strings = getFieldStrings(field, style, symbols);
if (strings != null) {
- int fieldValue = get(field);
if (fieldValue < strings.length) {
return strings[fieldValue];
}
@@ -2155,10 +2171,26 @@
ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null;
}
- if (style == ALL_STYLES || isStandaloneStyle(style)) {
- return CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale);
+
+ String calendarType = getCalendarType();
+ if (style == ALL_STYLES || isStandaloneStyle(style) || isNarrowFormatStyle(style)) {
+ Map<String, Integer> map;
+ map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field, style, locale);
+
+ // Perform fallback here to follow the CLDR rules
+ if (map == null) {
+ if (isNarrowFormatStyle(style)) {
+ map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field,
+ toStandaloneStyle(style), locale);
+ } else if (style != ALL_STYLES) {
+ map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field,
+ getBaseStyle(style), locale);
+ }
+ }
+ return map;
}
- // SHORT, LONG, or NARROW
+
+ // SHORT or LONG
return getDisplayNamesImpl(field, style, locale);
}
@@ -2544,14 +2576,22 @@
return style & ~STANDALONE_MASK;
}
- boolean isStandaloneStyle(int style) {
+ private int toStandaloneStyle(int style) {
+ return style | STANDALONE_MASK;
+ }
+
+ private boolean isStandaloneStyle(int style) {
return (style & STANDALONE_MASK) != 0;
}
- boolean isNarrowStyle(int style) {
+ private boolean isNarrowStyle(int style) {
return style == NARROW_FORMAT || style == NARROW_STANDALONE;
}
+ private boolean isNarrowFormatStyle(int style) {
+ return style == NARROW_FORMAT;
+ }
+
/**
* Returns the pseudo-time-stamp for two fields, given their
* individual pseudo-time-stamps. If either of the fields
--- a/jdk/src/java.base/share/classes/java/util/HashMap.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/HashMap.java Fri Apr 03 16:37:06 2015 -0700
@@ -1082,6 +1082,16 @@
return null;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link ConcurrentModificationException} if it is detected that the
+ * mapping function modifies this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * mapping function modified this map
+ */
@Override
public V computeIfAbsent(K key,
Function<? super K, ? extends V> mappingFunction) {
@@ -1115,7 +1125,9 @@
return oldValue;
}
}
+ int mc = modCount;
V v = mappingFunction.apply(key);
+ if (mc != modCount) { throw new ConcurrentModificationException(); }
if (v == null) {
return null;
} else if (old != null) {
@@ -1130,12 +1142,23 @@
if (binCount >= TREEIFY_THRESHOLD - 1)
treeifyBin(tab, hash);
}
- ++modCount;
+ modCount = mc + 1;
++size;
afterNodeInsertion(true);
return v;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link ConcurrentModificationException} if it is detected that the
+ * remapping function modifies this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * remapping function modified this map
+ */
+ @Override
public V computeIfPresent(K key,
BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
if (remappingFunction == null)
@@ -1144,7 +1167,9 @@
int hash = hash(key);
if ((e = getNode(hash, key)) != null &&
(oldValue = e.value) != null) {
+ int mc = modCount;
V v = remappingFunction.apply(key, oldValue);
+ if (mc != modCount) { throw new ConcurrentModificationException(); }
if (v != null) {
e.value = v;
afterNodeAccess(e);
@@ -1156,6 +1181,16 @@
return null;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link ConcurrentModificationException} if it is detected that the
+ * remapping function modifies this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * remapping function modified this map
+ */
@Override
public V compute(K key,
BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
@@ -1185,7 +1220,9 @@
}
}
V oldValue = (old == null) ? null : old.value;
+ int mc = modCount;
V v = remappingFunction.apply(key, oldValue);
+ if (mc != modCount) { throw new ConcurrentModificationException(); }
if (old != null) {
if (v != null) {
old.value = v;
@@ -1202,13 +1239,23 @@
if (binCount >= TREEIFY_THRESHOLD - 1)
treeifyBin(tab, hash);
}
- ++modCount;
+ modCount = mc + 1;
++size;
afterNodeInsertion(true);
}
return v;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link ConcurrentModificationException} if it is detected that the
+ * remapping function modifies this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * remapping function modified this map
+ */
@Override
public V merge(K key, V value,
BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
@@ -1241,10 +1288,15 @@
}
if (old != null) {
V v;
- if (old.value != null)
+ if (old.value != null) {
+ int mc = modCount;
v = remappingFunction.apply(old.value, value);
- else
+ if (mc != modCount) {
+ throw new ConcurrentModificationException();
+ }
+ } else {
v = value;
+ }
if (v != null) {
old.value = v;
afterNodeAccess(old);
--- a/jdk/src/java.base/share/classes/java/util/Hashtable.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Hashtable.java Fri Apr 03 16:37:06 2015 -0700
@@ -1000,6 +1000,16 @@
return null;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link java.util.ConcurrentModificationException} if the mapping
+ * function modified this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * mapping function modified this map
+ */
@Override
public synchronized V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
Objects.requireNonNull(mappingFunction);
@@ -1016,7 +1026,9 @@
}
}
+ int mc = modCount;
V newValue = mappingFunction.apply(key);
+ if (mc != modCount) { throw new ConcurrentModificationException(); }
if (newValue != null) {
addEntry(hash, key, newValue, index);
}
@@ -1024,6 +1036,16 @@
return newValue;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link java.util.ConcurrentModificationException} if the remapping
+ * function modified this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * remapping function modified this map
+ */
@Override
public synchronized V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
@@ -1035,14 +1057,18 @@
Entry<K,V> e = (Entry<K,V>)tab[index];
for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
if (e.hash == hash && e.key.equals(key)) {
+ int mc = modCount;
V newValue = remappingFunction.apply(key, e.value);
+ if (mc != modCount) {
+ throw new ConcurrentModificationException();
+ }
if (newValue == null) {
if (prev != null) {
prev.next = e.next;
} else {
tab[index] = e.next;
}
- modCount++;
+ modCount = mc + 1;
count--;
} else {
e.value = newValue;
@@ -1052,7 +1078,16 @@
}
return null;
}
-
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link java.util.ConcurrentModificationException} if the remapping
+ * function modified this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * remapping function modified this map
+ */
@Override
public synchronized V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
@@ -1064,14 +1099,18 @@
Entry<K,V> e = (Entry<K,V>)tab[index];
for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
if (e.hash == hash && Objects.equals(e.key, key)) {
+ int mc = modCount;
V newValue = remappingFunction.apply(key, e.value);
+ if (mc != modCount) {
+ throw new ConcurrentModificationException();
+ }
if (newValue == null) {
if (prev != null) {
prev.next = e.next;
} else {
tab[index] = e.next;
}
- modCount++;
+ modCount = mc + 1;
count--;
} else {
e.value = newValue;
@@ -1080,7 +1119,9 @@
}
}
+ int mc = modCount;
V newValue = remappingFunction.apply(key, null);
+ if (mc != modCount) { throw new ConcurrentModificationException(); }
if (newValue != null) {
addEntry(hash, key, newValue, index);
}
@@ -1088,6 +1129,16 @@
return newValue;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>This method will, on a best-effort basis, throw a
+ * {@link java.util.ConcurrentModificationException} if the remapping
+ * function modified this map during computation.
+ *
+ * @throws ConcurrentModificationException if it is detected that the
+ * remapping function modified this map
+ */
@Override
public synchronized V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
@@ -1099,14 +1150,18 @@
Entry<K,V> e = (Entry<K,V>)tab[index];
for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
if (e.hash == hash && e.key.equals(key)) {
+ int mc = modCount;
V newValue = remappingFunction.apply(e.value, value);
+ if (mc != modCount) {
+ throw new ConcurrentModificationException();
+ }
if (newValue == null) {
if (prev != null) {
prev.next = e.next;
} else {
tab[index] = e.next;
}
- modCount++;
+ modCount = mc + 1;
count--;
} else {
e.value = newValue;
--- a/jdk/src/java.base/share/classes/java/util/Map.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Map.java Fri Apr 03 16:37:06 2015 -0700
@@ -894,8 +894,8 @@
* to {@code null}), attempts to compute its value using the given mapping
* function and enters it into this map unless {@code null}.
*
- * <p>If the function returns {@code null} no mapping is recorded. If
- * the function itself throws an (unchecked) exception, the
+ * <p>If the mapping function returns {@code null}, no mapping is recorded.
+ * If the mapping function itself throws an (unchecked) exception, the
* exception is rethrown, and no mapping is recorded. The most
* common usage is to construct a new object serving as an initial
* mapped value or memoized result, as in:
@@ -911,6 +911,7 @@
* map.computeIfAbsent(key, k -> new HashSet<V>()).add(v);
* }</pre>
*
+ * <p>The mapping function should not modify this map during computation.
*
* @implSpec
* The default implementation is equivalent to the following steps for this
@@ -925,16 +926,27 @@
* }
* }</pre>
*
+ * <p>The default implementation makes no guarantees about detecting if the
+ * mapping function modifies this map during computation and, if
+ * appropriate, reporting an error. Non-concurrent implementations should
+ * override this method and, on a best-effort basis, throw a
+ * {@code ConcurrentModificationException} if it is detected that the
+ * mapping function modifies this map during computation. Concurrent
+ * implementations should override this method and, on a best-effort basis,
+ * throw an {@code IllegalStateException} if it is detected that the
+ * mapping function modifies this map during computation and as a result
+ * computation would never complete.
+ *
* <p>The default implementation makes no guarantees about synchronization
* or atomicity properties of this method. Any implementation providing
* atomicity guarantees must override this method and document its
* concurrency properties. In particular, all implementations of
* subinterface {@link java.util.concurrent.ConcurrentMap} must document
- * whether the function is applied once atomically only if the value is not
- * present.
+ * whether the mapping function is applied once atomically only if the value
+ * is not present.
*
* @param key key with which the specified value is to be associated
- * @param mappingFunction the function to compute a value
+ * @param mappingFunction the mapping function to compute a value
* @return the current (existing or computed) value associated with
* the specified key, or null if the computed value is null
* @throws NullPointerException if the specified key is null and
@@ -967,10 +979,12 @@
* If the value for the specified key is present and non-null, attempts to
* compute a new mapping given the key and its current mapped value.
*
- * <p>If the function returns {@code null}, the mapping is removed. If the
- * function itself throws an (unchecked) exception, the exception is
- * rethrown, and the current mapping is left unchanged.
- *
+ * <p>If the remapping function returns {@code null}, the mapping is removed.
+ * If the remapping function itself throws an (unchecked) exception, the
+ * exception is rethrown, and the current mapping is left unchanged.
+ *
+ * <p>The remapping function should not modify this map during computation.
+ *
* @implSpec
* The default implementation is equivalent to performing the following
* steps for this {@code map}, then returning the current value or
@@ -987,16 +1001,27 @@
* }
* }</pre>
*
+ * <p>The default implementation makes no guarantees about detecting if the
+ * remapping function modifies this map during computation and, if
+ * appropriate, reporting an error. Non-concurrent implementations should
+ * override this method and, on a best-effort basis, throw a
+ * {@code ConcurrentModificationException} if it is detected that the
+ * remapping function modifies this map during computation. Concurrent
+ * implementations should override this method and, on a best-effort basis,
+ * throw an {@code IllegalStateException} if it is detected that the
+ * remapping function modifies this map during computation and as a result
+ * computation would never complete.
+ *
* <p>The default implementation makes no guarantees about synchronization
* or atomicity properties of this method. Any implementation providing
* atomicity guarantees must override this method and document its
* concurrency properties. In particular, all implementations of
* subinterface {@link java.util.concurrent.ConcurrentMap} must document
- * whether the function is applied once atomically only if the value is not
- * present.
+ * whether the remapping function is applied once atomically only if the
+ * value is not present.
*
* @param key key with which the specified value is to be associated
- * @param remappingFunction the function to compute a value
+ * @param remappingFunction the remapping function to compute a value
* @return the new value associated with the specified key, or null if none
* @throws NullPointerException if the specified key is null and
* this map does not support null keys, or the
@@ -1037,10 +1062,12 @@
* map.compute(key, (k, v) -> (v == null) ? msg : v.concat(msg))}</pre>
* (Method {@link #merge merge()} is often simpler to use for such purposes.)
*
- * <p>If the function returns {@code null}, the mapping is removed (or
- * remains absent if initially absent). If the function itself throws an
- * (unchecked) exception, the exception is rethrown, and the current mapping
- * is left unchanged.
+ * <p>If the remapping function returns {@code null}, the mapping is removed
+ * (or remains absent if initially absent). If the remapping function
+ * itself throws an (unchecked) exception, the exception is rethrown, and
+ * the current mapping is left unchanged.
+ *
+ * <p>The remapping function should not modify this map during computation.
*
* @implSpec
* The default implementation is equivalent to performing the following
@@ -1063,16 +1090,27 @@
* }
* }</pre>
*
+ * <p>The default implementation makes no guarantees about detecting if the
+ * remapping function modifies this map during computation and, if
+ * appropriate, reporting an error. Non-concurrent implementations should
+ * override this method and, on a best-effort basis, throw a
+ * {@code ConcurrentModificationException} if it is detected that the
+ * remapping function modifies this map during computation. Concurrent
+ * implementations should override this method and, on a best-effort basis,
+ * throw an {@code IllegalStateException} if it is detected that the
+ * remapping function modifies this map during computation and as a result
+ * computation would never complete.
+ *
* <p>The default implementation makes no guarantees about synchronization
* or atomicity properties of this method. Any implementation providing
* atomicity guarantees must override this method and document its
* concurrency properties. In particular, all implementations of
* subinterface {@link java.util.concurrent.ConcurrentMap} must document
- * whether the function is applied once atomically only if the value is not
- * present.
+ * whether the remapping function is applied once atomically only if the
+ * value is not present.
*
* @param key key with which the specified value is to be associated
- * @param remappingFunction the function to compute a value
+ * @param remappingFunction the remapping function to compute a value
* @return the new value associated with the specified key, or null if none
* @throws NullPointerException if the specified key is null and
* this map does not support null keys, or the
@@ -1121,9 +1159,11 @@
* map.merge(key, msg, String::concat)
* }</pre>
*
- * <p>If the function returns {@code null} the mapping is removed. If the
- * function itself throws an (unchecked) exception, the exception is
- * rethrown, and the current mapping is left unchanged.
+ * <p>If the remapping function returns {@code null}, the mapping is removed.
+ * If the remapping function itself throws an (unchecked) exception, the
+ * exception is rethrown, and the current mapping is left unchanged.
+ *
+ * <p>The remapping function should not modify this map during computation.
*
* @implSpec
* The default implementation is equivalent to performing the following
@@ -1140,19 +1180,31 @@
* map.put(key, newValue);
* }</pre>
*
+ * <p>The default implementation makes no guarantees about detecting if the
+ * remapping function modifies this map during computation and, if
+ * appropriate, reporting an error. Non-concurrent implementations should
+ * override this method and, on a best-effort basis, throw a
+ * {@code ConcurrentModificationException} if it is detected that the
+ * remapping function modifies this map during computation. Concurrent
+ * implementations should override this method and, on a best-effort basis,
+ * throw an {@code IllegalStateException} if it is detected that the
+ * remapping function modifies this map during computation and as a result
+ * computation would never complete.
+ *
* <p>The default implementation makes no guarantees about synchronization
* or atomicity properties of this method. Any implementation providing
* atomicity guarantees must override this method and document its
* concurrency properties. In particular, all implementations of
* subinterface {@link java.util.concurrent.ConcurrentMap} must document
- * whether the function is applied once atomically only if the value is not
- * present.
+ * whether the remapping function is applied once atomically only if the
+ * value is not present.
*
* @param key key with which the resulting value is to be associated
* @param value the non-null value to be merged with the existing value
* associated with the key or, if no existing value or a null value
* is associated with the key, to be associated with the key
- * @param remappingFunction the function to recompute a value if present
+ * @param remappingFunction the remapping function to recompute a value if
+ * present
* @return the new value associated with the specified key, or null if no
* value is associated with the key
* @throws UnsupportedOperationException if the {@code put} operation
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/Exported.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2013, 2014, 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 jdk;
+
+import java.lang.annotation.*;
+
+/**
+ * Indicates whether or not a JDK specific type or package is an
+ * exported part of the JDK suitable for use outside of the JDK
+ * implementation itself.
+ *
+ * This annotation should only be applied to types and packages
+ * <em>outside</em> of the Java SE namespaces of {@code java.*} and
+ * {@code javax.*} packages. For example, certain portions of {@code
+ * com.sun.*} are official parts of the JDK meant to be generally
+ * usable while other portions of {@code com.sun.*} are not. This
+ * annotation type allows those portions to be easily and
+ * programmatically distinguished.
+ *
+ * <p>If in one release a type or package is
+ * <code>@Exported(true)</code>, in a subsequent major release such a
+ * type or package can transition to <code>@Exported(false)</code>.
+ *
+ * <p>If a type or package is <code>@Exported(false)</code> in a
+ * release, it may be removed in a subsequent major release.
+ *
+ * <p>If a top-level type has an <code>@Exported</code> annotation,
+ * any nested member types with the top-level type should have an
+ * <code>@Exported</code> annotation with the same value.
+ *
+ * (In exceptional cases, if a nested type is going to be removed
+ * before its enclosing type, the nested type's could be
+ * <code>@Exported(false)</code> while its enclosing type was
+ * <code>@Exported(true)</code>.)
+ *
+ * Likewise, if a package has an <code>@Exported</code> annotation,
+ * top-level types within that package should also have an
+ * <code>@Exported</code> annotation.
+ *
+ * Sometimes a top-level type may have a different
+ * <code>@Exported</code> value than its package.
+ *
+ * @since 1.8
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.PACKAGE})
+@Exported
+public @interface Exported {
+ /**
+ * Whether or not the annotated type or package is an exported
+ * part of the JDK.
+ * @return whether or not the annotated type or package is an exported
+ * part of the JDK
+ */
+ boolean value() default true;
+}
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java Fri Apr 03 16:37:06 2015 -0700
@@ -631,6 +631,10 @@
/**
* Atomically updates Java variable to {@code x} if it is currently
* holding {@code expected}.
+ *
+ * <p>This operation has memory semantics of a {@code volatile} read
+ * and write. Corresponds to C11 atomic_compare_exchange_strong.
+ *
* @return {@code true} if successful
*/
public final native boolean compareAndSwapObject(Object o, long offset,
@@ -640,6 +644,10 @@
/**
* Atomically updates Java variable to {@code x} if it is currently
* holding {@code expected}.
+ *
+ * <p>This operation has memory semantics of a {@code volatile} read
+ * and write. Corresponds to C11 atomic_compare_exchange_strong.
+ *
* @return {@code true} if successful
*/
public final native boolean compareAndSwapInt(Object o, long offset,
@@ -649,6 +657,10 @@
/**
* Atomically updates Java variable to {@code x} if it is currently
* holding {@code expected}.
+ *
+ * <p>This operation has memory semantics of a {@code volatile} read
+ * and write. Corresponds to C11 atomic_compare_exchange_strong.
+ *
* @return {@code true} if successful
*/
public final native boolean compareAndSwapLong(Object o, long offset,
--- a/jdk/src/java.base/share/classes/sun/reflect/misc/FieldUtil.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/classes/sun/reflect/misc/FieldUtil.java Fri Apr 03 16:37:06 2015 -0700
@@ -45,9 +45,4 @@
ReflectUtil.checkPackageAccess(cls);
return cls.getFields();
}
-
- public static Field[] getDeclaredFields(Class<?> cls) {
- ReflectUtil.checkPackageAccess(cls);
- return cls.getDeclaredFields();
- }
}
--- a/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java Fri Apr 03 16:37:06 2015 -0700
@@ -625,6 +625,15 @@
params[2] = 5;
params[3] = 86400000;
}
+ // Additional check for startDayOfWeek=6 and starTime=86400000
+ // is needed for Asia/Amman; Asia/Gasa and Asia/Hebron
+ if (params[2] == 7 && params[3] == 0 &&
+ (zoneId.equals("Asia/Amman") ||
+ zoneId.equals("Asia/Gaza") ||
+ zoneId.equals("Asia/Hebron"))) {
+ params[2] = 6; // Friday
+ params[3] = 86400000; // 24h
+ }
//endDayOfWeek and endTime workaround
if (params[7] == 6 && params[8] == 0 &&
(zoneId.equals("Africa/Cairo"))) {
--- a/jdk/src/java.base/share/native/libjli/java.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/native/libjli/java.c Fri Apr 03 16:37:06 2015 -0700
@@ -730,7 +730,7 @@
static int
parse_size(const char *s, jlong *result) {
jlong n = 0;
- int args_read = sscanf(s, jlong_format_specifier(), &n);
+ int args_read = sscanf(s, JLONG_FORMAT_SPECIFIER, &n);
if (args_read != 1) {
return 0;
}
@@ -798,7 +798,7 @@
* overflow before the JVM startup code can check to make sure the stack
* is big enough.
*/
- if (threadStackSize < STACK_SIZE_MINIMUM) {
+ if (threadStackSize < (jlong)STACK_SIZE_MINIMUM) {
threadStackSize = STACK_SIZE_MINIMUM;
}
}
--- a/jdk/src/java.base/share/native/libjli/java.h Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/native/libjli/java.h Fri Apr 03 16:37:06 2015 -0700
@@ -144,8 +144,6 @@
void JLI_ReportExceptionDescription(JNIEnv * env);
void PrintMachineDependentOptions();
-const char *jlong_format_specifier();
-
/*
* Block current thread and continue execution in new thread
*/
--- a/jdk/src/java.base/share/native/libjli/manifest_info.h Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/native/libjli/manifest_info.h Fri Apr 03 16:37:06 2015 -0700
@@ -109,6 +109,8 @@
/*
* Macros for getting end of central directory header (END) fields
*/
+#define ENDNMD(b) SH(b, 4) /* number of this disk */
+#define ENDDSK(b) SH(b, 6) /* disk number of start */
#define ENDSUB(b) SH(b, 8) /* number of entries on this disk */
#define ENDTOT(b) SH(b, 10) /* total number of entries */
#define ENDSIZ(b) LG(b, 12) /* central directory size */
--- a/jdk/src/java.base/share/native/libjli/parse_manifest.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/native/libjli/parse_manifest.c Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -111,52 +111,127 @@
return (NULL);
}
-static jboolean zip64_present = JNI_FALSE;
+/*
+ * Implementation notes:
+ *
+ * This is a zip format reader for seekable files, that tolerates
+ * leading and trailing garbage, and tolerates having had internal
+ * offsets adjusted for leading garbage (as with Info-Zip's zip -A).
+ *
+ * We find the end header by scanning backwards from the end of the
+ * file for the end signature. This may fail in the presence of
+ * trailing garbage or a ZIP file comment that contains binary data.
+ * Similarly, the ZIP64 end header may need to be located by scanning
+ * backwards from the end header. It may be misidentified, but this
+ * is very unlikely to happen in practice without adversarial input.
+ *
+ * The zip file format is documented at:
+ * https://www.pkware.com/documents/casestudies/APPNOTE.TXT
+ *
+ * TODO: more informative error messages
+ */
+
+/** Reads count bytes from fd at position pos into given buffer. */
+static jboolean
+readAt(int fd, jlong pos, unsigned int count, void *buf) {
+ return (pos >= 0
+ && JLI_Lseek(fd, pos, SEEK_SET) == pos
+ && read(fd, buf, count) == (jlong) count);
+}
+
/*
- * Checks to see if we have ZIP64 archive, and save
- * the check for later use
+ * Tells whether given header values (obtained from either ZIP64 or
+ * non-ZIP64 header) appear to be correct, by checking the first LOC
+ * and CEN headers.
*/
-static int
-haveZIP64(Byte *p) {
- jlong cenlen, cenoff, centot;
- cenlen = ENDSIZ(p);
- cenoff = ENDOFF(p);
- centot = ENDTOT(p);
- zip64_present = (cenlen == ZIP64_MAGICVAL ||
- cenoff == ZIP64_MAGICVAL ||
- centot == ZIP64_MAGICCOUNT);
- return zip64_present;
-}
-
-static jlong
-find_end64(int fd, Byte *ep, jlong pos)
-{
- jlong end64pos;
- jlong bytes;
- if ((end64pos = JLI_Lseek(fd, pos - ZIP64_LOCHDR, SEEK_SET)) < (jlong)0)
- return -1;
- if ((bytes = read(fd, ep, ZIP64_LOCHDR)) < 0)
- return -1;
- if (ZIP64_LOCSIG_AT(ep))
- return end64pos;
- return -1;
+static jboolean
+is_valid_end_header(int fd, jlong endpos,
+ jlong censiz, jlong cenoff, jlong entries) {
+ Byte cenhdr[CENHDR];
+ Byte lochdr[LOCHDR];
+ // Expected offset of the first central directory header
+ jlong censtart = endpos - censiz;
+ // Expected position within the file that offsets are relative to
+ jlong base_offset = endpos - (censiz + cenoff);
+ return censtart >= 0 && cenoff >= 0 &&
+ (censiz == 0 ||
+ // Validate first CEN and LOC header signatures.
+ // Central directory must come directly before the end header.
+ (readAt(fd, censtart, CENHDR, cenhdr)
+ && CENSIG_AT(cenhdr)
+ && readAt(fd, base_offset + CENOFF(cenhdr), LOCHDR, lochdr)
+ && LOCSIG_AT(lochdr)
+ && CENNAM(cenhdr) == LOCNAM(lochdr)));
}
/*
- * A very little used routine to handle the case that zip file has
- * a comment at the end. Believe it or not, the only way to find the
- * END record is to walk backwards, byte by bloody byte looking for
- * the END record signature.
+ * Tells whether p appears to be pointing at a valid ZIP64 end header.
+ * Values censiz, cenoff, and entries are the corresponding values
+ * from the non-ZIP64 end header. We perform extra checks to avoid
+ * misidentifying data from the last entry as a ZIP64 end header.
+ */
+static jboolean
+is_zip64_endhdr(int fd, const Byte *p, jlong end64pos,
+ jlong censiz, jlong cenoff, jlong entries) {
+ if (ZIP64_ENDSIG_AT(p)) {
+ jlong censiz64 = ZIP64_ENDSIZ(p);
+ jlong cenoff64 = ZIP64_ENDOFF(p);
+ jlong entries64 = ZIP64_ENDTOT(p);
+ return (censiz64 == censiz || censiz == ZIP64_MAGICVAL)
+ && (cenoff64 == cenoff || cenoff == ZIP64_MAGICVAL)
+ && (entries64 == entries || entries == ZIP64_MAGICCOUNT)
+ && is_valid_end_header(fd, end64pos, censiz64, cenoff64, entries64);
+ }
+ return JNI_FALSE;
+}
+
+/*
+ * Given a non-ZIP64 end header located at endhdr and endpos, look for
+ * an adjacent ZIP64 end header, finding the base offset and censtart
+ * from the ZIP64 header if available, else from the non-ZIP64 header.
+ * @return 0 if successful, -1 in case of failure
+ */
+static int
+find_positions64(int fd, const Byte * const endhdr, const jlong endpos,
+ jlong* base_offset, jlong* censtart)
+{
+ jlong censiz = ENDSIZ(endhdr);
+ jlong cenoff = ENDOFF(endhdr);
+ jlong entries = ENDTOT(endhdr);
+ jlong end64pos;
+ Byte buf[ZIP64_ENDHDR + ZIP64_LOCHDR];
+ if (censiz + cenoff != endpos
+ && (end64pos = endpos - sizeof(buf)) >= (jlong)0
+ && readAt(fd, end64pos, sizeof(buf), buf)
+ && ZIP64_LOCSIG_AT(buf + ZIP64_ENDHDR)
+ && (jlong) ZIP64_LOCDSK(buf + ZIP64_ENDHDR) == ENDDSK(endhdr)
+ && (is_zip64_endhdr(fd, buf, end64pos, censiz, cenoff, entries)
+ || // A variable sized "zip64 extensible data sector" ?
+ ((end64pos = ZIP64_LOCOFF(buf + ZIP64_ENDHDR)) >= (jlong)0
+ && readAt(fd, end64pos, ZIP64_ENDHDR, buf)
+ && is_zip64_endhdr(fd, buf, end64pos, censiz, cenoff, entries)))
+ ) {
+ *censtart = end64pos - ZIP64_ENDSIZ(buf);
+ *base_offset = *censtart - ZIP64_ENDOFF(buf);
+ } else {
+ if (!is_valid_end_header(fd, endpos, censiz, cenoff, entries))
+ return -1;
+ *censtart = endpos - censiz;
+ *base_offset = *censtart - cenoff;
+ }
+ return 0;
+}
+
+/*
+ * Finds the base offset and censtart of the zip file.
*
- * fd: File descriptor of the jar file.
- * eb: Pointer to a buffer to receive a copy of the END header.
- *
- * Returns the offset of the END record in the file on success,
- * -1 on failure.
+ * @param fd file descriptor of the jar file
+ * @param eb scratch buffer
+ * @return 0 if successful, -1 in case of failure
*/
-static jlong
-find_end(int fd, Byte *eb)
+static int
+find_positions(int fd, Byte *eb, jlong* base_offset, jlong* censtart)
{
jlong len;
jlong pos;
@@ -174,10 +249,10 @@
*/
if ((pos = JLI_Lseek(fd, -ENDHDR, SEEK_END)) < (jlong)0)
return (-1);
- if ((bytes = read(fd, eb, ENDHDR)) < 0)
+ if (read(fd, eb, ENDHDR) < 0)
return (-1);
if (ENDSIG_AT(eb)) {
- return haveZIP64(eb) ? find_end64(fd, eb, pos) : pos;
+ return find_positions64(fd, eb, pos, base_offset, censtart);
}
/*
@@ -193,7 +268,13 @@
return (-1);
if ((buffer = malloc(END_MAXLEN)) == NULL)
return (-1);
- if ((bytes = read(fd, buffer, len)) < 0) {
+
+ /*
+ * read() on windows takes an unsigned int for count. Casting len
+ * to an unsigned int here is safe since it is guaranteed to be
+ * less than END_MAXLEN.
+ */
+ if ((bytes = read(fd, buffer, (unsigned int)len)) < 0) {
free(buffer);
return (-1);
}
@@ -208,7 +289,7 @@
(void) memcpy(eb, cp, ENDHDR);
free(buffer);
pos = flen - (endpos - cp);
- return haveZIP64(eb) ? find_end64(fd, eb, pos) : pos;
+ return find_positions64(fd, eb, pos, base_offset, censtart);
}
free(buffer);
return (-1);
@@ -218,82 +299,6 @@
#define MINREAD 1024
/*
- * Computes and positions at the start of the CEN header, ie. the central
- * directory, this will also return the offset if there is a zip file comment
- * at the end of the archive, for most cases this would be 0.
- */
-static jlong
-compute_cen(int fd, Byte *bp)
-{
- int bytes;
- Byte *p;
- jlong base_offset;
- jlong offset;
- char buffer[MINREAD];
- p = (Byte*) buffer;
- /*
- * Read the END Header, which is the starting point for ZIP files.
- * (Clearly designed to make writing a zip file easier than reading
- * one. Now isn't that precious...)
- */
- if ((base_offset = find_end(fd, bp)) == -1) {
- return (-1);
- }
- p = bp;
- /*
- * There is a historical, but undocumented, ability to allow for
- * additional "stuff" to be prepended to the zip/jar file. It seems
- * that this has been used to prepend an actual java launcher
- * executable to the jar on Windows. Although this is just another
- * form of statically linking a small piece of the JVM to the
- * application, we choose to continue to support it. Note that no
- * guarantees have been made (or should be made) to the customer that
- * this will continue to work.
- *
- * Therefore, calculate the base offset of the zip file (within the
- * expanded file) by assuming that the central directory is followed
- * immediately by the end record.
- */
- if (zip64_present) {
- if ((offset = ZIP64_LOCOFF(p)) < (jlong)0) {
- return -1;
- }
- if (JLI_Lseek(fd, offset, SEEK_SET) < (jlong) 0) {
- return (-1);
- }
- if ((bytes = read(fd, buffer, MINREAD)) < 0) {
- return (-1);
- }
- if (!ZIP64_ENDSIG_AT(buffer)) {
- return -1;
- }
- if ((offset = ZIP64_ENDOFF(buffer)) < (jlong)0) {
- return -1;
- }
- if (JLI_Lseek(fd, offset, SEEK_SET) < (jlong)0) {
- return (-1);
- }
- p = (Byte*) buffer;
- base_offset = base_offset - ZIP64_ENDSIZ(p) - ZIP64_ENDOFF(p) - ZIP64_ENDHDR;
- } else {
- base_offset = base_offset - ENDSIZ(p) - ENDOFF(p);
- /*
- * The END Header indicates the start of the Central Directory
- * Headers. Remember that the desired Central Directory Header (CEN)
- * will almost always be the second one and the first one is a small
- * directory entry ("META-INF/"). Keep the code optimized for
- * that case.
- *
- * Seek to the beginning of the Central Directory.
- */
- if (JLI_Lseek(fd, base_offset + ENDOFF(p), SEEK_SET) < (jlong) 0) {
- return (-1);
- }
- }
- return base_offset;
-}
-
-/*
* Locate the manifest file with the zip/jar file.
*
* fd: File descriptor of the jar file.
@@ -327,7 +332,23 @@
int res;
int entry_size;
int read_size;
+
+ /*
+ * The (imaginary) position within the file relative to which
+ * offsets within the zip file refer. This is usually the
+ * location of the first local header (the start of the zip data)
+ * (which in turn is usually 0), but if the zip file has content
+ * prepended, then it will be either 0 or the length of the
+ * prepended content, depending on whether or not internal offsets
+ * have been adjusted (via e.g. zip -A). May be negative if
+ * content is prepended, zip -A is run, then the prefix is
+ * detached!
+ */
jlong base_offset;
+
+ /** The position within the file of the start of the central directory. */
+ jlong censtart;
+
Byte *p;
Byte *bp;
Byte *buffer;
@@ -338,9 +359,11 @@
}
bp = buffer;
- base_offset = compute_cen(fd, bp);
- if (base_offset == -1) {
- free(buffer);
+
+ if (find_positions(fd, bp, &base_offset, &censtart) == -1) {
+ return -1;
+ }
+ if (JLI_Lseek(fd, censtart, SEEK_SET) < (jlong) 0) {
return -1;
}
@@ -574,7 +597,7 @@
info->jre_version = NULL;
info->jre_restrict_search = 0;
info->splashscreen_image_file_name = NULL;
- if (rc = find_file(fd, &entry, manifest_name) != 0) {
+ if ((rc = find_file(fd, &entry, manifest_name)) != 0) {
close(fd);
return (-2);
}
@@ -675,7 +698,7 @@
return (-1);
}
- if (rc = find_file(fd, &entry, manifest_name) != 0) {
+ if ((rc = find_file(fd, &entry, manifest_name)) != 0) {
close(fd);
return (-2);
}
--- a/jdk/src/java.base/share/native/libjli/splashscreen_stubs.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/native/libjli/splashscreen_stubs.c Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, 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
@@ -61,11 +61,11 @@
#define INVOKEV(name) _INVOKE(name, ,;)
int DoSplashLoadMemory(void* pdata, int size) {
- INVOKE(SplashLoadMemory, NULL)(pdata, size);
+ INVOKE(SplashLoadMemory, 0)(pdata, size);
}
int DoSplashLoadFile(const char* filename) {
- INVOKE(SplashLoadFile, NULL)(filename);
+ INVOKE(SplashLoadFile, 0)(filename);
}
void DoSplashInit(void) {
@@ -87,4 +87,4 @@
char* DoSplashGetScaledImageName(const char* fileName, const char* jarName,
float* scaleFactor) {
INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor);
-}
\ No newline at end of file
+}
--- a/jdk/src/java.base/share/native/libjli/wildcard.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/share/native/libjli/wildcard.c Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, 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
@@ -274,7 +274,7 @@
}
static void
-FileList_addSubstring(FileList fl, const char *beg, int len)
+FileList_addSubstring(FileList fl, const char *beg, size_t len)
{
char *filename = (char *) JLI_MemAlloc(len+1);
memcpy(filename, beg, len);
@@ -310,7 +310,7 @@
FileList_split(const char *path, char sep)
{
const char *p, *q;
- int len = (int)JLI_StrLen(path);
+ size_t len = JLI_StrLen(path);
int count;
FileList fl;
for (count = 1, p = path; p < path + len; p++)
--- a/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java Fri Apr 03 16:37:06 2015 -0700
@@ -285,8 +285,6 @@
* 1 - fork(2) and exec(2)
* 2 - posix_spawn(3P)
* 3 - vfork(2) and exec(2)
- *
- * (4 - clone(2) and exec(2) - obsolete and currently disabled in native code)
* </pre>
* @param fds an array of three file descriptors.
* Indexes 0, 1, and 2 correspond to standard input,
--- a/jdk/src/java.base/unix/conf/arm/jvm.cfg Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-# Copyright (c) 2011, 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.
-#
-# List of JVMs that can be used as an option to java, javac, etc.
-# Order is important -- first in this list is the default JVM.
-# NOTE that this both this file and its format are UNSUPPORTED and
-# WILL GO AWAY in a future release.
-#
-# You may also select a JVM in an arbitrary location with the
-# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
-# and may not be available in a future release.
-#
--client IF_SERVER_CLASS -server
--server KNOWN
--minimal KNOWN
--- a/jdk/src/java.base/unix/conf/ppc/jvm.cfg Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-# Copyright (c) 2011, 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.
-#
-# List of JVMs that can be used as an option to java, javac, etc.
-# Order is important -- first in this list is the default JVM.
-# NOTE that this both this file and its format are UNSUPPORTED and
-# WILL GO AWAY in a future release.
-#
-# You may also select a JVM in an arbitrary location with the
-# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
-# and may not be available in a future release.
-#
--client KNOWN
--server KNOWN
--minimal KNOWN
--- a/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c Fri Apr 03 16:37:06 2015 -0700
@@ -97,8 +97,7 @@
* address space temporarily, before launching the target command.
*
* Based on the above analysis, we are currently using vfork() on
- * Linux and spawn() on other Unix systems, but the code to use clone()
- * and fork() remains.
+ * Linux and posix_spawn() on other Unix systems.
*/
@@ -385,39 +384,13 @@
}
/**
- * We are unusually paranoid; use of clone/vfork is
+ * We are unusually paranoid; use of vfork is
* especially likely to tickle gcc/glibc bugs.
*/
#ifdef __attribute_noinline__ /* See: sys/cdefs.h */
__attribute_noinline__
#endif
-#define START_CHILD_USE_CLONE 0 /* clone() currently disabled; see above. */
-
-#ifdef START_CHILD_USE_CLONE
-static pid_t
-cloneChild(ChildStuff *c) {
-#ifdef __linux__
-#define START_CHILD_CLONE_STACK_SIZE (64 * 1024)
- /*
- * See clone(2).
- * Instead of worrying about which direction the stack grows, just
- * allocate twice as much and start the stack in the middle.
- */
- if ((c->clone_stack = malloc(2 * START_CHILD_CLONE_STACK_SIZE)) == NULL)
- /* errno will be set to ENOMEM */
- return -1;
- return clone(childProcess,
- c->clone_stack + START_CHILD_CLONE_STACK_SIZE,
- CLONE_VFORK | CLONE_VM | SIGCHLD, c);
-#else
-/* not available on Solaris / Mac */
- assert(0);
- return -1;
-#endif
-}
-#endif
-
static pid_t
vforkChild(ChildStuff *c) {
volatile pid_t resultPid;
@@ -590,12 +563,11 @@
c->argv = NULL;
c->envv = NULL;
c->pdir = NULL;
- c->clone_stack = NULL;
/* Convert prog + argBlock into a char ** argv.
* Add one word room for expansion of argv for use by
* execve_as_traditional_shell_script.
- * This word is also used when using spawn mode
+ * This word is also used when using posix_spawn mode
*/
assert(prog != NULL && argBlock != NULL);
if ((phelperpath = getBytes(env, helperpath)) == NULL) goto Catch;
@@ -654,7 +626,7 @@
throwIOException(env, errno, "fork failed");
break;
case MODE_POSIX_SPAWN:
- throwIOException(env, errno, "spawn failed");
+ throwIOException(env, errno, "posix_spawn failed");
break;
}
goto Catch;
@@ -677,8 +649,6 @@
fds[2] = (err[0] != -1) ? err[0] : -1;
Finally:
- free(c->clone_stack);
-
/* Always clean up the child's side of the pipes */
closeSafely(in [0]);
closeSafely(out[1]);
--- a/jdk/src/java.base/unix/native/libjava/childproc.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/unix/native/libjava/childproc.c Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, 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
@@ -304,7 +304,7 @@
}
/**
- * Child process after a successful fork() or clone().
+ * Child process after a successful fork().
* This function must not return, and must be prepared for either all
* of its address space to be shared with its parent, or to be a copy.
* It must not modify global variables such as "environ".
--- a/jdk/src/java.base/unix/native/libjava/childproc.h Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/unix/native/libjava/childproc.h Fri Apr 03 16:37:06 2015 -0700
@@ -101,7 +101,6 @@
const char **envv;
const char *pdir;
int redirectErrorStream;
- void *clone_stack;
} ChildStuff;
/* following used in addition when mode is SPAWN */
--- a/jdk/src/java.base/unix/native/libjava/jni_util_md.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/unix/native/libjava/jni_util_md.c Fri Apr 03 16:37:06 2015 -0700
@@ -55,10 +55,12 @@
size_t
getLastErrorString(char *buf, size_t len)
{
+ char *err;
+ size_t n;
if (errno == 0 || len < 1) return 0;
- const char *err = strerror(errno);
- size_t n = strlen(err);
+ err = strerror(errno);
+ n = strlen(err);
if (n >= len)
n = len - 1;
--- a/jdk/src/java.base/unix/native/libjli/java_md.h Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/unix/native/libjli/java_md.h Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, 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
@@ -43,6 +43,12 @@
#define MAXNAMELEN PATH_MAX
#endif
+#ifdef _LP64
+#define JLONG_FORMAT_SPECIFIER "%ld"
+#else
+#define JLONG_FORMAT_SPECIFIER "%lld"
+#endif
+
int UnsetEnv(char *name);
char *FindExecName(char *program);
const char *SetExecname(char **argv);
--- a/jdk/src/java.base/unix/native/libjli/java_md_common.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/unix/native/libjli/java_md_common.c Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -269,11 +269,6 @@
return(borrowed_unsetenv(name));
}
-const char *
-jlong_format_specifier() {
- return "%lld";
-}
-
jboolean
IsJavaw()
{
--- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, 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
@@ -888,7 +888,7 @@
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
void * tmp;
pthread_join(tid, &tmp);
- rslt = (int)tmp;
+ rslt = (int)(intptr_t)tmp;
} else {
/*
* Continue execution in current thread if for some reason (e.g. out of
@@ -906,7 +906,7 @@
if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
void * tmp;
thr_join(tid, NULL, &tmp);
- rslt = (int)tmp;
+ rslt = (int)(intptr_t)tmp;
} else {
/* See above. Continue in current thread if thr_create() failed */
rslt = continuation(args);
--- a/jdk/src/java.base/windows/native/libjli/cmdtoargs.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/windows/native/libjli/cmdtoargs.c Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -77,7 +77,7 @@
USHORT ch = 0;
int i;
jboolean done = JNI_FALSE;
- int charLength;
+ ptrdiff_t charLength;
*wildcard = JNI_FALSE;
while (!done) {
@@ -208,10 +208,12 @@
argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg));
argv[nargs].arg = JLI_StringDup(arg);
argv[nargs].has_wildcard = wildcard;
- *arg = NULL;
+ *arg = '\0';
nargs++;
} while (src != NULL);
+ JLI_MemFree(arg);
+
stdargc = nargs;
stdargs = argv;
}
--- a/jdk/src/java.base/windows/native/libjli/java_md.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/windows/native/libjli/java_md.c Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -107,7 +107,7 @@
* GetParamValue("theParam", "theParam=value") returns pointer to "value".
*/
const char * GetParamValue(const char *paramName, const char *arg) {
- int nameLen = JLI_StrLen(paramName);
+ size_t nameLen = JLI_StrLen(paramName);
if (JLI_StrNCmp(paramName, arg, nameLen) == 0) {
/* arg[nameLen] is valid (may contain final NULL) */
if (arg[nameLen] == '=') {
@@ -561,7 +561,7 @@
if (rc < 0) {
/* apply ansi semantics */
buffer[size - 1] = '\0';
- return size;
+ return (int)size;
} else if (rc == size) {
/* force a null terminator */
buffer[size - 1] = '\0';
@@ -728,11 +728,6 @@
}
}
-const char *
-jlong_format_specifier() {
- return "%I64d";
-}
-
/*
* Block current thread and continue execution in a new thread
*/
@@ -882,7 +877,7 @@
if (hPreloadAwt == NULL) {
/* awt.dll is not loaded yet */
char libraryPath[MAXPATHLEN];
- int jrePathLen = 0;
+ size_t jrePathLen = 0;
HMODULE hJava = NULL;
HMODULE hVerify = NULL;
@@ -1004,7 +999,8 @@
jobjectArray
CreateApplicationArgs(JNIEnv *env, char **strv, int argc)
{
- int i, j, idx, tlen;
+ int i, j, idx;
+ size_t tlen;
jobjectArray outArray, inArray;
char *ostart, *astart, **nargv;
jboolean needs_expansion = JNI_FALSE;
--- a/jdk/src/java.base/windows/native/libjli/java_md.h Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.base/windows/native/libjli/java_md.h Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, 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
@@ -39,6 +39,7 @@
#define MAXPATHLEN MAX_PATH
#define MAXNAMELEN MAX_PATH
+#define JLONG_FORMAT_SPECIFIER "%I64d"
/*
* Support for doing cheap, accurate interval timing.
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java Fri Apr 03 16:37:06 2015 -0700
@@ -44,7 +44,6 @@
import sun.lwawt.macosx.*;
public final class CFontManager extends SunFontManager {
- private FontConfigManager fcManager = null;
private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>();
@Override
@@ -231,15 +230,6 @@
return font2D;
}
- /*
- public synchronized FontConfigManager getFontConfigManager() {
- if (fcManager == null) {
- fcManager = new FontConfigManager();
- }
- return fcManager;
- }
- */
-
protected void registerFontsInDir(String dirName, boolean useJavaRasterizer, int fontRank, boolean defer, boolean resolveSymLinks) {
loadNativeDirFonts(dirName);
super.registerFontsInDir(dirName, useJavaRasterizer, fontRank, defer, resolveSymLinks);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/NativeFont.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2015, 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 sun.font;
+
+import java.awt.FontFormatException;
+import java.awt.font.FontRenderContext;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+/*
+ * This class should never be invoked on the windows implementation
+ * So the constructor throws a FontFormatException, which is caught
+ * and the font is ignored.
+ */
+
+public class NativeFont extends PhysicalFont {
+
+ /**
+ * Verifies native font is accessible.
+ * @throws FontFormatException - if the font can't be located.
+ */
+ public NativeFont(String platName, boolean isBitmapDelegate)
+ throws FontFormatException {
+
+ throw new FontFormatException("NativeFont not used on OS X");
+ }
+
+ static boolean hasExternalBitmaps(String platName) {
+ return false;
+ }
+
+ public CharToGlyphMapper getMapper() {
+ return null;
+ }
+
+ PhysicalFont getDelegateFont() {
+ return null;
+ }
+
+ FontStrike createStrike(FontStrikeDesc desc) {
+ return null;
+ }
+
+ public Rectangle2D getMaxCharBounds(FontRenderContext frc) {
+ return null;
+ }
+
+ StrikeMetrics getFontMetrics(long pScalerContext) {
+ return null;
+ }
+
+ public GeneralPath getGlyphOutline(long pScalerContext,
+ int glyphCode,
+ float x, float y) {
+ return null;
+ }
+
+ public GeneralPath getGlyphVectorOutline(long pScalerContext,
+ int[] glyphs, int numGlyphs,
+ float x, float y) {
+ return null;
+ }
+
+
+ long getGlyphImage(long pScalerContext, int glyphCode) {
+ return 0L;
+ }
+
+
+ void getGlyphMetrics(long pScalerContext, int glyphCode,
+ Point2D.Float metrics) {
+ }
+
+
+ float getGlyphAdvance(long pScalerContext, int glyphCode) {
+ return 0f;
+ }
+
+ Rectangle2D.Float getGlyphOutlineBounds(long pScalerContext,
+ int glyphCode) {
+ return new Rectangle2D.Float(0f, 0f, 0f, 0f);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/NativeStrike.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2015, 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 sun.font;
+
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Point2D;
+import java.awt.Rectangle;
+import java.awt.geom.Rectangle2D;
+
+public class NativeStrike extends PhysicalStrike {
+
+ NativeFont nativeFont;
+
+ NativeStrike(NativeFont nativeFont, FontStrikeDesc desc) {
+ super(nativeFont, desc);
+
+ throw new RuntimeException("NativeFont not used on OS X");
+ }
+
+ NativeStrike(NativeFont nativeFont, FontStrikeDesc desc,
+ boolean nocache) {
+ super(nativeFont, desc);
+
+ throw new RuntimeException("NativeFont not used on Windows");
+ }
+
+
+ void getGlyphImagePtrs(int[] glyphCodes, long[] images,int len) {
+ }
+
+ long getGlyphImagePtr(int glyphCode) {
+ return 0L;
+ }
+
+ long getGlyphImagePtrNoCache(int glyphCode) {
+ return 0L;
+ }
+
+ void getGlyphImageBounds(int glyphcode,
+ Point2D.Float pt,
+ Rectangle result) {
+ }
+
+ Point2D.Float getGlyphMetrics(int glyphCode) {
+ return null;
+ }
+
+ float getGlyphAdvance(int glyphCode) {
+ return 0f;
+ }
+
+ Rectangle2D.Float getGlyphOutlineBounds(int glyphCode) {
+ return null;
+ }
+ GeneralPath getGlyphOutline(int glyphCode, float x, float y) {
+ return null;
+ }
+
+ GeneralPath getGlyphVectorOutline(int[] glyphs, float x, float y) {
+ return null;
+ }
+
+}
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m Fri Apr 03 16:37:06 2015 -0700
@@ -311,7 +311,10 @@
}
- (BOOL) performKeyEquivalent: (NSEvent *) event {
- [self deliverJavaKeyEventHelper: event];
+ // if IM is active key events should be ignored
+ if (![self hasMarkedText] && !fInPressAndHold) {
+ [self deliverJavaKeyEventHelper: event];
+ }
// Workaround for 8020209: special case for "Cmd =" and "Cmd ."
// because Cocoa calls performKeyEquivalent twice for these keystrokes
--- a/jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m Fri Apr 03 16:37:06 2015 -0700
@@ -126,14 +126,28 @@
return buf;
}
+BOOL isSWTRunning() {
+ char envVar[80];
+ // If this property is present we are running SWT
+ snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
+ return getenv(envVar) != NULL;
+}
+
char* SplashGetScaledImageName(const char* jar, const char* file,
float *scaleFactor) {
+ *scaleFactor = 1;
+
+ if(isSWTRunning()){
+ return nil;
+ }
+
NSAutoreleasePool *pool = [NSAutoreleasePool new];
- *scaleFactor = 1;
char* scaledFile = nil;
__block float screenScaleFactor = 1;
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
+ // initialize NSApplication and AWT stuff
+ [NSApplicationAWT sharedApplication];
screenScaleFactor = [SplashNSScreen() backingScaleFactor];
}];
@@ -180,12 +194,8 @@
splash->screenFormat.byteOrder = 1 ? BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST;
splash->screenFormat.depthBytes = 4;
- // If this property is present we are running SWT and should not start a runLoop
- // Can't check if running SWT in webstart, so splash screen in webstart SWT
- // applications is not supported
- char envVar[80];
- snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
- if (getenv(envVar) == NULL) {
+ // If we are running SWT we should not start a runLoop
+ if (!isSWTRunning()) {
[JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
[NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]];
}];
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java Fri Apr 03 16:37:06 2015 -0700
@@ -225,7 +225,7 @@
}
public short readShort() throws IOException {
- if (read(byteBuf, 0, 2) < 0) {
+ if (read(byteBuf, 0, 2) != 2) {
throw new EOFException();
}
@@ -247,7 +247,7 @@
}
public int readInt() throws IOException {
- if (read(byteBuf, 0, 4) < 0) {
+ if (read(byteBuf, 0, 4) != 4) {
throw new EOFException();
}
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSliderUI.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSliderUI.java Fri Apr 03 16:37:06 2015 -0700
@@ -308,14 +308,14 @@
public Dimension getPreferredSize(JComponent c) {
recalculateIfInsetsChanged();
Dimension d = new Dimension(contentRect.width, contentRect.height);
+ Insets i = slider.getInsets();
if (slider.getOrientation() == JSlider.VERTICAL) {
d.height = 200;
+ d.height += i.top + i.bottom;
} else {
d.width = 200;
+ d.width += i.left + i.right;
}
- Insets i = slider.getInsets();
- d.width += i.left + i.right;
- d.height += i.top + i.bottom;
return d;
}
--- a/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java Fri Apr 03 16:37:06 2015 -0700
@@ -439,6 +439,26 @@
return tip;
}
+ /**
+ * Returns the preferred size of the table header.
+ * This is the size required to display the header and requested for
+ * the viewport.
+ * The returned {@code Dimension} {@code width} will always be calculated by
+ * the underlying TableHeaderUI, regardless of any width specified by
+ * {@link JComponent#setPreferredSize(java.awt.Dimension)}
+ *
+ * @return the size
+ */
+ @Override
+ public Dimension getPreferredSize() {
+ Dimension preferredSize = super.getPreferredSize();
+ if (isPreferredSizeSet() && ui != null) {
+ Dimension size = ui.getPreferredSize(this);
+ if (size != null) preferredSize.width = size.width;
+ }
+ return preferredSize;
+ }
+
//
// Managing TableHeaderUI
//
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c Fri Apr 03 16:37:06 2015 -0700
@@ -368,9 +368,9 @@
if (length > CONV_BUFFER_SIZE-1)
{
length = CONV_BUFFER_SIZE-1;
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
fprintf(stderr, "Note: Detail is too long: %d chars\n", length);
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
}
(*env)->GetStringUTFRegion(env, val, 0, length, convertionBuffer);
@@ -507,9 +507,9 @@
}
}
} else {
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
fprintf(stderr, "Cannot load g_vfs_get_supported_uri_schemes\n");
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
}
}
@@ -522,23 +522,23 @@
const char *gtk_version = fp_gtk_check_version(2, 14, 0);
if (gtk_version != NULL) {
// The gtk_show_uri is available from GTK+ 2.14
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
fprintf (stderr, "The version of GTK is %s. "
"The gtk_show_uri function is supported "
"since GTK+ 2.14.\n", gtk_version);
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
} else {
// Loading symbols only if the GTK version is 2.14 and higher
fp_gtk_show_uri = dl_symbol("gtk_show_uri");
const char *dlsym_error = dlerror();
if (dlsym_error) {
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
fprintf (stderr, "Cannot load symbol: %s \n", dlsym_error);
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
} else if (fp_gtk_show_uri == NULL) {
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
fprintf(stderr, "dlsym(gtk_show_uri) returned NULL\n");
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
} else {
update_supported_actions(env);
success = TRUE;
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@
#include <X11/XKBlib.h>
-#if defined(DEBUG) || defined(INTERNAL_BUILD)
+#if defined(DEBUG)
static jmethodID lockIsHeldMID = NULL;
static void
@@ -2346,4 +2346,3 @@
(*env)->ReleaseIntArrayElements(env, bitmap, values, JNI_ABORT);
}
-
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.c Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.c Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, 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
@@ -42,7 +42,7 @@
// we are trying to load the library without a version suffix
vfs_handle = dlopen(JNI_LIB_NAME("gnomevfs-2"), RTLD_LAZY);
if (vfs_handle == NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
fprintf(stderr, "can not load libgnomevfs-2.so\n");
#endif
return FALSE;
@@ -51,13 +51,13 @@
dlerror(); /* Clear errors */
gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");
if (gnome_vfs_init == NULL){
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n");
#endif
return FALSE;
}
if ((errmsg = dlerror()) != NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg);
#endif
return FALSE;
@@ -69,7 +69,7 @@
if (gnome_handle == NULL) {
gnome_handle = dlopen(JNI_LIB_NAME("gnome-2"), RTLD_LAZY);
if (gnome_handle == NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
fprintf(stderr, "can not load libgnome-2.so\n");
#endif
return FALSE;
@@ -78,7 +78,7 @@
dlerror(); /* Clear errors */
gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show");
if ((errmsg = dlerror()) != NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
fprintf(stderr, "can not find symble gnome_url_show\n");
#endif
return FALSE;
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt.h Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt.h Fri Apr 03 16:37:06 2015 -0700
@@ -228,7 +228,7 @@
/*
* checks if the current thread is/isn't the toolkit thread
*/
-#if defined(DEBUG) || defined(INTERNAL_BUILD)
+#if defined(DEBUG)
#define CHECK_IS_TOOLKIT_THREAD() \
if (GetCurrentThreadId() != AwtToolkit::MainThread()) \
{ JNU_ThrowInternalError(env,"Operation is not permitted on non-toolkit thread!\n"); }
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, 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
@@ -31,6 +31,7 @@
import java.security.*;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import sun.misc.JavaAWTAccess;
import sun.misc.SharedSecrets;
@@ -579,7 +580,8 @@
// added in the user context.
class LoggerContext {
// Table of named Loggers that maps names to Loggers.
- private final Hashtable<String,LoggerWeakRef> namedLoggers = new Hashtable<>();
+ private final ConcurrentHashMap<String,LoggerWeakRef> namedLoggers =
+ new ConcurrentHashMap<>();
// Tree of named Loggers
private final LogNode root;
private LoggerContext() {
@@ -642,21 +644,44 @@
}
- synchronized Logger findLogger(String name) {
- // ensure that this context is properly initialized before
- // looking for loggers.
- ensureInitialized();
+ Logger findLogger(String name) {
+ // Attempt to find logger without locking.
LoggerWeakRef ref = namedLoggers.get(name);
- if (ref == null) {
- return null;
+ Logger logger = ref == null ? null : ref.get();
+
+ // if logger is not null, then we can return it right away.
+ // if name is "" or "global" and logger is null
+ // we need to fall through and check that this context is
+ // initialized.
+ // if ref is not null and logger is null we also need to
+ // fall through.
+ if (logger != null || (ref == null && !name.isEmpty()
+ && !name.equals(Logger.GLOBAL_LOGGER_NAME))) {
+ return logger;
}
- Logger logger = ref.get();
- if (logger == null) {
- // Hashtable holds stale weak reference
- // to a logger which has been GC-ed.
- ref.dispose();
+
+ // We either found a stale reference, or we were looking for
+ // "" or "global" and didn't find them.
+ // Make sure context is initialized (has the default loggers),
+ // and look up again, cleaning the stale reference if it hasn't
+ // been cleaned up in between. All this needs to be done inside
+ // a synchronized block.
+ synchronized(this) {
+ // ensure that this context is properly initialized before
+ // looking for loggers.
+ ensureInitialized();
+ ref = namedLoggers.get(name);
+ if (ref == null) {
+ return null;
+ }
+ logger = ref.get();
+ if (logger == null) {
+ // The namedLoggers map holds stale weak reference
+ // to a logger which has been GC-ed.
+ ref.dispose();
+ }
+ return logger;
}
- return logger;
}
// This method is called before adding a logger to the
@@ -752,7 +777,6 @@
final LogManager owner = getOwner();
logger.setLogManager(owner);
ref = owner.new LoggerWeakRef(logger);
- namedLoggers.put(name, ref);
// Apply any initial level defined for the new logger, unless
// the logger's level is already initialized
@@ -789,10 +813,17 @@
node.walkAndSetParent(logger);
// new LogNode is ready so tell the LoggerWeakRef about it
ref.setNode(node);
+
+ // Do not publish 'ref' in namedLoggers before the logger tree
+ // is fully updated - because the named logger will be visible as
+ // soon as it is published in namedLoggers (findLogger takes
+ // benefit of the ConcurrentHashMap implementation of namedLoggers
+ // to avoid synchronizing on retrieval when that is possible).
+ namedLoggers.put(name, ref);
return true;
}
- synchronized void removeLoggerRef(String name, LoggerWeakRef ref) {
+ void removeLoggerRef(String name, LoggerWeakRef ref) {
namedLoggers.remove(name, ref);
}
@@ -800,7 +831,7 @@
// ensure that this context is properly initialized before
// returning logger names.
ensureInitialized();
- return namedLoggers.keys();
+ return Collections.enumeration(namedLoggers.keySet());
}
// If logger.getUseParentHandlers() returns 'true' and any of the logger's
@@ -1379,7 +1410,19 @@
reset();
// Load the properties
- props.load(ins);
+ try {
+ props.load(ins);
+ } catch (IllegalArgumentException x) {
+ // props.load may throw an IllegalArgumentException if the stream
+ // contains malformed Unicode escape sequences.
+ // We wrap that in an IOException as readConfiguration is
+ // specified to throw IOException if there are problems reading
+ // from the stream.
+ // Note: new IOException(x.getMessage(), x) allow us to get a more
+ // concise error message than new IOException(x);
+ throw new IOException(x.getMessage(), x);
+ }
+
// Instantiate new configuration objects.
String names[] = parseClassNames("config");
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SessionManager.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SessionManager.java Fri Apr 03 16:37:06 2015 -0700
@@ -90,6 +90,7 @@
// maximum number of active sessions during this invocation, for debugging
private int maxActiveSessions;
+ private Object maxActiveSessionsLock;
// flags to use in the C_OpenSession() call
private final long openSessionFlags;
@@ -113,6 +114,9 @@
this.token = token;
this.objSessions = new Pool(this);
this.opSessions = new Pool(this);
+ if (debug != null) {
+ maxActiveSessionsLock = new Object();
+ }
}
// returns whether only a fairly low number of sessions are
@@ -212,7 +216,7 @@
Session session = new Session(token, id);
activeSessions.incrementAndGet();
if (debug != null) {
- synchronized(this) {
+ synchronized(maxActiveSessionsLock) {
if (activeSessions.get() > maxActiveSessions) {
maxActiveSessions = activeSessions.get();
if (maxActiveSessions % 10 == 0) {
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipConstants.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipConstants.java Fri Apr 03 16:37:06 2015 -0700
@@ -184,10 +184,19 @@
return (LG(b, n)) | (LG(b, n + 4) << 32);
}
- static final long GETSIG(byte[] b) {
- return LG(b, 0);
+ static long getSig(byte[] b, int n) { return LG(b, n); }
+
+ private static boolean pkSigAt(byte[] b, int n, int b1, int b2) {
+ return b[n] == 'P' & b[n + 1] == 'K' & b[n + 2] == b1 & b[n + 3] == b2;
}
+ static boolean cenSigAt(byte[] b, int n) { return pkSigAt(b, n, 1, 2); }
+ static boolean locSigAt(byte[] b, int n) { return pkSigAt(b, n, 3, 4); }
+ static boolean endSigAt(byte[] b, int n) { return pkSigAt(b, n, 5, 6); }
+ static boolean extSigAt(byte[] b, int n) { return pkSigAt(b, n, 7, 8); }
+ static boolean end64SigAt(byte[] b, int n) { return pkSigAt(b, n, 6, 6); }
+ static boolean locator64SigAt(byte[] b, int n) { return pkSigAt(b, n, 6, 7); }
+
// local file (LOC) header fields
static final long LOCSIG(byte[] b) { return LG(b, 0); } // signature
static final int LOCVER(byte[] b) { return SH(b, 4); } // version needed to extract
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java Fri Apr 03 16:37:06 2015 -0700
@@ -1060,7 +1060,7 @@
int pos = 0;
int limit = cen.length - ENDHDR;
while (pos < limit) {
- if (CENSIG(cen, pos) != CENSIG)
+ if (!cenSigAt(cen, pos))
zerror("invalid CEN header (bad signature)");
int method = CENHOW(cen, pos);
int nlen = CENNAM(cen, pos);
@@ -1894,7 +1894,7 @@
throws IOException
{
byte[] cen = zipfs.cen;
- if (CENSIG(cen, pos) != CENSIG)
+ if (!cenSigAt(cen, pos))
zerror("invalid CEN header (bad signature)");
versionMade = CENVEM(cen, pos);
version = CENVER(cen, pos);
@@ -2057,9 +2057,9 @@
assert (buf.length >= LOCHDR);
if (zipfs.readFullyAt(buf, 0, LOCHDR , pos) != LOCHDR)
throw new ZipException("loc: reading failed");
- if (LOCSIG(buf) != LOCSIG)
+ if (!locSigAt(buf, 0))
throw new ZipException("loc: wrong sig ->"
- + Long.toString(LOCSIG(buf), 16));
+ + Long.toString(getSig(buf, 0), 16));
//startPos = pos;
version = LOCVER(buf);
flag = LOCFLG(buf);
@@ -2289,9 +2289,9 @@
if (zipfs.readFullyAt(buf, 0, buf.length , locoff)
!= buf.length)
throw new ZipException("loc: reading failed");
- if (LOCSIG(buf) != LOCSIG)
+ if (!locSigAt(buf, 0))
throw new ZipException("loc: wrong sig ->"
- + Long.toString(LOCSIG(buf), 16));
+ + Long.toString(getSig(buf, 0), 16));
int locElen = LOCEXT(buf);
if (locElen < 9) // EXTT is at lease 9 bytes
--- a/jdk/test/TEST.groups Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/TEST.groups Fri Apr 03 16:37:06 2015 -0700
@@ -453,7 +453,6 @@
java/util/jar/JarInputStream/ExtraFileInMetaInf.java \
java/util/logging/TestLoggerWeakRefLeak.java \
java/util/zip/3GBZipFiles.sh \
- jdk/lambda/FDTest.java \
jdk/lambda/separate/Compiler.java \
sun/management/jmxremote/bootstrap/JvmstatCountersTest.java \
sun/management/jmxremote/bootstrap/LocalManagementTest.java \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.html Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--
+ @test
+ @bug 6271849
+ @summary Tests that component in modal excluded Window which parent is blocked responses to mouse clicks.
+ @author anton.tarasov@sun.com: area=awt.focus
+ @run applet ModalExcludedWindowClickTest.html
+ -->
+<head>
+<title>ModalExcludedWindowClickTest</title>
+</head>
+<body>
+
+<h1>ModalExcludedWindowClickTest<br>Bug ID: 6272324</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="ModalExcludedWindowClickTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ test
+ @bug 6271849
+ @summary Tests that component in modal excluded Window which parent is blocked responses to mouse clicks.
+ @author anton.tarasov@sun.com: area=awt.focus
+ @run applet ModalExcludedWindowClickTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+
+public class ModalExcludedWindowClickTest extends Applet {
+ Robot robot;
+ Frame frame = new Frame("Frame");
+ Window w = new Window(frame);
+ Dialog d = new Dialog ((Dialog)null, "NullParentDialog", true);
+ Button button = new Button("Button");
+ boolean actionPerformed = false;
+
+ public static void main (String args[]) {
+ ModalExcludedWindowClickTest app = new ModalExcludedWindowClickTest();
+ app.init();
+ app.start();
+ }
+
+ public void init() {
+ try {
+ robot = new Robot();
+ } catch (AWTException e) {
+ throw new RuntimeException("Error: unable to create robot", e);
+ }
+ // Create instructions for the user here, as well as set up
+ // the environment -- set the layout manager, add buttons,
+ // etc.
+ this.setLayout (new BorderLayout ());
+ Sysout.createDialogWithInstructions(new String[]
+ {"This is an AUTOMATIC test", "simply wait until it is done"});
+ }
+
+ public void start() {
+
+ if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+ Sysout.println("No testing on MToolkit.");
+ return;
+ }
+
+ button.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ actionPerformed = true;
+ Sysout.println(e.paramString());
+ }
+ });
+
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ frame.setSize(200, 200);
+ frame.setVisible(true);
+
+ w.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
+ w.add(button);
+ w.setSize(200, 200);
+ w.setLocation(230, 230);
+ w.setVisible(true);
+
+ d.setSize(200, 200);
+ d.setLocation(0, 230);
+ d.setVisible(true);
+
+ }
+ });
+
+ waitTillShown(d);
+
+ test();
+ }
+
+ void test() {
+ clickOn(button);
+ waitForIdle();
+ if (!actionPerformed) {
+ throw new RuntimeException("Test failed!");
+ }
+ Sysout.println("Test passed.");
+ }
+
+ void clickOn(Component c) {
+ Point p = c.getLocationOnScreen();
+ Dimension d = c.getSize();
+
+ Sysout.println("Clicking " + c);
+
+ if (c instanceof Frame) {
+ robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2);
+ } else {
+ robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+ }
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ waitForIdle();
+ }
+ void waitTillShown(Component c) {
+ while (true) {
+ try {
+ Thread.sleep(100);
+ c.getLocationOnScreen();
+ break;
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalComponentStateException e) {}
+ }
+ }
+ void waitForIdle() {
+ try {
+ robot.waitForIdle();
+ EventQueue.invokeAndWait( new Runnable() {
+ public void run() {} // Dummy implementation
+ });
+ } catch(InterruptedException ie) {
+ Sysout.println("waitForIdle, non-fatal exception caught:");
+ ie.printStackTrace();
+ } catch(InvocationTargetException ite) {
+ Sysout.println("waitForIdle, non-fatal exception caught:");
+ ite.printStackTrace();
+ }
+
+ // wait longer...
+ robot.delay(200);
+ }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+{
+ static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+}// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+{
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ pack();
+
+ setVisible(true);
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ System.out.println(messageIn);
+ }
+
+}// TestDialog class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.html Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--
+ @test
+ @bug 6272324
+ @summary Modal excluded Window which decorated parent is blocked should be non-focusable.
+ @author anton.tarasov@sun.com: area=awt.focus
+ @run applet NonFocusableBlockedOwnerTest.html
+ -->
+<head>
+<title>NonFocusableBlockedOwnerTest</title>
+</head>
+<body>
+
+<h1>NonFocusableBlockedOwnerTest<br>Bug ID: 6272324</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="NonFocusableBlockedOwnerTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ test
+ @bug 6272324
+ @summary Modal excluded Window which decorated parent is blocked should be non-focusable.
+ @author anton.tarasov@sun.com: area=awt.focus
+ @run applet NonFocusableBlockedOwnerTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+
+public class NonFocusableBlockedOwnerTest extends Applet {
+ Robot robot;
+ Frame frame = new Frame("Modal Blocked Frame");
+ Dialog dialog = new Dialog(frame, "Modal Dialog", true);
+ Window excluded = new Window(frame);
+ Button button = new Button("button");
+
+ public static void main(String[] args) {
+ NonFocusableBlockedOwnerTest app = new NonFocusableBlockedOwnerTest();
+ app.init();
+ app.start();
+ }
+
+ public void init() {
+ try {
+ robot = new Robot();
+ } catch (AWTException e) {
+ throw new RuntimeException("Error: unable to create robot", e);
+ }
+ // Create instructions for the user here, as well as set up
+ // the environment -- set the layout manager, add buttons,
+ // etc.
+ this.setLayout (new BorderLayout ());
+ Sysout.createDialogWithInstructions(new String[]
+ {"This is an AUTOMATIC test", "simply wait until it is done"});
+ }
+
+ public void start() {
+
+ if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+ Sysout.println("No testing on MToolkit.");
+ return;
+ }
+
+ try {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ frame.setSize(300, 200);
+ frame.setVisible(true);
+
+ excluded.setSize(300, 200);
+ excluded.setLocation(0, 400);
+ excluded.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
+ excluded.setLayout(new FlowLayout());
+ excluded.add(button);
+ excluded.setVisible(true);
+
+ dialog.setSize(200, 100);
+ dialog.setLocation(0, 250);
+ dialog.setVisible(true);
+ }
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ waitTillShown(dialog);
+ clickOn(button);
+ if (frame == KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow()) {
+ throw new RuntimeException("Test failed!");
+ }
+ if (excluded == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow()) {
+ throw new RuntimeException("Test failed!");
+ }
+ if (button == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
+ throw new RuntimeException("Test failed!");
+ }
+ Sysout.println("Test passed.");
+ }
+
+ void clickOn(Component c) {
+ Point p = c.getLocationOnScreen();
+ Dimension d = c.getSize();
+
+ Sysout.println("Clicking " + c);
+
+ if (c instanceof Frame) {
+ robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2);
+ } else {
+ robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+ }
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ waitForIdle();
+ }
+
+ void waitTillShown(Component c) {
+ while (true) {
+ try {
+ Thread.sleep(100);
+ c.getLocationOnScreen();
+ break;
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalComponentStateException e) {}
+ }
+ }
+ void waitForIdle() {
+ try {
+ robot.waitForIdle();
+ EventQueue.invokeAndWait( new Runnable() {
+ public void run() {} // Dummy implementation
+ });
+ } catch(InterruptedException ie) {
+ Sysout.println("waitForIdle, non-fatal exception caught:");
+ ie.printStackTrace();
+ } catch(InvocationTargetException ite) {
+ Sysout.println("waitForIdle, non-fatal exception caught:");
+ ite.printStackTrace();
+ }
+
+ // wait longer...
+ robot.delay(200);
+ }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+{
+ static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+}// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+{
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ pack();
+
+ setVisible(true);
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ System.out.println(messageIn);
+ }
+
+}// TestDialog class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.html Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--
+ @test
+ @bug 6253913
+ @summary Tests that a Window shown before its owner is focusable.
+ @author anton.tarasov@sun.com: area=awt-focus
+ @run applet WindowUpdateFocusabilityTest.html
+ -->
+<head>
+<title>WindowUpdateFocusabilityTest</title>
+</head>
+<body>
+
+<h1>WindowUpdateFocusabilityTest<br>Bug ID: 6253913</h1>
+
+<p>See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE=WindowUpdateFocusabilityTest.class WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ test
+ @bug 6253913
+ @summary Tests that a Window shown before its owner is focusable.
+ @author anton.tarasov@sun.com: area=awt-focus
+ @run applet WindowUpdateFocusabilityTest.html
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.lang.reflect.*;
+
+public class WindowUpdateFocusabilityTest extends Applet {
+ Robot robot;
+ boolean focusGained = false;
+ final Object monitor = new Object();
+ FocusListener listener = new FocusAdapter () {
+ public void focusGained(FocusEvent e) {
+ Sysout.println(e.toString());
+ synchronized (monitor) {
+ focusGained = true;
+ monitor.notifyAll();
+ }
+ }
+ };
+
+ public static void main(String[] args) {
+ WindowUpdateFocusabilityTest app = new WindowUpdateFocusabilityTest();
+ app.init();
+ app.start();
+ }
+
+ public void init() {
+ try {
+ robot = new Robot();
+ } catch (AWTException e) {
+ throw new RuntimeException("Error: couldn't create robot");
+ }
+ // Create instructions for the user here, as well as set up
+ // the environment -- set the layout manager, add buttons,
+ // etc.
+ this.setLayout (new BorderLayout ());
+ Sysout.createDialogWithInstructions(new String[]
+ {"This is an automatic test. Simply wait until it's done."});
+ }
+
+ public void start() {
+ if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+ Sysout.println("No testing on Motif.");
+ return;
+ }
+
+ test(new Frame("Frame owner"));
+ Frame dialog_owner = new Frame("dialog's owner");
+ test(new Dialog(dialog_owner));
+ test(new Dialog(dialog_owner, Dialog.ModalityType.DOCUMENT_MODAL));
+ test(new Dialog(dialog_owner, Dialog.ModalityType.APPLICATION_MODAL));
+ test(new Dialog(dialog_owner, Dialog.ModalityType.TOOLKIT_MODAL));
+ test(new Dialog((Window) null, Dialog.ModalityType.MODELESS));
+ test(new Dialog((Window) null, Dialog.ModalityType.DOCUMENT_MODAL));
+ test(new Dialog((Window) null, Dialog.ModalityType.APPLICATION_MODAL));
+ test(new Dialog((Window) null, Dialog.ModalityType.TOOLKIT_MODAL));
+ dialog_owner.dispose();
+ }
+
+ private void test(final Window owner)
+ {
+ Window window0 = new Window(owner); // will not be shown
+ Window window1 = new Window(window0);
+ Window window2 = new Window(window1);
+ Button button1 = new Button("button1");
+ Button button2 = new Button("button2");
+ button1.addFocusListener(listener);
+ button2.addFocusListener(listener);
+
+ owner.setBounds(800, 0, 100, 100);
+ window1.setBounds(800, 300, 100, 100);
+ window2.setBounds(800, 150, 100, 100);
+
+ window1.add(button1);
+ window2.add(button2);
+
+ window2.setVisible(true);
+ window1.setVisible(true);
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ owner.setVisible(true);
+ }
+ });
+
+ try {
+ EventQueue.invokeAndWait(new Runnable() {
+ public void run() {
+ // do nothing just wait until previous invokeLater will be executed
+ }
+ });
+ } catch (InterruptedException ie) {
+ throw new RuntimeException(ie);
+ } catch (InvocationTargetException ite) {
+ throw new RuntimeException(ite);
+ }
+
+ robot.delay(1000);
+
+ clickOn(button1);
+
+ if (!isFocusGained()) {
+ throw new RuntimeException("Test failed: window1 is not focusable!");
+ }
+
+ focusGained = false;
+ clickOn(button2);
+
+ if (!isFocusGained()) {
+ throw new RuntimeException("Test failed: window2 is not focusable!");
+ }
+
+ Sysout.println("Test for " + owner.getName() + " passed.");
+ owner.dispose();
+ }
+
+ void clickOn(Component c) {
+ Point p = c.getLocationOnScreen();
+ Dimension d = c.getSize();
+
+ Sysout.println("Clicking " + c);
+
+ robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ waitForIdle();
+ }
+
+ void waitForIdle() {
+ try {
+ robot.waitForIdle();
+ robot.delay(50);
+ EventQueue.invokeAndWait( new Runnable() {
+ public void run() {} // Dummy implementation
+ });
+ } catch(InterruptedException ie) {
+ Sysout.println("waitForIdle, non-fatal exception caught:");
+ ie.printStackTrace();
+ } catch(InvocationTargetException ite) {
+ Sysout.println("waitForIdle, non-fatal exception caught:");
+ ite.printStackTrace();
+ }
+ }
+
+ boolean isFocusGained() {
+ synchronized (monitor) {
+ if (!focusGained) {
+ try {
+ monitor.wait(3000);
+ } catch (InterruptedException e) {
+ Sysout.println("Interrupted unexpectedly!");
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ return focusGained;
+ }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+{
+ static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+}// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+{
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ pack();
+
+ setVisible(true);
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ System.out.println(messageIn);
+ }
+
+}// TestDialog class
--- a/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -192,8 +192,7 @@
}
private void waitForIdle() {
try {
- Toolkit.getDefaultToolkit().sync();
- sun.awt.SunToolkit.flushPendingEvents();
+ robot.waitForIdle();
EventQueue.invokeAndWait( new Runnable() {
public void run() {
// dummy implementation
--- a/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java Fri Apr 03 16:37:06 2015 -0700
@@ -23,13 +23,16 @@
import java.awt.Color;
import java.awt.Dialog;
+import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Panel;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.SplashScreen;
+import java.awt.TextField;
import java.awt.Window;
+import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
@@ -37,7 +40,7 @@
/**
* @test
- * @bug 8043869
+ * @bug 8043869 8075244
* @author Alexander Scherbatiy
* @summary [macosx] java -splash does not honor 2x hi dpi notation for retina
* support
@@ -45,6 +48,7 @@
* @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_SPLASH 0
* @run main/othervm -splash:splash2 MultiResolutionSplashTest TEST_SPLASH 1
* @run main/othervm -splash:splash3. MultiResolutionSplashTest TEST_SPLASH 2
+ * @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_FOCUS
*/
public class MultiResolutionSplashTest {
@@ -69,6 +73,9 @@
int index = Integer.parseInt(args[1]);
testSplash(tests[index]);
break;
+ case "TEST_FOCUS":
+ testFocus();
+ break;
default:
throw new RuntimeException("Unknown test: " + test);
}
@@ -92,12 +99,49 @@
float scaleFactor = getScaleFactor();
Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;
- if (!testColor.equals(splashScreenColor)) {
+ if (!compare(testColor, splashScreenColor)) {
throw new RuntimeException(
"Image with wrong resolution is used for splash screen!");
}
}
+ static void testFocus() throws Exception {
+
+ System.out.println("Focus Test!");
+ Robot robot = new Robot();
+ robot.setAutoDelay(50);
+
+ Frame frame = new Frame();
+ frame.setSize(100, 100);
+ String test = "123";
+ TextField textField = new TextField(test);
+ frame.add(textField);
+ frame.setVisible(true);
+ robot.waitForIdle();
+
+ robot.keyPress(KeyEvent.VK_A);
+ robot.keyRelease(KeyEvent.VK_A);
+ robot.keyPress(KeyEvent.VK_B);
+ robot.keyRelease(KeyEvent.VK_B);
+ robot.waitForIdle();
+
+ frame.dispose();
+
+ if(!textField.getText().equals("ab")){
+ throw new RuntimeException("Focus is lost!");
+ }
+ }
+
+ static boolean compare(Color c1, Color c2){
+ return compare(c1.getRed(), c2.getRed())
+ && compare(c1.getGreen(), c2.getGreen())
+ && compare(c1.getBlue(), c2.getBlue());
+ }
+
+ static boolean compare(int n, int m){
+ return Math.abs(n - m) <= 50;
+ }
+
static float getScaleFactor() {
final Dialog dialog = new Dialog((Window) null);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,795 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 4632143
+ @summary Unit test for the RFE window/frame/dialog always on top
+ @author dom@sparc.spb.su: area=awt.toplevel
+ @run main AutoTestOnTop
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+import javax.swing.*;
+import java.util.Vector;
+
+/**
+ * @author tav@sparc.spb.su
+ * @author dom@sparc.spb.su
+ * Tests that always-on-top windows combine correctly with different kinds of window in different styles and conditions.
+ *
+ * !!! WARNING !!!
+ * The test fails sometimes because the toFront() method doesn't guarantee
+ * that after its invocation the frame will be placed above all other windows.
+ */
+public class AutoTestOnTop {
+ static Window topw;
+ static Frame parentw = new Frame();
+ static Window f;
+ static Frame parentf = new Frame();
+
+ static Object uncheckedSrc = new Object(); // used when no need to check event source
+ static Object eventSrc = uncheckedSrc;
+ static boolean dispatchedCond;
+
+ static Semaphore STATE_SEMA = new Semaphore();
+ static Semaphore VIS_SEMA = new Semaphore();
+ static Vector errors = new Vector();
+
+ static boolean isUnix = false;
+
+ static StringBuffer msgError = new StringBuffer();
+ static StringBuffer msgCase = new StringBuffer();
+ static StringBuffer msgAction = new StringBuffer();
+ static StringBuffer msgFunc = new StringBuffer();
+ static StringBuffer msgVisibility = new StringBuffer();
+
+ static volatile int stageNum;
+ static volatile int actNum;
+ static volatile int testResult = 0;
+
+ static volatile boolean doCheckEvents;
+ static volatile boolean eventsCheckPassed;
+ static boolean[] eventsCheckInitVals = new boolean[] { // Whether events are checked for abcence or precence
+ true, true, true, true, true, false, false, false, false
+ };
+ static String[] msgEventsChecks = new String[] {
+ null, null, null, null, null,
+ "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+ "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+ "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+ "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+ };
+
+ static final int stagesCount = 7;
+ static final int actionsCount = 9;
+
+ static Method[] preActions = new Method[actionsCount];
+ static Method[] postActions = new Method[actionsCount];
+ static Method[] isActionsAllowed = new Method[actionsCount];
+ static Method[] checksActionEvents = new Method[actionsCount];
+
+ static Robot robot;
+
+ static boolean doStartTest;
+ static String osName = System.getProperty("os.name");
+
+
+ public static void main(String[] args) {
+ checkTesting();
+
+ }
+
+ public static void performTesting() {
+ isUnix = osName.equals("Linux") || osName.equals("SunOS");
+
+ Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+ public void eventDispatched(AWTEvent e) {
+ if (e.getID() == MouseEvent.MOUSE_CLICKED) {
+ if (eventSrc != null & eventSrc != uncheckedSrc && e.getSource() != eventSrc) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": " + msgError);
+ testResult = -1;
+ }
+ synchronized (eventSrc) {
+ dispatchedCond = true;
+ eventSrc.notify();
+ }
+ }
+
+ if (doCheckEvents && (e.getSource() == topw || e.getSource() == f)) {
+
+ //System.err.println("AWTEventListener: catched the event " + e);
+
+ try {
+ checksActionEvents[actNum].invoke(null, new Object[] {e});
+ } catch (InvocationTargetException ite) {
+ ite.printStackTrace();
+ } catch (IllegalAccessException iae) {
+ iae.printStackTrace();
+ }
+ return;
+ }
+ }
+ }, 0xffffffffffffffffL);
+
+ Method[] allMethods;
+
+ try {
+ allMethods = AutoTestOnTop.class.getDeclaredMethods();
+ } catch (SecurityException se) {
+ throw new RuntimeException(se);
+ }
+
+ for (int i = 0; i < allMethods.length; i++) {
+ String name = allMethods[i].getName();
+ if (name.startsWith("preAction")) {
+ preActions[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+ } else if (name.startsWith("postAction")) {
+ postActions[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+ } else if (name.startsWith("isActionAllowed")) {
+ isActionsAllowed[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+ } else if (name.startsWith("checkActionEvents")) {
+ checksActionEvents[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+ }
+ }
+
+ f = new Frame("Auxiliary Frame");
+ f.setBounds(50, 0, 400, 50);
+ f.setVisible(true);
+ waitTillShown(f);
+
+ try {
+ robot = new Robot();
+ } catch (AWTException e) {
+ throw new RuntimeException("Error: unable to create robot", e);
+ }
+
+ mainTest();
+
+ if (testResult != 0) {
+ System.err.println("The following errors were encountered: ");
+ for (int i = 0; i < errors.size(); i++) {
+ System.err.println(errors.get(i).toString());
+ }
+ throw new RuntimeException("Test failed.");
+ } else {
+ System.err.println("Test PASSED.");
+ }
+ }
+
+ public static void mainTest() {
+// stageNum = 0;
+// for (int i = 0; i < 5; i++) {
+// actNum = 2;
+// System.err.println("************************* A C T I O N " + actNum + " *************************");
+// doStage(stageNum, actNum);
+// // pause(500);
+// actNum = 3;
+// System.err.println("************************* A C T I O N " + actNum + " *************************");
+// doStage(stageNum, actNum);
+// // pause(500);
+// }
+ for (stageNum = 0; stageNum < stagesCount; stageNum++) {
+ System.err.println("************************* S T A G E " + stageNum + " *************************");
+ for (actNum = 0; actNum < actionsCount; actNum++) {
+ System.err.println("************************* A C T I O N " + actNum + " *************************");
+ doStage(stageNum, actNum);
+ } // for thru actNum
+ } // fow thru stageNum
+
+ eventSrc = null;
+ }
+
+ private static void doStage(int stageNum, int actNum) {
+ try {
+
+ if (!((Boolean)isActionsAllowed[actNum].invoke(null, new Object[0])).booleanValue()) {
+ System.err.println("Action skipped due to a platform limitations");
+ return;
+ }
+
+ STATE_SEMA.reset();
+ createWindow(stageNum);
+
+ //*************************
+ // Set window always-on-top
+ //*************************
+
+ preActions[actNum].invoke(null, new Object[0]);
+ setAlwaysOnTop(topw, true);
+ waitForIdle(true);
+
+ if (!topw.isAlwaysOnTopSupported()) return;
+
+ postActions[actNum].invoke(null, new Object[0]);
+ waitForIdle(false);
+
+ STATE_SEMA.reset();
+
+ testForAlwaysOnTop();
+
+ //*****************************
+ // Set window not always-on-top
+ //*****************************
+
+ preActions[actNum].invoke(null, new Object[0]);
+ setAlwaysOnTop(topw, false);
+ waitForIdle(true);
+ postActions[actNum].invoke(null, new Object[0]);
+ waitForIdle(false);
+ STATE_SEMA.reset();
+
+ testForNotAlwaysOnTop();
+
+ } catch (InvocationTargetException ite) {
+ ite.printStackTrace();
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ private static void checkTesting() {
+ if (Toolkit.getDefaultToolkit().isAlwaysOnTopSupported()) {
+ performTesting();
+ }
+ }
+
+ public static void testForAlwaysOnTop() {
+ System.err.println("Checking for always-on-top " + topw);
+
+ ensureInitialWinPosition(topw);
+
+ // Check that always-on-top window is topmost.
+ // - Click on always-on-top window on the windows cross area.
+ clickOn(topw, f, 10, 30, "setting " + msgVisibility +
+ " window (1) always-on-top didn't make it topmost");
+
+ // Check that we can't change z-order of always-on-top window.
+ // - a) Try to put the other window on the top.
+ f.toFront();
+ clickOn(uncheckedSrc, f, 190, 30, ""); // coz toFront() works not always
+ pause(300);
+
+ // - b) Click on always-on-top window on the windows cross area.
+ clickOn(topw, f, 10, 30, "setting " + msgVisibility +
+ " window (1) always-on-top didn't make it such");
+
+ // Ask for always-on-top property
+ if (isAlwaysOnTop(topw) != true)
+ error("Test failed: stage #" + stageNum + ", action #" + actNum + ": " + msgCase + ": " + msgAction +
+ ": isAlwaysOnTop() returned 'false' for window (1) set always-on-top at state "
+ + msgVisibility);
+ }
+
+ public static void testForNotAlwaysOnTop() {
+ System.err.println("Checking for non always-on-top of " + topw);
+ ensureInitialWinPosition(topw);
+
+ if (msgVisibility.equals("visible") && actNum != 2) {
+ // Check that the window remains topmost.
+ // - click on the window on the windows cross area.
+ clickOn(topw, f, 10, 30, "setting " + msgVisibility +
+ " window (1) not always-on-top didn't keep it topmost");
+ }
+
+ // Check that we can change z-order of not always-on-top window.
+ // - a) try to put the other window on the top.
+ f.toFront();
+ clickOn(uncheckedSrc, f, 190, 30, ""); // coz toFront() works not always
+ pause(300);
+
+ // - b) click on not always-on-top window on the windows cross area.
+ clickOn(f, f, 10, 30, "setting " + msgVisibility +
+ " window (1) not always-on-top didn't make it such");
+
+ // Ask for always-on-top property
+ if (isAlwaysOnTop(topw) != false)
+ error("Test failed: stage #" + stageNum + ", action #" + actNum + ": " + msgCase + ": " + msgAction +
+ ": isAlwaysOnTop() returned 'true' for window (1) set not always-on-top at state "
+ + msgVisibility);
+ }
+
+
+ private static void createWindow(int stageNum) {
+ // Free native resourses
+ if (topw != null && topw.isVisible()) {
+ topw.dispose();
+ }
+
+ switch (stageNum) {
+ case 0:
+ topw = new Frame("Top Frame");
+ msgCase.replace(0, msgCase.length(), "Frame (1) over Frame (2)");
+ break;
+ case 1:
+ topw = new JFrame("Top JFrame");
+ msgCase.replace(0, msgCase.length(), "JFrame (1) over Frame (2)");
+ break;
+ case 2:
+ topw = new Dialog(parentw, "Top Dialog");
+ msgCase.replace(0, msgCase.length(), "Dialog (1) over Frame (2)");
+ break;
+ case 3:
+ topw = new JDialog(parentw, "Top JDialog");
+ msgCase.replace(0, msgCase.length(), "JDialog (1) over Frame (2)");
+ break;
+ case 4:
+ topw = new Frame("Top Frame");
+ f.dispose();
+ f = new Dialog(parentf, "Auxiliary Dialog");
+ f.setBounds(50, 0, 250, 50);
+ f.setVisible(true);
+ waitTillShown(f);
+ msgCase.replace(0, msgCase.length(), "Frame (1) over Dialog (2)");
+ break;
+ case 5:
+ topw = new Window(parentw);
+ msgCase.replace(0, msgCase.length(), "Window (1) over Frame (2)");
+ break;
+ case 6:
+ topw = new JWindow(parentw);
+ msgCase.replace(0, msgCase.length(), "JWindow (1) over Frame (2)");
+ break;
+ }
+ topw.addWindowStateListener(new WindowAdapter() {
+ public void windowStateChanged(WindowEvent e) {
+ System.err.println("* " + e);
+ STATE_SEMA.raise();
+ }
+ });
+ topw.setSize(200, 50);
+ }
+
+ /**
+ * 0: setting always-on-top to invisible window
+ * 1: setting always-on-top to visible window
+ * 2: always-on-top on visible non-focusable window
+ * 3: always-on-top on visible, dragging topw after that
+ * 4: always-on-top on visible, dragging f after that
+ * 5: always-on-top on (visible, maximized), make normal after that
+ * 6: always-on-top on (visible, iconified), make normal after that
+ * 7: always-on-top on visible, iconify/deiconify after that
+ * 8: always-on-top on visible, maximize/restore after that
+ */
+ public static void preAction_0() {
+ topw.setVisible(false);
+ }
+ public static void postAction_0() {
+ if (topw.isShowing()) {
+ error("Test failed: stage #" + stageNum + ", action #" + actNum + ": " + msgCase +
+ ": no actions with windows: changing always-on-top property at window (1) state 'invisible' makes window (1) visible");
+ }
+ setWindowVisible("no actions with windows", "invisible");
+ }
+ public static boolean isActionAllowed_0() {
+ // Window on Linux is always always-on-top!
+ return !((stageNum == 5 || stageNum == 6) && isUnix) && (stageNum < stagesCount);
+ }
+ public static void checkActionEvents_0(AWTEvent e) {
+ System.err.println(e.toString());
+ }
+
+ public static void preAction_1() {
+ setWindowVisible("no actions with windows", "visible");
+ }
+ public static void postAction_1() {}
+ public static boolean isActionAllowed_1() {
+ return !((stageNum == 5 || stageNum == 6) && isUnix) && (stageNum < stagesCount );
+ }
+ public static void checkActionEvents_1(AWTEvent e) {
+ System.err.println(e.toString());
+ if (e instanceof PaintEvent) {
+ return;
+ }
+ eventsCheckPassed = false;
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": unexpected event " + e + " was generated");
+ }
+
+ public static void preAction_2() {
+ setWindowVisible("when window (1) set not focusable", "visible");
+ topw.setFocusableWindowState(false);
+ f.toFront();
+ pause(300);
+ }
+ public static void postAction_2() {}
+ public static boolean isActionAllowed_2() {
+ return !((stageNum == 5 || stageNum == 6) && isUnix) && (stageNum < stagesCount);
+ }
+ public static void checkActionEvents_2(AWTEvent e) {
+ System.err.println(e.toString());
+ if ( (e.getID() >= FocusEvent.FOCUS_FIRST && e.getID() <= FocusEvent.FOCUS_LAST) ||
+ (e.getID() == WindowEvent.WINDOW_LOST_FOCUS && e.getID() == WindowEvent.WINDOW_GAINED_FOCUS)) {
+ eventsCheckPassed = false;
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " +
+ msgAction + ": after call " + msgFunc +
+ ": unexpected event " + e + " was generated");
+ }
+ }
+
+ public static void preAction_3() {
+ setWindowVisible("after dragging", "visible");
+ }
+ public static void postAction_3() {
+ Point p = topw.getLocationOnScreen();
+ int x = p.x + 40, y = p.y + 5;
+
+ try { // Take a pause to avoid double click
+ Thread.sleep(500); // when called one after another.
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ } catch (IllegalComponentStateException e) {
+ e.printStackTrace();
+ }
+
+ // Drag the window.
+ robot.mouseMove(x, y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseMove(200, 50);
+ robot.mouseMove(x, y);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ }
+ public static boolean isActionAllowed_3() {
+ return (stageNum < 5);
+ }
+ public static void checkActionEvents_3(AWTEvent e) {
+ System.err.println(e.toString());
+ }
+
+ public static void preAction_4() {
+ setWindowVisible("after dragging window (2)", "visible");
+ }
+ public static void postAction_4() {
+ Point p = f.getLocationOnScreen();
+ int x = p.x + 150, y = p.y + 5;
+
+ try { // Take a pause to avoid double click
+ Thread.sleep(500); // when called one after another.
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ } catch (IllegalComponentStateException e) {
+ e.printStackTrace();
+ }
+
+ // Drag the window.
+ robot.mouseMove(x, y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseMove(200, 50);
+ robot.mouseMove(x, y);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+ ensureInitialWinPosition(f);
+ }
+ public static boolean isActionAllowed_4() {
+ return !((stageNum == 5 || stageNum == 6) && isUnix);
+ }
+ public static void checkActionEvents_4(AWTEvent e) {
+ System.err.println(e.toString());
+ }
+
+ // Metacity has a bug not allowing to set a window to NORMAL state!!!
+
+ public static void preAction_5() {
+ setWindowVisible("at state 'maximized'", "visible");
+ ((Frame)topw).setExtendedState(Frame.MAXIMIZED_BOTH);
+ waitForStateChange();
+ }
+ public static void postAction_5() {
+ ((Frame)topw).setExtendedState(Frame.NORMAL);
+ waitForStateChange();
+ }
+ public static boolean isActionAllowed_5() {
+ return (stageNum < 2);
+ }
+ public static void checkActionEvents_5(AWTEvent e) {
+ System.err.println("=" + e.toString());
+ if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+ eventsCheckPassed = true;
+ }
+ }
+
+ public static void preAction_6() {
+ setWindowVisible("at state 'iconified'", "visible");
+ System.err.println("Iconifying " + topw);
+ ((Frame)topw).setExtendedState(Frame.ICONIFIED);
+ if (!waitForStateChange()) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": state change to ICONIFIED hasn't been generated");
+ }
+ }
+ public static void postAction_6() {
+ System.err.println("Restoring " + topw);
+ ((Frame)topw).setExtendedState(Frame.NORMAL);
+ if (!waitForStateChange()) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": state change to NORMAL hasn't been generated");
+ }
+ }
+ public static boolean isActionAllowed_6() {
+ return (stageNum < 2 );
+ }
+ public static void checkActionEvents_6(AWTEvent e) {
+ System.err.println("+" + e.toString());
+ if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+ eventsCheckPassed = true;
+ }
+ }
+
+ public static void preAction_7() {
+ setWindowVisible("before state 'iconified'", "visible");
+ }
+ public static void postAction_7() {
+ System.err.println("Setting iconified");
+ ((Frame)topw).setExtendedState(Frame.ICONIFIED);
+ if (!waitForStateChange()) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": state change to ICONIFIED hasn't been generated");
+ }
+ System.err.println("Setting normal");
+ ((Frame)topw).setExtendedState(Frame.NORMAL);
+ if (!waitForStateChange()) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": state change to NORMAL hasn't been generated");
+ }
+ }
+ public static boolean isActionAllowed_7() {
+ return (stageNum < 2);
+ }
+ public static void checkActionEvents_7(AWTEvent e) {
+ System.err.println(e.toString());
+ if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+ eventsCheckPassed = true;
+ }
+ }
+
+ public static void preAction_8() {
+ setWindowVisible("before state 'maximized'", "visible");
+ }
+ public static void postAction_8() {
+ ((Frame)topw).setExtendedState(Frame.MAXIMIZED_BOTH);
+ if (!waitForStateChange()) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": state change to MAXIMIZED hasn't been generated");
+ }
+ ((Frame)topw).setExtendedState(Frame.NORMAL);
+ if (!waitForStateChange()) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+ ": state change to NORMAL hasn't been generated");
+ }
+ }
+ public static boolean isActionAllowed_8() {
+ return (stageNum < 2);
+ }
+ public static void checkActionEvents_8(AWTEvent e) {
+ System.err.println(e.toString());
+ if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+ eventsCheckPassed = true;
+ }
+ }
+
+ //***************************************************************************
+
+ private static void setWindowVisible(String mAction, String mVisibility) {
+ msgAction.replace(0, msgAction.length(), mAction);
+ msgVisibility.replace(0, msgVisibility.length(), mVisibility);
+
+ topw.setVisible(true);
+ pause(100); // Needs for Sawfish
+ topw.setLocation(0, 0);
+ waitTillShown(topw);
+ f.toFront();
+ pause(300);
+ }
+
+ private static void clickOn(Object src, Window relwin, int x, int y, String errorStr) {
+ Point p = relwin.getLocationOnScreen();
+ int counter = 10;
+ while (--counter > 0) {
+ eventSrc = src;
+ msgError.replace(0, msgError.length(), errorStr);
+
+ robot.mouseMove(p.x + x, p.y + y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+ synchronized (eventSrc) {
+ if (!dispatchedCond) {
+ try {
+ eventSrc.wait(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ if (!dispatchedCond) {
+ //System.err.println("clickOn: MOUSE_CLICKED event losed, trying to generate it again...");
+ continue;
+ }
+ dispatchedCond = false;
+ }
+ break;
+ } // end while
+ if (counter <= 0) {
+ eventSrc = uncheckedSrc;
+ error("Test: internal error: could't catch MOUSE_CLICKED event. Skip testing this stage");
+ }
+ }
+
+ private static void setAlwaysOnTop(Window w, boolean value) {
+ System.err.println("Setting always on top on " + w + " to " + value);
+ robot.mouseMove(0, 100); // Move out of the window
+ msgFunc.replace(0, msgCase.length(), "setAlwaysOnTop()");
+ try {
+ w.setAlwaysOnTop(value);
+ } catch (Exception e) {
+ error("Test failed: stage#" + stageNum + "action #" + actNum + ": " + msgCase + ": " + msgAction +
+ ": setAlwaysOnTop(" + value + ") called at state " + msgVisibility +
+ " threw exeption " + e);
+ }
+ }
+
+ private static boolean isAlwaysOnTop(Window w) {
+ robot.mouseMove(0, 100); // Move out of the window
+ msgFunc.replace(0, msgCase.length(), "isAlwaysOnTop()");
+ boolean result = false;
+ try {
+ result = w.isAlwaysOnTop();
+ } catch (Exception e) {
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction +
+ ": isAlwaysOnTop() called at state " + msgVisibility +
+ " threw exeption " + e);
+ }
+ return result;
+ }
+
+ private static void waitTillShown(Component c) {
+ while (true) {
+ try {
+ Thread.sleep(100);
+ c.getLocationOnScreen();
+ break;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ break;
+ }
+ }
+ }
+
+ private static void waitForIdle(boolean doCheck) {
+ try {
+ robot.waitForIdle();
+ EventQueue.invokeAndWait( new Runnable() {
+ public void run() {} // Dummy implementation
+ } );
+ } catch(InterruptedException ite) {
+ System.err.println("waitForIdle, non-fatal exception caught:");
+ ite.printStackTrace();
+ } catch(InvocationTargetException ine) {
+ System.err.println("waitForIdle, non-fatal exception caught:");
+ ine.printStackTrace();
+ }
+ doCheckEvents = doCheck;
+
+ if (doCheck) {
+ eventsCheckPassed = eventsCheckInitVals[actNum]; // Initialize
+ } else if (!eventsCheckPassed &&
+ msgEventsChecks[actNum] != null) {
+
+
+ // Some expected event hasn't been catched,
+ // so give it one more chance...
+ doCheckEvents = true;
+ pause(500);
+ doCheckEvents = false;
+
+ if (!eventsCheckPassed) {
+ testResult = -1;
+ error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call "
+ + msgFunc + ": " + msgEventsChecks[actNum]);
+ }
+ }
+ }
+
+ private static boolean waitForStateChange() {
+ System.err.println("------- Waiting for state change");
+ try {
+ STATE_SEMA.doWait(3000);
+ } catch (InterruptedException ie) {
+ System.err.println("Wait interrupted: " + ie);
+ }
+ boolean state = STATE_SEMA.getState();
+ STATE_SEMA.reset();
+ return state;
+ }
+
+ private static void ensureInitialWinPosition(Window w) {
+ int counter = 30;
+ while (w.getLocationOnScreen().y != 0 && --counter > 0) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ break;
+ }
+ }
+ if (counter <= 0) {
+ w.setLocation(0, 0);
+ pause(100);
+ System.err.println("Test: window set to initial position forcedly");
+ }
+ }
+
+ private static void pause(int mls) {
+ try {
+ Thread.sleep(mls);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static void error(String msg) {
+ errors.add(msg);
+ System.err.println(msg);
+ }
+}
+
+class Semaphore {
+ boolean state = false;
+ int waiting = 0;
+ public Semaphore() {
+ }
+ public synchronized void doWait() throws InterruptedException {
+ if (state) {
+ return;
+ }
+ waiting++;
+ wait();
+ waiting--;
+ }
+ public synchronized void doWait(int timeout) throws InterruptedException {
+ if (state) {
+ return;
+ }
+ waiting++;
+ wait(timeout);
+ waiting--;
+ }
+ public synchronized void raise() {
+ state = true;
+ if (waiting > 0) {
+ notifyAll();
+ }
+ }
+
+ public synchronized void doNotify() {
+ notifyAll();
+ }
+ public synchronized boolean getState() {
+ return state;
+ }
+
+ public synchronized void reset() {
+ state = false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/ComponentEvent/MovedResizedTardyEventTest/MovedResizedTardyEventTest.html Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--
+ @test
+ @bug 4985250
+ @summary COMPONENT_MOVED/RESIZED tardy events shouldn't be generated.
+ @author tav@sparc.spb.su
+ @run applet MovedResizedTardyEventTest.html
+ -->
+<head>
+<title>MovedResizedTardyEventTest</title>
+</head>
+<body>
+
+<h1>MovedResizedTardyEventTest<br>Bug ID: 4985250</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="MovedResizedTardyEventTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/ComponentEvent/MovedResizedTardyEventTest/MovedResizedTardyEventTest.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ test
+ @bug 4985250
+ @summary COMPONENT_MOVED/RESIZED tardy events shouldn't be generated.
+ @author tav@sparc.spb.su
+ @run applet MovedResizedTardyEventTest.html
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.lang.reflect.InvocationTargetException;
+
+public class MovedResizedTardyEventTest extends Applet {
+ Frame f1 = new Frame("F-1");
+ Frame f2 = new Frame("F-2");
+
+ boolean eventFlag = false;
+
+ public static void main(String[] args) {
+ Applet a = new MovedResizedTardyEventTest();
+ a.start();
+ }
+
+ public void start() {
+ f1.setVisible(true);
+ f2.setVisible(true);
+
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {}
+
+ f1.addComponentListener(new ComponentAdapter() {
+ public void componentMoved(ComponentEvent e) {
+ MovedResizedTardyEventTest.this.eventFlag = true;
+ System.err.println(e);
+ }
+ public void componentResized(ComponentEvent e) {
+ MovedResizedTardyEventTest.this.eventFlag = true;
+ System.err.println(e);
+ }
+ });
+
+ f1.toFront();
+
+ waitForIdle();
+
+ try { // wait more...
+ Thread.sleep(500);
+ } catch (InterruptedException e) {}
+
+ if (eventFlag) {
+ throw new RuntimeException("Test failed!");
+ }
+ }
+
+ void waitForIdle() {
+ try {
+ (new Robot()).waitForIdle();
+ EventQueue.invokeAndWait( new Runnable() {
+ public void run() {} // Dummy implementation
+ });
+ } catch(InterruptedException ie) {
+ System.err.println("waitForIdle, non-fatal exception caught:");
+ ie.printStackTrace();
+ } catch(InvocationTargetException ite) {
+ System.err.println("waitForIdle, non-fatal exception caught:");
+ ite.printStackTrace();
+ } catch(AWTException rex) {
+ rex.printStackTrace();
+ throw new RuntimeException("unexpected exception");
+ }
+ }
+}
--- a/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java Fri Apr 03 16:37:06 2015 -0700
@@ -29,8 +29,6 @@
@run main AltCharAcceleratorTest
*/
-import sun.awt.SunToolkit;
-
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
@@ -103,13 +101,12 @@
}
void test() throws Exception {
- ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+ Robot robot = new Robot();
+ robot.setAutoDelay(100);
+ robot.waitForIdle();
focusLatch.await(5, TimeUnit.SECONDS);
- Robot robot = new Robot();
- robot.setAutoDelay(100);
-
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_T);
robot.keyRelease(KeyEvent.VK_T);
@@ -133,4 +130,4 @@
AltCharAcceleratorTest t = new AltCharAcceleratorTest();
t.test();
}
-}
\ No newline at end of file
+}
--- a/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java Fri Apr 03 16:37:06 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -24,18 +24,14 @@
/*
@test
@bug 6799551
- @library ../../regtesthelpers
- @build Util Sysout
@summary Extended key codes for small letters undefined
@author Andrei Dmitriev: area=awt.keyboard
@run main EqualKeyCode
*/
-import sun.awt.*;
import java.awt.*;
-import test.java.awt.regtesthelpers.Util;
-import test.java.awt.regtesthelpers.Sysout;
+import java.awt.event.KeyEvent;
public class EqualKeyCode {
@@ -46,13 +42,13 @@
char cSmall = LETTERS.charAt(i);
char cLarge = Character.toUpperCase(cSmall);
- int iSmall = ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall);
- int iLarge = ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge);
+ int iSmall = KeyEvent.getExtendedKeyCodeForChar(cSmall);
+ int iLarge = KeyEvent.getExtendedKeyCodeForChar(cLarge);
System.out.print(" " + cSmall + ":" + iSmall + " ---- ");
System.out.println(" " + cLarge + " : " + iLarge);
- if (ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall) !=
- ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge))
+ if (KeyEvent.getExtendedKeyCodeForChar(cSmall) !=
+ KeyEvent.getExtendedKeyCodeForChar(cLarge))
{
throw new RuntimeException("ExtendedKeyCode doesn't exist or doesn't match between capital and small letters.");
}
--- a/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java Fri Apr 03 16:37:06 2015 -0700
@@ -97,7 +97,7 @@
// no datagram received
if (sa == null) {
if (expectedSender != null) {
- throw new RuntimeException("Expected message not recieved");
+ throw new RuntimeException("Expected message not received");
}
System.out.println("No message received (correct)");
return;
@@ -109,10 +109,15 @@
buf.flip();
byte[] bytes = new byte[buf.remaining()];
buf.get(bytes);
- int receivedId = Integer.parseInt(new String(bytes));
-
- System.out.format("Received message from %s (id=0x%x)\n",
- sender, receivedId);
+ String s = new String(bytes, "UTF-8");
+ int receivedId = -1;
+ try {
+ receivedId = Integer.parseInt(s);
+ System.out.format("Received message from %s (id=0x%x)\n",
+ sender, receivedId);
+ } catch (NumberFormatException x) {
+ System.out.format("Received message from %s (msg=%s)\n", sender, s);
+ }
if (expectedSender == null) {
if (receivedId == id)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Calendar/Bug8075548.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8075548
+ * @summary Make sure that the format form of month names are produced when there are
+ * no stand-alone ones available.
+ */
+
+import java.text.*;
+import java.util.*;
+import static java.util.Calendar.*;
+
+public class Bug8075548 {
+ static int errors = 0;
+
+ public static void main(String[] args) throws Throwable {
+ Date date = new SimpleDateFormat("yyyy-MM-dd", Locale.US).parse("2010-09-15");
+ String[][] FORMAT_PAIRS = {
+ { "LLLL", "MMMM" },
+ { "LLL", "MMM" }
+ };
+ Locale[] LOCALES = {
+ Locale.ENGLISH, Locale.FRENCH, Locale.GERMAN, Locale.JAPANESE
+ };
+
+ for (Locale locale : LOCALES) {
+ for (String[] formats : FORMAT_PAIRS) {
+ String el = new SimpleDateFormat(formats[0], locale).format(date);
+ String em = new SimpleDateFormat(formats[1], locale).format(date);
+ if (!el.equals(em)) {
+ errors++;
+ System.err.println(locale + ": " +
+ formats[0] + " -> " + el + ", " +
+ formats[1] + " -> " + em);
+ }
+ }
+ }
+
+ // Test Calendar.getDisplayName() and .getDisplayNames().
+ for (Locale locale : LOCALES) {
+ testDisplayNames(locale, LONG_FORMAT, LONG_STANDALONE);
+ testDisplayNames(locale, SHORT_FORMAT, SHORT_STANDALONE);
+ testDisplayNames(locale, NARROW_FORMAT, NARROW_STANDALONE);
+ }
+
+ if (errors > 0) {
+ throw new RuntimeException("Failed");
+ }
+ }
+
+ private static void testDisplayNames(Locale locale, int formatStyle, int standaloneStyle) {
+ Map<String, Integer> map = new HashMap<>();
+ for (int month = JANUARY; month <= DECEMBER; month++) {
+ Calendar cal = new GregorianCalendar(2015, month, 1);
+ String format = cal.getDisplayName(MONTH, formatStyle, locale);
+ String standalone = cal.getDisplayName(MONTH, standaloneStyle, locale);
+ if (!format.equals(standalone)) {
+ System.err.println("Calendar.getDisplayName: " + (month+1) +
+ ", locale=" + locale +
+ ", format=" + format + ", standalone=" + standalone);
+ errors++;
+ }
+ if (standalone != null) {
+ map.put(standalone, month);
+ }
+ }
+ if (formatStyle == NARROW_FORMAT) {
+ // Narrow styles don't support unique names.
+ // (e.g., "J" for JANUARY, JUNE, and JULY)
+ return;
+ }
+ Calendar cal = new GregorianCalendar(2015, JANUARY, 1);
+ Map<String, Integer> mapStandalone = cal.getDisplayNames(MONTH, standaloneStyle, locale);
+ if (!map.equals(mapStandalone)) {
+ System.err.printf("Calendar.getDisplayNames: locale=%s%n map=%s%n mapStandalone=%s%n",
+ locale, map, mapStandalone);
+ errors++;
+ }
+ Map<String, Integer> mapAll = cal.getDisplayNames(MONTH, ALL_STYLES, locale);
+ if (!mapAll.entrySet().containsAll(map.entrySet())) {
+ System.err.printf("Calendar.getDisplayNames: locale=%s%n map=%s%n mapAll=%s%n",
+ locale, map, mapAll);
+ errors++;
+ }
+ }
+}
--- a/jdk/test/java/util/Calendar/NarrowNamesTest.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/java/util/Calendar/NarrowNamesTest.java Fri Apr 03 16:37:06 2015 -0700
@@ -86,7 +86,19 @@
"\u6728",
"\u91d1",
"\u571f");
- testMap(THTH, MONTH, NARROW_FORMAT); // expect null
+ testMap(THTH, MONTH, NARROW_FORMAT,
+ "\u0e21.\u0e04.",
+ "\u0e01.\u0e1e.",
+ "\u0e21\u0e35.\u0e04.",
+ "\u0e40\u0e21.\u0e22.",
+ "\u0e1e.\u0e04.",
+ "\u0e21\u0e34.\u0e22", // no last dot
+ "\u0e01.\u0e04.",
+ "\u0e2a.\u0e04.",
+ "\u0e01.\u0e22.",
+ "\u0e15.\u0e04.",
+ "\u0e1e.\u0e22.",
+ "\u0e18.\u0e04.");
testMap(THTH, MONTH, NARROW_STANDALONE,
"\u0e21.\u0e04.",
"\u0e01.\u0e1e.",
@@ -146,7 +158,7 @@
Calendar cal = Calendar.getInstance(locale);
Map<String, Integer> got = cal.getDisplayNames(field, style, locale);
if (!(expectedMap == null && got == null)
- && !expectedMap.equals(got)) {
+ && !(expectedMap != null && expectedMap.equals(got))) {
System.err.printf("testMap: locale=%s, field=%d, style=%d, expected=%s, got=%s%n",
locale, field, style, expectedMap, got);
errors++;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Map/FunctionalCMEs.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+import java.util.Arrays;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.DataProvider;
+
+/**
+ * @test
+ * @bug 8071667
+ * @summary Ensure that ConcurrentModificationExceptions are thrown as specified from Map methods that accept Functions
+ * @author bchristi
+ * @build Defaults
+ * @run testng FunctionalCMEs
+ */
+public class FunctionalCMEs {
+ final static String KEY = "key";
+
+ @DataProvider(name = "Maps", parallel = true)
+ private static Iterator<Object[]> makeMaps() {
+ return Arrays.asList(
+ // Test maps that CME
+ new Object[]{new HashMap<>(), true},
+ new Object[]{new Hashtable<>(), true},
+ new Object[]{new LinkedHashMap<>(), true},
+ // Test default Map methods - no CME
+ new Object[]{new Defaults.ExtendsAbstractMap<>(), false}
+ ).iterator();
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testComputeIfAbsent(Map<String,String> map, boolean expectCME) {
+ checkCME(() -> {
+ map.computeIfAbsent(KEY, k -> {
+ putToForceRehash(map);
+ return "computedValue";
+ });
+ }, expectCME);
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testCompute(Map<String,String> map, boolean expectCME) {
+ checkCME(() -> {
+ map.compute(KEY, mkBiFunc(map));
+ }, expectCME);
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testComputeWithKeyMapped(Map<String,String> map, boolean expectCME) {
+ map.put(KEY, "firstValue");
+ checkCME(() -> {
+ map.compute(KEY, mkBiFunc(map));
+ }, expectCME);
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testComputeIfPresent(Map<String,String> map, boolean expectCME) {
+ map.put(KEY, "firstValue");
+ checkCME(() -> {
+ map.computeIfPresent(KEY, mkBiFunc(map));
+ }, expectCME);
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testMerge(Map<String,String> map, boolean expectCME) {
+ map.put(KEY, "firstValue");
+ checkCME(() -> {
+ map.merge(KEY, "nextValue", mkBiFunc(map));
+ }, expectCME);
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testForEach(Map<String,String> map, boolean ignored) {
+ checkCME(() -> {
+ map.put(KEY, "firstValue");
+ putToForceRehash(map);
+ map.forEach((k,v) -> {
+ map.remove(KEY);
+ });
+ }, true);
+ }
+
+ @Test(dataProvider = "Maps")
+ public void testReplaceAll(Map<String,String> map, boolean ignored) {
+ checkCME(() -> {
+ map.put(KEY, "firstValue");
+ putToForceRehash(map);
+ map.replaceAll((k,v) -> {
+ map.remove(KEY);
+ return "computedValue";
+ });
+ },true);
+ }
+
+ private static void checkCME(Runnable code, boolean expectCME) {
+ try {
+ code.run();
+ } catch (ConcurrentModificationException cme) {
+ if (expectCME) { return; } else { throw cme; }
+ }
+ if (expectCME) {
+ throw new RuntimeException("Expected CME, but wasn't thrown");
+ }
+ }
+
+ private static BiFunction<String,String,String> mkBiFunc(Map<String,String> map) {
+ return (k,v) -> {
+ putToForceRehash(map);
+ return "computedValue";
+ };
+ }
+
+ private static void putToForceRehash(Map<String,String> map) {
+ for (int i = 0; i < 64; ++i) {
+ map.put(i + "", "value");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/LogManager/Configuration/InvalidEscapeConfigurationTest.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UncheckedIOException;
+import java.io.UnsupportedEncodingException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Properties;
+import java.util.logging.LogManager;
+
+
+/**
+ * @test
+ * @bug 8075810
+ * @run main/othervm InvalidEscapeConfigurationTest
+ * @author danielfuchs
+ */
+public class InvalidEscapeConfigurationTest {
+
+ public static void main(String[] args)
+ throws UnsupportedEncodingException, IOException {
+ String[] validEscapes = {
+ "com.f\\u006fo.level = INF\\u004f",
+ "com.f\\u006fo.level = INFO",
+ "com.foo.level = INF\\u004f"
+ };
+ String[] invalidEscapes = {
+ "com.fo\\u0O6f.level = INF\\u0O4f",
+ "com.fo\\u0O6f.level = INFO",
+ "com.foo.level = INF\\u0O4f"
+ };
+ for (String line : validEscapes) {
+ test(line, true);
+ }
+ for (String line : invalidEscapes) {
+ test(line, false);
+ }
+ try {
+ Properties props = new Properties();
+ props.load((InputStream)null);
+ throw new RuntimeException("Properties.load(null): "
+ + "NullPointerException exception not raised");
+ } catch (NullPointerException x) {
+ System.out.println("Properties.load(null): "
+ + "got expected exception: " + x);
+ }
+ try {
+ LogManager.getLogManager().readConfiguration(null);
+ throw new RuntimeException("LogManager.readConfiguration(null): "
+ + "NullPointerException exception not raised");
+ } catch (NullPointerException x) {
+ System.out.println("LogManager.readConfiguration(null): "
+ + "got expected exception: " + x);
+ }
+
+
+ }
+
+ public static void test(String line, boolean valid) throws IOException {
+ String test = (valid ? "valid" : "invalid")
+ + " line \"" +line + "\"";
+ System.out.println("Testing " + test);
+
+ // First verify that we get the expected result from Properties.load()
+ try {
+ ByteArrayInputStream bais =
+ new ByteArrayInputStream(line.getBytes("UTF-8"));
+ Properties props = new Properties();
+ props.load(bais);
+ if (!valid) {
+ throw new RuntimeException(test
+ + "\n\tProperties.load: expected exception not raised");
+ } else {
+ System.out.println("Properties.load passed for " + test);
+ }
+ } catch(IllegalArgumentException x) {
+ if (!valid) {
+ System.out.println(
+ "Properties.load: Got expected exception: "
+ + x + "\n\tfor " + test);
+ } else {
+ throw x;
+ }
+ }
+
+ // Then verify that we get the expected result from
+ // LogManager.readConfiguration
+ try {
+ String content = defaultConfiguration() + '\n' + line + '\n';
+ ByteArrayInputStream bais =
+ new ByteArrayInputStream(content.getBytes("UTF-8"));
+ LogManager.getLogManager().readConfiguration(bais);
+ if (!valid) {
+ throw new RuntimeException(test
+ + "\n\tLogManager.readConfiguration: "
+ + "expected exception not raised");
+ } else {
+ System.out.println("LogManager.readConfiguration passed for "
+ + test);
+ }
+ } catch(IOException x) {
+ if (!valid) {
+ System.out.println(
+ "LogManager.readConfiguration: Got expected exception: "
+ + x + "\n\tfor " + test);
+ } else {
+ throw x;
+ }
+ }
+ }
+
+ static String getConfigurationFileName() {
+ String fname = System.getProperty("java.util.logging.config.file");
+ if (fname == null) {
+ fname = System.getProperty("java.home");
+ if (fname == null) {
+ throw new Error("Can't find java.home ??");
+ }
+ fname = Paths.get(fname, "conf", "logging.properties")
+ .toAbsolutePath().normalize().toString();
+ }
+ return fname;
+ }
+
+ static String defaultConfiguration() throws IOException {
+ Properties props = new Properties();
+ String fileName = getConfigurationFileName();
+ if (Files.exists(Paths.get(fileName))) {
+ try (InputStream is = new FileInputStream(fileName);) {
+ props.load(is);
+ } catch(IOException x) {
+ throw new UncheckedIOException(x);
+ }
+ }
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ props.store(bos, null);
+ return bos.toString();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/LogManager/TestLoggerNames.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Phaser;
+import java.util.concurrent.Semaphore;
+import java.util.logging.Handler;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+
+/**
+ * @test
+ * @bug 7113878
+ * @summary This is not a test that will check that 7113878 is fixed, but
+ * rather a test that will invoke the modified code & try to verify
+ * that fixing 7113878 has not introduced some big regression.
+ * This test should pass, whether 7113878 is there or not.
+ * @run main/othervm TestLoggerNames
+ * @author danielfuchs
+ */
+public class TestLoggerNames {
+
+ static final class TestLogger extends java.util.logging.Logger {
+
+ final Semaphore sem = new Semaphore(0);
+ final Semaphore wait = new Semaphore(0);
+
+ public TestLogger(String name, String resourceBundleName) {
+ super(name, resourceBundleName);
+ }
+
+ @Override
+ public Handler[] getHandlers() {
+ boolean found = false;
+ try {
+ System.out.println("Entering "+getName()+" getHandlers()");
+ for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
+ if (LogManager.class.getName().equals(ste.getClassName())
+ && "reset".equals(ste.getMethodName())) {
+ found = true;
+ System.out.println(getName()+" getHandlers() called by " + ste);
+ }
+ }
+ sem.release();
+ try {
+ System.out.println("TestLogger: Acquiring wait for "+getName());
+ wait.acquire();
+ try {
+ System.out.println("TestLogger: Acquired wait for "+getName());
+ return super.getHandlers();
+ } finally {
+ System.out.println("TestLogger: Releasing wait for "+getName());
+ wait.release();
+ }
+ } finally {
+ System.out.println("Unblocking "+getName());
+ sem.acquire();
+ System.out.println("Unblocked "+getName());
+ if (found) {
+ System.out.println("Reset will proceed...");
+ }
+ }
+ } catch (InterruptedException x) {
+ throw new IllegalStateException(x);
+ }
+ }
+ }
+
+ static volatile boolean stop;
+ static volatile Throwable resetFailed;
+ static volatile Throwable checkLoggerNamesFailed;
+ static volatile Phaser phaser = new Phaser(2);
+
+
+ static void checkLoggerNames(List<Logger> loggers) {
+ Enumeration<String> names = LogManager.getLogManager().getLoggerNames();
+ if (names instanceof Iterator) {
+ for (Iterator<?> it = Iterator.class.cast(names); it.hasNext(); ) {
+ try {
+ it.remove();
+ throw new RuntimeException("Iterator supports remove!");
+ } catch (UnsupportedOperationException x) {
+ System.out.println("OK: Iterator doesn't support remove.");
+ }
+ }
+ }
+ List<String> loggerNames = Collections.list(names);
+ if (!loggerNames.contains("")) {
+ throw new RuntimeException("\"\"" +
+ " not found in " + loggerNames);
+ }
+ if (!loggerNames.contains("global")) {
+ throw new RuntimeException("global" +
+ " not found in " + loggerNames);
+ }
+ for (Logger l : loggers) {
+ if (!loggerNames.contains(l.getName())) {
+ throw new RuntimeException(l.getName() +
+ " not found in " + loggerNames);
+ }
+ }
+ System.out.println("Got all expected logger names");
+ }
+
+
+ public static void main(String[] args) throws InterruptedException {
+ LogManager.getLogManager().addLogger(new TestLogger("com.foo.bar.zzz", null));
+ try {
+ Logger.getLogger(null);
+ throw new RuntimeException("Logger.getLogger(null) didn't throw expected NPE");
+ } catch (NullPointerException x) {
+ System.out.println("Got expected NullPointerException for Logger.getLogger(null)");
+ }
+ List<Logger> loggers = new CopyOnWriteArrayList<>();
+ loggers.add(Logger.getLogger("one.two.addMeAChild"));
+ loggers.add(Logger.getLogger("aaa.bbb.replaceMe"));
+ loggers.add(Logger.getLogger("bbb.aaa.addMeAChild"));
+ TestLogger test = (TestLogger)Logger.getLogger("com.foo.bar.zzz");
+ loggers.add(Logger.getLogger("ddd.aaa.addMeAChild"));
+
+ checkLoggerNames(loggers);
+
+ Thread loggerNamesThread = new Thread(() -> {
+ try {
+ while (!stop) {
+ checkLoggerNames(loggers);
+ Thread.sleep(10);
+ if (!stop) {
+ phaser.arriveAndAwaitAdvance();
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace(System.err);
+ checkLoggerNamesFailed = t;
+ }
+ }, "loggerNames");
+
+ Thread resetThread = new Thread(() -> {
+ try {
+ System.out.println("Calling reset...");
+ LogManager.getLogManager().reset();
+ System.out.println("Reset done...");
+ System.out.println("Reset again...");
+ LogManager.getLogManager().reset();
+ System.out.println("Reset done...");
+ } catch(Throwable t) {
+ resetFailed = t;
+ System.err.println("Unexpected exception or error in reset Thread");
+ t.printStackTrace(System.err);
+ }
+ }, "reset");
+
+ resetThread.setDaemon(true);
+ resetThread.start();
+
+ System.out.println("Waiting for reset to get handlers");
+ test.sem.acquire();
+ try {
+ loggerNamesThread.start();
+ System.out.println("Reset has called getHandlers on " + test.getName());
+ int i = 0;
+ for (Enumeration<String> e = LogManager.getLogManager().getLoggerNames();
+ e.hasMoreElements();) {
+ String name = e.nextElement();
+ if (name.isEmpty()) continue;
+ if (name.endsWith(".addMeAChild")) {
+ Logger l = Logger.getLogger(name+".child");
+ loggers.add(l);
+ System.out.println("*** Added " + l.getName());
+ i++;
+ } else if (name.endsWith("replaceMe")) {
+ Logger l = Logger.getLogger(name);
+ loggers.remove(l);
+ l = Logger.getLogger(name.replace("replaceMe", "meReplaced"));
+ loggers.add(l);
+ System.gc();
+ if (LogManager.getLogManager().getLogger(name) == null) {
+ System.out.println("*** "+ name + " successfully replaced with " + l.getName());
+ }
+ i++;
+ } else {
+ System.out.println("Nothing to do for logger: " + name);
+ }
+ phaser.arriveAndAwaitAdvance();
+ if (i >= 3 && i++ == 3) {
+ System.out.println("Loggers are now: " +
+ Collections.list(LogManager.getLogManager().getLoggerNames()));
+ test.wait.release();
+ test.sem.release();
+ System.out.println("Joining " + resetThread);
+ resetThread.join();
+ }
+ }
+ } catch (RuntimeException | InterruptedException | Error x) {
+ test.wait.release();
+ test.sem.release();
+ throw x;
+ } finally {
+ stop = true;
+ phaser.arriveAndDeregister();
+ loggerNamesThread.join();
+ loggers.clear();
+ }
+
+
+ if (resetFailed != null || checkLoggerNamesFailed != null) {
+ RuntimeException r = new RuntimeException("Some of the concurrent threads failed");
+ if (resetFailed != null) r.addSuppressed(resetFailed);
+ if (checkLoggerNamesFailed != null) r.addSuppressed(checkLoggerNamesFailed);
+ throw r;
+ }
+
+ }
+
+}
--- a/jdk/test/java/util/zip/EntryCount64k.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/java/util/zip/EntryCount64k.java Fri Apr 03 16:37:06 2015 -0700
@@ -24,33 +24,76 @@
/**
* @test
* @summary Test java.util.zip behavior with ~64k entries
+ * @library /lib/testlibrary
* @run main/othervm EntryCount64k
* @run main/othervm -Djdk.util.zip.inhibitZip64=true EntryCount64k
* @run main/othervm -Djdk.util.zip.inhibitZip64=false EntryCount64k
*/
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.nio.file.Files;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.RandomAccessFile;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
public class EntryCount64k {
+ public static class Main {
+ public static void main(String[] args) {
+ System.out.print("Main");
+ }
+ }
- public static void main(String[] args) throws Exception {
- for (int i = (1 << 16) - 2; i < (1 << 16) + 2; i++)
+ static final String MAIN_CLASS = "EntryCount64k$Main";
+ static final String THIS_CLASS = "EntryCount64k";
+ static final String[] SPECIAL_CLASSES = { MAIN_CLASS, THIS_CLASS };
+ // static final String[] SPECIAL_CLASSES = { MAIN_CLASS };
+ static final int SPECIAL_COUNT = 1 + SPECIAL_CLASSES.length;
+
+ public static void main(String[] args) throws Throwable {
+ for (int i = (1 << 16) - 3; i < (1 << 16) + 2; i++)
test(i);
}
- static void test(int entryCount) throws Exception {
+ static void test(int entryCount) throws Throwable {
File zipFile = new File("EntryCount64k-tmp.zip");
zipFile.delete();
- try (ZipOutputStream zos =
- new ZipOutputStream(
- new BufferedOutputStream(
- new FileOutputStream(zipFile)))) {
- for (int i = 0; i < entryCount; i++) {
- ZipEntry e = new ZipEntry(Integer.toString(i));
- zos.putNextEntry(e);
+ try (FileOutputStream fos = new FileOutputStream(zipFile);
+ BufferedOutputStream bos = new BufferedOutputStream(fos);
+ ZipOutputStream zos = new ZipOutputStream(bos)) {
+
+ // Add entries to allow the zip file to be used with "java -jar"
+ zos.putNextEntry(new ZipEntry("META-INF/MANIFEST.MF"));
+ for (String line : new String[] {
+ "Manifest-Version: 1.0",
+ "Main-Class: " + MAIN_CLASS,
+ })
+ zos.write((line + "\n").getBytes("US-ASCII"));
+ zos.closeEntry();
+
+ String testClasses = System.getProperty("test.classes");
+ for (String className : SPECIAL_CLASSES) {
+ String baseName = className + ".class";
+ ZipEntry ze = new ZipEntry(baseName);
+ File file = new File(testClasses, baseName);
+ zos.putNextEntry(ze);
+ Files.copy(file.toPath(), zos);
+ zos.closeEntry();
+ }
+
+ for (int i = SPECIAL_COUNT; i < entryCount; i++) {
+ zos.putNextEntry(new ZipEntry(Integer.toString(i)));
zos.closeEntry();
}
}
@@ -86,16 +129,16 @@
return false;
}
- static void checkCanRead(File zipFile, int entryCount) throws Exception {
+ static void checkCanRead(File zipFile, int entryCount) throws Throwable {
// Check ZipInputStream API
- try (ZipInputStream zis =
- new ZipInputStream(
- new BufferedInputStream(
- new FileInputStream(zipFile)))) {
+ try (FileInputStream fis = new FileInputStream(zipFile);
+ BufferedInputStream bis = new BufferedInputStream(fis);
+ ZipInputStream zis = new ZipInputStream(bis)) {
for (int i = 0; i < entryCount; i++) {
ZipEntry e = zis.getNextEntry();
- if (Integer.parseInt(e.getName()) != i)
- throw new AssertionError();
+ if (i >= SPECIAL_COUNT) // skip special entries
+ if (Integer.parseInt(e.getName()) != i)
+ throw new AssertionError(e.getName());
}
if (zis.getNextEntry() != null)
throw new AssertionError();
@@ -106,8 +149,9 @@
Enumeration<? extends ZipEntry> en = zf.entries();
for (int i = 0; i < entryCount; i++) {
ZipEntry e = en.nextElement();
- if (Integer.parseInt(e.getName()) != i)
- throw new AssertionError();
+ if (i >= SPECIAL_COUNT) // skip special entries
+ if (Integer.parseInt(e.getName()) != i)
+ throw new AssertionError();
}
if (en.hasMoreElements()
|| (zf.size() != entryCount)
@@ -115,5 +159,15 @@
|| (zf.getEntry(Integer.toString(entryCount)) != null))
throw new AssertionError();
}
+
+ // Check java -jar
+ String javaHome = System.getProperty("java.home");
+ String java = Paths.get(javaHome, "bin", "java").toString();
+ String[] cmd = { java, "-jar", zipFile.getName() };
+ ProcessBuilder pb = new ProcessBuilder(cmd);
+ OutputAnalyzer a = ProcessTools.executeProcess(pb);
+ a.shouldHaveExitValue(0);
+ a.stdoutShouldMatch("\\AMain\\Z");
+ a.stderrShouldMatch("\\A\\Z");
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/stream/ShortStreamTest.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8074954
+ * @summary Test verifies that an IOException is triggered if input stream
+ * does not contain enough data to read a multi-byte type.
+ *
+ * @run main ShortStreamTest
+ */
+
+import javax.imageio.ImageIO;
+import javax.imageio.stream.ImageInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+public class ShortStreamTest {
+ public static void main(String[] args) throws IOException {
+ TestCase[] tests = createTests();
+
+ for (TestCase t : tests) {
+ t.test();
+ }
+ }
+
+ private static abstract class TestCase {
+ abstract void testRead(ImageInputStream iis) throws IOException;
+
+ public void test() {
+ boolean gotException = false;
+
+ ImageInputStream iis = createShortStream();
+
+ try {
+ testRead(iis);
+ } catch (IOException e) {
+ e.printStackTrace(System.out);
+ gotException = true;
+ }
+
+ if (!gotException) {
+ throw new RuntimeException("Test failed.");
+ }
+ System.out.println("Test PASSED");
+ }
+ }
+
+
+ private static ImageInputStream createShortStream() {
+ try {
+ byte[] integerTestArray = new byte[] { 80 };
+ ByteArrayInputStream bais = new ByteArrayInputStream(integerTestArray);
+
+ return ImageIO.createImageInputStream(bais);
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ private static TestCase[] createTests() {
+ return new TestCase[]{
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readInt();
+ }
+ },
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readShort();
+ }
+ },
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readDouble();
+ }
+ },
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readFloat();
+ }
+ },
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readLong();
+ }
+ },
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readUnsignedInt();
+ }
+ },
+ new TestCase() {
+ @Override
+ void testRead(ImageInputStream iis) throws IOException {
+ iis.readUnsignedShort();
+ }
+ }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTableHeader/4473075/bug4473075.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 4473075
+ @summary JTable header rendering problem (after setting preferred size)
+ @author Semyon Sadetsky
+*/
+
+import javax.swing.*;
+import javax.swing.table.DefaultTableModel;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+public class bug4473075 {
+ public static final int USER_HEADER_HEIGHT = 40;
+ private static JTable table;
+ private static JScrollPane scpScroll;
+ private static Point point;
+ private static JFrame frame;
+
+ public static void main(String[] args) throws Exception {
+ Robot robot = new Robot();
+ robot.setAutoDelay(20);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame = new JFrame();
+ frame.setUndecorated(true);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ table = new JTable();
+ String t = "a cell text";
+ table.setModel(new DefaultTableModel(
+ new Object[][]{new Object[]{t, t, t, t, t}},
+ new Object[]{t, t, t, t, t}));
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+ scpScroll = new JScrollPane(table);
+
+ // Manually set preferred size of header...
+ Dimension preferredSize = new Dimension(table.getSize().width,
+ USER_HEADER_HEIGHT);
+ table.getTableHeader().setPreferredSize(preferredSize);
+
+ frame.setContentPane(scpScroll);
+ frame.setSize(250, 480);
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+ point = scpScroll.getHorizontalScrollBar()
+ .getLocationOnScreen();
+ }
+ });
+ robot.waitForIdle();
+
+ robot.mouseMove(point.x + 100, point.y + 5);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseMove(point.x + 150, point.y + 5);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+ int headerH = table.getTableHeader().getHeight();
+ if (headerH != USER_HEADER_HEIGHT) {
+ throw new RuntimeException("TableHeader height was not set: "
+ + headerH + " !=" + USER_HEADER_HEIGHT);
+ }
+
+ double tableX = table.getX();
+ int headerX = table.getTableHeader().getX();
+ if (tableX != headerX) {
+ throw new RuntimeException("TableHeader X position is wrong: "
+ + tableX + " !=" + headerX);
+ }
+
+ double tableW = table.getWidth();
+ int headerW = table.getTableHeader().getWidth();
+ if (tableW != headerW) {
+ throw new RuntimeException("TableHeader width is wrong: "
+ + tableW + " !=" + headerW);
+ }
+
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ frame.dispose();
+ }
+ });
+ System.out.println("ok");
+ }
+}
--- a/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java Fri Apr 03 16:37:06 2015 -0700
@@ -28,8 +28,6 @@
@run main bug7123767
*/
-import sun.awt.SunToolkit;
-
import javax.swing.*;
import javax.swing.plaf.metal.MetalLookAndFeel;
import java.awt.*;
@@ -160,8 +158,10 @@
// Moves mouse pointer to the corners of every GraphicsConfiguration
private static void testToolTip() throws AWTException {
- SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
- toolkit.realSync();
+
+ robot = new Robot();
+ robot.setAutoDelay(20);
+ robot.waitForIdle();
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = environment.getScreenDevices();
@@ -169,28 +169,28 @@
GraphicsConfiguration[] configs = device.getConfigurations();
for (GraphicsConfiguration config : configs) {
Rectangle rect = config.getBounds();
- Insets insets = toolkit.getScreenInsets(config);
+ Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(config);
adjustInsets(rect, insets);
// Upper left
glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
rect.x + MARGIN, rect.y + MARGIN);
- toolkit.realSync();
+ robot.waitForIdle();
// Lower left
glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
rect.x + MARGIN, rect.y + rect.height - MARGIN);
- toolkit.realSync();
+ robot.waitForIdle();
// Upper right
glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
rect.x + rect.width - MARGIN, rect.y + MARGIN);
- toolkit.realSync();
+ robot.waitForIdle();
// Lower right
glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
- toolkit.realSync();
+ robot.waitForIdle();
}
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/synth/8040328/bug8040328.java Fri Apr 03 16:37:06 2015 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 8040328
+ @summary JSlider has wrong preferred size with Synth LAF
+ @author Semyon Sadetsky
+*/
+
+import javax.swing.*;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import java.awt.*;
+import java.io.ByteArrayInputStream;
+
+public class bug8040328 {
+ private static String synthXml = "<synth>" +
+ " <style id=\"all\">" +
+ " <font name=\"Segoe UI\" size=\"12\"/>" +
+ " </style>" +
+ " <bind style=\"all\" type=\"REGION\" key=\".*\"/>" +
+ " <style id=\"slider\">" +
+ " <insets top=\"10\" left=\"5\" bottom=\"10\" right=\"5\"/>" +
+ " </style>" +
+ " <bind style=\"slider\" type=\"region\" key=\"Slider\"/>" +
+ "</synth>";
+
+ public static void main(String[] args) throws Exception {
+ SynthLookAndFeel lookAndFeel = new SynthLookAndFeel();
+ lookAndFeel.load(new ByteArrayInputStream(synthXml.getBytes("UTF8")),
+ bug8040328.class);
+ UIManager.setLookAndFeel(lookAndFeel);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final JFrame frame = new JFrame();
+ try {
+ frame.setUndecorated(true);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setVisible(true);
+ test(frame);
+ } finally {
+ frame.dispose();
+ }
+ }
+ });
+ System.out.println("ok");
+ }
+
+ static void test(JFrame frame) {
+ JSlider hslider = new JSlider(JSlider.HORIZONTAL);
+ hslider.setBackground(Color.DARK_GRAY);
+ frame.getContentPane().add(hslider, BorderLayout.CENTER);
+ frame.getContentPane().setBackground(Color.CYAN);
+ frame.pack();
+ Insets insets = hslider.getInsets();
+ if (hslider.getWidth() != 200 + insets.left + insets.right) {
+ throw new RuntimeException(
+ "Horizontal slider width is wrong " + hslider.getWidth());
+ }
+ if (hslider.getHeight() != hslider.getMinimumSize().height) {
+ throw new RuntimeException(
+ "Horizontal slider height is wrong " + hslider.getHeight());
+ }
+ frame.getContentPane().remove(hslider);
+
+ JSlider vslider = new JSlider(JSlider.VERTICAL);
+ frame.getContentPane().add(vslider);
+ frame.pack();
+ insets = vslider.getInsets();
+ if (vslider.getWidth() != vslider.getMinimumSize().width) {
+ throw new RuntimeException(
+ "Verical slider width is wrong " + vslider.getWidth());
+ }
+ if (vslider.getHeight() != 200 + insets.top + insets.bottom) {
+ throw new RuntimeException(
+ "Verical slider height is wrong " + vslider.getHeight());
+ }
+ }
+}
--- a/jdk/test/javax/xml/jaxp/transform/8062923/XslSubstringTest.java Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/javax/xml/jaxp/transform/8062923/XslSubstringTest.java Fri Apr 03 16:37:06 2015 -0700
@@ -23,10 +23,11 @@
/**
* @test
- * @bug 8062923 8062924
+ * @bug 8062923 8062924 8074297 8076290
* @run testng XslSubstringTest
* @summary Test xsl substring function with negative, Inf and
- * NaN length and few other use cases
+ * NaN length and few other use cases. Also test proper
+ * processing of supplementary characters by substring function.
*/
import java.io.StringReader;
@@ -39,6 +40,7 @@
import javax.xml.transform.stream.StreamSource;
import static org.testng.Assert.assertEquals;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class XslSubstringTest {
@@ -50,6 +52,36 @@
+ "<xsl:template match='/'><t>";
final String xslPost = "</t></xsl:template></xsl:stylesheet>";
+ @DataProvider(name = "GeneralTestsData")
+ private Object[][] xmls() {
+ return new Object[][] {
+ { "|<xsl:value-of select=\"substring('asdf',2, 1)\"/>|", "<t>|s|</t>"},
+ { "|<xsl:value-of select=\"substring('asdf',2, 1 div 0)\"/>|", "<t>|sdf|</t>"},
+ { "|<xsl:value-of select=\"substring('asdf',2, -0 div 0)\"/>|", "<t>||</t>" },
+ { "|<xsl:value-of select=\"substring('asdf',2, 1 div 0)\"/>|", "<t>|sdf|</t>" },
+ // 8076290 bug test case
+ { "|<xsl:value-of select=\"substring('123', 0, 3)\"/>|", "<t>|12|</t>"},
+ };
+ }
+
+ @DataProvider(name = "SupplementaryCharactersTestData")
+ private Object[][] dataSupplementaryCharacters() {
+ return new Object[][] {
+ // 8074297 bug test cases
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 3)\"/>|", "<t>|BC|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 3, 1)\"/>|", "<t>|B|</t>" },
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 2, 2)\"/>|", "<t>|AB|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 3, 2)\"/>|", "<t>|BC|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 3, 4)\"/>|", "<t>|BC|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 1, 1)\"/>|", "<t>|𠀋|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 2, 1)\"/>|", "<t>|A|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 1, 1 div 0)\"/>|", "<t>|𠀋ABC|</t>"},
+ { "|<xsl:value-of select=\"substring('𠀋ABC', -10, 1 div 0)\"/>|", "<t>|𠀋ABC|</t>"},
+ // 8076290 bug test case
+ { "|<xsl:value-of select=\"substring('𠀋ABC', 0, 2)\"/>|", "<t>|𠀋|</t>"},
+ };
+ }
+
private String testTransform(String xsl) throws Exception {
//Prepare sources for transormation
Source src = new StreamSource(new StringReader(xml));
@@ -78,27 +110,14 @@
"<t>||</t>");
}
- @Test
- public void testGeneral1() throws Exception {
- assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, 1)\"/>|"),
- "<t>|s|</t>");
- }
-
- @Test
- public void testGeneral2() throws Exception {
- assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, 1 div 0)\"/>|"),
- "<t>|sdf|</t>");
+ @Test(dataProvider = "GeneralTestsData")
+ public void testGeneralAll(String xsl, String result) throws Exception {
+ assertEquals(testTransform(xsl), result);
}
- @Test
- public void testGeneral3() throws Exception {
- assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, -0 div 0)\"/>|"),
- "<t>||</t>");
+ @Test(dataProvider = "SupplementaryCharactersTestData")
+ public void testSupplementCharacters(String xsl, String result) throws Exception {
+ assertEquals(testTransform(xsl), result);
}
- @Test
- public void testGeneral4() throws Exception {
- assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, 0 div 0)\"/>|"),
- "<t>||</t>");
- }
}
--- a/jdk/test/jdk/lambda/FDTest.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-
-import shapegen.*;
-
-import com.sun.source.util.JavacTask;
-import com.sun.tools.javac.util.Pair;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeSuite;
-import org.testng.annotations.DataProvider;
-import static org.testng.Assert.*;
-
-public class FDTest {
-
- public enum TestKind {
- POSITIVE,
- NEGATIVE;
-
- Collection<Hierarchy> getHierarchy(HierarchyGenerator hg) {
- return this == POSITIVE ?
- hg.getOK() : hg.getErr();
- }
- }
-
- public static JavaCompiler comp;
- public static StandardJavaFileManager fm;
-
- @BeforeSuite
- static void init() {
- // create default shared JavaCompiler - reused across multiple
- // compilations
-
- comp = ToolProvider.getSystemJavaCompiler();
- fm = comp.getStandardFileManager(null, null, null);
- }
-
- public static void main(String[] args) throws Exception {
- init();
-
- for (Pair<TestKind,Hierarchy> fdtest : generateCases()) {
- runTest(fdtest.fst, fdtest.snd, comp, fm);
- }
- }
-
- @Test(dataProvider = "fdCases")
- public void testOneCase(TestKind tk, Hierarchy hs)
- throws Exception {
- FDTest.runTest(tk, hs, comp, fm);
- }
-
- @DataProvider(name = "fdCases")
- public Object[][] caseGenerator() {
- List<Pair<TestKind, Hierarchy>> cases = generateCases();
- Object[][] fdCases = new Object[cases.size()][];
- for (int i = 0; i < cases.size(); ++i) {
- fdCases[i] = new Object[2];
- fdCases[i][0] = cases.get(i).fst;
- fdCases[i][1] = cases.get(i).snd;
- }
- return fdCases;
- }
-
- public static List<Pair<TestKind, Hierarchy>> generateCases() {
- ArrayList<Pair<TestKind,Hierarchy>> list = new ArrayList<>();
- HierarchyGenerator hg = new HierarchyGenerator();
- for (TestKind tk : TestKind.values()) {
- for (Hierarchy hs : tk.getHierarchy(hg)) {
- list.add(new Pair<>(tk, hs));
- }
- }
- return list;
- }
-
- public static void runTest(TestKind tk, Hierarchy hs,
- JavaCompiler comp, StandardJavaFileManager fm) throws Exception {
- new FDTest(tk, hs).run(comp, fm);
- }
-
- TestKind tk;
- Hierarchy hs;
- DefenderTestSource source;
- DiagnosticChecker diagChecker;
-
- public FDTest() {}
-
- FDTest(TestKind tk, Hierarchy hs) {
- this.tk = tk;
- this.hs = hs;
- this.source = new DefenderTestSource();
- this.diagChecker = new DiagnosticChecker();
- }
-
- void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
- JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
- null, null, Arrays.asList(source));
- try {
- ct.analyze();
- } catch (Throwable ex) {
- fail("Error thrown when analyzing the following source:\n" + source.getCharContent(true));
- }
- check();
- }
-
- void check() {
- boolean errorExpected = tk == TestKind.NEGATIVE;
- if (errorExpected != diagChecker.errorFound) {
- fail("problem in source: \n" +
- "\nerror found = " + diagChecker.errorFound +
- "\nerror expected = " + errorExpected +
- "\n" + dumpHierarchy() +
- "\n" + source.getCharContent(true));
- }
- }
-
- String dumpHierarchy() {
- StringBuilder buf = new StringBuilder();
- buf.append("root = " + hs.root + "\n");
- for (ClassCase cc : hs.all) {
- buf.append(" class name = " + cc.getName() + "\n");
- buf.append(" class OK = " + cc.get_OK() + "\n");
- buf.append(" prov = " + cc.get_mprov() + "\n");
-
- }
- return buf.toString();
- }
-
- class DefenderTestSource extends SimpleJavaFileObject {
-
- String source;
-
- public DefenderTestSource() {
- super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
- StringBuilder buf = new StringBuilder();
- List<ClassCase> defaultRef = new ArrayList<>();
- for (ClassCase cc : hs.all) {
- Hierarchy.genClassDef(buf, cc, null, defaultRef);
- }
- source = buf.toString();
- }
-
- @Override
- public CharSequence getCharContent(boolean ignoreEncodingErrors) {
- return source;
- }
- }
-
- static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
-
- boolean errorFound;
-
- public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
- if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
- errorFound = true;
- }
- }
- }
-}
--- a/jdk/test/jdk/lambda/LambdaTranslationInInterface.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-/**
- * @author Robert Field
- */
-
-interface LTII {
-
- interface ILsp1 {
- String m();
- }
-
- interface ILsp2 {
- String m(String x);
- }
-
- default ILsp1 t1() {
- return () -> { return "yo"; };
- }
-
- default ILsp2 t2() {
- return (x) -> { return "snur" + x; };
- }
-
-}
-
-@Test
-public class LambdaTranslationInInterface implements LTII {
-
- public void testLambdaInDefaultMethod() {
- assertEquals(t1().m(), "yo");
- assertEquals(t2().m("p"), "snurp");
- }
-
-}
--- a/jdk/test/jdk/lambda/LambdaTranslationInnerConstructor.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class LambdaTranslationInnerConstructor {
-
- public void testLambdaWithInnerConstructor() {
- assertEquals(seq1().m().toString(), "Cbl:nada");
- assertEquals(seq2().m("rats").toString(), "Cbl:rats");
- }
-
- Ib1 seq1() {
- return () -> { return new Cbl(); };
- }
-
- Ib2 seq2() {
- return (x) -> { return new Cbl(x); };
- }
-
- class Cbl {
- String val;
-
- Cbl() {
- this.val = "nada";
- }
-
- Cbl(String z) {
- this.val = z;
- }
-
- public String toString() {
- return "Cbl:" + val;
- }
- }
-
- interface Ib1 {
- Object m();
- }
-
- interface Ib2 {
- Object m(String x);
- }
-}
\ No newline at end of file
--- a/jdk/test/jdk/lambda/MethodReferenceTestFDCCE.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-/**
- * Method references and raw types.
- * @author Robert Field
- */
-
-@Test
-@SuppressWarnings({"rawtypes", "unchecked"})
-public class MethodReferenceTestFDCCE {
-
- static void assertCCE(Throwable t) {
- assertEquals(t.getClass().getName(), "java.lang.ClassCastException");
- }
-
- interface Pred<T> { boolean accept(T x); }
-
- interface Ps { boolean accept(short x); }
-
- interface Oo { Object too(int x); }
-
- interface Reto<T> { T m(); }
-
- class A {}
- class B extends A {}
-
- static boolean isMinor(int x) {
- return x < 18;
- }
-
- static boolean tst(A x) {
- return true;
- }
-
- static Object otst(Object x) {
- return x;
- }
-
- static boolean stst(Short x) {
- return x < 18;
- }
-
- static short ritst() {
- return 123;
- }
-
- public void testMethodReferenceFDPrim1() {
- Pred<Byte> p = MethodReferenceTestFDCCE::isMinor;
- Pred p2 = p;
- assertTrue(p2.accept((Byte)(byte)15));
- }
-
- public void testMethodReferenceFDPrim2() {
- Pred<Byte> p = MethodReferenceTestFDCCE::isMinor;
- Pred p2 = p;
- assertTrue(p2.accept((byte)15));
- }
-
- public void testMethodReferenceFDPrimICCE() {
- Pred<Byte> p = MethodReferenceTestFDCCE::isMinor;
- Pred p2 = p;
- try {
- p2.accept(15); // should throw CCE
- fail("Exception should have been thrown");
- } catch (Throwable t) {
- assertCCE(t);
- }
- }
-
- public void testMethodReferenceFDPrimOCCE() {
- Pred<Byte> p = MethodReferenceTestFDCCE::isMinor;
- Pred p2 = p;
- try {
- p2.accept(new Object()); // should throw CCE
- fail("Exception should have been thrown");
- } catch (Throwable t) {
- assertCCE(t);
- }
- }
-
- public void testMethodReferenceFDRef() {
- Pred<B> p = MethodReferenceTestFDCCE::tst;
- Pred p2 = p;
- assertTrue(p2.accept(new B()));
- }
-
- public void testMethodReferenceFDRefCCE() {
- Pred<B> p = MethodReferenceTestFDCCE::tst;
- Pred p2 = p;
- try {
- p2.accept(new A()); // should throw CCE
- fail("Exception should have been thrown");
- } catch (Throwable t) {
- assertCCE(t);
- }
- }
-
- public void testMethodReferenceFDPrimPrim() {
- Ps p = MethodReferenceTestFDCCE::isMinor;
- assertTrue(p.accept((byte)15));
- }
-
- public void testMethodReferenceFDPrimBoxed() {
- Ps p = MethodReferenceTestFDCCE::stst;
- assertTrue(p.accept((byte)15));
- }
-
- public void testMethodReferenceFDPrimRef() {
- Oo p = MethodReferenceTestFDCCE::otst;
- assertEquals(p.too(15).getClass().getName(), "java.lang.Integer");
- }
-
- public void testMethodReferenceFDRet1() {
- Reto<Short> p = MethodReferenceTestFDCCE::ritst;
- assertEquals(p.m(), (Short)(short)123);
- }
-
-}
\ No newline at end of file
--- a/jdk/test/jdk/lambda/MethodReferenceTestInnerDefault.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-interface IDSs { String m(String a); }
-
-interface InDefA {
- default String xsA__(String s) {
- return "A__xsA:" + s;
- }
-
- default String xsAB_(String s) {
- return "AB_xsA:" + s;
- }
-
-}
-
-interface InDefB extends InDefA {
-
- default String xsAB_(String s) {
- return "AB_xsB:" + s;
- }
-
- default String xs_B_(String s) {
- return "_B_xsB:" + s;
- }
-}
-
-@Test
-public class MethodReferenceTestInnerDefault implements InDefB {
-
- public void testMethodReferenceInnerDefault() {
- (new In()).testMethodReferenceInnerDefault();
- }
-
- class In {
-
- public void testMethodReferenceInnerDefault() {
- IDSs q;
-
- q = MethodReferenceTestInnerDefault.this::xsA__;
- assertEquals(q.m("*"), "A__xsA:*");
-
- q = MethodReferenceTestInnerDefault.this::xsAB_;
- assertEquals(q.m("*"), "AB_xsB:*");
-
- q = MethodReferenceTestInnerDefault.this::xs_B_;
- assertEquals(q.m("*"), "_B_xsB:*");
- }
- }
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestInnerInstance.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestInnerInstance {
-
- public void testMethodReferenceInnerInstance() {
- cia().cib().testMethodReferenceInstance();
- }
-
- public void testMethodReferenceInnerExternal() {
- cia().cib().testMethodReferenceExternal();
- }
-
- interface SI {
- String m(Integer a);
- }
-
- class CIA {
-
- String xI(Integer i) {
- return "xI:" + i;
- }
-
- public class CIB {
-
- public void testMethodReferenceInstance() {
- SI q;
-
- q = CIA.this::xI;
- assertEquals(q.m(55), "xI:55");
- }
-
- public void testMethodReferenceExternal() {
- SI q;
-
- q = (new E())::xI;
- assertEquals(q.m(77), "ExI:77");
- }
- }
-
- CIB cib() {
- return new CIB();
- }
-
- class E {
-
- String xI(Integer i) {
- return "ExI:" + i;
- }
- }
-
- }
-
- CIA cia() {
- return new CIA();
- }
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestInnerVarArgsThis.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestInnerVarArgsThis {
-
- interface NsII {
-
- String m(Integer a, Integer b);
- }
-
- interface Nsiii {
-
- String m(int a, int b, int c);
- }
-
- interface Nsi {
-
- String m(int a);
- }
-
- interface NsaO {
-
- String m(Object[] a);
- }
-
- interface Nsai {
-
- String m(int[] a);
- }
-
- interface Nsvi {
-
- String m(int... va);
- }
-
- class CIA {
-
- String xvI(Integer... vi) {
- StringBuilder sb = new StringBuilder("xvI:");
- for (Integer i : vi) {
- sb.append(i);
- sb.append("-");
- }
- return sb.toString();
- }
-
- String xIvI(Integer f, Integer... vi) {
- StringBuilder sb = new StringBuilder("xIvI:");
- sb.append(f);
- for (Integer i : vi) {
- sb.append(i);
- sb.append("-");
- }
- return sb.toString();
- }
-
- String xvi(int... vi) {
- int sum = 0;
- for (int i : vi) {
- sum += i;
- }
- return "xvi:" + sum;
- }
-
- String xIvi(Integer f, int... vi) {
- int sum = 0;
- for (int i : vi) {
- sum += i;
- }
- return "xIvi:(" + f + ")" + sum;
- }
-
- String xvO(Object... vi) {
- StringBuilder sb = new StringBuilder("xvO:");
- for (Object i : vi) {
- if (i.getClass().isArray()) {
- sb.append("[");
- int len = Array.getLength(i);
- for (int x = 0; x < len; ++x) {
- sb.append(Array.get(i, x));
- sb.append(",");
- }
- sb.append("]");
-
- } else {
- sb.append(i);
- }
- sb.append("*");
- }
- return sb.toString();
- }
-
- public class CIB {
-
- // These should be processed as var args
- public void testVarArgsNsSuperclass() {
- NsII q;
-
- q = CIA.this::xvO;
- assertEquals(q.m(55, 66), "xvO:55*66*");
- }
-
- public void testVarArgsNsArray() {
- Nsai q;
-
- q = CIA.this::xvO;
- assertEquals(q.m(new int[]{55, 66}), "xvO:[55,66,]*");
- }
-
- public void testVarArgsNsII() {
- NsII q;
-
- q = CIA.this::xvI;
- assertEquals(q.m(33, 7), "xvI:33-7-");
-
- q = CIA.this::xIvI;
- assertEquals(q.m(50, 40), "xIvI:5040-");
-
- q = CIA.this::xvi;
- assertEquals(q.m(100, 23), "xvi:123");
-
- q = CIA.this::xIvi;
- assertEquals(q.m(9, 21), "xIvi:(9)21");
- }
-
- public void testVarArgsNsiii() {
- Nsiii q;
-
- q = CIA.this::xvI;
- assertEquals(q.m(3, 2, 1), "xvI:3-2-1-");
-
- q = CIA.this::xIvI;
- assertEquals(q.m(888, 99, 2), "xIvI:88899-2-");
-
- q = CIA.this::xvi;
- assertEquals(q.m(900, 80, 7), "xvi:987");
-
- q = CIA.this::xIvi;
- assertEquals(q.m(333, 27, 72), "xIvi:(333)99");
- }
-
- public void testVarArgsNsi() {
- Nsi q;
-
- q = CIA.this::xvI;
- assertEquals(q.m(3), "xvI:3-");
-
- q = CIA.this::xIvI;
- assertEquals(q.m(888), "xIvI:888");
-
- q = CIA.this::xvi;
- assertEquals(q.m(900), "xvi:900");
-
- q = CIA.this::xIvi;
- assertEquals(q.m(333), "xIvi:(333)0");
- }
-
- // These should NOT be processed as var args
- public void testVarArgsNsaO() {
- NsaO q;
-
- q = CIA.this::xvO;
- assertEquals(q.m(new String[]{"yo", "there", "dude"}), "xvO:yo*there*dude*");
- }
- }
-
- CIB cib() {
- return new CIB();
- }
-
- class E {
-
- String xI(Integer i) {
- return "ExI:" + i;
- }
- }
- }
-
- CIA cia() {
- return new CIA();
- }
-
- // These should be processed as var args
- public void testVarArgsNsSuperclass() {
- cia().cib().testVarArgsNsSuperclass();
- }
-
- public void testVarArgsNsArray() {
- cia().cib().testVarArgsNsArray();
- }
-
- public void testVarArgsNsII() {
- cia().cib().testVarArgsNsII();
- }
-
- public void testVarArgsNsiii() {
- cia().cib().testVarArgsNsiii();
- }
-
- public void testVarArgsNsi() {
- cia().cib().testVarArgsNsi();
- }
-
- // These should NOT be processed as var args
-
- public void testVarArgsNsaO() {
- cia().cib().testVarArgsNsaO();
- }
-
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestInstance.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-class MethodReferenceTestInstance_E {
- String xI(Integer i) {
- return "ExI:" + i;
- }
-}
-
-@Test
-public class MethodReferenceTestInstance {
-
- interface SI { String m(Integer a); }
-
- String xI(Integer i) {
- return "xI:" + i;
- }
-
- public void testMethodReferenceInstance() {
- SI q;
-
- q = this::xI;
- assertEquals(q.m(55), "xI:55");
- }
-
- public void testMethodReferenceExternal() {
- SI q;
-
- q = (new MethodReferenceTestInstance_E())::xI;
- assertEquals(q.m(77), "ExI:77");
- }
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestKinds.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestKinds extends MethodReferenceTestKindsSup {
-
- interface S0 { String get(); }
- interface S1 { String get(MethodReferenceTestKinds x); }
- interface S2 { String get(MethodReferenceTestKinds x, MethodReferenceTestKinds y); }
-
- interface SXN0 { MethodReferenceTestKindsBase make(MethodReferenceTestKinds x); }
- interface SXN1 { MethodReferenceTestKindsBase make(MethodReferenceTestKinds x, String str); }
-
- interface SN0 { MethodReferenceTestKindsBase make(); }
- interface SN1 { MethodReferenceTestKindsBase make(String x); }
-
- class In extends MethodReferenceTestKindsBase {
- In(String val) {
- this.val = val;
- }
-
- In() {
- this("blank");
- }
- }
-
- String instanceMethod0() { return "IM:0-" + this; }
- String instanceMethod1(MethodReferenceTestKinds x) { return "IM:1-" + this + x; }
-
- static String staticMethod0() { return "SM:0"; }
- static String staticMethod1(MethodReferenceTestKinds x) { return "SM:1-" + x; }
-
- MethodReferenceTestKinds(String val) {
- super(val);
- }
-
- MethodReferenceTestKinds() {
- super("blank");
- }
-
- MethodReferenceTestKinds inst(String val) {
- return new MethodReferenceTestKinds(val);
- }
-
- public void testMRBound() {
- S0 var = this::instanceMethod0;
- assertEquals(var.get(), "IM:0-MethodReferenceTestKinds(blank)");
- }
-
- public void testMRBoundArg() {
- S1 var = this::instanceMethod1;
- assertEquals(var.get(inst("arg")), "IM:1-MethodReferenceTestKinds(blank)MethodReferenceTestKinds(arg)");
- }
-
- public void testMRUnbound() {
- S1 var = MethodReferenceTestKinds::instanceMethod0;
- assertEquals(var.get(inst("rcvr")), "IM:0-MethodReferenceTestKinds(rcvr)");
- }
-
- public void testMRUnboundArg() {
- S2 var = MethodReferenceTestKinds::instanceMethod1;
- assertEquals(var.get(inst("rcvr"), inst("arg")), "IM:1-MethodReferenceTestKinds(rcvr)MethodReferenceTestKinds(arg)");
- }
-
- public void testMRSuper() {
- S0 var = super::instanceMethod0;
- assertEquals(var.get(), "SIM:0-MethodReferenceTestKinds(blank)");
- }
-
- public void testMRSuperArg() {
- S1 var = super::instanceMethod1;
- assertEquals(var.get(inst("arg")), "SIM:1-MethodReferenceTestKinds(blank)MethodReferenceTestKinds(arg)");
- }
-
- public void testMRStatic() {
- S0 var = MethodReferenceTestKinds::staticMethod0;
- assertEquals(var.get(), "SM:0");
- }
-
- public void testMRStaticArg() {
- S1 var = MethodReferenceTestKinds::staticMethod1;
- assertEquals(var.get(inst("arg")), "SM:1-MethodReferenceTestKinds(arg)");
- }
-
- public void testMRTopLevel() {
- SN0 var = MethodReferenceTestKindsBase::new;
- assertEquals(var.make().toString(), "MethodReferenceTestKindsBase(blank)");
- }
-
- public void testMRTopLevelArg() {
- SN1 var = MethodReferenceTestKindsBase::new;
- assertEquals(var.make("name").toString(), "MethodReferenceTestKindsBase(name)");
- }
-/* unbound inner case not supported anymore (dropped by EG)
- public void testMRUnboundInner() {
- SXN0 var = MethodReferenceTestKinds.In::new;
- assertEquals(var.make(inst("out")).toString(), "In(blank)");
- }
-
- public void testMRUnboundInnerArg() {
- SXN1 var = MethodReferenceTestKinds.In::new;
- assertEquals(var.make(inst("out"), "name").toString(), "In(name)");
- }
-*/
- public void testMRImplicitInner() {
- SN0 var = MethodReferenceTestKinds.In::new;
- assertEquals(var.make().toString(), "In(blank)");
- }
-
- public void testMRImplicitInnerArg() {
- SN1 var = MethodReferenceTestKinds.In::new;
- assertEquals(var.make("name").toString(), "In(name)");
- }
-
-}
-
-
-class MethodReferenceTestKindsBase {
- String val = "unset";
-
- public String toString() {
- return getClass().getSimpleName() + "(" + val + ")";
- }
-
- MethodReferenceTestKindsBase(String val) {
- this.val = val;
- }
-
- MethodReferenceTestKindsBase() {
- this("blank");
- }
-
-}
-
-class MethodReferenceTestKindsSup extends MethodReferenceTestKindsBase {
- String instanceMethod0() { return "SIM:0-" + this; }
- String instanceMethod1(MethodReferenceTestKinds x) { return "SIM:1-" + this + x; }
-
- MethodReferenceTestKindsSup(String val) {
- super(val);
- }
-
-}
-
--- a/jdk/test/jdk/lambda/MethodReferenceTestNew.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestNew {
-
- interface M0<T> {
-
- T m();
- }
-
- static class N0 {
-
- N0() {
- }
- }
-
- interface M1<T> {
-
- T m(Integer a);
- }
-
- static class N1 {
-
- int i;
-
- N1(int i) {
- this.i = i;
- }
- }
-
- interface M2<T> {
-
- T m(Integer n, String o);
- }
-
- static class N2 {
-
- Number n;
- Object o;
-
- N2(Number n, Object o) {
- this.n = n;
- this.o = o;
- }
-
- public String toString() {
- return "N2(" + n + "," + o + ")";
- }
- }
-
- interface MV {
-
- NV m(Integer ai, int i);
- }
-
- static class NV {
-
- int i;
-
- NV(int... v) {
- i = 0;
- for (int x : v) {
- i += x;
- }
- }
-
- public String toString() {
- return "NV(" + i + ")";
- }
- }
-
- public void testConstructorReference0() {
- M0<N0> q;
-
- q = N0::new;
- assertEquals(q.m().getClass().getSimpleName(), "N0");
- }
-
- public void testConstructorReference1() {
- M1<N1> q;
-
- q = N1::new;
- assertEquals(q.m(14).getClass().getSimpleName(), "N1");
- }
-
- public void testConstructorReference2() {
- M2<N2> q;
-
- q = N2::new;
- assertEquals(q.m(7, "hi").toString(), "N2(7,hi)");
- }
-
- public void testConstructorReferenceVarArgs() {
- MV q;
-
- q = NV::new;
- assertEquals(q.m(5, 45).toString(), "NV(50)");
- }
-
-}
-
--- a/jdk/test/jdk/lambda/MethodReferenceTestNewInner.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestNewInner {
-
- String note = "NO NOTE";
-
- interface M0<T> {
-
- T m();
- }
-
- interface MP<T> {
-
- T m(MethodReferenceTestNewInner m);
- }
-
- class N0 {
-
- N0() {
- }
- }
-
- interface M1<T> {
-
- T m(Integer a);
- }
-
- class N1 {
-
- int i;
-
- N1(int i) {
- this.i = i;
- }
- }
-
- interface M2<T> {
-
- T m(Integer n, String o);
- }
-
- class N2 {
-
- Number n;
- Object o;
-
- N2(Number n, Object o) {
- this.n = n;
- this.o = o;
- }
-
- public String toString() {
- return note + ":N2(" + n + "," + o + ")";
- }
- }
-
- interface MV {
-
- NV m(Integer ai, int i);
- }
-
- class NV {
-
- int i;
-
- NV(int... v) {
- i = 0;
- for (int x : v) {
- i += x;
- }
- }
-
- public String toString() {
- return note + ":NV(" + i + ")";
- }
- }
-
-/* unbound constructor case not supported anymore (dropped by EG)
- public static void testConstructorReferenceP() {
- MP<N0> q;
-
- q = N0::new;
- assertEquals(q.m(new MethodReferenceTestNewInner()).getClass().getSimpleName(), "N0");
- }
-*/
- public void testConstructorReference0() {
- M0<N0> q;
-
- q = N0::new;
- assertEquals(q.m().getClass().getSimpleName(), "N0");
- }
-
- public void testConstructorReference1() {
- M1<N1> q;
-
- q = N1::new;
- assertEquals(q.m(14).getClass().getSimpleName(), "N1");
- }
-
- public void testConstructorReference2() {
- M2<N2> q;
-
- note = "T2";
- q = N2::new;
- assertEquals(q.m(7, "hi").toString(), "T2:N2(7,hi)");
- }
-
- /***
- public void testConstructorReferenceVarArgs() {
- MV q;
-
- note = "TVA";
- q = NV::new;
- assertEquals(q.m(5, 45).toString(), "TNV:NV(50)");
- }
- ***/
-
-}
-
-
--- a/jdk/test/jdk/lambda/MethodReferenceTestSueCase1.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestSueCase1 {
-
- public interface Sam2<T> { public String get(T target, String s); }
-
- String instanceMethod(String s) { return "2"; }
- Sam2<MethodReferenceTestSueCase1> var = MethodReferenceTestSueCase1::instanceMethod;
-
- String m() { return var.get(new MethodReferenceTestSueCase1(), ""); }
-
- public void testSueCase1() {
- assertEquals(m(), "2");
- }
-}
\ No newline at end of file
--- a/jdk/test/jdk/lambda/MethodReferenceTestSueCase2.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestSueCase2 {
-
- public interface Sam2<T> { public String get(T target, String s); }
-
- String instanceMethod(String s) { return "2"; }
- static Sam2<MethodReferenceTestSueCase2> var = MethodReferenceTestSueCase2::instanceMethod;
-
- String m() { return var.get(new MethodReferenceTestSueCase2(), ""); }
-
- public void testSueCase2() {
- assertEquals(m(), "2");
- }
-
-}
\ No newline at end of file
--- a/jdk/test/jdk/lambda/MethodReferenceTestSueCase4.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestSueCase4 {
-
- public interface Sam2<T> { public String get(T target, String s); }
-
- Sam2<Target> var = new Object().equals(new Object()) ? Target::instanceMethod : Target::instanceMethod;
-
- String m() {
- return var.get(new Target(), "");
- }
-
- static class Target {
- String instanceMethod(String s) { return "2"; }
- }
-
- public void testSueCase4() {
- assertEquals(m(), "2");
- }
-
-}
\ No newline at end of file
--- a/jdk/test/jdk/lambda/MethodReferenceTestSuper.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-
-
-/**
- * @author Robert Field
- */
-
-interface SPRI { String m(String a); }
-
-class SPRA {
- String xsA__(String s) {
- return "A__xsA:" + s;
- }
-
- String xsA_M(String s) {
- return "A_MxsA:" + s;
- }
-
- String xsAB_(String s) {
- return "AB_xsA:" + s;
- }
-
- String xsABM(String s) {
- return "ABMxsA:" + s;
- }
-
-}
-
-class SPRB extends SPRA {
-
- String xsAB_(String s) {
- return "AB_xsB:" + s;
- }
-
- String xsABM(String s) {
- return "ABMxsB:" + s;
- }
-
- String xs_B_(String s) {
- return "_B_xsB:" + s;
- }
-
- String xs_BM(String s) {
- return "_BMxsB:" + s;
- }
-
-}
-
-@Test
-public class MethodReferenceTestSuper extends SPRB {
-
- String xsA_M(String s) {
- return "A_MxsM:" + s;
- }
-
-
- String xsABM(String s) {
- return "ABMxsM:" + s;
- }
-
- String xs_BM(String s) {
- return "_BMxsM:" + s;
- }
-
- public void testMethodReferenceSuper() {
- SPRI q;
-
- q = super::xsA__;
- assertEquals(q.m("*"), "A__xsA:*");
-
- q = super::xsA_M;
- assertEquals(q.m("*"), "A_MxsA:*");
-
- q = super::xsAB_;
- assertEquals(q.m("*"), "AB_xsB:*");
-
- q = super::xsABM;
- assertEquals(q.m("*"), "ABMxsB:*");
-
- q = super::xs_B_;
- assertEquals(q.m("*"), "_B_xsB:*");
-
- q = super::xs_BM;
- assertEquals(q.m("*"), "_BMxsB:*");
- }
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestSuperDefault.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-
-/**
- * @author Robert Field
- */
-
-interface DSPRI { String m(String a); }
-
-interface DSPRA {
- default String xsA__(String s) {
- return "A__xsA:" + s;
- }
-
- default String xsAB_(String s) {
- return "AB_xsA:" + s;
- }
-
-}
-
-interface DSPRB extends DSPRA {
-
- default String xsAB_(String s) {
- return "AB_xsB:" + s;
- }
-
- default String xs_B_(String s) {
- return "_B_xsB:" + s;
- }
-
-}
-
-@Test
-public class MethodReferenceTestSuperDefault implements DSPRB {
-
- public void testMethodReferenceSuper() {
- DSPRI q;
-
- q = DSPRB.super::xsA__;
- assertEquals(q.m("*"), "A__xsA:*");
-
- q = DSPRB.super::xsAB_;
- assertEquals(q.m("*"), "AB_xsB:*");
-
- q = DSPRB.super::xs_B_;
- assertEquals(q.m("*"), "_B_xsB:*");
- }
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestTypeConversion.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-class MethodReferenceTestTypeConversion_E<T> {
- T xI(T t) { return t; }
-}
-
-@Test
-public class MethodReferenceTestTypeConversion {
-
- interface ISi { int m(Short a); }
-
- interface ICc { char m(Character a); }
-
- public void testUnboxObjectToNumberWiden() {
- ISi q = (new MethodReferenceTestTypeConversion_E<Short>())::xI;
- assertEquals(q.m((short)77), (short)77);
- }
-
- public void testUnboxObjectToChar() {
- ICc q = (new MethodReferenceTestTypeConversion_E<Character>())::xI;
- assertEquals(q.m('@'), '@');
- }
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestVarArgs.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestVarArgs {
-
- interface SII {
-
- String m(Integer a, Integer b);
- }
-
- interface Siii {
-
- String m(int a, int b, int c);
- }
-
- interface Si {
-
- String m(int a);
- }
-
- interface SaO {
-
- String m(Object[] a);
- }
-
- interface Sai {
-
- String m(int[] a);
- }
-
- interface Svi {
-
- String m(int... va);
- }
-
- // These should be processed as var args
-
- static String xvI(Integer... vi) {
- StringBuilder sb = new StringBuilder("xvI:");
- for (Integer i : vi) {
- sb.append(i);
- sb.append("-");
- }
- return sb.toString();
- }
-
- static String xIvI(Integer f, Integer... vi) {
- StringBuilder sb = new StringBuilder("xIvI:");
- sb.append(f);
- for (Integer i : vi) {
- sb.append(i);
- sb.append("-");
- }
- return sb.toString();
- }
-
- static String xvi(int... vi) {
- int sum = 0;
- for (int i : vi) {
- sum += i;
- }
- return "xvi:" + sum;
- }
-
- static String xIvi(Integer f, int... vi) {
- int sum = 0;
- for (int i : vi) {
- sum += i;
- }
- return "xIvi:(" + f + ")" + sum;
- }
-
- static String xvO(Object... vi) {
- StringBuilder sb = new StringBuilder("xvO:");
- for (Object i : vi) {
- if (i.getClass().isArray()) {
- sb.append("[");
- int len = Array.getLength(i);
- for (int x = 0; x < len; ++x) {
- sb.append(Array.get(i, x));
- sb.append(",");
- }
- sb.append("]");
-
- } else {
- sb.append(i);
- }
- sb.append("*");
- }
- return sb.toString();
- }
-
- public void testVarArgsSuperclass() {
- SII q;
-
- q = MethodReferenceTestVarArgs::xvO;
- assertEquals(q.m(55,66), "xvO:55*66*");
- }
-
- public void testVarArgsArray() {
- Sai q;
-
- q = MethodReferenceTestVarArgs::xvO;
- assertEquals(q.m(new int[] { 55,66 } ), "xvO:[55,66,]*");
- }
-
- public void testVarArgsII() {
- SII q;
-
- q = MethodReferenceTestVarArgs::xvI;
- assertEquals(q.m(33,7), "xvI:33-7-");
-
- q = MethodReferenceTestVarArgs::xIvI;
- assertEquals(q.m(50,40), "xIvI:5040-");
-
- q = MethodReferenceTestVarArgs::xvi;
- assertEquals(q.m(100,23), "xvi:123");
-
- q = MethodReferenceTestVarArgs::xIvi;
- assertEquals(q.m(9,21), "xIvi:(9)21");
- }
-
- public void testVarArgsiii() {
- Siii q;
-
- q = MethodReferenceTestVarArgs::xvI;
- assertEquals(q.m(3, 2, 1), "xvI:3-2-1-");
-
- q = MethodReferenceTestVarArgs::xIvI;
- assertEquals(q.m(888, 99, 2), "xIvI:88899-2-");
-
- q = MethodReferenceTestVarArgs::xvi;
- assertEquals(q.m(900,80,7), "xvi:987");
-
- q = MethodReferenceTestVarArgs::xIvi;
- assertEquals(q.m(333,27, 72), "xIvi:(333)99");
- }
-
- public void testVarArgsi() {
- Si q;
-
- q = MethodReferenceTestVarArgs::xvI;
- assertEquals(q.m(3), "xvI:3-");
-
- q = MethodReferenceTestVarArgs::xIvI;
- assertEquals(q.m(888), "xIvI:888");
-
- q = MethodReferenceTestVarArgs::xvi;
- assertEquals(q.m(900), "xvi:900");
-
- q = MethodReferenceTestVarArgs::xIvi;
- assertEquals(q.m(333), "xIvi:(333)0");
- }
-
- // These should NOT be processed as var args
-
- public void testVarArgsaO() {
- SaO q;
-
- q = MethodReferenceTestVarArgs::xvO;
- assertEquals(q.m(new String[] { "yo", "there", "dude" }), "xvO:yo*there*dude*");
- }
-
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestVarArgsExt.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-interface NXII { String m(Integer a, Integer b); }
-
-interface NXiii { String m(int a, int b, int c); }
-
-interface NXi { String m(int a); }
-
-interface NXaO { String m(Object[] a); }
-
-interface NXai { String m(int[] a); }
-
-interface NXvi { String m(int... va); }
-
-@Test
-public class MethodReferenceTestVarArgsExt {
-
- // These should be processed as var args
-
- public void testVarArgsNXSuperclass() {
- NXII q;
-
- q = (new Ext())::xvO;
- assertEquals(q.m(55,66), "xvO:55*66*");
- }
-
- public void testVarArgsNXArray() {
- NXai q;
-
- q = (new Ext())::xvO;
- assertEquals(q.m(new int[] { 55,66 } ), "xvO:[55,66,]*");
- }
-
- public void testVarArgsNXII() {
- NXII q;
-
- q = (new Ext())::xvI;
- assertEquals(q.m(33,7), "xvI:33-7-");
-
- q = (new Ext())::xIvI;
- assertEquals(q.m(50,40), "xIvI:5040-");
-
- q = (new Ext())::xvi;
- assertEquals(q.m(100,23), "xvi:123");
-
- q = (new Ext())::xIvi;
- assertEquals(q.m(9,21), "xIvi:(9)21");
- }
-
- public void testVarArgsNXiii() {
- NXiii q;
-
- q = (new Ext())::xvI;
- assertEquals(q.m(3, 2, 1), "xvI:3-2-1-");
-
- q = (new Ext())::xIvI;
- assertEquals(q.m(888, 99, 2), "xIvI:88899-2-");
-
- q = (new Ext())::xvi;
- assertEquals(q.m(900,80,7), "xvi:987");
-
- q = (new Ext())::xIvi;
- assertEquals(q.m(333,27, 72), "xIvi:(333)99");
- }
-
- public void testVarArgsNXi() {
- NXi q;
-
- q = (new Ext())::xvI;
- assertEquals(q.m(3), "xvI:3-");
-
- q = (new Ext())::xIvI;
- assertEquals(q.m(888), "xIvI:888");
-
- q = (new Ext())::xvi;
- assertEquals(q.m(900), "xvi:900");
-
- q = (new Ext())::xIvi;
- assertEquals(q.m(333), "xIvi:(333)0");
- }
-
- // These should NOT be processed as var args
-
- public void testVarArgsNXaO() {
- NXaO q;
-
- q = (new Ext())::xvO;
- assertEquals(q.m(new String[] { "yo", "there", "dude" }), "xvO:yo*there*dude*");
- }
-
-
-}
-
-class Ext {
-
- String xvI(Integer... vi) {
- StringBuilder sb = new StringBuilder("xvI:");
- for (Integer i : vi) {
- sb.append(i);
- sb.append("-");
- }
- return sb.toString();
- }
-
- String xIvI(Integer f, Integer... vi) {
- StringBuilder sb = new StringBuilder("xIvI:");
- sb.append(f);
- for (Integer i : vi) {
- sb.append(i);
- sb.append("-");
- }
- return sb.toString();
- }
-
- String xvi(int... vi) {
- int sum = 0;
- for (int i : vi) {
- sum += i;
- }
- return "xvi:" + sum;
- }
-
- String xIvi(Integer f, int... vi) {
- int sum = 0;
- for (int i : vi) {
- sum += i;
- }
- return "xIvi:(" + f + ")" + sum;
- }
-
- String xvO(Object... vi) {
- StringBuilder sb = new StringBuilder("xvO:");
- for (Object i : vi) {
- if (i.getClass().isArray()) {
- sb.append("[");
- int len = Array.getLength(i);
- for (int x = 0; x < len; ++x) {
- sb.append(Array.get(i, x));
- sb.append(",");
- }
- sb.append("]");
-
- } else {
- sb.append(i);
- }
- sb.append("*");
- }
- return sb.toString();
- }
-
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestVarArgsSuper.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-
-
-/**
- * @author Robert Field
- */
-
-class MethodReferenceTestVarArgsSuper_Sub {
-
- String xvI(Integer... vi) {
- StringBuilder sb = new StringBuilder("xvI:");
- for (Integer i : vi) {
- sb.append(i);
- sb.append("-");
- }
- return sb.toString();
- }
-
- String xIvI(Integer f, Integer... vi) {
- StringBuilder sb = new StringBuilder("xIvI:");
- sb.append(f);
- for (Integer i : vi) {
- sb.append(i);
- sb.append("-");
- }
- return sb.toString();
- }
-
- String xvi(int... vi) {
- int sum = 0;
- for (int i : vi) {
- sum += i;
- }
- return "xvi:" + sum;
- }
-
- String xIvi(Integer f, int... vi) {
- int sum = 0;
- for (int i : vi) {
- sum += i;
- }
- return "xIvi:(" + f + ")" + sum;
- }
-
- String xvO(Object... vi) {
- StringBuilder sb = new StringBuilder("xvO:");
- for (Object i : vi) {
- if (i.getClass().isArray()) {
- sb.append("[");
- int len = Array.getLength(i);
- for (int x = 0; x < len; ++x) {
- sb.append(Array.get(i, x));
- sb.append(",");
- }
- sb.append("]");
-
- } else {
- sb.append(i);
- }
- sb.append("*");
- }
- return sb.toString();
- }
-}
-
-@Test
-public class MethodReferenceTestVarArgsSuper extends MethodReferenceTestVarArgsSuper_Sub {
-
- interface SPRII { String m(Integer a, Integer b); }
-
- interface SPRiii { String m(int a, int b, int c); }
-
- interface SPRi { String m(int a); }
-
- interface SPRaO { String m(Object[] a); }
-
- interface SPRai { String m(int[] a); }
-
- interface SPRvi { String m(int... va); }
-
- String xvI(Integer... vi) {
- return "ERROR";
- }
-
- String xIvI(Integer f, Integer... vi) {
- return "ERROR";
- }
-
- String xvi(int... vi) {
- return "ERROR";
- }
-
- String xIvi(Integer f, int... vi) {
- return "ERROR";
- }
-
- String xvO(Object... vi) {
- return "ERROR";
- }
-
- // These should be processed as var args
-
- public void testVarArgsSPRSuperclass() {
- SPRII q;
-
- q = super::xvO;
- assertEquals(q.m(55,66), "xvO:55*66*");
- }
-
- public void testVarArgsSPRArray() {
- SPRai q;
-
- q = super::xvO;
- assertEquals(q.m(new int[] { 55,66 } ), "xvO:[55,66,]*");
- }
-
- public void testVarArgsSPRII() {
- SPRII q;
-
- q = super::xvI;
- assertEquals(q.m(33,7), "xvI:33-7-");
-
- q = super::xIvI;
- assertEquals(q.m(50,40), "xIvI:5040-");
-
- q = super::xvi;
- assertEquals(q.m(100,23), "xvi:123");
-
- q = super::xIvi;
- assertEquals(q.m(9,21), "xIvi:(9)21");
- }
-
- public void testVarArgsSPRiii() {
- SPRiii q;
-
- q = super::xvI;
- assertEquals(q.m(3, 2, 1), "xvI:3-2-1-");
-
- q = super::xIvI;
- assertEquals(q.m(888, 99, 2), "xIvI:88899-2-");
-
- q = super::xvi;
- assertEquals(q.m(900,80,7), "xvi:987");
-
- q = super::xIvi;
- assertEquals(q.m(333,27, 72), "xIvi:(333)99");
- }
-
- public void testVarArgsSPRi() {
- SPRi q;
-
- q = super::xvI;
- assertEquals(q.m(3), "xvI:3-");
-
- q = super::xIvI;
- assertEquals(q.m(888), "xIvI:888");
-
- q = super::xvi;
- assertEquals(q.m(900), "xvi:900");
-
- q = super::xIvi;
- assertEquals(q.m(333), "xIvi:(333)0");
- }
-
- // These should NOT be processed as var args
-
- public void testVarArgsSPRaO() {
- SPRaO q;
-
- q = super::xvO;
- assertEquals(q.m(new String[] { "yo", "there", "dude" }), "xvO:yo*there*dude*");
- }
-}
-
--- a/jdk/test/jdk/lambda/MethodReferenceTestVarArgsSuperDefault.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-interface MethodReferenceTestVarArgsSuperDefault_I {
-
- default String xvI(Integer... vi) {
- StringBuilder sb = new StringBuilder("xvI:");
- for (Integer i : vi) {
- sb.append(i);
- sb.append("-");
- }
- return sb.toString();
- }
-
- default String xIvI(Integer f, Integer... vi) {
- StringBuilder sb = new StringBuilder("xIvI:");
- sb.append(f);
- for (Integer i : vi) {
- sb.append(i);
- sb.append("-");
- }
- return sb.toString();
- }
-
- default String xvi(int... vi) {
- int sum = 0;
- for (int i : vi) {
- sum += i;
- }
- return "xvi:" + sum;
- }
-
- default String xIvi(Integer f, int... vi) {
- int sum = 0;
- for (int i : vi) {
- sum += i;
- }
- return "xIvi:(" + f + ")" + sum;
- }
-
- default String xvO(Object... vi) {
- StringBuilder sb = new StringBuilder("xvO:");
- for (Object i : vi) {
- if (i.getClass().isArray()) {
- sb.append("[");
- int len = Array.getLength(i);
- for (int x = 0; x < len; ++x) {
- sb.append(Array.get(i, x));
- sb.append(",");
- }
- sb.append("]");
-
- } else {
- sb.append(i);
- }
- sb.append("*");
- }
- return sb.toString();
- }
-}
-
-@Test
-public class MethodReferenceTestVarArgsSuperDefault implements MethodReferenceTestVarArgsSuperDefault_I {
-
- interface DSPRII { String m(Integer a, Integer b); }
-
- interface DSPRiii { String m(int a, int b, int c); }
-
- interface DSPRi { String m(int a); }
-
- interface DSPRaO { String m(Object[] a); }
-
- interface DSPRai { String m(int[] a); }
-
- interface DSPRvi { String m(int... va); }
-
- // These should be processed as var args
-
- public void testVarArgsSPRSuperclass() {
- DSPRII q;
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xvO;
- assertEquals(q.m(55,66), "xvO:55*66*");
- }
-
- public void testVarArgsSPRArray() {
- DSPRai q;
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xvO;
- assertEquals(q.m(new int[] { 55,66 } ), "xvO:[55,66,]*");
- }
-
- public void testVarArgsSPRII() {
- DSPRII q;
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xvI;
- assertEquals(q.m(33,7), "xvI:33-7-");
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xIvI;
- assertEquals(q.m(50,40), "xIvI:5040-");
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xvi;
- assertEquals(q.m(100,23), "xvi:123");
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xIvi;
- assertEquals(q.m(9,21), "xIvi:(9)21");
- }
-
- public void testVarArgsSPRiii() {
- DSPRiii q;
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xvI;
- assertEquals(q.m(3, 2, 1), "xvI:3-2-1-");
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xIvI;
- assertEquals(q.m(888, 99, 2), "xIvI:88899-2-");
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xvi;
- assertEquals(q.m(900,80,7), "xvi:987");
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xIvi;
- assertEquals(q.m(333,27, 72), "xIvi:(333)99");
- }
-
- public void testVarArgsSPRi() {
- DSPRi q;
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xvI;
- assertEquals(q.m(3), "xvI:3-");
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xIvI;
- assertEquals(q.m(888), "xIvI:888");
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xvi;
- assertEquals(q.m(900), "xvi:900");
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xIvi;
- assertEquals(q.m(333), "xIvi:(333)0");
- }
-
- // These should NOT be processed as var args
-
- public void testVarArgsSPRaO() {
- DSPRaO q;
-
- q = MethodReferenceTestVarArgsSuperDefault_I.super::xvO;
- assertEquals(q.m(new String[] { "yo", "there", "dude" }), "xvO:yo*there*dude*");
- }
-
-
-}
-
--- a/jdk/test/jdk/lambda/MethodReferenceTestVarArgsThis.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-interface NsII { String m(Integer a, Integer b); }
-
-interface Nsiii { String m(int a, int b, int c); }
-
-interface Nsi { String m(int a); }
-
-interface NsaO { String m(Object[] a); }
-
-interface Nsai { String m(int[] a); }
-
-interface Nsvi { String m(int... va); }
-
-@Test
-public class MethodReferenceTestVarArgsThis {
-
- // These should be processed as var args
-
- String xvI(Integer... vi) {
- StringBuilder sb = new StringBuilder("xvI:");
- for (Integer i : vi) {
- sb.append(i);
- sb.append("-");
- }
- return sb.toString();
- }
-
- String xIvI(Integer f, Integer... vi) {
- StringBuilder sb = new StringBuilder("xIvI:");
- sb.append(f);
- for (Integer i : vi) {
- sb.append(i);
- sb.append("-");
- }
- return sb.toString();
- }
-
- String xvi(int... vi) {
- int sum = 0;
- for (int i : vi) {
- sum += i;
- }
- return "xvi:" + sum;
- }
-
- String xIvi(Integer f, int... vi) {
- int sum = 0;
- for (int i : vi) {
- sum += i;
- }
- return "xIvi:(" + f + ")" + sum;
- }
-
- String xvO(Object... vi) {
- StringBuilder sb = new StringBuilder("xvO:");
- for (Object i : vi) {
- if (i.getClass().isArray()) {
- sb.append("[");
- int len = Array.getLength(i);
- for (int x = 0; x < len; ++x) {
- sb.append(Array.get(i, x));
- sb.append(",");
- }
- sb.append("]");
-
- } else {
- sb.append(i);
- }
- sb.append("*");
- }
- return sb.toString();
- }
-
- public void testVarArgsNsSuperclass() {
- NsII q;
-
- q = this::xvO;
- assertEquals(q.m(55,66), "xvO:55*66*");
- }
-
- public void testVarArgsNsArray() {
- Nsai q;
-
- q = this::xvO;
- assertEquals(q.m(new int[] { 55,66 } ), "xvO:[55,66,]*");
- }
-
- public void testVarArgsNsII() {
- NsII q;
-
- q = this::xvI;
- assertEquals(q.m(33,7), "xvI:33-7-");
-
- q = this::xIvI;
- assertEquals(q.m(50,40), "xIvI:5040-");
-
- q = this::xvi;
- assertEquals(q.m(100,23), "xvi:123");
-
- q = this::xIvi;
- assertEquals(q.m(9,21), "xIvi:(9)21");
- }
-
- public void testVarArgsNsiii() {
- Nsiii q;
-
- q = this::xvI;
- assertEquals(q.m(3, 2, 1), "xvI:3-2-1-");
-
- q = this::xIvI;
- assertEquals(q.m(888, 99, 2), "xIvI:88899-2-");
-
- q = this::xvi;
- assertEquals(q.m(900,80,7), "xvi:987");
-
- q = this::xIvi;
- assertEquals(q.m(333,27, 72), "xIvi:(333)99");
- }
-
- public void testVarArgsNsi() {
- Nsi q;
-
- q = this::xvI;
- assertEquals(q.m(3), "xvI:3-");
-
- q = this::xIvI;
- assertEquals(q.m(888), "xIvI:888");
-
- q = this::xvi;
- assertEquals(q.m(900), "xvi:900");
-
- q = this::xIvi;
- assertEquals(q.m(333), "xIvi:(333)0");
- }
-
- // These should NOT be processed as var args
-
- public void testVarArgsNsaO() {
- NsaO q;
-
- q = this::xvO;
- assertEquals(q.m(new String[] { "yo", "there", "dude" }), "xvO:yo*there*dude*");
- }
-
-
-}
--- a/jdk/test/jdk/lambda/shapegen/ClassCase.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,310 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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 shapegen;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- *
- * @author Robert Field
- */
-public class ClassCase {
-
- public enum Kind {
- IVAC (true, "v"),
- IPRESENT (true, "p"),
- IDEFAULT (true, "d"),
- CNONE (false, "n"),
- CABSTRACT (false, "a"),
- CCONCRETE (false, "c");
-
- private final String prefix;
- public final boolean isInterface;
-
- Kind(boolean isInterface, String prefix) {
- this.isInterface = isInterface;
- this.prefix = prefix;
- }
-
- public String getPrefix() { return prefix; }
- }
-
- public final Kind kind;
- private final ClassCase superclass;
- private final List<ClassCase> supertypes;
-
- private String name;
- private boolean _OK;
- private boolean _HasClassMethod;
- private Set<ClassCase> _mprov;
- private boolean _IsConcrete;
- private boolean _HasDefault;
- private ClassCase _mres;
- private ClassCase _mdefend;
-
- private Set<RuleGroup> executed = new HashSet<RuleGroup>();
-
- public ClassCase(Kind kind, ClassCase superclass, List<ClassCase> interfaces) {
- this.kind = kind;
- this.superclass = superclass;
-
- // Set supertypes from superclass (if any) and interfaces
- List<ClassCase> lc;
- if (superclass == null) {
- lc = interfaces;
- } else {
- lc = new ArrayList<>();
- lc.add(superclass);
- lc.addAll(interfaces);
- }
- this.supertypes = lc;
- }
-
- public final boolean isInterface() { return kind.isInterface; }
- public final boolean isClass() { return !kind.isInterface; }
-
- public Set<ClassCase> get_mprov() {
- exec(RuleGroup.PROVENENCE);
- return _mprov;
- }
-
- public void set_mprov(ClassCase cc) {
- Set<ClassCase> s = new HashSet<>();
- s.add(cc);
- _mprov = s;
- }
-
- public void set_mprov(Set<ClassCase> s) {
- _mprov = s;
- }
-
- public ClassCase get_mres() {
- exec(RuleGroup.RESOLUTION);
- return _mres;
- }
-
- public void set_mres(ClassCase cc) {
- _mres = cc;
- }
-
- public ClassCase get_mdefend() {
- exec(RuleGroup.DEFENDER);
- return _mdefend;
- }
-
- public void set_mdefend(ClassCase cc) {
- _mdefend = cc;
- }
-
- public boolean get_HasClassMethod() {
- exec(RuleGroup.PROVENENCE);
- return _HasClassMethod;
- }
-
- public void set_HasClassMethod(boolean bool) {
- _HasClassMethod = bool;
- }
-
- public boolean get_HasDefault() {
- exec(RuleGroup.MARKER);
- return _HasDefault;
- }
-
- public void set_HasDefault(boolean bool) {
- _HasDefault = bool;
- }
-
- public boolean get_IsConcrete() {
- exec(RuleGroup.MARKER);
- return _IsConcrete;
- }
-
- public void set_IsConcrete(boolean bool) {
- _IsConcrete = bool;
- }
-
- public boolean get_OK() {
- exec(RuleGroup.CHECKING);
- return _OK;
- }
-
- public void set_OK(boolean bool) {
- _OK = bool;
- }
-
- public boolean isMethodDefined() {
- for (ClassCase cc : supertypes) {
- if (cc.isMethodDefined()) {
- return true;
- }
- }
- switch (kind) {
- case CCONCRETE:
- case CABSTRACT:
- case IPRESENT:
- case IDEFAULT:
- return true;
- default:
- return false;
- }
- }
-
- public boolean isAbstract() {
- return isMethodDefined() && (get_mres()==null);
- }
-
- public boolean hasSuperclass() {
- return superclass != null;
- }
-
- public ClassCase getSuperclass() {
- return superclass;
- }
-
- public List<ClassCase> getSupertypes() {
- return supertypes;
- }
-
- public List<ClassCase> getInterfaces() {
- if (superclass != null) {
- if (supertypes.get(0) != superclass) {
- throw new AssertionError("superclass missing from supertypes");
- }
- return supertypes.subList(1, supertypes.size());
- } else {
- return supertypes;
- }
- }
-
- public boolean isSubtypeOf(ClassCase cc) {
- // S-Refl
- if (cc.equals(this)) {
- return true;
- }
-
- // S-Def
- for (ClassCase sp : getSupertypes()) {
- if (cc.equals(sp)) {
- return true;
- }
- }
-
- // _S-Trans
- for (ClassCase sp : getSupertypes()) {
- if (sp.isSubtypeOf(cc)) {
- return true;
- }
- }
-
- return false;
- }
-
- public void init(Map<String, Integer> namingContext) {
- if (name != null) {
- return; // Already inited
- }
-
- for (ClassCase sup : supertypes) {
- sup.init(namingContext);
- }
-
- // Build name
- StringBuilder sb = new StringBuilder();
- if (!supertypes.isEmpty()) {
- sb.append(isInterface() ? "I" : "C");
- for (ClassCase cc : supertypes) {
- sb.append(cc.getName());
- }
- sb.append(kind.isInterface ? "i" : "c");
- }
- sb.append(kind.prefix);
- String pname = sb.toString();
- Integer icnt = namingContext.get(pname);
- int cnt = icnt == null ? 0 : icnt;
- ++cnt;
- namingContext.put(pname, cnt);
- if (cnt > 1) {
- sb.append(cnt);
- }
- this.name = sb.toString();
- }
-
- public boolean isa(Kind... kinds) {
- for (Kind k : kinds) {
- if (kind == k) {
- return true;
- }
- }
- return false;
- }
-
- private void exec(RuleGroup rg ) {
- if (!executed.contains(rg)) {
- rg.exec(this);
- executed.add(rg);
- }
- }
-
- public void collectClasses(Set<ClassCase> seen) {
- seen.add(this);
- for (ClassCase cc : supertypes) {
- cc.collectClasses(seen);
- }
- }
-
- public String getID() {
- if (name == null) {
- throw new Error("Access to uninitialized ClassCase");
- } else {
- return name;
- }
- }
-
- public final String getName() {
- if (name == null) {
- return "ClassCase uninited@" + hashCode();
- } else {
- return name;
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- return obj instanceof ClassCase && getID().equals(((ClassCase)obj).getID());
- }
-
- @Override
- public int hashCode() {
- return getID().hashCode();
- }
-
- @Override
- public String toString() {
- return getName();
- }
-}
--- a/jdk/test/jdk/lambda/shapegen/Hierarchy.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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 shapegen;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import static shapegen.ClassCase.Kind.*;
-
-/**
- *
- * @author Robert Field
- */
-public class Hierarchy {
-
- public final ClassCase root;
- public final Set<ClassCase> all;
-
- public Hierarchy(ClassCase root) {
- this.root = root;
- root.init(new HashMap<String,Integer>());
- Set<ClassCase> allClasses = new HashSet<>();
- root.collectClasses(allClasses);
- this.all = allClasses;
- }
-
- public boolean anyDefaults() {
- for (ClassCase cc : all) {
- if (cc.kind == IDEFAULT) {
- return true;
- }
- }
- return false;
- }
-
- public boolean get_OK() {
- return root.get_OK();
- }
-
- public String testName() {
- return root + "Test";
- }
-
- private static void genInterfaceList(StringBuilder buf, String prefix, List<ClassCase> interfaces) {
- if (!interfaces.isEmpty()) {
- buf.append(" ");
- buf.append(prefix);
- buf.append(" ");
- buf.append(interfaces.get(0));
- for (int i = 1; i < interfaces.size(); ++i) {
- buf.append(", " + interfaces.get(i));
- }
- }
- }
-
- public static void genClassDef(StringBuilder buf, ClassCase cc, String implClass, List<ClassCase> defaultRef) {
- if (cc.isInterface()) {
- buf.append("interface ");
- buf.append(cc.getName() + " ");
- genInterfaceList(buf, "extends", cc.getInterfaces());
- buf.append(" {\n");
-
- switch (cc.kind) {
- case IDEFAULT:
- buf.append(" default String m() { return \"\"; }\n");
- defaultRef.add(cc);
- break;
- case IPRESENT:
- buf.append(" String m();\n");
- break;
- case IVAC:
- break;
- default:
- throw new AssertionError("Unexpected kind");
- }
- buf.append("}\n\n");
- } else {
- buf.append((cc.isAbstract()? "abstract " : ""));
- buf.append(" class " + cc.getName());
- if (cc.getSuperclass() != null) {
- buf.append(" extends " + cc.getSuperclass());
- }
-
- genInterfaceList(buf, "implements", cc.getInterfaces());
- buf.append(" {\n");
-
- switch (cc.kind) {
- case CCONCRETE:
- buf.append(" public String m() { return \"\"; }\n");
- break;
- case CABSTRACT:
- buf.append(" public abstract String m();\n");
- break;
- case CNONE:
- break;
- default:
- throw new AssertionError("Unexpected kind");
- }
- buf.append("}\n\n");
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- return obj instanceof Hierarchy && root.getID().equals(((Hierarchy)obj).root.getID());
- }
-
- @Override
- public int hashCode() {
- return root.getID().hashCode();
- }
-
- @Override
- public String toString() {
- return root.getName();
- }
-
- private static String classNames[] = {
- "C", "D", "E", "F", "G", "H", "S", "T", "U", "V"
- };
-
- private static String interfaceNames[] = {
- "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R"
- };
-
- private static int CLASS_INDEX = 0;
- private static int INTERFACE_INDEX = 1;
- private static int NUM_INDICIES = 2;
-
- public List<String> getDescription() {
- Map<ClassCase,String> nameMap = new HashMap<>();
- assignNames(root, new int[NUM_INDICIES], nameMap);
-
- ArrayList<String> res = new ArrayList<>();
- if (root.getSupertypes().size() == 0) {
- res.add(nameMap.get(root) + root.kind.getPrefix() + "()");
- } else {
- genCaseDescription(root, res, new HashSet<ClassCase>(), nameMap);
- }
- return res;
- }
-
- private static void assignNames(
- ClassCase cc, int indices[], Map<ClassCase,String> names) {
- String name = names.get(cc);
- if (name == null) {
- if (cc.isInterface()) {
- names.put(cc, interfaceNames[indices[INTERFACE_INDEX]++]);
- } else {
- names.put(cc, classNames[indices[CLASS_INDEX]++]);
- }
- for (int i = 0; i < cc.getSupertypes().size(); ++i) {
- assignNames(cc.getSupertypes().get(i), indices, names);
- }
- }
- }
-
- private static void genCaseDescription(
- ClassCase cc, List<String> res, Set<ClassCase> alreadyDone,
- Map<ClassCase,String> nameMap) {
- if (!alreadyDone.contains(cc)) {
- if (cc.getSupertypes().size() > 0) {
- StringBuilder sb = new StringBuilder();
- sb.append(nameMap.get(cc));
- sb.append(cc.kind.getPrefix());
- sb.append("(");
- for (int i = 0; i < cc.getSupertypes().size(); ++i) {
- ClassCase supertype = cc.getSupertypes().get(i);
- if (i != 0) {
- sb.append(",");
- }
- genCaseDescription(supertype, res, alreadyDone, nameMap);
- sb.append(nameMap.get(supertype));
- sb.append(supertype.kind.getPrefix());
- }
- sb.append(")");
- res.add(sb.toString());
- }
- }
- alreadyDone.add(cc);
- }
-}
--- a/jdk/test/jdk/lambda/shapegen/HierarchyGenerator.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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 shapegen;
-
-import shapegen.ClassCase.Kind;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.util.List;
-
-import static shapegen.ClassCase.Kind.*;
-
-import static java.lang.Math.pow;
-
-/**
- *
- * @author Robert Field
- */
-public final class HierarchyGenerator {
-
- private int okcnt = 0;
- private int errcnt = 0;
- private Set<Hierarchy> uniqueOK = new HashSet<>();
- private Set<Hierarchy> uniqueErr = new HashSet<>();
-
- /**
- * @param args the command line arguments
- */
- public HierarchyGenerator() {
- organize("exhaustive interface", iExhaustive(2));
- organize("exhaustive class", cExhaustive());
- organize("shapes interface", iShapes());
- organize("shapes class/interface", ciShapes());
-
- System.out.printf("\nExpect OK: %d -- unique %d", okcnt, uniqueOK.size());
- System.out.printf("\nExpect Error: %d -- unique %d\n", errcnt, uniqueErr.size());
- }
-
- public Collection<Hierarchy> getOK() {
- return uniqueOK;
- }
-
- public Collection<Hierarchy> getErr() {
- return uniqueErr;
- }
-
- private void organize(String tname, List<Hierarchy> totest) {
- System.out.printf("\nGenerating %s....\n", tname);
- int nodefault = 0;
- List<Hierarchy> ok = new ArrayList<>();
- List<Hierarchy> err = new ArrayList<>();
- for (Hierarchy cc : totest) {
- if (cc.anyDefaults()) {
- //System.out.printf(" %s\n", cc);
- if (cc.get_OK()) {
- ok.add(cc);
- } else {
- err.add(cc);
- }
- } else {
- ++nodefault;
- }
- }
-
- errcnt += err.size();
- okcnt += ok.size();
- uniqueErr.addAll(err);
- uniqueOK.addAll(ok);
-
- System.out.printf(" %5d No default\n %5d Error\n %5d OK\n %5d Total\n",
- nodefault, err.size(), ok.size(), totest.size());
- }
-
- public List<Hierarchy> iExhaustive(int idepth) {
- List<ClassCase> current = new ArrayList<>();
- for (int i = 0; i < idepth; ++i) {
- current = ilayer(current);
- }
- return wrapInClassAndHierarchy(current);
- }
-
- private List<ClassCase> ilayer(List<ClassCase> srcLayer) {
- List<ClassCase> lay = new ArrayList<>();
- for (int i = (int) pow(2, srcLayer.size()) - 1; i >= 0; --i) {
- List<ClassCase> itfs = new ArrayList<>();
- for (int b = srcLayer.size() - 1; b >= 0; --b) {
- if ((i & (1<<b)) != 0) {
- itfs.add(srcLayer.get(b));
- }
- }
- lay.add(new ClassCase(IVAC, null, itfs));
- lay.add(new ClassCase(IPRESENT, null, itfs));
- lay.add(new ClassCase(IDEFAULT, null, itfs));
- lay.add(new ClassCase(IDEFAULT, null, itfs));
- }
- return lay;
- }
-
- public List<Hierarchy> cExhaustive() {
- final Kind[] iKinds = new Kind[]{IDEFAULT, IVAC, IPRESENT, null};
- final Kind[] cKinds = new Kind[]{CNONE, CABSTRACT, CCONCRETE};
- List<Hierarchy> totest = new ArrayList<>();
- for (int i1 = 0; i1 < iKinds.length; ++i1) {
- for (int i2 = 0; i2 < iKinds.length; ++i2) {
- for (int i3 = 0; i3 < iKinds.length; ++i3) {
- for (int c1 = 0; c1 < cKinds.length; ++c1) {
- for (int c2 = 0; c2 < cKinds.length; ++c2) {
- for (int c3 = 0; c3 < cKinds.length; ++c3) {
- totest.add( new Hierarchy(
- new ClassCase(cKinds[c1],
- new ClassCase(cKinds[c2],
- new ClassCase(cKinds[c3],
- null,
- iList(iKinds[i1])
- ),
- iList(iKinds[i2])
- ),
- iList(iKinds[i3])
- )));
- }
- }
- }
- }
- }
- }
- return totest;
- }
-
- public static final List<ClassCase> EMPTY_LIST = new ArrayList<>();
-
- private List<ClassCase> iList(Kind kind) {
- if (kind == null) {
- return EMPTY_LIST;
- } else {
- List<ClassCase> itfs = new ArrayList<>();
- itfs.add(new ClassCase(kind, null, EMPTY_LIST));
- return itfs;
- }
- }
-
- public List<Hierarchy> ciShapes() {
- return wrapInHierarchy(TTShape.allCases(true));
- }
-
- public List<Hierarchy> iShapes() {
- return wrapInClassAndHierarchy(TTShape.allCases(false));
- }
-
- public List<Hierarchy> wrapInClassAndHierarchy(List<ClassCase> ihs) {
- List<Hierarchy> totest = new ArrayList<>();
- for (ClassCase cc : ihs) {
- List<ClassCase> interfaces = new ArrayList<>();
- interfaces.add(cc);
- totest.add(new Hierarchy(new ClassCase(CNONE, null, interfaces)));
- }
- return totest;
- }
-
- public List<Hierarchy> wrapInHierarchy(List<ClassCase> ihs) {
- List<Hierarchy> totest = new ArrayList<>();
- for (ClassCase cc : ihs) {
- totest.add(new Hierarchy(cc));
- }
- return totest;
- }
-}
--- a/jdk/test/jdk/lambda/shapegen/Rule.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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 shapegen;
-
-/**
- *
- * @author Robert Field
- */
-public abstract class Rule {
-
- public final String name;
-
- public Rule(String name) {
- this.name = name;
- }
-
- abstract boolean guard(ClassCase cc);
-
- abstract void eval(ClassCase cc);
-
- @Override
- public String toString() {
- return name;
- }
-}
--- a/jdk/test/jdk/lambda/shapegen/RuleGroup.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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 shapegen;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import static shapegen.ClassCase.Kind.*;
-
-/**
- *
- * @author Robert Field
- */
-public class RuleGroup {
-
- final String name;
- private final Rule[] rules;
-
- public RuleGroup(String name, Rule[] rules) {
- this.name = name;
- this.rules = rules;
- }
-
- public boolean exec(ClassCase cc) {
- boolean found = false;
- for (Rule rule : rules) {
- if (rule.guard(cc)) {
- if (found) {
- throw new RuntimeException("Bad rules -- multiple matches " + toString() + " for " + cc);
- } else {
- rule.eval(cc);
- found = true;
- }
- }
- }
- return found;
- }
-
- @Override
- public String toString() {
- return name;
- }
-
- public static RuleGroup PROVENENCE = new RuleGroup("Provenence", new Rule[] {
- new Rule("P-CDeclare") {
- boolean guard(ClassCase cc) {
- return cc.isa(CCONCRETE, CABSTRACT);
- }
-
- void eval(ClassCase cc) {
- cc.set_mprov(cc);
- cc.set_HasClassMethod(true);
- }
- },
-
- new Rule("P-IDeclare") {
- boolean guard(ClassCase cc) {
- return cc.isa(IDEFAULT, IPRESENT);
- }
-
- void eval(ClassCase cc) {
- cc.set_mprov(cc);
- }
- },
-
- new Rule("P-IntfInh") {
- boolean guard(ClassCase cc) {
- return cc.isa(IVAC, CNONE) && !(cc.hasSuperclass() && cc.getSuperclass().get_HasClassMethod());
- }
-
- void eval(ClassCase cc) {
- Set<ClassCase> _S = new HashSet<>();
- for (ClassCase t : cc.getSupertypes()) {
- _S.addAll(t.get_mprov());
- }
- Set<ClassCase> tops = new HashSet<>();
- for (ClassCase _W : _S) {
- for (ClassCase _V : _S) {
- if (_V.equals(_W) || !(_V.isSubtypeOf(_W))) {
- tops.add(_W);
- }
- }
- }
- cc.set_mprov(tops);
- }
- },
-
- new Rule("P-ClassInh") {
- boolean guard(ClassCase cc) {
- return cc.isa(CNONE) && (cc.hasSuperclass() && cc.getSuperclass().get_HasClassMethod());
- }
-
- void eval(ClassCase cc) {
- cc.set_mprov(cc.getSuperclass());
- cc.set_HasClassMethod(true);
- }
- },
-
- });
-
- public static RuleGroup MARKER = new RuleGroup("Marker", new Rule[] {
- new Rule("M-Default") {
- boolean guard(ClassCase cc) {
- return cc.isa(IDEFAULT);
- }
-
- void eval(ClassCase cc) {
- cc.set_HasDefault(true);
- }
- },
-
- new Rule("M-Conc") {
- boolean guard(ClassCase cc) {
- return cc.isa(CCONCRETE);
- }
-
- void eval(ClassCase cc) {
- cc.set_IsConcrete(true);
- }
- },
-
- });
-
- public static RuleGroup RESOLUTION = new RuleGroup("Resolution", new Rule[] {
- new Rule("R-Resolve") {
- boolean guard(ClassCase cc) {
- if (!(cc.isClass() && cc.get_mprov().size() == 1)) {
- return false;
- }
- ClassCase _V = cc.get_mprov().iterator().next();
- return _V.get_IsConcrete() || _V.get_HasDefault();
- }
-
- void eval(ClassCase cc) {
- ClassCase _V = cc.get_mprov().iterator().next();
- cc.set_mres(_V);
- }
- },
-
- });
-
- public static RuleGroup DEFENDER = new RuleGroup("Defender", new Rule[] {
- new Rule("D-Defend") {
- boolean guard(ClassCase cc) {
- ClassCase mresSuper = cc.hasSuperclass() ? cc.getSuperclass().get_mres() : null;
- boolean eq = cc.get_mres() == null ? mresSuper == null : cc.get_mres().equals(mresSuper);
- return cc.isa(CNONE) && !eq;
- }
-
- void eval(ClassCase cc) {
- cc.set_mdefend(cc.get_mres());
- }
- },
-
- });
-
- public static RuleGroup CHECKING = new RuleGroup("Checking", new Rule[] {
- new Rule("C-Check") {
- boolean guard(ClassCase cc) {
- for (ClassCase t : cc.getSupertypes()) {
- if (! t.get_OK()) {
- return false;
- }
- }
- int defenderCount = 0;
- int provCount = 0;
- for (ClassCase prov : cc.get_mprov()) {
- if (prov.get_HasDefault()) {
- defenderCount++;
- }
- provCount++;
- }
- return provCount <= 1 || defenderCount == 0;
- }
-
- void eval(ClassCase cc) {
- cc.set_OK(true);
- }
- },
-
- });
-
-}
--- a/jdk/test/jdk/lambda/shapegen/TTNode.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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 shapegen;
-
-import shapegen.ClassCase.Kind;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import static shapegen.ClassCase.Kind.*;
-
-/**
- * Type Template Node
- *
- * @author Robert Field
- */
-public class TTNode {
-
- final List<TTNode> supertypes;
- final boolean canBeClass;
-
- private int currentKindIndex;
- private Kind[] kinds;
-
- public TTNode(List<TTNode> subtypes, boolean canBeClass) {
- this.supertypes = subtypes;
- this.canBeClass = canBeClass;
- }
-
- public void start(boolean includeClasses) {
- kinds =
- supertypes.isEmpty()?
- (new Kind[]{IDEFAULT, IPRESENT})
- : ((includeClasses && canBeClass)?
- new Kind[]{CNONE, IVAC, IDEFAULT, IPRESENT}
- : new Kind[]{IVAC, IDEFAULT, IPRESENT});
- currentKindIndex = 0;
-
- for (TTNode sub : supertypes) {
- sub.start(includeClasses);
- }
- }
-
- public boolean next() {
- ++currentKindIndex;
- if (currentKindIndex >= kinds.length) {
- currentKindIndex = 0;
- return false;
- } else {
- return true;
- }
- }
-
- public void collectAllSubtypes(Set<TTNode> subs) {
- subs.add(this);
- for (TTNode n : supertypes) {
- n.collectAllSubtypes(subs);
- }
- }
-
- private Kind getKind() {
- return kinds[currentKindIndex];
- }
-
- boolean isInterface() {
- return getKind().isInterface;
- }
-
- boolean isClass() {
- return !isInterface();
- }
-
- boolean hasDefault() {
- return getKind() == IDEFAULT;
- }
-
- public boolean isValid() {
- for (TTNode n : supertypes) {
- if (!n.isValid() || (isInterface() && n.isClass())) {
- return false;
- }
- }
- return true;
- }
-
- public ClassCase genCase() {
- ClassCase subclass;
- List<TTNode> ttintfs;
- if (isClass() && !supertypes.isEmpty() && supertypes.get(0).isClass()) {
- subclass = supertypes.get(0).genCase();
- ttintfs = supertypes.subList(1, supertypes.size());
- } else {
- subclass = null;
- ttintfs = supertypes;
- }
- List<ClassCase> intfs = new ArrayList<>();
- for (TTNode node : ttintfs) {
- intfs.add(node.genCase());
- }
- return new ClassCase(getKind(), subclass, intfs);
- }
-}
--- a/jdk/test/jdk/lambda/shapegen/TTParser.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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 shapegen;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.StringReader;
-
-import static java.lang.Character.isLetter;
-import static java.lang.Character.isUpperCase;
-import static java.lang.Character.isWhitespace;
-
-/**
- * Parse a type template definition string
- *
- * input :: classDef
- * classDef :: letter [ ( classDef* ) ]
- *
- * @author Robert Field
- */
-public class TTParser extends StringReader {
-
- private Map<Character, TTNode> letterMap = new HashMap<>();
- private char ch;
-
- private final String def;
-
- public TTParser(String s) {
- super(s);
- this.def = s;
- }
-
- private void advance() throws IOException {
- do {
- ch = (char)read();
- } while (isWhitespace(ch));
- }
-
- public TTNode parse() {
- try {
- advance();
- return classDef();
- } catch (IOException t) {
- throw new RuntimeException(t);
- }
- }
-
- private TTNode classDef() throws IOException {
- if (!isLetter(ch)) {
- if (ch == (char)-1) {
- throw new IOException("Unexpected end of type template in " + def);
- } else {
- throw new IOException("Unexpected character in type template: " + (Character)ch + " in " + def);
- }
- }
- char nodeCh = ch;
- TTNode node = letterMap.get(nodeCh);
- boolean canBeClass = isUpperCase(nodeCh);
- advance();
- if (node == null) {
- List<TTNode> subtypes = new ArrayList<>();
- if (ch == '(') {
- advance();
- while (ch != ')') {
- subtypes.add(classDef());
- }
- advance();
- }
- node = new TTNode(subtypes, canBeClass);
- letterMap.put(nodeCh, node);
- }
- return node;
- }
-}
--- a/jdk/test/jdk/lambda/shapegen/TTShape.java Wed Jul 05 20:26:30 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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 shapegen;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- *
- * @author Robert Field
- */
-public class TTShape {
-
- private final TTNode root;
- private final TTNode[] nodes;
-
- TTShape(TTNode root) {
- this.root = root;
- Set<TTNode> subs = new HashSet<>();
- root.collectAllSubtypes(subs);
- nodes = subs.toArray(new TTNode[subs.size()]);
- }
-
- private List<ClassCase> toCases(boolean includeClasses) {
- List<ClassCase> ccs = new ArrayList<>();
- root.start(includeClasses);
- int i;
- outer:
- while (true) {
- if (root.isValid()) {
- ClassCase cc = root.genCase();
- //System.out.println(cc);
- ccs.add(cc);
- }
-
- i = 0;
- do {
- if (i >= nodes.length) {
- break outer;
- }
- } while(!nodes[i++].next());
- }
- return ccs;
- }
-
- public static List<ClassCase> allCases(boolean includeClasses) {
- List<ClassCase> ccs = new ArrayList<>();
- for (TTShape shape : SHAPES) {
- ccs.addAll(shape.toCases(includeClasses));
- }
- return ccs;
- }
-
- public static TTShape parse(String s) {
- return new TTShape(new TTParser(s).parse());
- }
-
- public static final TTShape[] SHAPES = new TTShape[] {
- parse("a"),
- parse("a(b)"),
- parse("A(bb)"),
- parse("A(B(d)c(d))"),
- parse("A(b(c))"),
- parse("A(B(cd)d)"),
- parse("A(B(c)c)"),
- parse("A(B(Ce)d(e))"),
- parse("A(B(C)d(e))"),
- parse("A(Bc(d))"),
- parse("A(B(d)dc)"),
- parse("A(B(dc)dc)"),
- parse("A(B(c(d))d)"),
- parse("A(B(C(d))d)"),
- parse("A(B(C(e)d(e))e)"),
- parse("A(B(c(d))c)"),
- parse("A(B(dc(d))c)"),
- parse("A(B(C(d))d)"),
- };
-
-}
--- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION Fri Apr 03 16:37:06 2015 -0700
@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
-tzdata2015a
+tzdata2015b
--- a/jdk/test/sun/util/calendar/zi/tzdata/asia Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/sun/util/calendar/zi/tzdata/asia Fri Apr 03 16:37:06 2015 -0700
@@ -1927,6 +1927,13 @@
# was at the start of 2008-03-31 (the day of Steffen Thorsen's report);
# this is almost surely wrong.
+# From Ganbold Tsagaankhuu (2015-03-10):
+# It seems like yesterday Mongolian Government meeting has concluded to use
+# daylight saving time in Mongolia.... Starting at 2:00AM of last Saturday of
+# March 2015, daylight saving time starts. And 00:00AM of last Saturday of
+# September daylight saving time ends. Source:
+# http://zasag.mn/news/view/8969
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mongol 1983 1984 - Apr 1 0:00 1:00 S
Rule Mongol 1983 only - Oct 1 0:00 0 -
@@ -1947,6 +1954,8 @@
Rule Mongol 2001 only - Apr lastSat 2:00 1:00 S
Rule Mongol 2001 2006 - Sep lastSat 2:00 0 -
Rule Mongol 2002 2006 - Mar lastSat 2:00 1:00 S
+Rule Mongol 2015 max - Mar lastSat 2:00 1:00 S
+Rule Mongol 2015 max - Sep lastSat 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
# Hovd, a.k.a. Chovd, Dund-Us, Dzhargalant, Khovd, Jirgalanta
@@ -2365,13 +2374,19 @@
# official source...:
# http://www.palestinecabinet.gov.ps/ar/Views/ViewDetails.aspx?pid=1252
-# From Paul Eggert (2013-09-24):
-# For future dates, guess the last Thursday in March at 24:00 through
-# the first Friday on or after September 21 at 00:00. This is consistent with
-# the predictions in today's editions of the following URLs,
-# which are for Gaza and Hebron respectively:
-# http://www.timeanddate.com/worldclock/timezone.html?n=702
-# http://www.timeanddate.com/worldclock/timezone.html?n=2364
+# From Steffen Thorsen (2015-03-03):
+# Sources such as http://www.alquds.com/news/article/view/id/548257
+# and http://www.raya.ps/ar/news/890705.html say Palestine areas will
+# start DST on 2015-03-28 00:00 which is one day later than expected.
+#
+# From Paul Eggert (2015-03-03):
+# http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
+# says that the fall 2014 transition was Oct 23 at 24:00.
+# For future dates, guess the last Friday in March at 24:00 through
+# the first Friday on or after October 21 at 00:00. This is consistent with
+# the predictions in today's editions of the following URLs:
+# http://www.timeanddate.com/time/change/gaza-strip/gaza
+# http://www.timeanddate.com/time/change/west-bank/hebron
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
@@ -2397,9 +2412,11 @@
Rule Palestine 2011 only - Aug 1 0:00 0 -
Rule Palestine 2011 only - Aug 30 0:00 1:00 S
Rule Palestine 2011 only - Sep 30 0:00 0 -
-Rule Palestine 2012 max - Mar lastThu 24:00 1:00 S
+Rule Palestine 2012 2014 - Mar lastThu 24:00 1:00 S
Rule Palestine 2012 only - Sep 21 1:00 0 -
-Rule Palestine 2013 max - Sep Fri>=21 0:00 0 -
+Rule Palestine 2013 only - Sep Fri>=21 0:00 0 -
+Rule Palestine 2014 max - Oct Fri>=21 0:00 0 -
+Rule Palestine 2015 max - Mar lastFri 24:00 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
--- a/jdk/test/sun/util/calendar/zi/tzdata/australasia Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/sun/util/calendar/zi/tzdata/australasia Fri Apr 03 16:37:06 2015 -0700
@@ -396,6 +396,7 @@
9:39:00 - LMT 1901 # Agana
10:00 - GST 2000 Dec 23 # Guam
10:00 - ChST # Chamorro Standard Time
+Link Pacific/Guam Pacific/Saipan # N Mariana Is
# Kiribati
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -411,12 +412,7 @@
14:00 - LINT
# N Mariana Is
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Pacific/Saipan -14:17:00 - LMT 1844 Dec 31
- 9:43:00 - LMT 1901
- 9:00 - MPT 1969 Oct # N Mariana Is Time
- 10:00 - MPT 2000 Dec 23
- 10:00 - ChST # Chamorro Standard Time
+# See Pacific/Guam.
# Marshall Is
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -586,6 +582,7 @@
-11:00 - NST 1967 Apr # N=Nome
-11:00 - BST 1983 Nov 30 # B=Bering
-11:00 - SST # S=Samoa
+Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands
# Samoa (formerly and also known as Western Samoa)
@@ -767,23 +764,7 @@
# uninhabited
# Midway
-#
-# From Mark Brader (2005-01-23):
-# [Fallacies and Fantasies of Air Transport History, by R.E.G. Davies,
-# published 1994 by Paladwr Press, McLean, VA, USA; ISBN 0-9626483-5-3]
-# reproduced a Pan American Airways timetable from 1936, for their weekly
-# "Orient Express" flights between San Francisco and Manila, and connecting
-# flights to Chicago and the US East Coast. As it uses some time zone
-# designations that I've never seen before:....
-# Fri. 6:30A Lv. HONOLOLU (Pearl Harbor), H.I. H.L.T. Ar. 5:30P Sun.
-# " 3:00P Ar. MIDWAY ISLAND . . . . . . . . . M.L.T. Lv. 6:00A "
-#
-Zone Pacific/Midway -11:49:28 - LMT 1901
- -11:00 - NST 1956 Jun 3
- -11:00 1:00 NDT 1956 Sep 2
- -11:00 - NST 1967 Apr # N=Nome
- -11:00 - BST 1983 Nov 30 # B=Bering
- -11:00 - SST # S=Samoa
+# See Pacific/Pago_Pago.
# Palmyra
# uninhabited since World War II; was probably like Pacific/Kiritimati
--- a/jdk/test/sun/util/calendar/zi/tzdata/europe Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/sun/util/calendar/zi/tzdata/europe Fri Apr 03 16:37:06 2015 -0700
@@ -2423,7 +2423,7 @@
4:00 Russia VOL%sT 1989 Mar 26 2:00s # Volgograd T
3:00 Russia VOL%sT 1991 Mar 31 2:00s
4:00 - VOLT 1992 Mar 29 2:00s
- 3:00 Russia MSK 2011 Mar 27 2:00s
+ 3:00 Russia MSK/MSD 2011 Mar 27 2:00s
4:00 - MSK 2014 Oct 26 2:00s
3:00 - MSK
--- a/jdk/test/sun/util/calendar/zi/tzdata/northamerica Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/sun/util/calendar/zi/tzdata/northamerica Fri Apr 03 16:37:06 2015 -0700
@@ -2335,8 +2335,24 @@
# "...the new time zone will come into effect at two o'clock on the first Sunday
# of February, when we will have to advance the clock one hour from its current
# time..."
+# Also, the new zone will not use DST.
#
-# Also, the new zone will not use DST.
+# From Carlos Raúl Perasso (2015-02-02):
+# The decree that modifies the Mexican Hour System Law has finally
+# been published at the Diario Oficial de la Federación
+# http://www.dof.gob.mx/nota_detalle.php?codigo=5380123&fecha=31/01/2015
+# It establishes 5 zones for Mexico:
+# 1- Zona Centro (Central Zone): Corresponds to longitude 90 W,
+# includes most of Mexico, excluding what's mentioned below.
+# 2- Zona Pacífico (Pacific Zone): Longitude 105 W, includes the
+# states of Baja California Sur; Chihuahua; Nayarit (excluding Bahía
+# de Banderas which lies in Central Zone); Sinaloa and Sonora.
+# 3- Zona Noroeste (Northwest Zone): Longitude 120 W, includes the
+# state of Baja California.
+# 4- Zona Sureste (Southeast Zone): Longitude 75 W, includes the state
+# of Quintana Roo.
+# 5- The islands, reefs and keys shall take their timezone from the
+# longitude they are located at.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mexico 1939 only - Feb 5 0:00 1:00 D
@@ -2531,14 +2547,9 @@
###############################################################################
# Anguilla
+# Antigua and Barbuda
# See America/Port_of_Spain.
-# Antigua and Barbuda
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Antigua -4:07:12 - LMT 1912 Mar 2
- -5:00 - EST 1951
- -4:00 - AST
-
# Bahamas
#
# For 1899 Milne gives -5:09:29.5; round that.
@@ -2604,10 +2615,7 @@
-4:00 US A%sT
# Cayman Is
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Cayman -5:25:32 - LMT 1890 # Georgetown
- -5:07:11 - KMT 1912 Feb # Kingston Mean Time
- -5:00 - EST
+# See America/Panama.
# Costa Rica
@@ -3130,6 +3138,7 @@
Zone America/Panama -5:18:08 - LMT 1890
-5:19:36 - CMT 1908 Apr 22 # Colón Mean Time
-5:00 - EST
+Link America/Panama America/Cayman
# Puerto Rico
# There are too many San Juans elsewhere, so we'll use 'Puerto_Rico'.
--- a/jdk/test/sun/util/calendar/zi/tzdata/southamerica Wed Jul 05 20:26:30 2017 +0200
+++ b/jdk/test/sun/util/calendar/zi/tzdata/southamerica Fri Apr 03 16:37:06 2015 -0700
@@ -1229,10 +1229,13 @@
# DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
# http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
-# From Juan Correa (2015-01-28):
-# ... today the Ministry of Energy announced that Chile will drop DST, will keep
-# "summer time" (UTC -3 / UTC -5) all year round....
-# http://www.minenergia.cl/ministerio/noticias/generales/ministerio-de-energia-anuncia.html
+# From Eduardo Romero Urra (2015-03-03):
+# Today has been published officially that Chile will use the DST time
+# permanently until March 25 of 2017
+# http://www.diariooficial.interior.gob.cl/media/2015/03/03/1-large.jpg
+#
+# From Paul Eggert (2015-03-03):
+# For now, assume that the extension will persist indefinitely.
# NOTE: ChileAQ rules for Antarctic bases are stored separately in the
# 'antarctica' file.
@@ -1291,7 +1294,7 @@
-3:00 - CLT
Zone Pacific/Easter -7:17:44 - LMT 1890
-7:17:28 - EMT 1932 Sep # Easter Mean Time
- -7:00 Chile EAS%sT 1982 Mar 13 3:00u # Easter Time
+ -7:00 Chile EAS%sT 1982 Mar 14 3:00u # Easter Time
-6:00 Chile EAS%sT 2015 Apr 26 3:00u
-5:00 - EAST
#
@@ -1626,6 +1629,7 @@
# These all agree with Trinidad and Tobago since 1970.
Link America/Port_of_Spain America/Anguilla
+Link America/Port_of_Spain America/Antigua
Link America/Port_of_Spain America/Dominica
Link America/Port_of_Spain America/Grenada
Link America/Port_of_Spain America/Guadeloupe