提交 a4d84ed8 编写于 作者: L lana

Merge

...@@ -239,7 +239,7 @@ classes : $(CLASSES_INIT) .delete.classlist .compile.classlist ...@@ -239,7 +239,7 @@ classes : $(CLASSES_INIT) .delete.classlist .compile.classlist
$(CAT) $<.filtered; \ $(CAT) $<.filtered; \
$(ECHO) "# Running javac: $$numfiles files; in $(CURDIR)"; \ $(ECHO) "# Running javac: $$numfiles files; in $(CURDIR)"; \
$(ECHO) $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \ $(ECHO) $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
$(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \ $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered && \
$(ECHO) "# javac finished"; \ $(ECHO) "# javac finished"; \
fi fi
@$(java-vm-cleanup) @$(java-vm-cleanup)
......
...@@ -25,15 +25,15 @@ ...@@ -25,15 +25,15 @@
# Properties for jprt # Properties for jprt
# Release to build for # Locked down to jdk8
jprt.tools.default.release=jdk8 jprt.tools.default.release=jdk8
# The different build flavors we want, we override here so we just get these 2 # The different build flavors we want, we override here so we just get these 2
jprt.build.flavors=product,fastdebug jprt.build.flavors=product,fastdebug
# Standard list of jprt build targets for this source tree # Standard list of jprt build targets for this source tree
jprt.build.targets= \ jprt.build.targets= \
solaris_sparc_5.10-{product|fastdebug}, \ solaris_sparc_5.10-{product|fastdebug}, \
solaris_sparcv9_5.10-{product|fastdebug}, \ solaris_sparcv9_5.10-{product|fastdebug}, \
solaris_i586_5.10-{product|fastdebug}, \ solaris_i586_5.10-{product|fastdebug}, \
solaris_x64_5.10-{product|fastdebug}, \ solaris_x64_5.10-{product|fastdebug}, \
...@@ -45,247 +45,59 @@ jprt.build.targets= \ ...@@ -45,247 +45,59 @@ jprt.build.targets= \
# User can select the test set with jprt submit "-testset name" option # User can select the test set with jprt submit "-testset name" option
jprt.my.test.set=${jprt.test.set} jprt.my.test.set=${jprt.test.set}
# Standard vm test target # Test target list (no fastdebug & limited c2 testing)
jprt.vm.default.test.targets= \ jprt.my.test.target.set= \
solaris_sparc_5.10-product-c1-jvm98, \ solaris_sparc_5.10-product-c1-TESTNAME, \
solaris_sparcv9_5.10-product-c2-jvm98, \ solaris_sparcv9_5.10-product-c2-TESTNAME, \
solaris_i586_5.10-product-c1-jvm98, \ solaris_i586_5.10-product-c1-TESTNAME, \
solaris_x64_5.10-product-c2-jvm98, \ solaris_x64_5.10-product-c2-TESTNAME, \
linux_i586_2.6-product-{c1|c2}-jvm98, \ linux_i586_2.6-product-{c1|c2}-TESTNAME, \
linux_x64_2.6-product-c2-jvm98, \ linux_x64_2.6-product-c2-TESTNAME, \
windows_i586_5.1-product-c1-jvm98, \ windows_i586_5.1-product-c1-TESTNAME, \
windows_x64_5.2-product-c2-jvm98 windows_x64_5.2-product-c2-TESTNAME
# Select vm testlist to use (allow for testset to be empty too) # Default vm test targets (testset=default)
jprt.vm.all.test.targets=${jprt.vm.default.test.targets} jprt.vm.default.test.targets= \
jprt.vm..test.targets=${jprt.vm.default.test.targets} ${jprt.my.test.target.set:TESTNAME=jvm98}
jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets}
# Default jdk test targets in test/Makefile (no fastdebug & limited c2) # Default jdk test targets (testset=default)
jprt.make.rule.default.test.targets= \ jprt.make.rule.default.test.targets= \
\ ${jprt.my.test.target.set:TESTNAME=jdk_beans1}, \
solaris_sparc_5.10-product-c1-jdk_beans1, \ ${jprt.my.test.target.set:TESTNAME=jdk_io}, \
solaris_sparcv9_5.10-product-c2-jdk_beans1, \ ${jprt.my.test.target.set:TESTNAME=jdk_lang}, \
solaris_i586_5.10-product-c1-jdk_beans1, \ ${jprt.my.test.target.set:TESTNAME=jdk_math}, \
solaris_x64_5.10-product-c2-jdk_beans1, \ ${jprt.my.test.target.set:TESTNAME=jdk_misc}, \
linux_i586_2.6-product-{c1|c2}-jdk_beans1, \ ${jprt.my.test.target.set:TESTNAME=jdk_net}, \
linux_x64_2.6-product-c2-jdk_beans1, \ ${jprt.my.test.target.set:TESTNAME=jdk_nio1}, \
windows_i586_5.1-product-c1-jdk_beans1, \ ${jprt.my.test.target.set:TESTNAME=jdk_nio2}, \
windows_x64_5.2-product-c2-jdk_beans1, \ ${jprt.my.test.target.set:TESTNAME=jdk_nio3}, \
\ ${jprt.my.test.target.set:TESTNAME=jdk_security1}, \
solaris_sparc_5.10-product-c1-jdk_io, \ ${jprt.my.test.target.set:TESTNAME=jdk_text}, \
solaris_sparcv9_5.10-product-c2-jdk_io, \ ${jprt.my.test.target.set:TESTNAME=jdk_util}
solaris_i586_5.10-product-c1-jdk_io, \
solaris_x64_5.10-product-c2-jdk_io, \ # All vm test targets (testset=all)
linux_i586_2.6-product-{c1|c2}-jdk_io, \ jprt.vm.all.test.targets= \
linux_x64_2.6-product-c2-jdk_io, \ ${jprt.vm.default.test.targets}, \
windows_i586_5.1-product-c1-jdk_io, \ ${jprt.my.test.target.set:TESTNAME=runThese}, \
windows_x64_5.2-product-c2-jdk_io, \ ${jprt.my.test.target.set:TESTNAME=jbb_default}
\
solaris_sparc_5.10-product-c1-jdk_lang, \
solaris_sparcv9_5.10-product-c2-jdk_lang, \
solaris_i586_5.10-product-c1-jdk_lang, \
solaris_x64_5.10-product-c2-jdk_lang, \
linux_i586_2.6-product-{c1|c2}-jdk_lang, \
linux_x64_2.6-product-c2-jdk_lang, \
windows_i586_5.1-product-c1-jdk_lang, \
windows_x64_5.2-product-c2-jdk_lang, \
\
solaris_sparc_5.10-product-c1-jdk_math, \
solaris_sparcv9_5.10-product-c2-jdk_math, \
solaris_i586_5.10-product-c1-jdk_math, \
solaris_x64_5.10-product-c2-jdk_math, \
linux_i586_2.6-product-{c1|c2}-jdk_math, \
linux_x64_2.6-product-c2-jdk_math, \
windows_i586_5.1-product-c1-jdk_math, \
windows_x64_5.2-product-c2-jdk_math, \
\
solaris_sparc_5.10-product-c1-jdk_misc, \
solaris_sparcv9_5.10-product-c2-jdk_misc, \
solaris_i586_5.10-product-c1-jdk_misc, \
solaris_x64_5.10-product-c2-jdk_misc, \
linux_i586_2.6-product-{c1|c2}-jdk_misc, \
linux_x64_2.6-product-c2-jdk_misc, \
windows_i586_5.1-product-c1-jdk_misc, \
windows_x64_5.2-product-c2-jdk_misc, \
\
solaris_sparc_5.10-product-c1-jdk_net, \
solaris_sparcv9_5.10-product-c2-jdk_net, \
solaris_i586_5.10-product-c1-jdk_net, \
solaris_x64_5.10-product-c2-jdk_net, \
linux_i586_2.6-product-{c1|c2}-jdk_net, \
linux_x64_2.6-product-c2-jdk_net, \
windows_i586_5.1-product-c1-jdk_net, \
windows_x64_5.2-product-c2-jdk_net, \
\
solaris_sparc_5.10-product-c1-jdk_nio1, \
solaris_sparcv9_5.10-product-c2-jdk_nio1, \
solaris_i586_5.10-product-c1-jdk_nio1, \
solaris_x64_5.10-product-c2-jdk_nio1, \
linux_i586_2.6-product-{c1|c2}-jdk_nio1, \
linux_x64_2.6-product-c2-jdk_nio1, \
windows_i586_5.1-product-c1-jdk_nio1, \
windows_x64_5.2-product-c2-jdk_nio1, \
\
solaris_sparc_5.10-product-c1-jdk_nio2, \
solaris_sparcv9_5.10-product-c2-jdk_nio2, \
solaris_i586_5.10-product-c1-jdk_nio2, \
solaris_x64_5.10-product-c2-jdk_nio2, \
linux_i586_2.6-product-{c1|c2}-jdk_nio2, \
linux_x64_2.6-product-c2-jdk_nio2, \
windows_i586_5.1-product-c1-jdk_nio2, \
windows_x64_5.2-product-c2-jdk_nio2, \
\
solaris_sparc_5.10-product-c1-jdk_nio3, \
solaris_sparcv9_5.10-product-c2-jdk_nio3, \
solaris_i586_5.10-product-c1-jdk_nio3, \
solaris_x64_5.10-product-c2-jdk_nio3, \
linux_i586_2.6-product-{c1|c2}-jdk_nio3, \
linux_x64_2.6-product-c2-jdk_nio3, \
windows_i586_5.1-product-c1-jdk_nio3, \
windows_x64_5.2-product-c2-jdk_nio3, \
\
solaris_sparc_5.10-product-c1-jdk_security1, \
solaris_sparcv9_5.10-product-c2-jdk_security1, \
solaris_i586_5.10-product-c1-jdk_security1, \
solaris_x64_5.10-product-c2-jdk_security1, \
linux_i586_2.6-product-{c1|c2}-jdk_security1, \
linux_x64_2.6-product-c2-jdk_security1, \
windows_i586_5.1-product-c1-jdk_security1, \
windows_x64_5.2-product-c2-jdk_security1, \
\
solaris_sparc_5.10-product-c1-jdk_text, \
solaris_sparcv9_5.10-product-c2-jdk_text, \
solaris_i586_5.10-product-c1-jdk_text, \
solaris_x64_5.10-product-c2-jdk_text, \
linux_i586_2.6-product-{c1|c2}-jdk_text, \
linux_x64_2.6-product-c2-jdk_text, \
windows_i586_5.1-product-c1-jdk_text, \
windows_x64_5.2-product-c2-jdk_text, \
\
solaris_sparc_5.10-product-c1-jdk_tools1, \
solaris_sparcv9_5.10-product-c2-jdk_tools1, \
solaris_i586_5.10-product-c1-jdk_tools1, \
solaris_x64_5.10-product-c2-jdk_tools1, \
linux_i586_2.6-product-{c1|c2}-jdk_tools1, \
linux_x64_2.6-product-c2-jdk_tools1, \
windows_i586_5.1-product-c1-jdk_tools1, \
windows_x64_5.2-product-c2-jdk_tools1, \
\
solaris_sparc_5.10-product-c1-jdk_util, \
solaris_sparcv9_5.10-product-c2-jdk_util, \
solaris_i586_5.10-product-c1-jdk_util, \
solaris_x64_5.10-product-c2-jdk_util, \
linux_i586_2.6-product-{c1|c2}-jdk_util, \
linux_x64_2.6-product-c2-jdk_util, \
windows_i586_5.1-product-c1-jdk_util, \
windows_x64_5.2-product-c2-jdk_util
# All jdk test targets in test/Makefile (still no fastdebug & limited c2) # All jdk test targets (testset=all)
jprt.make.rule.all.test.targets= \ jprt.make.rule.all.test.targets= \
\ ${jprt.make.rule.default.test.targets}, \
${jprt.make.rule.default.test.targets}, \ ${jprt.my.test.target.set:TESTNAME=jdk_awt}, \
\ ${jprt.my.test.target.set:TESTNAME=jdk_beans2}, \
solaris_sparc_5.10-product-c1-jdk_awt, \ ${jprt.my.test.target.set:TESTNAME=jdk_beans3}, \
solaris_sparcv9_5.10-product-c2-jdk_awt, \ ${jprt.my.test.target.set:TESTNAME=jdk_management1}, \
solaris_i586_5.10-product-c1-jdk_awt, \ ${jprt.my.test.target.set:TESTNAME=jdk_management2}, \
solaris_x64_5.10-product-c2-jdk_awt, \ ${jprt.my.test.target.set:TESTNAME=jdk_rmi}, \
linux_i586_2.6-product-{c1|c2}-jdk_awt, \ ${jprt.my.test.target.set:TESTNAME=jdk_security2}, \
linux_x64_2.6-product-c2-jdk_awt, \ ${jprt.my.test.target.set:TESTNAME=jdk_security3}, \
windows_i586_5.1-product-c1-jdk_awt, \ ${jprt.my.test.target.set:TESTNAME=jdk_sound}, \
windows_x64_5.2-product-c2-jdk_awt, \ ${jprt.my.test.target.set:TESTNAME=jdk_swing}, \
\ ${jprt.my.test.target.set:TESTNAME=jdk_tools1}, \
solaris_sparc_5.10-product-c1-jdk_beans2, \ ${jprt.my.test.target.set:TESTNAME=jdk_tools2}
solaris_sparcv9_5.10-product-c2-jdk_beans2, \
solaris_i586_5.10-product-c1-jdk_beans2, \
solaris_x64_5.10-product-c2-jdk_beans2, \
linux_i586_2.6-product-{c1|c2}-jdk_beans2, \
linux_x64_2.6-product-c2-jdk_beans2, \
windows_i586_5.1-product-c1-jdk_beans2, \
windows_x64_5.2-product-c2-jdk_beans2, \
\
solaris_sparc_5.10-product-c1-jdk_beans3, \
solaris_sparcv9_5.10-product-c2-jdk_beans3, \
solaris_i586_5.10-product-c1-jdk_beans3, \
solaris_x64_5.10-product-c2-jdk_beans3, \
linux_i586_2.6-product-{c1|c2}-jdk_beans3, \
linux_x64_2.6-product-c2-jdk_beans3, \
windows_i586_5.1-product-c1-jdk_beans3, \
windows_x64_5.2-product-c2-jdk_beans3, \
\
solaris_sparc_5.10-product-c1-jdk_management1, \
solaris_sparcv9_5.10-product-c2-jdk_management1, \
solaris_i586_5.10-product-c1-jdk_management1, \
solaris_x64_5.10-product-c2-jdk_management1, \
linux_i586_2.6-product-{c1|c2}-jdk_management1, \
linux_x64_2.6-product-c2-jdk_management1, \
windows_i586_5.1-product-c1-jdk_management1, \
windows_x64_5.2-product-c2-jdk_management1, \
\
solaris_sparc_5.10-product-c1-jdk_management2, \
solaris_sparcv9_5.10-product-c2-jdk_management2, \
solaris_i586_5.10-product-c1-jdk_management2, \
solaris_x64_5.10-product-c2-jdk_management2, \
linux_i586_2.6-product-{c1|c2}-jdk_management2, \
linux_x64_2.6-product-c2-jdk_management2, \
windows_i586_5.1-product-c1-jdk_management2, \
windows_x64_5.2-product-c2-jdk_management2, \
\
solaris_sparc_5.10-product-c1-jdk_rmi, \
solaris_sparcv9_5.10-product-c2-jdk_rmi, \
solaris_i586_5.10-product-c1-jdk_rmi, \
solaris_x64_5.10-product-c2-jdk_rmi, \
linux_i586_2.6-product-{c1|c2}-jdk_rmi, \
linux_x64_2.6-product-c2-jdk_rmi, \
windows_i586_5.1-product-c1-jdk_rmi, \
windows_x64_5.2-product-c2-jdk_rmi, \
\
solaris_sparc_5.10-product-c1-jdk_security2, \
solaris_sparcv9_5.10-product-c2-jdk_security2, \
solaris_i586_5.10-product-c1-jdk_security2, \
solaris_x64_5.10-product-c2-jdk_security2, \
linux_i586_2.6-product-{c1|c2}-jdk_security2, \
linux_x64_2.6-product-c2-jdk_security2, \
windows_i586_5.1-product-c1-jdk_security2, \
windows_x64_5.2-product-c2-jdk_security2, \
\
solaris_sparc_5.10-product-c1-jdk_security3, \
solaris_sparcv9_5.10-product-c2-jdk_security3, \
solaris_i586_5.10-product-c1-jdk_security3, \
solaris_x64_5.10-product-c2-jdk_security3, \
linux_i586_2.6-product-{c1|c2}-jdk_security3, \
linux_x64_2.6-product-c2-jdk_security3, \
windows_i586_5.1-product-c1-jdk_security3, \
windows_x64_5.2-product-c2-jdk_security3, \
\
solaris_sparc_5.10-product-c1-jdk_sound, \
solaris_sparcv9_5.10-product-c2-jdk_sound, \
solaris_i586_5.10-product-c1-jdk_sound, \
solaris_x64_5.10-product-c2-jdk_sound, \
linux_i586_2.6-product-{c1|c2}-jdk_sound, \
linux_x64_2.6-product-c2-jdk_sound, \
windows_i586_5.1-product-c1-jdk_sound, \
windows_x64_5.2-product-c2-jdk_sound, \
\
solaris_sparc_5.10-product-c1-jdk_swing, \
solaris_sparcv9_5.10-product-c2-jdk_swing, \
solaris_i586_5.10-product-c1-jdk_swing, \
solaris_x64_5.10-product-c2-jdk_swing, \
linux_i586_2.6-product-{c1|c2}-jdk_swing, \
linux_x64_2.6-product-c2-jdk_swing, \
windows_i586_5.1-product-c1-jdk_swing, \
windows_x64_5.2-product-c2-jdk_swing, \
\
solaris_sparc_5.10-product-c1-jdk_tools2, \
solaris_sparcv9_5.10-product-c2-jdk_tools2, \
solaris_i586_5.10-product-c1-jdk_tools2, \
solaris_x64_5.10-product-c2-jdk_tools2, \
linux_i586_2.6-product-{c1|c2}-jdk_tools2, \
linux_x64_2.6-product-c2-jdk_tools2, \
windows_i586_5.1-product-c1-jdk_tools2, \
windows_x64_5.2-product-c2-jdk_tools2
# JCK test targets in test/Makefile (no fastdebug & limited c2, windows broken) # JCK test targets in test/Makefile (no windows)
jprt.my.jck.test.target.set= \ jprt.my.jck.test.target.set= \
solaris_sparc_5.10-product-c1-JCK7TESTRULE, \ solaris_sparc_5.10-product-c1-JCK7TESTRULE, \
solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \ solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \
...@@ -301,8 +113,10 @@ jprt.make.rule.jck.test.targets= \ ...@@ -301,8 +113,10 @@ jprt.make.rule.jck.test.targets= \
${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7compiler} ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7compiler}
# Select list to use (allow for testset to be empty too) # Select list to use (allow for testset to be empty too)
jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets} jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets}
jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets} jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets}
jprt.vm..test.targets=${jprt.vm.default.test.targets}
jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets}
# Directories to be excluded from the source bundles # Directories to be excluded from the source bundles
jprt.bundle.exclude.src.dirs=build dist webrev jprt.bundle.exclude.src.dirs=build dist webrev
......
...@@ -35,7 +35,7 @@ class ArrayRegionTypeNode extends AbstractSimpleTypeNode { ...@@ -35,7 +35,7 @@ class ArrayRegionTypeNode extends AbstractSimpleTypeNode {
} }
String javaType() { String javaType() {
return "List"; return "List<?>";
} }
public void genJavaWrite(PrintWriter writer, int depth, public void genJavaWrite(PrintWriter writer, int depth,
......
...@@ -89,7 +89,7 @@ class OutNode extends AbstractTypeListNode { ...@@ -89,7 +89,7 @@ class OutNode extends AbstractTypeListNode {
if (Main.genDebug) { if (Main.genDebug) {
indent(writer, depth+1); indent(writer, depth+1);
writer.println( writer.println(
"if ((vm.traceFlags & vm.TRACE_SENDS) != 0) {"); "if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) {");
indent(writer, depth+2); indent(writer, depth+2);
writer.print( writer.print(
"vm.printTrace(\"Sending Command(id=\" + ps.pkt.id + \") "); "vm.printTrace(\"Sending Command(id=\" + ps.pkt.id + \") ");
......
...@@ -29,5 +29,5 @@ package com.sun.java.swing; ...@@ -29,5 +29,5 @@ package com.sun.java.swing;
* *
* @deprecated Use {@link javax.swing.Painter} instead. * @deprecated Use {@link javax.swing.Painter} instead.
*/ */
public interface Painter<T> extends javax.swing.Painter { public interface Painter<T> extends javax.swing.Painter<T> {
} }
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
*/ */
public class AbsentInformationException extends Exception public class AbsentInformationException extends Exception
{ {
private static final long serialVersionUID = 4988939309582416373L;
public AbsentInformationException() public AbsentInformationException()
{ {
super(); super();
......
...@@ -69,6 +69,7 @@ package com.sun.jdi; ...@@ -69,6 +69,7 @@ package com.sun.jdi;
*/ */
public class ClassNotLoadedException extends Exception public class ClassNotLoadedException extends Exception
{ {
private static final long serialVersionUID = -6242978768444298722L;
private String className; private String className;
public ClassNotLoadedException(String className) { public ClassNotLoadedException(String className) {
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class ClassNotPreparedException extends RuntimeException { public class ClassNotPreparedException extends RuntimeException {
private static final long serialVersionUID = -6120698967144079642L;
public ClassNotPreparedException() public ClassNotPreparedException()
{ {
super(); super();
......
...@@ -34,6 +34,7 @@ package com.sun.jdi; ...@@ -34,6 +34,7 @@ package com.sun.jdi;
*/ */
public class IncompatibleThreadStateException extends Exception public class IncompatibleThreadStateException extends Exception
{ {
private static final long serialVersionUID = 6199174323414551389L;
public IncompatibleThreadStateException() public IncompatibleThreadStateException()
{ {
super(); super();
......
...@@ -35,6 +35,7 @@ package com.sun.jdi; ...@@ -35,6 +35,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class InconsistentDebugInfoException extends RuntimeException { public class InconsistentDebugInfoException extends RuntimeException {
private static final long serialVersionUID = 7964236415376861808L;
public InconsistentDebugInfoException() { public InconsistentDebugInfoException() {
super(); super();
} }
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class InternalException extends RuntimeException { public class InternalException extends RuntimeException {
private static final long serialVersionUID = -9171606393104480607L;
private int errorCode; private int errorCode;
public InternalException() { public InternalException() {
......
...@@ -36,6 +36,7 @@ package com.sun.jdi; ...@@ -36,6 +36,7 @@ package com.sun.jdi;
*/ */
@Deprecated @Deprecated
public class InvalidCodeIndexException extends RuntimeException { public class InvalidCodeIndexException extends RuntimeException {
private static final long serialVersionUID = 7416010225133747805L;
public InvalidCodeIndexException() { public InvalidCodeIndexException() {
super(); super();
} }
......
...@@ -36,6 +36,7 @@ package com.sun.jdi; ...@@ -36,6 +36,7 @@ package com.sun.jdi;
*/ */
@Deprecated @Deprecated
public class InvalidLineNumberException extends RuntimeException { public class InvalidLineNumberException extends RuntimeException {
private static final long serialVersionUID = 4048709912372692875L;
public InvalidLineNumberException() { public InvalidLineNumberException() {
super(); super();
} }
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class InvalidStackFrameException extends RuntimeException { public class InvalidStackFrameException extends RuntimeException {
private static final long serialVersionUID = -1919378296505827922L;
public InvalidStackFrameException() { public InvalidStackFrameException() {
super(); super();
} }
......
...@@ -34,6 +34,7 @@ package com.sun.jdi; ...@@ -34,6 +34,7 @@ package com.sun.jdi;
*/ */
public class InvalidTypeException extends Exception public class InvalidTypeException extends Exception
{ {
private static final long serialVersionUID = 2256667231949650806L;
public InvalidTypeException() public InvalidTypeException()
{ {
super(); super();
......
...@@ -34,6 +34,7 @@ package com.sun.jdi; ...@@ -34,6 +34,7 @@ package com.sun.jdi;
*/ */
public class InvocationException extends Exception public class InvocationException extends Exception
{ {
private static final long serialVersionUID = 6066780907971918568L;
ObjectReference exception; ObjectReference exception;
public InvocationException(ObjectReference exception) public InvocationException(ObjectReference exception)
......
...@@ -79,7 +79,7 @@ package com.sun.jdi; ...@@ -79,7 +79,7 @@ package com.sun.jdi;
*/ */
public final class JDIPermission extends java.security.BasicPermission { public final class JDIPermission extends java.security.BasicPermission {
private static final long serialVersionUID = -6988461416938786271L;
/** /**
* The <code>JDIPermission</code> class represents access rights to the * The <code>JDIPermission</code> class represents access rights to the
* <code>VirtualMachineManager</code> * <code>VirtualMachineManager</code>
......
...@@ -34,6 +34,7 @@ package com.sun.jdi; ...@@ -34,6 +34,7 @@ package com.sun.jdi;
*/ */
public class NativeMethodException extends RuntimeException { public class NativeMethodException extends RuntimeException {
private static final long serialVersionUID = 3924951669039469992L;
public NativeMethodException() { public NativeMethodException() {
super(); super();
} }
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class ObjectCollectedException extends RuntimeException { public class ObjectCollectedException extends RuntimeException {
private static final long serialVersionUID = -1928428056197269588L;
public ObjectCollectedException() { public ObjectCollectedException() {
super(); super();
} }
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.5 * @since 1.5
*/ */
public class VMCannotBeModifiedException extends UnsupportedOperationException { public class VMCannotBeModifiedException extends UnsupportedOperationException {
private static final long serialVersionUID = -4063879815130164009L;
public VMCannotBeModifiedException() { public VMCannotBeModifiedException() {
super(); super();
} }
......
...@@ -35,6 +35,7 @@ package com.sun.jdi; ...@@ -35,6 +35,7 @@ package com.sun.jdi;
*/ */
public class VMDisconnectedException extends RuntimeException { public class VMDisconnectedException extends RuntimeException {
private static final long serialVersionUID = 2892975269768351637L;
public VMDisconnectedException() { public VMDisconnectedException() {
super(); super();
} }
......
...@@ -34,6 +34,7 @@ package com.sun.jdi; ...@@ -34,6 +34,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class VMMismatchException extends RuntimeException { public class VMMismatchException extends RuntimeException {
private static final long serialVersionUID = 289169358790459564L;
public VMMismatchException() { public VMMismatchException() {
super(); super();
} }
......
...@@ -33,6 +33,7 @@ package com.sun.jdi; ...@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3 * @since 1.3
*/ */
public class VMOutOfMemoryException extends RuntimeException { public class VMOutOfMemoryException extends RuntimeException {
private static final long serialVersionUID = 71504228548910686L;
public VMOutOfMemoryException() { public VMOutOfMemoryException() {
super(); super();
} }
......
...@@ -38,6 +38,7 @@ import java.util.Collections; ...@@ -38,6 +38,7 @@ import java.util.Collections;
*/ */
public class IllegalConnectorArgumentsException extends Exception public class IllegalConnectorArgumentsException extends Exception
{ {
private static final long serialVersionUID = -3042212603611350941L;
List<String> names; List<String> names;
/** /**
......
...@@ -55,7 +55,7 @@ package com.sun.jdi.connect; ...@@ -55,7 +55,7 @@ package com.sun.jdi.connect;
* @since 1.5 * @since 1.5
*/ */
public class TransportTimeoutException extends java.io.IOException { public class TransportTimeoutException extends java.io.IOException {
private static final long serialVersionUID = 4107035242623365074L;
/** /**
* Constructs a <tt>TransportTimeoutException</tt> with no detail * Constructs a <tt>TransportTimeoutException</tt> with no detail
* message. * message.
......
...@@ -36,6 +36,7 @@ package com.sun.jdi.connect; ...@@ -36,6 +36,7 @@ package com.sun.jdi.connect;
*/ */
public class VMStartException extends Exception public class VMStartException extends Exception
{ {
private static final long serialVersionUID = 6408644824640801020L;
Process process; Process process;
public VMStartException(Process process) { public VMStartException(Process process) {
......
...@@ -46,7 +46,7 @@ package com.sun.jdi.connect.spi; ...@@ -46,7 +46,7 @@ package com.sun.jdi.connect.spi;
* @since 1.5 * @since 1.5
*/ */
public class ClosedConnectionException extends java.io.IOException { public class ClosedConnectionException extends java.io.IOException {
private static final long serialVersionUID = 3877032124297204774L;
/** /**
* Constructs a <tt>ClosedConnectionException</tt> with no detail * Constructs a <tt>ClosedConnectionException</tt> with no detail
* message. * message.
......
...@@ -33,6 +33,7 @@ package com.sun.jdi.request; ...@@ -33,6 +33,7 @@ package com.sun.jdi.request;
*/ */
public class DuplicateRequestException extends RuntimeException public class DuplicateRequestException extends RuntimeException
{ {
private static final long serialVersionUID = -3719784920313411060L;
public DuplicateRequestException() public DuplicateRequestException()
{ {
super(); super();
......
...@@ -36,6 +36,7 @@ package com.sun.jdi.request; ...@@ -36,6 +36,7 @@ package com.sun.jdi.request;
* @since 1.3 * @since 1.3
*/ */
public class InvalidRequestStateException extends RuntimeException { public class InvalidRequestStateException extends RuntimeException {
private static final long serialVersionUID = -3774632428543322148L;
public InvalidRequestStateException() public InvalidRequestStateException()
{ {
super(); super();
......
...@@ -70,8 +70,8 @@ public class ArrayReferenceImpl extends ObjectReferenceImpl ...@@ -70,8 +70,8 @@ public class ArrayReferenceImpl extends ObjectReferenceImpl
} }
public Value getValue(int index) { public Value getValue(int index) {
List list = getValues(index, 1); List<Value> list = getValues(index, 1);
return (Value)list.get(0); return list.get(0);
} }
public List<Value> getValues() { public List<Value> getValues() {
......
...@@ -61,7 +61,7 @@ public class ArrayTypeImpl extends ReferenceTypeImpl ...@@ -61,7 +61,7 @@ public class ArrayTypeImpl extends ReferenceTypeImpl
return findType(componentSignature()); return findType(componentSignature());
} }
void addVisibleMethods(Map map) { void addVisibleMethods(Map<String, Method> map) {
// arrays don't have methods // arrays don't have methods
} }
...@@ -83,10 +83,10 @@ public class ArrayTypeImpl extends ReferenceTypeImpl ...@@ -83,10 +83,10 @@ public class ArrayTypeImpl extends ReferenceTypeImpl
if (PacketStream.isObjectTag(tag)) { if (PacketStream.isObjectTag(tag)) {
// It's a reference type // It's a reference type
JNITypeParser parser = new JNITypeParser(componentSignature()); JNITypeParser parser = new JNITypeParser(componentSignature());
List list = vm.classesByName(parser.typeName()); List<ReferenceType> list = vm.classesByName(parser.typeName());
Iterator iter = list.iterator(); Iterator<ReferenceType> iter = list.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceType type = (ReferenceType)iter.next(); ReferenceType type = iter.next();
ClassLoaderReference cl = type.classLoader(); ClassLoaderReference cl = type.classLoader();
if ((cl == null)? if ((cl == null)?
(classLoader() == null) : (classLoader() == null) :
......
...@@ -78,7 +78,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl ...@@ -78,7 +78,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl
} }
public int intValue() { public int intValue() {
return(int)((value)?1:0); return (value)?1:0;
} }
public long longValue() { public long longValue() {
...@@ -90,7 +90,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl ...@@ -90,7 +90,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl
} }
public double doubleValue() { public double doubleValue() {
return(double)((value)?1.0:0.0); return (value)?1.0:0.0;
} }
public String toString() { public String toString() {
......
...@@ -75,7 +75,7 @@ public class CharValueImpl extends PrimitiveValueImpl ...@@ -75,7 +75,7 @@ public class CharValueImpl extends PrimitiveValueImpl
} }
public char charValue() { public char charValue() {
return(char)value; return value;
} }
public short shortValue() { public short shortValue() {
......
...@@ -80,7 +80,7 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl ...@@ -80,7 +80,7 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl
classes = Collections.unmodifiableList(classes); classes = Collections.unmodifiableList(classes);
if (local != null) { if (local != null) {
local.visibleClasses = classes; local.visibleClasses = classes;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() + vm.printTrace(description() +
" temporarily caching visible classes (count = " + " temporarily caching visible classes (count = " +
classes.size() + ")"); classes.size() + ")");
...@@ -95,9 +95,9 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl ...@@ -95,9 +95,9 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl
Type findType(String signature) throws ClassNotLoadedException { Type findType(String signature) throws ClassNotLoadedException {
List<ReferenceType> types = visibleClasses(); List<ReferenceType> types = visibleClasses();
Iterator iter = types.iterator(); Iterator<ReferenceType> iter = types.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceType type = (ReferenceType)iter.next(); ReferenceType type = iter.next();
if (type.signature().equals(signature)) { if (type.signature().equals(signature)) {
return type; return type;
} }
......
...@@ -76,7 +76,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl ...@@ -76,7 +76,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
List<InterfaceType> immediate = interfaces(); List<InterfaceType> immediate = interfaces();
list.addAll(interfaces()); list.addAll(interfaces());
Iterator iter = immediate.iterator(); Iterator<InterfaceType> iter = immediate.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
interfaze.addSuperinterfaces(list); interfaze.addSuperinterfaces(list);
...@@ -389,7 +389,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl ...@@ -389,7 +389,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
* overwrite them in the hash table * overwrite them in the hash table
*/ */
Iterator iter = interfaces().iterator(); Iterator<InterfaceType> iter = interfaces().iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
interfaze.addVisibleMethods(methodMap); interfaze.addVisibleMethods(methodMap);
...@@ -411,7 +411,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl ...@@ -411,7 +411,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
return true; return true;
} else { } else {
List<InterfaceType> interfaces = interfaces(); List<InterfaceType> interfaces = interfaces();
Iterator iter = interfaces.iterator(); Iterator<InterfaceType> iter = interfaces.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
if (interfaze.isAssignableTo(type)) { if (interfaze.isAssignableTo(type)) {
......
...@@ -192,7 +192,7 @@ public class ConcreteMethodImpl extends MethodImpl { ...@@ -192,7 +192,7 @@ public class ConcreteMethodImpl extends MethodImpl {
return super.codeIndexToLineInfo(stratum, codeIndex); return super.codeIndexToLineInfo(stratum, codeIndex);
} }
Iterator iter = lineLocations.iterator(); Iterator<Location> iter = lineLocations.iterator();
/* /*
* Treat code before the beginning of the first line table * Treat code before the beginning of the first line table
* entry as part of the first line. javac will generate * entry as part of the first line. javac will generate
...@@ -221,9 +221,9 @@ public class ConcreteMethodImpl extends MethodImpl { ...@@ -221,9 +221,9 @@ public class ConcreteMethodImpl extends MethodImpl {
List<LocalVariable> variables = getVariables(); List<LocalVariable> variables = getVariables();
List<LocalVariable> retList = new ArrayList<LocalVariable>(2); List<LocalVariable> retList = new ArrayList<LocalVariable>(2);
Iterator iter = variables.iterator(); Iterator<LocalVariable> iter = variables.iterator();
while(iter.hasNext()) { while(iter.hasNext()) {
LocalVariable variable = (LocalVariable)iter.next(); LocalVariable variable = iter.next();
if (variable.name().equals(name)) { if (variable.name().equals(name)) {
retList.add(variable); retList.add(variable);
} }
...@@ -235,9 +235,9 @@ public class ConcreteMethodImpl extends MethodImpl { ...@@ -235,9 +235,9 @@ public class ConcreteMethodImpl extends MethodImpl {
List<LocalVariable> variables = getVariables(); List<LocalVariable> variables = getVariables();
List<LocalVariable> retList = new ArrayList<LocalVariable>(variables.size()); List<LocalVariable> retList = new ArrayList<LocalVariable>(variables.size());
Iterator iter = variables.iterator(); Iterator<LocalVariable> iter = variables.iterator();
while(iter.hasNext()) { while(iter.hasNext()) {
LocalVariable variable = (LocalVariable)iter.next(); LocalVariable variable = iter.next();
if (variable.isArgument()) { if (variable.isArgument()) {
retList.add(variable); retList.add(variable);
} }
...@@ -291,7 +291,7 @@ public class ConcreteMethodImpl extends MethodImpl { ...@@ -291,7 +291,7 @@ public class ConcreteMethodImpl extends MethodImpl {
SDE.LineStratum lastLineStratum = null; SDE.LineStratum lastLineStratum = null;
SDE.Stratum baseStratum = SDE.Stratum baseStratum =
declaringType.stratum(SDE.BASE_STRATUM_NAME); declaringType.stratum(SDE.BASE_STRATUM_NAME);
Iterator it = getBaseLocations().lineLocations.iterator(); Iterator<Location> it = getBaseLocations().lineLocations.iterator();
while(it.hasNext()) { while(it.hasNext()) {
LocationImpl loc = (LocationImpl)it.next(); LocationImpl loc = (LocationImpl)it.next();
int baseLineNumber = loc.lineNumber(baseStratum); int baseLineNumber = loc.lineNumber(baseStratum);
......
...@@ -47,9 +47,9 @@ abstract class ConnectorImpl implements Connector { ...@@ -47,9 +47,9 @@ abstract class ConnectorImpl implements Connector {
public Map<String,Argument> defaultArguments() { public Map<String,Argument> defaultArguments() {
Map<String,Argument> defaults = new java.util.LinkedHashMap<String,Argument>(); Map<String,Argument> defaults = new java.util.LinkedHashMap<String,Argument>();
Collection values = defaultArguments.values(); Collection<Argument> values = defaultArguments.values();
Iterator iter = values.iterator(); Iterator<Argument> iter = values.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ArgumentImpl argument = (ArgumentImpl)iter.next(); ArgumentImpl argument = (ArgumentImpl)iter.next();
defaults.put(argument.name(), (Argument)argument.clone()); defaults.put(argument.name(), (Argument)argument.clone());
...@@ -96,7 +96,7 @@ abstract class ConnectorImpl implements Connector { ...@@ -96,7 +96,7 @@ abstract class ConnectorImpl implements Connector {
mustSpecify, list)); mustSpecify, list));
} }
ArgumentImpl argument(String name, Map arguments) ArgumentImpl argument(String name, Map<String, ? extends Argument> arguments)
throws IllegalConnectorArgumentsException { throws IllegalConnectorArgumentsException {
ArgumentImpl argument = (ArgumentImpl)arguments.get(name); ArgumentImpl argument = (ArgumentImpl)arguments.get(name);
...@@ -130,7 +130,7 @@ abstract class ConnectorImpl implements Connector { ...@@ -130,7 +130,7 @@ abstract class ConnectorImpl implements Connector {
public String toString() { public String toString() {
String string = name() + " (defaults: "; String string = name() + " (defaults: ";
Iterator iter = defaultArguments().values().iterator(); Iterator<Argument> iter = defaultArguments().values().iterator();
boolean first = true; boolean first = true;
while (iter.hasNext()) { while (iter.hasNext()) {
ArgumentImpl argument = (ArgumentImpl)iter.next(); ArgumentImpl argument = (ArgumentImpl)iter.next();
...@@ -222,7 +222,7 @@ abstract class ConnectorImpl implements Connector { ...@@ -222,7 +222,7 @@ abstract class ConnectorImpl implements Connector {
class BooleanArgumentImpl extends ConnectorImpl.ArgumentImpl class BooleanArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.BooleanArgument { implements Connector.BooleanArgument {
private static final long serialVersionUID = 1624542968639361316L;
BooleanArgumentImpl(String name, String label, String description, BooleanArgumentImpl(String name, String label, String description,
boolean value, boolean value,
boolean mustSpecify) { boolean mustSpecify) {
...@@ -277,7 +277,7 @@ abstract class ConnectorImpl implements Connector { ...@@ -277,7 +277,7 @@ abstract class ConnectorImpl implements Connector {
class IntegerArgumentImpl extends ConnectorImpl.ArgumentImpl class IntegerArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.IntegerArgument { implements Connector.IntegerArgument {
private static final long serialVersionUID = 763286081923797770L;
private final int min; private final int min;
private final int max; private final int max;
...@@ -378,7 +378,7 @@ abstract class ConnectorImpl implements Connector { ...@@ -378,7 +378,7 @@ abstract class ConnectorImpl implements Connector {
class StringArgumentImpl extends ConnectorImpl.ArgumentImpl class StringArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.StringArgument { implements Connector.StringArgument {
private static final long serialVersionUID = 7500484902692107464L;
StringArgumentImpl(String name, String label, String description, StringArgumentImpl(String name, String label, String description,
String value, String value,
boolean mustSpecify) { boolean mustSpecify) {
...@@ -396,7 +396,7 @@ abstract class ConnectorImpl implements Connector { ...@@ -396,7 +396,7 @@ abstract class ConnectorImpl implements Connector {
class SelectedArgumentImpl extends ConnectorImpl.ArgumentImpl class SelectedArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.SelectedArgument { implements Connector.SelectedArgument {
private static final long serialVersionUID = -5689584530908382517L;
private final List<String> choices; private final List<String> choices;
SelectedArgumentImpl(String name, String label, String description, SelectedArgumentImpl(String name, String label, String description,
......
...@@ -101,7 +101,7 @@ public class DoubleValueImpl extends PrimitiveValueImpl ...@@ -101,7 +101,7 @@ public class DoubleValueImpl extends PrimitiveValueImpl
} }
public double doubleValue() { public double doubleValue() {
return(double)value; return value;
} }
byte checkedByteValue() throws InvalidTypeException { byte checkedByteValue() throws InvalidTypeException {
......
...@@ -43,7 +43,7 @@ import java.util.*; ...@@ -43,7 +43,7 @@ import java.util.*;
class EventRequestManagerImpl extends MirrorImpl class EventRequestManagerImpl extends MirrorImpl
implements EventRequestManager implements EventRequestManager
{ {
List[] requestLists; List<? extends EventRequest>[] requestLists;
private static int methodExitEventCmd = 0; private static int methodExitEventCmd = 0;
static int JDWPtoJDISuspendPolicy(byte jdwpPolicy) { static int JDWPtoJDISuspendPolicy(byte jdwpPolicy) {
...@@ -91,7 +91,7 @@ class EventRequestManagerImpl extends MirrorImpl ...@@ -91,7 +91,7 @@ class EventRequestManagerImpl extends MirrorImpl
* access/modification should be protected by synchronizing on * access/modification should be protected by synchronizing on
* the enclosing instance of EventRequestImpl. * the enclosing instance of EventRequestImpl.
*/ */
List filters = new ArrayList(); List<Object> filters = new ArrayList<>();
boolean isEnabled = false; boolean isEnabled = false;
boolean deleted = false; boolean deleted = false;
...@@ -195,7 +195,6 @@ class EventRequestManagerImpl extends MirrorImpl ...@@ -195,7 +195,6 @@ class EventRequestManagerImpl extends MirrorImpl
*/ */
synchronized void set() { synchronized void set() {
JDWP.EventRequest.Set.Modifier[] mods = JDWP.EventRequest.Set.Modifier[] mods =
(JDWP.EventRequest.Set.Modifier[])
filters.toArray( filters.toArray(
new JDWP.EventRequest.Set.Modifier[filters.size()]); new JDWP.EventRequest.Set.Modifier[filters.size()]);
try { try {
...@@ -582,10 +581,10 @@ class EventRequestManagerImpl extends MirrorImpl ...@@ -582,10 +581,10 @@ class EventRequestManagerImpl extends MirrorImpl
/* /*
* Make sure this isn't a duplicate * Make sure this isn't a duplicate
*/ */
List requests = stepRequests(); List<StepRequest> requests = stepRequests();
Iterator iter = requests.iterator(); Iterator<StepRequest> iter = requests.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
StepRequest request = (StepRequest)iter.next(); StepRequest request = iter.next();
if ((request != this) && if ((request != this) &&
request.isEnabled() && request.isEnabled() &&
request.thread().equals(thread)) { request.thread().equals(thread)) {
...@@ -735,7 +734,7 @@ class EventRequestManagerImpl extends MirrorImpl ...@@ -735,7 +734,7 @@ class EventRequestManagerImpl extends MirrorImpl
} }
requestLists = new List[highest+1]; requestLists = new List[highest+1];
for (int i=0; i <= highest; i++) { for (int i=0; i <= highest; i++) {
requestLists[i] = new ArrayList(); requestLists[i] = new ArrayList<>();
} }
} }
...@@ -852,7 +851,7 @@ class EventRequestManagerImpl extends MirrorImpl ...@@ -852,7 +851,7 @@ class EventRequestManagerImpl extends MirrorImpl
public void deleteEventRequests(List<? extends EventRequest> eventRequests) { public void deleteEventRequests(List<? extends EventRequest> eventRequests) {
validateMirrors(eventRequests); validateMirrors(eventRequests);
// copy the eventRequests to avoid ConcurrentModificationException // copy the eventRequests to avoid ConcurrentModificationException
Iterator iter = (new ArrayList(eventRequests)).iterator(); Iterator<? extends EventRequest> iter = (new ArrayList<>(eventRequests)).iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
((EventRequestImpl)iter.next()).delete(); ((EventRequestImpl)iter.next()).delete();
} }
...@@ -869,76 +868,76 @@ class EventRequestManagerImpl extends MirrorImpl ...@@ -869,76 +868,76 @@ class EventRequestManagerImpl extends MirrorImpl
} }
public List<StepRequest> stepRequests() { public List<StepRequest> stepRequests() {
return unmodifiableRequestList(JDWP.EventKind.SINGLE_STEP); return (List<StepRequest>)unmodifiableRequestList(JDWP.EventKind.SINGLE_STEP);
} }
public List<ClassPrepareRequest> classPrepareRequests() { public List<ClassPrepareRequest> classPrepareRequests() {
return unmodifiableRequestList(JDWP.EventKind.CLASS_PREPARE); return (List<ClassPrepareRequest>)unmodifiableRequestList(JDWP.EventKind.CLASS_PREPARE);
} }
public List<ClassUnloadRequest> classUnloadRequests() { public List<ClassUnloadRequest> classUnloadRequests() {
return unmodifiableRequestList(JDWP.EventKind.CLASS_UNLOAD); return (List<ClassUnloadRequest>)unmodifiableRequestList(JDWP.EventKind.CLASS_UNLOAD);
} }
public List<ThreadStartRequest> threadStartRequests() { public List<ThreadStartRequest> threadStartRequests() {
return unmodifiableRequestList(JDWP.EventKind.THREAD_START); return (List<ThreadStartRequest>)unmodifiableRequestList(JDWP.EventKind.THREAD_START);
} }
public List<ThreadDeathRequest> threadDeathRequests() { public List<ThreadDeathRequest> threadDeathRequests() {
return unmodifiableRequestList(JDWP.EventKind.THREAD_DEATH); return (List<ThreadDeathRequest>)unmodifiableRequestList(JDWP.EventKind.THREAD_DEATH);
} }
public List<ExceptionRequest> exceptionRequests() { public List<ExceptionRequest> exceptionRequests() {
return unmodifiableRequestList(JDWP.EventKind.EXCEPTION); return (List<ExceptionRequest>)unmodifiableRequestList(JDWP.EventKind.EXCEPTION);
} }
public List<BreakpointRequest> breakpointRequests() { public List<BreakpointRequest> breakpointRequests() {
return unmodifiableRequestList(JDWP.EventKind.BREAKPOINT); return (List<BreakpointRequest>)unmodifiableRequestList(JDWP.EventKind.BREAKPOINT);
} }
public List<AccessWatchpointRequest> accessWatchpointRequests() { public List<AccessWatchpointRequest> accessWatchpointRequests() {
return unmodifiableRequestList(JDWP.EventKind.FIELD_ACCESS); return (List<AccessWatchpointRequest>)unmodifiableRequestList(JDWP.EventKind.FIELD_ACCESS);
} }
public List<ModificationWatchpointRequest> modificationWatchpointRequests() { public List<ModificationWatchpointRequest> modificationWatchpointRequests() {
return unmodifiableRequestList(JDWP.EventKind.FIELD_MODIFICATION); return (List<ModificationWatchpointRequest>)unmodifiableRequestList(JDWP.EventKind.FIELD_MODIFICATION);
} }
public List<MethodEntryRequest> methodEntryRequests() { public List<MethodEntryRequest> methodEntryRequests() {
return unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY); return (List<MethodEntryRequest>)unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY);
} }
public List<MethodExitRequest> methodExitRequests() { public List<MethodExitRequest> methodExitRequests() {
return unmodifiableRequestList( return (List<MethodExitRequest>)unmodifiableRequestList(
EventRequestManagerImpl.methodExitEventCmd); EventRequestManagerImpl.methodExitEventCmd);
} }
public List<MonitorContendedEnterRequest> monitorContendedEnterRequests() { public List<MonitorContendedEnterRequest> monitorContendedEnterRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTER); return (List<MonitorContendedEnterRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTER);
} }
public List<MonitorContendedEnteredRequest> monitorContendedEnteredRequests() { public List<MonitorContendedEnteredRequest> monitorContendedEnteredRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTERED); return (List<MonitorContendedEnteredRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTERED);
} }
public List<MonitorWaitRequest> monitorWaitRequests() { public List<MonitorWaitRequest> monitorWaitRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_WAIT); return (List<MonitorWaitRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_WAIT);
} }
public List<MonitorWaitedRequest> monitorWaitedRequests() { public List<MonitorWaitedRequest> monitorWaitedRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_WAITED); return (List<MonitorWaitedRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_WAITED);
} }
public List<VMDeathRequest> vmDeathRequests() { public List<VMDeathRequest> vmDeathRequests() {
return unmodifiableRequestList(JDWP.EventKind.VM_DEATH); return (List<VMDeathRequest>)unmodifiableRequestList(JDWP.EventKind.VM_DEATH);
} }
List unmodifiableRequestList(int eventCmd) { List<? extends EventRequest> unmodifiableRequestList(int eventCmd) {
return Collections.unmodifiableList(requestList(eventCmd)); return Collections.unmodifiableList(requestList(eventCmd));
} }
EventRequest request(int eventCmd, int requestId) { EventRequest request(int eventCmd, int requestId) {
List rl = requestList(eventCmd); List<? extends EventRequest> rl = requestList(eventCmd);
for (int i = rl.size() - 1; i >= 0; i--) { for (int i = rl.size() - 1; i >= 0; i--) {
EventRequestImpl er = (EventRequestImpl)rl.get(i); EventRequestImpl er = (EventRequestImpl)rl.get(i);
if (er.id == requestId) { if (er.id == requestId) {
......
...@@ -47,7 +47,7 @@ enum EventDestination {UNKNOWN_EVENT, INTERNAL_EVENT, CLIENT_EVENT}; ...@@ -47,7 +47,7 @@ enum EventDestination {UNKNOWN_EVENT, INTERNAL_EVENT, CLIENT_EVENT};
* that is on the queues are all for client requests. * that is on the queues are all for client requests.
*/ */
public class EventSetImpl extends ArrayList<Event> implements EventSet { public class EventSetImpl extends ArrayList<Event> implements EventSet {
private static final long serialVersionUID = -4857338819787924570L;
private VirtualMachineImpl vm; // we implement Mirror private VirtualMachineImpl vm; // we implement Mirror
private Packet pkt; private Packet pkt;
private byte suspendPolicy; private byte suspendPolicy;
...@@ -607,7 +607,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet { ...@@ -607,7 +607,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
PacketStream ps = new PacketStream(vm, pkt); PacketStream ps = new PacketStream(vm, pkt);
JDWP.Event.Composite compEvt = new JDWP.Event.Composite(vm, ps); JDWP.Event.Composite compEvt = new JDWP.Event.Composite(vm, ps);
suspendPolicy = compEvt.suspendPolicy; suspendPolicy = compEvt.suspendPolicy;
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
switch(suspendPolicy) { switch(suspendPolicy) {
case JDWP.SuspendPolicy.ALL: case JDWP.SuspendPolicy.ALL:
vm.printTrace("EventSet: SUSPEND_ALL"); vm.printTrace("EventSet: SUSPEND_ALL");
...@@ -626,7 +626,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet { ...@@ -626,7 +626,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
ThreadReference fix6485605 = null; ThreadReference fix6485605 = null;
for (int i = 0; i < compEvt.events.length; i++) { for (int i = 0; i < compEvt.events.length; i++) {
EventImpl evt = createEvent(compEvt.events[i]); EventImpl evt = createEvent(compEvt.events[i]);
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
try { try {
vm.printTrace("Event: " + evt); vm.printTrace("Event: " + evt);
} catch (VMDisconnectedException ee) { } catch (VMDisconnectedException ee) {
......
...@@ -97,7 +97,7 @@ public class FloatValueImpl extends PrimitiveValueImpl ...@@ -97,7 +97,7 @@ public class FloatValueImpl extends PrimitiveValueImpl
} }
public float floatValue() { public float floatValue() {
return(float)value; return value;
} }
public double doubleValue() { public double doubleValue() {
......
...@@ -105,7 +105,7 @@ public class GenericAttachingConnector ...@@ -105,7 +105,7 @@ public class GenericAttachingConnector
/** /**
* Attach to a target VM using the specified address and Connector arguments. * Attach to a target VM using the specified address and Connector arguments.
*/ */
public VirtualMachine attach(String address, Map args) public VirtualMachine attach(String address, Map<String, ? extends Connector.Argument> args)
throws IOException, IllegalConnectorArgumentsException throws IOException, IllegalConnectorArgumentsException
{ {
String ts = argument(ARG_TIMEOUT, args).value(); String ts = argument(ARG_TIMEOUT, args).value();
......
...@@ -83,7 +83,7 @@ public class IntegerValueImpl extends PrimitiveValueImpl ...@@ -83,7 +83,7 @@ public class IntegerValueImpl extends PrimitiveValueImpl
} }
public int intValue() { public int intValue() {
return(int)value; return value;
} }
public long longValue() { public long longValue() {
......
...@@ -128,9 +128,9 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl ...@@ -128,9 +128,9 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl
* list being built. * list being built.
*/ */
List<InterfaceType> immediate = new ArrayList<InterfaceType>(superinterfaces()); List<InterfaceType> immediate = new ArrayList<InterfaceType>(superinterfaces());
Iterator iter = immediate.iterator(); Iterator<InterfaceType> iter = immediate.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
InterfaceType interfaze = (InterfaceType)iter.next(); InterfaceType interfaze = iter.next();
if (list.contains(interfaze)) { if (list.contains(interfaze)) {
iter.remove(); iter.remove();
} }
......
...@@ -59,7 +59,7 @@ public class InternalEventHandler implements Runnable ...@@ -59,7 +59,7 @@ public class InternalEventHandler implements Runnable
ClassUnloadEvent cuEvent = (ClassUnloadEvent)event; ClassUnloadEvent cuEvent = (ClassUnloadEvent)event;
vm.removeReferenceType(cuEvent.classSignature()); vm.removeReferenceType(cuEvent.classSignature());
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
vm.printTrace("Handled Unload Event for " + vm.printTrace("Handled Unload Event for " +
cuEvent.classSignature()); cuEvent.classSignature());
} }
...@@ -68,7 +68,7 @@ public class InternalEventHandler implements Runnable ...@@ -68,7 +68,7 @@ public class InternalEventHandler implements Runnable
((ReferenceTypeImpl)cpEvent.referenceType()) ((ReferenceTypeImpl)cpEvent.referenceType())
.markPrepared(); .markPrepared();
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
vm.printTrace("Handled Prepare Event for " + vm.printTrace("Handled Prepare Event for " +
cpEvent.referenceType().name()); cpEvent.referenceType().name());
} }
......
...@@ -27,7 +27,7 @@ package com.sun.tools.jdi; ...@@ -27,7 +27,7 @@ package com.sun.tools.jdi;
import com.sun.jdi.*; import com.sun.jdi.*;
class JDWPException extends Exception { class JDWPException extends Exception {
private static final long serialVersionUID = -6321344442751299874L;
short errorCode; short errorCode;
JDWPException(short errorCode) { JDWPException(short errorCode) {
......
...@@ -93,7 +93,7 @@ public class LongValueImpl extends PrimitiveValueImpl ...@@ -93,7 +93,7 @@ public class LongValueImpl extends PrimitiveValueImpl
} }
public long longValue() { public long longValue() {
return(long)value; return value;
} }
public float floatValue() { public float floatValue() {
......
...@@ -362,7 +362,7 @@ public abstract class MethodImpl extends TypeComponentImpl ...@@ -362,7 +362,7 @@ public abstract class MethodImpl extends TypeComponentImpl
int argSize = arguments.size(); int argSize = arguments.size();
JNITypeParser parser = new JNITypeParser(signature()); JNITypeParser parser = new JNITypeParser(signature());
List signatures = parser.argumentSignatures(); List<String> signatures = parser.argumentSignatures();
if (signatures.size() != argSize) { if (signatures.size() != argSize) {
throw new IllegalArgumentException("Invalid argument count: expected " + throw new IllegalArgumentException("Invalid argument count: expected " +
......
...@@ -83,8 +83,8 @@ abstract class MirrorImpl extends Object implements Mirror { ...@@ -83,8 +83,8 @@ abstract class MirrorImpl extends Object implements Mirror {
* Throw NullPointerException on null mirrors. * Throw NullPointerException on null mirrors.
* Throw VMMismatchException on wrong VM. * Throw VMMismatchException on wrong VM.
*/ */
void validateMirrors(Collection mirrors) { void validateMirrors(Collection<? extends Mirror> mirrors) {
Iterator iter = mirrors.iterator(); Iterator<? extends Mirror> iter = mirrors.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
MirrorImpl mirror = (MirrorImpl)iter.next(); MirrorImpl mirror = (MirrorImpl)iter.next();
if (!vm.equals(mirror.vm)) { if (!vm.equals(mirror.vm)) {
...@@ -96,8 +96,8 @@ abstract class MirrorImpl extends Object implements Mirror { ...@@ -96,8 +96,8 @@ abstract class MirrorImpl extends Object implements Mirror {
* Allow null mirrors. * Allow null mirrors.
* Throw VMMismatchException on wrong VM. * Throw VMMismatchException on wrong VM.
*/ */
void validateMirrorsOrNulls(Collection mirrors) { void validateMirrorsOrNulls(Collection<? extends Mirror> mirrors) {
Iterator iter = mirrors.iterator(); Iterator<? extends Mirror> iter = mirrors.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
MirrorImpl mirror = (MirrorImpl)iter.next(); MirrorImpl mirror = (MirrorImpl)iter.next();
if ((mirror != null) && !vm.equals(mirror.vm)) { if ((mirror != null) && !vm.equals(mirror.vm)) {
......
...@@ -110,7 +110,7 @@ public class ObjectReferenceImpl extends ValueImpl ...@@ -110,7 +110,7 @@ public class ObjectReferenceImpl extends ValueImpl
public boolean vmNotSuspended(VMAction action) { public boolean vmNotSuspended(VMAction action) {
// make sure that cache and listener management are synchronized // make sure that cache and listener management are synchronized
synchronized (vm.state()) { synchronized (vm.state()) {
if (cache != null && (vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if (cache != null && (vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("Clearing temporary cache for " + description()); vm.printTrace("Clearing temporary cache for " + description());
} }
disableCache(); disableCache();
...@@ -163,8 +163,8 @@ public class ObjectReferenceImpl extends ValueImpl ...@@ -163,8 +163,8 @@ public class ObjectReferenceImpl extends ValueImpl
public Value getValue(Field sig) { public Value getValue(Field sig) {
List<Field> list = new ArrayList<Field>(1); List<Field> list = new ArrayList<Field>(1);
list.add(sig); list.add(sig);
Map map = getValues(list); Map<Field, Value> map = getValues(list);
return(Value)map.get(sig); return map.get(sig);
} }
public Map<Field,Value> getValues(List<? extends Field> theFields) { public Map<Field,Value> getValues(List<? extends Field> theFields) {
...@@ -487,7 +487,7 @@ public class ObjectReferenceImpl extends ValueImpl ...@@ -487,7 +487,7 @@ public class ObjectReferenceImpl extends ValueImpl
info = JDWP.ObjectReference.MonitorInfo.process(vm, this); info = JDWP.ObjectReference.MonitorInfo.process(vm, this);
if (local != null) { if (local != null) {
local.monitorInfo = info; local.monitorInfo = info;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("ObjectReference " + uniqueID() + vm.printTrace("ObjectReference " + uniqueID() +
" temporarily caching monitor info"); " temporarily caching monitor info");
} }
......
...@@ -127,7 +127,7 @@ public class ProcessAttachingConnector ...@@ -127,7 +127,7 @@ public class ProcessAttachingConnector
} else { } else {
if (lib.equals("dt_shmem")) { if (lib.equals("dt_shmem")) {
try { try {
Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
ts = (TransportService)c.newInstance(); ts = (TransportService)c.newInstance();
} catch (Exception x) { } } catch (Exception x) { }
} }
......
...@@ -53,7 +53,7 @@ public class RawCommandLineLauncher extends AbstractLauncher implements Launchin ...@@ -53,7 +53,7 @@ public class RawCommandLineLauncher extends AbstractLauncher implements Launchin
super(); super();
try { try {
Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
transportService = (TransportService)c.newInstance(); transportService = (TransportService)c.newInstance();
transport = new Transport() { transport = new Transport() {
public String name() { public String name() {
......
...@@ -99,7 +99,7 @@ implements ReferenceType { ...@@ -99,7 +99,7 @@ implements ReferenceType {
// Fetch all methods for the class, check performance impact // Fetch all methods for the class, check performance impact
// Needs no synchronization now, since methods() returns // Needs no synchronization now, since methods() returns
// unmodifiable local data // unmodifiable local data
Iterator it = methods().iterator(); Iterator<Method> it = methods().iterator();
while (it.hasNext()) { while (it.hasNext()) {
MethodImpl method = (MethodImpl)it.next(); MethodImpl method = (MethodImpl)it.next();
if (method.ref() == ref) { if (method.ref() == ref) {
...@@ -113,7 +113,7 @@ implements ReferenceType { ...@@ -113,7 +113,7 @@ implements ReferenceType {
// Fetch all fields for the class, check performance impact // Fetch all fields for the class, check performance impact
// Needs no synchronization now, since fields() returns // Needs no synchronization now, since fields() returns
// unmodifiable local data // unmodifiable local data
Iterator it = fields().iterator(); Iterator<Field>it = fields().iterator();
while (it.hasNext()) { while (it.hasNext()) {
FieldImpl field = (FieldImpl)it.next(); FieldImpl field = (FieldImpl)it.next();
if (field.ref() == ref) { if (field.ref() == ref) {
...@@ -385,7 +385,7 @@ implements ReferenceType { ...@@ -385,7 +385,7 @@ implements ReferenceType {
/* Add inherited, visible fields */ /* Add inherited, visible fields */
List<? extends ReferenceType> types = inheritedTypes(); List<? extends ReferenceType> types = inheritedTypes();
Iterator iter = types.iterator(); Iterator<? extends ReferenceType> iter = types.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
/* /*
* TO DO: Be defensive and check for cyclic interface inheritance * TO DO: Be defensive and check for cyclic interface inheritance
...@@ -419,7 +419,7 @@ implements ReferenceType { ...@@ -419,7 +419,7 @@ implements ReferenceType {
/* Add inherited fields */ /* Add inherited fields */
List<? extends ReferenceType> types = inheritedTypes(); List<? extends ReferenceType> types = inheritedTypes();
Iterator iter = types.iterator(); Iterator<? extends ReferenceType> iter = types.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
type.addAllFields(fieldList, typeSet); type.addAllFields(fieldList, typeSet);
...@@ -434,13 +434,10 @@ implements ReferenceType { ...@@ -434,13 +434,10 @@ implements ReferenceType {
} }
public Field fieldByName(String fieldName) { public Field fieldByName(String fieldName) {
java.util.List searchList; List<Field> searchList = visibleFields();
Field f;
searchList = visibleFields();
for (int i=0; i<searchList.size(); i++) { for (int i=0; i<searchList.size(); i++) {
f = (Field)searchList.get(i); Field f = searchList.get(i);
if (f.name().equals(fieldName)) { if (f.name().equals(fieldName)) {
return f; return f;
...@@ -575,13 +572,13 @@ implements ReferenceType { ...@@ -575,13 +572,13 @@ implements ReferenceType {
} }
public List<ReferenceType> nestedTypes() { public List<ReferenceType> nestedTypes() {
List all = vm.allClasses(); List<ReferenceType> all = vm.allClasses();
List<ReferenceType> nested = new ArrayList<ReferenceType>(); List<ReferenceType> nested = new ArrayList<ReferenceType>();
String outername = name(); String outername = name();
int outerlen = outername.length(); int outerlen = outername.length();
Iterator iter = all.iterator(); Iterator<ReferenceType> iter = all.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceType refType = (ReferenceType)iter.next(); ReferenceType refType = iter.next();
String name = refType.name(); String name = refType.name();
int len = name.length(); int len = name.length();
/* The separator is historically '$' but could also be '#' */ /* The separator is historically '$' but could also be '#' */
...@@ -598,8 +595,8 @@ implements ReferenceType { ...@@ -598,8 +595,8 @@ implements ReferenceType {
public Value getValue(Field sig) { public Value getValue(Field sig) {
List<Field> list = new ArrayList<Field>(1); List<Field> list = new ArrayList<Field>(1);
list.add(sig); list.add(sig);
Map map = getValues(list); Map<Field, Value> map = getValues(list);
return(Value)map.get(sig); return map.get(sig);
} }
...@@ -847,7 +844,7 @@ implements ReferenceType { ...@@ -847,7 +844,7 @@ implements ReferenceType {
SDE.Stratum stratum = stratum(stratumID); SDE.Stratum stratum = stratum(stratumID);
List<Location> list = new ArrayList<Location>(); // location list List<Location> list = new ArrayList<Location>(); // location list
for (Iterator iter = methods().iterator(); iter.hasNext(); ) { for (Iterator<Method> iter = methods().iterator(); iter.hasNext(); ) {
MethodImpl method = (MethodImpl)iter.next(); MethodImpl method = (MethodImpl)iter.next();
try { try {
list.addAll( list.addAll(
...@@ -887,7 +884,7 @@ implements ReferenceType { ...@@ -887,7 +884,7 @@ implements ReferenceType {
List<Location> list = new ArrayList<Location>(); List<Location> list = new ArrayList<Location>();
Iterator iter = methods.iterator(); Iterator<Method> iter = methods.iterator();
while(iter.hasNext()) { while(iter.hasNext()) {
MethodImpl method = (MethodImpl)iter.next(); MethodImpl method = (MethodImpl)iter.next();
// eliminate native and abstract to eliminate // eliminate native and abstract to eliminate
......
...@@ -79,7 +79,7 @@ public class ShortValueImpl extends PrimitiveValueImpl ...@@ -79,7 +79,7 @@ public class ShortValueImpl extends PrimitiveValueImpl
} }
public short shortValue() { public short shortValue() {
return(short)value; return value;
} }
public int intValue() { public int intValue() {
......
...@@ -64,7 +64,7 @@ public class SunCommandLineLauncher extends AbstractLauncher implements Launchin ...@@ -64,7 +64,7 @@ public class SunCommandLineLauncher extends AbstractLauncher implements Launchin
* transport or the socket transport * transport or the socket transport
*/ */
try { try {
Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService"); Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
transportService = (TransportService)c.newInstance(); transportService = (TransportService)c.newInstance();
transport = new Transport() { transport = new Transport() {
public String name() { public String name() {
......
...@@ -178,7 +178,7 @@ public class TargetVM implements Runnable { ...@@ -178,7 +178,7 @@ public class TargetVM implements Runnable {
// Closing a queue causes a VMDisconnectEvent to // Closing a queue causes a VMDisconnectEvent to
// be put onto the queue. // be put onto the queue.
synchronized(eventQueues) { synchronized(eventQueues) {
Iterator iter = eventQueues.iterator(); Iterator<EventQueue> iter = eventQueues.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
((EventQueueImpl)iter.next()).close(); ((EventQueueImpl)iter.next()).close();
} }
...@@ -187,9 +187,9 @@ public class TargetVM implements Runnable { ...@@ -187,9 +187,9 @@ public class TargetVM implements Runnable {
// indirectly throw VMDisconnectedException to // indirectly throw VMDisconnectedException to
// command requesters. // command requesters.
synchronized(waitingQueue) { synchronized(waitingQueue) {
Iterator iter = waitingQueue.values().iterator(); Iterator<Packet> iter = waitingQueue.values().iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Packet packet = (Packet)iter.next(); Packet packet = iter.next();
synchronized(packet) { synchronized(packet) {
packet.notify(); packet.notify();
} }
...@@ -252,7 +252,7 @@ public class TargetVM implements Runnable { ...@@ -252,7 +252,7 @@ public class TargetVM implements Runnable {
void notifyDequeueEventSet() { void notifyDequeueEventSet() {
int maxQueueSize = 0; int maxQueueSize = 0;
synchronized(eventQueues) { synchronized(eventQueues) {
Iterator iter = eventQueues.iterator(); Iterator<EventQueue> iter = eventQueues.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
EventQueueImpl queue = (EventQueueImpl)iter.next(); EventQueueImpl queue = (EventQueueImpl)iter.next();
maxQueueSize = Math.max(maxQueueSize, queue.size()); maxQueueSize = Math.max(maxQueueSize, queue.size());
...@@ -265,7 +265,7 @@ public class TargetVM implements Runnable { ...@@ -265,7 +265,7 @@ public class TargetVM implements Runnable {
int maxQueueSize = 0; int maxQueueSize = 0;
synchronized(eventQueues) { synchronized(eventQueues) {
Iterator iter = eventQueues.iterator(); Iterator<EventQueue> iter = eventQueues.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
EventQueueImpl queue = (EventQueueImpl)iter.next(); EventQueueImpl queue = (EventQueueImpl)iter.next();
queue.enqueue(eventSet); queue.enqueue(eventSet);
......
...@@ -33,6 +33,7 @@ import java.util.EventObject; ...@@ -33,6 +33,7 @@ import java.util.EventObject;
* with JDI events. * with JDI events.
*/ */
class ThreadAction extends EventObject { class ThreadAction extends EventObject {
private static final long serialVersionUID = 5690763191100515283L;
// Event ids // Event ids
/*static final int THREAD_SUSPENDED = 1;*/ /*static final int THREAD_SUSPENDED = 1;*/
static final int THREAD_RESUMABLE = 2; static final int THREAD_RESUMABLE = 2;
......
...@@ -118,7 +118,7 @@ public class ThreadGroupReferenceImpl extends ObjectReferenceImpl ...@@ -118,7 +118,7 @@ public class ThreadGroupReferenceImpl extends ObjectReferenceImpl
.process(vm, this); .process(vm, this);
if (local != null) { if (local != null) {
local.kids = kids; local.kids = kids;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() + vm.printTrace(description() +
" temporarily caching children "); " temporarily caching children ");
} }
......
...@@ -240,7 +240,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -240,7 +240,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
public void stop(ObjectReference throwable) throws InvalidTypeException { public void stop(ObjectReference throwable) throws InvalidTypeException {
validateMirror(throwable); validateMirror(throwable);
// Verify that the given object is a Throwable instance // Verify that the given object is a Throwable instance
List list = vm.classesByName("java.lang.Throwable"); List<ReferenceType> list = vm.classesByName("java.lang.Throwable");
ClassTypeImpl throwableClass = (ClassTypeImpl)list.get(0); ClassTypeImpl throwableClass = (ClassTypeImpl)list.get(0);
if ((throwable == null) || if ((throwable == null) ||
!throwableClass.isAssignableFrom(throwable)) { !throwableClass.isAssignableFrom(throwable)) {
...@@ -296,10 +296,10 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -296,10 +296,10 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
try { try {
StackFrame frame = frame(0); StackFrame frame = frame(0);
Location location = frame.location(); Location location = frame.location();
List requests = vm.eventRequestManager().breakpointRequests(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests();
Iterator iter = requests.iterator(); Iterator<BreakpointRequest> iter = requests.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
BreakpointRequest request = (BreakpointRequest)iter.next(); BreakpointRequest request = iter.next();
if (location.equals(request.location())) { if (location.equals(request.location())) {
return true; return true;
} }
...@@ -352,8 +352,8 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -352,8 +352,8 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
} }
public StackFrame frame(int index) throws IncompatibleThreadStateException { public StackFrame frame(int index) throws IncompatibleThreadStateException {
List list = privateFrames(index, 1); List<StackFrame> list = privateFrames(index, 1);
return (StackFrame)list.get(0); return list.get(0);
} }
/** /**
...@@ -447,7 +447,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -447,7 +447,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
snapshot.ownedMonitors = Arrays.asList( snapshot.ownedMonitors = Arrays.asList(
(ObjectReference[])JDWP.ThreadReference.OwnedMonitors. (ObjectReference[])JDWP.ThreadReference.OwnedMonitors.
process(vm, this).owned); process(vm, this).owned);
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() + vm.printTrace(description() +
" temporarily caching owned monitors"+ " temporarily caching owned monitors"+
" (count = " + snapshot.ownedMonitors.size() + ")"); " (count = " + snapshot.ownedMonitors.size() + ")");
...@@ -475,7 +475,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -475,7 +475,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
process(vm, this).monitor; process(vm, this).monitor;
snapshot.triedCurrentContended = true; snapshot.triedCurrentContended = true;
if ((snapshot.contendedMonitor != null) && if ((snapshot.contendedMonitor != null) &&
((vm.traceFlags & vm.TRACE_OBJREFS) != 0)) { ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0)) {
vm.printTrace(description() + vm.printTrace(description() +
" temporarily caching contended monitor"+ " temporarily caching contended monitor"+
" (id = " + snapshot.contendedMonitor.uniqueID() + ")"); " (id = " + snapshot.contendedMonitor.uniqueID() + ")");
...@@ -509,7 +509,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -509,7 +509,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
snapshot.ownedMonitorsInfo.add(mon); snapshot.ownedMonitorsInfo.add(mon);
} }
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() + vm.printTrace(description() +
" temporarily caching owned monitors"+ " temporarily caching owned monitors"+
" (count = " + snapshot.ownedMonitorsInfo.size() + ")"); " (count = " + snapshot.ownedMonitorsInfo.size() + ")");
...@@ -601,9 +601,9 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -601,9 +601,9 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
void removeListener(ThreadListener listener) { void removeListener(ThreadListener listener) {
synchronized (vm.state()) { synchronized (vm.state()) {
Iterator iter = listeners.iterator(); Iterator<WeakReference<ThreadListener>> iter = listeners.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next(); WeakReference<ThreadListener> ref = iter.next();
if (listener.equals(ref.get())) { if (listener.equals(ref.get())) {
iter.remove(); iter.remove();
break; break;
...@@ -619,10 +619,10 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl ...@@ -619,10 +619,10 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
*/ */
private void processThreadAction(ThreadAction action) { private void processThreadAction(ThreadAction action) {
synchronized (vm.state()) { synchronized (vm.state()) {
Iterator iter = listeners.iterator(); Iterator<WeakReference<ThreadListener>> iter = listeners.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next(); WeakReference<ThreadListener> ref = iter.next();
ThreadListener listener = (ThreadListener)ref.get(); ThreadListener listener = ref.get();
if (listener != null) { if (listener != null) {
switch (action.id()) { switch (action.id()) {
case ThreadAction.THREAD_RESUMABLE: case ThreadAction.THREAD_RESUMABLE:
......
...@@ -33,6 +33,8 @@ import java.util.EventObject; ...@@ -33,6 +33,8 @@ import java.util.EventObject;
* with JDI events. * with JDI events.
*/ */
class VMAction extends EventObject { class VMAction extends EventObject {
private static final long serialVersionUID = -1701944679310296090L;
// Event ids // Event ids
static final int VM_SUSPENDED = 1; static final int VM_SUSPENDED = 1;
static final int VM_NOT_SUSPENDED = 2; static final int VM_NOT_SUSPENDED = 2;
......
...@@ -34,7 +34,7 @@ class VMState { ...@@ -34,7 +34,7 @@ class VMState {
private final VirtualMachineImpl vm; private final VirtualMachineImpl vm;
// Listeners // Listeners
private final List<WeakReference> listeners = new ArrayList<WeakReference>(); // synchronized (this) private final List<WeakReference<VMListener>> listeners = new ArrayList<WeakReference<VMListener>>(); // synchronized (this)
private boolean notifyingListeners = false; // synchronized (this) private boolean notifyingListeners = false; // synchronized (this)
/* /*
...@@ -129,7 +129,7 @@ class VMState { ...@@ -129,7 +129,7 @@ class VMState {
*/ */
synchronized void thaw(ThreadReference resumingThread) { synchronized void thaw(ThreadReference resumingThread) {
if (cache != null) { if (cache != null) {
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("Clearing VM suspended cache"); vm.printTrace("Clearing VM suspended cache");
} }
disableCache(); disableCache();
...@@ -142,10 +142,10 @@ class VMState { ...@@ -142,10 +142,10 @@ class VMState {
// Prevent recursion // Prevent recursion
notifyingListeners = true; notifyingListeners = true;
Iterator iter = listeners.iterator(); Iterator<WeakReference<VMListener>> iter = listeners.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next(); WeakReference<VMListener> ref = iter.next();
VMListener listener = (VMListener)ref.get(); VMListener listener = ref.get();
if (listener != null) { if (listener != null) {
boolean keep = true; boolean keep = true;
switch (action.id()) { switch (action.id()) {
...@@ -178,9 +178,9 @@ class VMState { ...@@ -178,9 +178,9 @@ class VMState {
} }
synchronized void removeListener(VMListener listener) { synchronized void removeListener(VMListener listener) {
Iterator iter = listeners.iterator(); Iterator<WeakReference<VMListener>> iter = listeners.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next(); WeakReference<VMListener> ref = iter.next();
if (listener.equals(ref.get())) { if (listener.equals(ref.get())) {
iter.remove(); iter.remove();
break; break;
...@@ -202,7 +202,7 @@ class VMState { ...@@ -202,7 +202,7 @@ class VMState {
process(vm).threads); process(vm).threads);
if (local != null) { if (local != null) {
local.threads = threads; local.threads = threads;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("Caching all threads (count = " + vm.printTrace("Caching all threads (count = " +
threads.size() + ") while VM suspended"); threads.size() + ") while VM suspended");
} }
...@@ -229,7 +229,7 @@ class VMState { ...@@ -229,7 +229,7 @@ class VMState {
process(vm).groups); process(vm).groups);
if (local != null) { if (local != null) {
local.groups = groups; local.groups = groups;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) { if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace( vm.printTrace(
"Caching top level thread groups (count = " + "Caching top level thread groups (count = " +
groups.size() + ") while VM suspended"); groups.size() + ") while VM suspended");
......
...@@ -300,9 +300,9 @@ class VirtualMachineImpl extends MirrorImpl ...@@ -300,9 +300,9 @@ class VirtualMachineImpl extends MirrorImpl
if (!canRedefineClasses()) { if (!canRedefineClasses()) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
Iterator it = classToBytes.entrySet().iterator(); Iterator<?> it = classToBytes.entrySet().iterator();
for (int i = 0; it.hasNext(); i++) { for (int i = 0; it.hasNext(); i++) {
Map.Entry entry = (Map.Entry)it.next(); Map.Entry<?,?> entry = (Map.Entry)it.next();
ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey(); ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey();
validateMirror(refType); validateMirror(refType);
defs[i] = new JDWP.VirtualMachine.RedefineClasses defs[i] = new JDWP.VirtualMachine.RedefineClasses
...@@ -801,7 +801,7 @@ class VirtualMachineImpl extends MirrorImpl ...@@ -801,7 +801,7 @@ class VirtualMachineImpl extends MirrorImpl
* we can't differentiate here, we first remove all * we can't differentiate here, we first remove all
* matching classes from our cache... * matching classes from our cache...
*/ */
Iterator iter = typesBySignature.iterator(); Iterator<ReferenceType> iter = typesBySignature.iterator();
int matches = 0; int matches = 0;
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
...@@ -833,7 +833,7 @@ class VirtualMachineImpl extends MirrorImpl ...@@ -833,7 +833,7 @@ class VirtualMachineImpl extends MirrorImpl
if (typesByID == null) { if (typesByID == null) {
return new ArrayList<ReferenceType>(0); return new ArrayList<ReferenceType>(0);
} }
Iterator iter = typesBySignature.iterator(); Iterator<ReferenceType> iter = typesBySignature.iterator();
List<ReferenceType> list = new ArrayList<ReferenceType>(); List<ReferenceType> list = new ArrayList<ReferenceType>();
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next(); ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
...@@ -1041,10 +1041,10 @@ class VirtualMachineImpl extends MirrorImpl ...@@ -1041,10 +1041,10 @@ class VirtualMachineImpl extends MirrorImpl
} }
Type findBootType(String signature) throws ClassNotLoadedException { Type findBootType(String signature) throws ClassNotLoadedException {
List types = allClasses(); List<ReferenceType> types = allClasses();
Iterator iter = types.iterator(); Iterator<ReferenceType> iter = types.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ReferenceType type = (ReferenceType)iter.next(); ReferenceType type = iter.next();
if ((type.classLoader() == null) && if ((type.classLoader() == null) &&
(type.signature().equals(signature))) { (type.signature().equals(signature))) {
return type; return type;
...@@ -1227,7 +1227,7 @@ class VirtualMachineImpl extends MirrorImpl ...@@ -1227,7 +1227,7 @@ class VirtualMachineImpl extends MirrorImpl
} }
private void processQueue() { private void processQueue() {
Reference ref; Reference<?> ref;
//if ((traceFlags & TRACE_OBJREFS) != 0) { //if ((traceFlags & TRACE_OBJREFS) != 0) {
// printTrace("Checking for softly reachable objects"); // printTrace("Checking for softly reachable objects");
//} //}
......
...@@ -278,9 +278,9 @@ public abstract class AWTEvent extends EventObject { ...@@ -278,9 +278,9 @@ public abstract class AWTEvent extends EventObject {
private static synchronized Field get_InputEvent_CanAccessSystemClipboard() { private static synchronized Field get_InputEvent_CanAccessSystemClipboard() {
if (inputEvent_CanAccessSystemClipboard_Field == null) { if (inputEvent_CanAccessSystemClipboard_Field == null) {
inputEvent_CanAccessSystemClipboard_Field = inputEvent_CanAccessSystemClipboard_Field =
(Field)java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() { new java.security.PrivilegedAction<Field>() {
public Object run() { public Field run() {
Field field = null; Field field = null;
try { try {
field = InputEvent.class. field = InputEvent.class.
......
...@@ -953,7 +953,7 @@ public class AWTEventMulticaster implements ...@@ -953,7 +953,7 @@ public class AWTEventMulticaster implements
* AWTEventMulticaster. Additionally, only listeners of type listenerType * AWTEventMulticaster. Additionally, only listeners of type listenerType
* are counted. Method modified to fix bug 4513402. -bchristi * are counted. Method modified to fix bug 4513402. -bchristi
*/ */
private static int getListenerCount(EventListener l, Class listenerType) { private static int getListenerCount(EventListener l, Class<?> listenerType) {
if (l instanceof AWTEventMulticaster) { if (l instanceof AWTEventMulticaster) {
AWTEventMulticaster mc = (AWTEventMulticaster)l; AWTEventMulticaster mc = (AWTEventMulticaster)l;
return getListenerCount(mc.a, listenerType) + return getListenerCount(mc.a, listenerType) +
...@@ -1017,6 +1017,7 @@ public class AWTEventMulticaster implements ...@@ -1017,6 +1017,7 @@ public class AWTEventMulticaster implements
* *
* @since 1.4 * @since 1.4
*/ */
@SuppressWarnings("unchecked")
public static <T extends EventListener> T[] public static <T extends EventListener> T[]
getListeners(EventListener l, Class<T> listenerType) getListeners(EventListener l, Class<T> listenerType)
{ {
......
...@@ -382,7 +382,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -382,7 +382,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @serial * @serial
* @see #add * @see #add
*/ */
Vector popups; Vector<PopupMenu> popups;
/** /**
* A component's name. * A component's name.
...@@ -441,7 +441,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -441,7 +441,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #getFocusTraversalKeys * @see #getFocusTraversalKeys
* @since 1.4 * @since 1.4
*/ */
Set[] focusTraversalKeys; Set<AWTKeyStroke>[] focusTraversalKeys;
private static final String[] focusTraversalKeyPropertyNames = { private static final String[] focusTraversalKeyPropertyNames = {
"forwardFocusTraversalKeys", "forwardFocusTraversalKeys",
...@@ -598,12 +598,12 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -598,12 +598,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
initIDs(); initIDs();
} }
String s = (String) java.security.AccessController.doPrivileged( String s = java.security.AccessController.doPrivileged(
new GetPropertyAction("awt.image.incrementaldraw")); new GetPropertyAction("awt.image.incrementaldraw"));
isInc = (s == null || s.equals("true")); isInc = (s == null || s.equals("true"));
s = (String) java.security.AccessController.doPrivileged( s = java.security.AccessController.doPrivileged(
new GetPropertyAction("awt.image.redrawrate")); new GetPropertyAction("awt.image.redrawrate"));
incRate = (s != null) ? Integer.parseInt(s) : 100; incRate = (s != null) ? Integer.parseInt(s) : 100;
} }
...@@ -986,6 +986,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -986,6 +986,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
appContext = AppContext.getAppContext(); appContext = AppContext.getAppContext();
} }
@SuppressWarnings({"rawtypes", "unchecked"})
void initializeFocusTraversalKeys() { void initializeFocusTraversalKeys() {
focusTraversalKeys = new Set[3]; focusTraversalKeys = new Set[3];
} }
...@@ -1369,13 +1370,13 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -1369,13 +1370,13 @@ public abstract class Component implements ImageObserver, MenuContainer,
throw new HeadlessException(); throw new HeadlessException();
} }
PointerInfo pi = (PointerInfo)java.security.AccessController.doPrivileged( PointerInfo pi = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() { new java.security.PrivilegedAction<PointerInfo>() {
public Object run() { public PointerInfo run() {
return MouseInfo.getPointerInfo(); return MouseInfo.getPointerInfo();
} }
} }
); );
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
Component inTheSameWindow = findUnderMouseInWindow(pi); Component inTheSameWindow = findUnderMouseInWindow(pi);
...@@ -2334,7 +2335,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -2334,7 +2335,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
peer.setBounds(nativeX, nativeY, width, height, op); peer.setBounds(nativeX, nativeY, width, height, op);
} }
@SuppressWarnings("deprecation")
private void notifyNewBounds(boolean resized, boolean moved) { private void notifyNewBounds(boolean resized, boolean moved) {
if (componentListener != null if (componentListener != null
|| (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0 || (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0
...@@ -4690,6 +4691,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -4690,6 +4691,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
dispatchEventImpl(e); dispatchEventImpl(e);
} }
@SuppressWarnings("deprecation")
void dispatchEventImpl(AWTEvent e) { void dispatchEventImpl(AWTEvent e) {
int id = e.getID(); int id = e.getID();
...@@ -5242,7 +5244,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -5242,7 +5244,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.4 * @since 1.4
*/ */
public synchronized ComponentListener[] getComponentListeners() { public synchronized ComponentListener[] getComponentListeners() {
return (ComponentListener[]) (getListeners(ComponentListener.class)); return getListeners(ComponentListener.class);
} }
/** /**
...@@ -5311,7 +5313,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -5311,7 +5313,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.4 * @since 1.4
*/ */
public synchronized FocusListener[] getFocusListeners() { public synchronized FocusListener[] getFocusListeners() {
return (FocusListener[]) (getListeners(FocusListener.class)); return getListeners(FocusListener.class);
} }
/** /**
...@@ -5402,7 +5404,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -5402,7 +5404,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.4 * @since 1.4
*/ */
public synchronized HierarchyListener[] getHierarchyListeners() { public synchronized HierarchyListener[] getHierarchyListeners() {
return (HierarchyListener[])(getListeners(HierarchyListener.class)); return getListeners(HierarchyListener.class);
} }
/** /**
...@@ -5564,8 +5566,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -5564,8 +5566,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.4 * @since 1.4
*/ */
public synchronized HierarchyBoundsListener[] getHierarchyBoundsListeners() { public synchronized HierarchyBoundsListener[] getHierarchyBoundsListeners() {
return (HierarchyBoundsListener[]) return getListeners(HierarchyBoundsListener.class);
(getListeners(HierarchyBoundsListener.class));
} }
/* /*
...@@ -5644,7 +5645,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -5644,7 +5645,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.4 * @since 1.4
*/ */
public synchronized KeyListener[] getKeyListeners() { public synchronized KeyListener[] getKeyListeners() {
return (KeyListener[]) (getListeners(KeyListener.class)); return getListeners(KeyListener.class);
} }
/** /**
...@@ -5713,7 +5714,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -5713,7 +5714,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.4 * @since 1.4
*/ */
public synchronized MouseListener[] getMouseListeners() { public synchronized MouseListener[] getMouseListeners() {
return (MouseListener[]) (getListeners(MouseListener.class)); return getListeners(MouseListener.class);
} }
/** /**
...@@ -5782,7 +5783,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -5782,7 +5783,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.4 * @since 1.4
*/ */
public synchronized MouseMotionListener[] getMouseMotionListeners() { public synchronized MouseMotionListener[] getMouseMotionListeners() {
return (MouseMotionListener[]) (getListeners(MouseMotionListener.class)); return getListeners(MouseMotionListener.class);
} }
/** /**
...@@ -5855,7 +5856,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -5855,7 +5856,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.4 * @since 1.4
*/ */
public synchronized MouseWheelListener[] getMouseWheelListeners() { public synchronized MouseWheelListener[] getMouseWheelListeners() {
return (MouseWheelListener[]) (getListeners(MouseWheelListener.class)); return getListeners(MouseWheelListener.class);
} }
/** /**
...@@ -5922,7 +5923,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -5922,7 +5923,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @since 1.4 * @since 1.4
*/ */
public synchronized InputMethodListener[] getInputMethodListeners() { public synchronized InputMethodListener[] getInputMethodListeners() {
return (InputMethodListener[]) (getListeners(InputMethodListener.class)); return getListeners(InputMethodListener.class);
} }
/** /**
...@@ -5967,6 +5968,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -5967,6 +5968,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* *
* @since 1.3 * @since 1.3
*/ */
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) { public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
EventListener l = null; EventListener l = null;
if (listenerType == ComponentListener.class) { if (listenerType == ComponentListener.class) {
...@@ -6909,7 +6911,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -6909,7 +6911,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
int npopups = (popups != null? popups.size() : 0); int npopups = (popups != null? popups.size() : 0);
for (int i = 0 ; i < npopups ; i++) { for (int i = 0 ; i < npopups ; i++) {
PopupMenu popup = (PopupMenu)popups.elementAt(i); PopupMenu popup = popups.elementAt(i);
popup.addNotify(); popup.addNotify();
} }
...@@ -6979,7 +6981,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -6979,7 +6981,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
int npopups = (popups != null? popups.size() : 0); int npopups = (popups != null? popups.size() : 0);
for (int i = 0 ; i < npopups ; i++) { for (int i = 0 ; i < npopups ; i++) {
PopupMenu popup = (PopupMenu)popups.elementAt(i); PopupMenu popup = popups.elementAt(i);
popup.removeNotify(); popup.removeNotify();
} }
// If there is any input context for this component, notify // If there is any input context for this component, notify
...@@ -7238,7 +7240,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -7238,7 +7240,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
// would erroneously generate an IllegalArgumentException for // would erroneously generate an IllegalArgumentException for
// DOWN_CYCLE_TRAVERSAL_KEY. // DOWN_CYCLE_TRAVERSAL_KEY.
final void setFocusTraversalKeys_NoIDCheck(int id, Set<? extends AWTKeyStroke> keystrokes) { final void setFocusTraversalKeys_NoIDCheck(int id, Set<? extends AWTKeyStroke> keystrokes) {
Set oldKeys; Set<AWTKeyStroke> oldKeys;
synchronized (this) { synchronized (this) {
if (focusTraversalKeys == null) { if (focusTraversalKeys == null) {
...@@ -7246,20 +7248,12 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -7246,20 +7248,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
if (keystrokes != null) { if (keystrokes != null) {
for (Iterator iter = keystrokes.iterator(); iter.hasNext(); ) { for (AWTKeyStroke keystroke : keystrokes ) {
Object obj = iter.next();
if (obj == null) { if (keystroke == null) {
throw new IllegalArgumentException("cannot set null focus traversal key"); throw new IllegalArgumentException("cannot set null focus traversal key");
} }
// Fix for 6195828:
//According to javadoc this method should throw IAE instead of ClassCastException
if (!(obj instanceof AWTKeyStroke)) {
throw new IllegalArgumentException("object is expected to be AWTKeyStroke");
}
AWTKeyStroke keystroke = (AWTKeyStroke)obj;
if (keystroke.getKeyChar() != KeyEvent.CHAR_UNDEFINED) { if (keystroke.getKeyChar() != KeyEvent.CHAR_UNDEFINED) {
throw new IllegalArgumentException("focus traversal keys cannot map to KEY_TYPED events"); throw new IllegalArgumentException("focus traversal keys cannot map to KEY_TYPED events");
} }
...@@ -7279,16 +7273,16 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -7279,16 +7273,16 @@ public abstract class Component implements ImageObserver, MenuContainer,
oldKeys = focusTraversalKeys[id]; oldKeys = focusTraversalKeys[id];
focusTraversalKeys[id] = (keystrokes != null) focusTraversalKeys[id] = (keystrokes != null)
? Collections.unmodifiableSet(new HashSet(keystrokes)) ? Collections.unmodifiableSet(new HashSet<AWTKeyStroke>(keystrokes))
: null; : null;
} }
firePropertyChange(focusTraversalKeyPropertyNames[id], oldKeys, firePropertyChange(focusTraversalKeyPropertyNames[id], oldKeys,
keystrokes); keystrokes);
} }
final Set getFocusTraversalKeys_NoIDCheck(int id) { final Set<AWTKeyStroke> getFocusTraversalKeys_NoIDCheck(int id) {
// Okay to return Set directly because it is an unmodifiable view // Okay to return Set directly because it is an unmodifiable view
Set keystrokes = (focusTraversalKeys != null) Set<AWTKeyStroke> keystrokes = (focusTraversalKeys != null)
? focusTraversalKeys[id] ? focusTraversalKeys[id]
: null; : null;
...@@ -7686,7 +7680,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -7686,7 +7680,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
Window window = getContainingWindow(); Window window = getContainingWindow();
if (window == null || !((Window)window).isFocusableWindow()) { if (window == null || !window.isFocusableWindow()) {
if (focusLog.isLoggable(PlatformLogger.FINEST)) { if (focusLog.isLoggable(PlatformLogger.FINEST)) {
focusLog.finest("Component doesn't have toplevel"); focusLog.finest("Component doesn't have toplevel");
} }
...@@ -8025,7 +8019,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -8025,7 +8019,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
popup.parent.remove(popup); popup.parent.remove(popup);
} }
if (popups == null) { if (popups == null) {
popups = new Vector(); popups = new Vector<PopupMenu>();
} }
popups.addElement(popup); popups.addElement(popup);
popup.parent = this; popup.parent = this;
...@@ -8044,6 +8038,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -8044,6 +8038,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #add(PopupMenu) * @see #add(PopupMenu)
* @since JDK1.1 * @since JDK1.1
*/ */
@SuppressWarnings("unchecked")
public void remove(MenuComponent popup) { public void remove(MenuComponent popup) {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
if (popups == null) { if (popups == null) {
...@@ -8556,26 +8551,26 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -8556,26 +8551,26 @@ public abstract class Component implements ImageObserver, MenuContainer,
// //
// Swing classes MUST be loaded by the bootstrap class loader, // Swing classes MUST be loaded by the bootstrap class loader,
// otherwise we don't consider them. // otherwise we don't consider them.
for (Class klass = Component.this.getClass(); klass != null; for (Class<?> klass = Component.this.getClass(); klass != null;
klass = klass.getSuperclass()) { klass = klass.getSuperclass()) {
if (klass.getPackage() == swingPackage && if (klass.getPackage() == swingPackage &&
klass.getClassLoader() == null) { klass.getClassLoader() == null) {
final Class swingClass = klass; final Class<?> swingClass = klass;
// Find the first override of the compWriteObjectNotify method // Find the first override of the compWriteObjectNotify method
Method[] methods = (Method[])AccessController.doPrivileged( Method[] methods = AccessController.doPrivileged(
new PrivilegedAction() { new PrivilegedAction<Method[]>() {
public Object run() { public Method[] run() {
return swingClass.getDeclaredMethods(); return swingClass.getDeclaredMethods();
} }
}); });
for (int counter = methods.length - 1; counter >= 0; for (int counter = methods.length - 1; counter >= 0;
counter--) { counter--) {
final Method method = methods[counter]; final Method method = methods[counter];
if (method.getName().equals("compWriteObjectNotify")){ if (method.getName().equals("compWriteObjectNotify")){
// We found it, use doPrivileged to make it accessible // We found it, use doPrivileged to make it accessible
// to use. // to use.
AccessController.doPrivileged(new PrivilegedAction() { AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Object run() { public Void run() {
method.setAccessible(true); method.setAccessible(true);
return null; return null;
} }
...@@ -8804,7 +8799,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -8804,7 +8799,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (popups != null) { if (popups != null) {
int npopups = popups.size(); int npopups = popups.size();
for (int i = 0 ; i < npopups ; i++) { for (int i = 0 ; i < npopups ; i++) {
PopupMenu popup = (PopupMenu)popups.elementAt(i); PopupMenu popup = popups.elementAt(i);
popup.parent = this; popup.parent = this;
} }
} }
...@@ -9658,7 +9653,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -9658,7 +9653,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
if (obj == null) return false; if (obj == null) return false;
if (className == null) return false; if (className == null) return false;
Class cls = obj.getClass(); Class<?> cls = obj.getClass();
while (cls != null) { while (cls != null) {
if (cls.getName().equals(className)) { if (cls.getName().equals(className)) {
return true; return true;
......
...@@ -254,7 +254,7 @@ public class Font implements java.io.Serializable ...@@ -254,7 +254,7 @@ public class Font implements java.io.Serializable
* @serial * @serial
* @see #getAttributes() * @see #getAttributes()
*/ */
private Hashtable fRequestedAttributes; private Hashtable<Object, Object> fRequestedAttributes;
/* /*
* Constants to be used for logical font family names. * Constants to be used for logical font family names.
...@@ -446,6 +446,7 @@ public class Font implements java.io.Serializable ...@@ -446,6 +446,7 @@ public class Font implements java.io.Serializable
// We implement this functionality in a package-private method // We implement this functionality in a package-private method
// to insure that it cannot be overridden by client subclasses. // to insure that it cannot be overridden by client subclasses.
// DO NOT INVOKE CLIENT CODE ON THIS THREAD! // DO NOT INVOKE CLIENT CODE ON THIS THREAD!
@SuppressWarnings("deprecation")
final FontPeer getPeer_NoClientCode() { final FontPeer getPeer_NoClientCode() {
if(peer == null) { if(peer == null) {
Toolkit tk = Toolkit.getDefaultToolkit(); Toolkit tk = Toolkit.getDefaultToolkit();
...@@ -907,11 +908,11 @@ public class Font implements java.io.Serializable ...@@ -907,11 +908,11 @@ public class Font implements java.io.Serializable
break; break;
} }
if (tracker != null) { if (tracker != null) {
if (totalSize+bytesRead > tracker.MAX_FILE_SIZE) { if (totalSize+bytesRead > CreatedFontTracker.MAX_FILE_SIZE) {
throw new IOException("File too big."); throw new IOException("File too big.");
} }
if (totalSize+tracker.getNumBytes() > if (totalSize+tracker.getNumBytes() >
tracker.MAX_TOTAL_BYTES) CreatedFontTracker.MAX_TOTAL_BYTES)
{ {
throw new IOException("Total files too big."); throw new IOException("Total files too big.");
} }
...@@ -2126,11 +2127,11 @@ public class Font implements java.io.Serializable ...@@ -2126,11 +2127,11 @@ public class Font implements java.io.Serializable
return false; // REMIND always safe, but prevents caller optimize return false; // REMIND always safe, but prevents caller optimize
} }
private transient SoftReference flmref; private transient SoftReference<FontLineMetrics> flmref;
private FontLineMetrics defaultLineMetrics(FontRenderContext frc) { private FontLineMetrics defaultLineMetrics(FontRenderContext frc) {
FontLineMetrics flm = null; FontLineMetrics flm = null;
if (flmref == null if (flmref == null
|| (flm = (FontLineMetrics)flmref.get()) == null || (flm = flmref.get()) == null
|| !flm.frc.equals(frc)) { || !flm.frc.equals(frc)) {
/* The device transform in the frc is not used in obtaining line /* The device transform in the frc is not used in obtaining line
...@@ -2194,7 +2195,7 @@ public class Font implements java.io.Serializable ...@@ -2194,7 +2195,7 @@ public class Font implements java.io.Serializable
ssOffset, italicAngle); ssOffset, italicAngle);
flm = new FontLineMetrics(0, cm, frc); flm = new FontLineMetrics(0, cm, frc);
flmref = new SoftReference(flm); flmref = new SoftReference<FontLineMetrics>(flm);
} }
return (FontLineMetrics)flm.clone(); return (FontLineMetrics)flm.clone();
......
...@@ -706,9 +706,9 @@ public abstract class Toolkit { ...@@ -706,9 +706,9 @@ public abstract class Toolkit {
final Properties properties = new Properties(); final Properties properties = new Properties();
atNames = (String)java.security.AccessController.doPrivileged( atNames = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() { new java.security.PrivilegedAction<String>() {
public Object run() { public String run() {
// Try loading the per-user accessibility properties file. // Try loading the per-user accessibility properties file.
try { try {
...@@ -798,7 +798,7 @@ public abstract class Toolkit { ...@@ -798,7 +798,7 @@ public abstract class Toolkit {
while (parser.hasMoreTokens()) { while (parser.hasMoreTokens()) {
atName = parser.nextToken(); atName = parser.nextToken();
try { try {
Class clazz; Class<?> clazz;
if (cl != null) { if (cl != null) {
clazz = cl.loadClass(atName); clazz = cl.loadClass(atName);
} else { } else {
...@@ -860,8 +860,8 @@ public abstract class Toolkit { ...@@ -860,8 +860,8 @@ public abstract class Toolkit {
java.lang.Compiler.disable(); java.lang.Compiler.disable();
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() { new java.security.PrivilegedAction<Void>() {
public Object run() { public Void run() {
String nm = null; String nm = null;
Class cls = null; Class cls = null;
try { try {
...@@ -1653,8 +1653,8 @@ public abstract class Toolkit { ...@@ -1653,8 +1653,8 @@ public abstract class Toolkit {
static { static {
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() { new java.security.PrivilegedAction<Void>() {
public Object run() { public Void run() {
try { try {
resources = resources =
ResourceBundle.getBundle("sun.awt.resources.awt", ResourceBundle.getBundle("sun.awt.resources.awt",
...@@ -1984,7 +1984,7 @@ public abstract class Toolkit { ...@@ -1984,7 +1984,7 @@ public abstract class Toolkit {
private int[] calls = new int[LONG_BITS]; private int[] calls = new int[LONG_BITS];
private static volatile long enabledOnToolkitMask; private static volatile long enabledOnToolkitMask;
private AWTEventListener eventListener = null; private AWTEventListener eventListener = null;
private WeakHashMap listener2SelectiveListener = new WeakHashMap(); private WeakHashMap<AWTEventListener, SelectiveAWTEventListener> listener2SelectiveListener = new WeakHashMap<>();
/* /*
* Extracts a "pure" AWTEventListener from a AWTEventListenerProxy, * Extracts a "pure" AWTEventListener from a AWTEventListenerProxy,
...@@ -2051,7 +2051,7 @@ public abstract class Toolkit { ...@@ -2051,7 +2051,7 @@ public abstract class Toolkit {
} }
synchronized (this) { synchronized (this) {
SelectiveAWTEventListener selectiveListener = SelectiveAWTEventListener selectiveListener =
(SelectiveAWTEventListener)listener2SelectiveListener.get(localL); listener2SelectiveListener.get(localL);
if (selectiveListener == null) { if (selectiveListener == null) {
// Create a new selectiveListener. // Create a new selectiveListener.
...@@ -2121,7 +2121,7 @@ public abstract class Toolkit { ...@@ -2121,7 +2121,7 @@ public abstract class Toolkit {
synchronized (this) { synchronized (this) {
SelectiveAWTEventListener selectiveListener = SelectiveAWTEventListener selectiveListener =
(SelectiveAWTEventListener)listener2SelectiveListener.get(localL); listener2SelectiveListener.get(localL);
if (selectiveListener != null) { if (selectiveListener != null) {
listener2SelectiveListener.remove(localL); listener2SelectiveListener.remove(localL);
...@@ -2244,7 +2244,7 @@ public abstract class Toolkit { ...@@ -2244,7 +2244,7 @@ public abstract class Toolkit {
synchronized (this) { synchronized (this) {
EventListener[] la = ToolkitEventMulticaster.getListeners(eventListener,AWTEventListener.class); EventListener[] la = ToolkitEventMulticaster.getListeners(eventListener,AWTEventListener.class);
java.util.List list = new ArrayList(la.length); java.util.List<AWTEventListenerProxy> list = new ArrayList<>(la.length);
for (int i = 0; i < la.length; i++) { for (int i = 0; i < la.length; i++) {
SelectiveAWTEventListener sael = (SelectiveAWTEventListener)la[i]; SelectiveAWTEventListener sael = (SelectiveAWTEventListener)la[i];
...@@ -2254,7 +2254,7 @@ public abstract class Toolkit { ...@@ -2254,7 +2254,7 @@ public abstract class Toolkit {
sael.getListener())); sael.getListener()));
} }
} }
return (AWTEventListener[])list.toArray(new AWTEventListener[0]); return list.toArray(new AWTEventListener[0]);
} }
} }
...@@ -2457,7 +2457,9 @@ public abstract class Toolkit { ...@@ -2457,7 +2457,9 @@ public abstract class Toolkit {
} }
} }
@SuppressWarnings("serial")
private static class DesktopPropertyChangeSupport extends PropertyChangeSupport { private static class DesktopPropertyChangeSupport extends PropertyChangeSupport {
private static final StringBuilder PROP_CHANGE_SUPPORT_KEY = private static final StringBuilder PROP_CHANGE_SUPPORT_KEY =
new StringBuilder("desktop property change support key"); new StringBuilder("desktop property change support key");
private final Object source; private final Object source;
......
...@@ -357,7 +357,7 @@ public abstract class ColorModel implements Transparency{ ...@@ -357,7 +357,7 @@ public abstract class ColorModel implements Transparency{
this.transparency = transparency; this.transparency = transparency;
} }
nBits = (int[]) bits.clone(); nBits = bits.clone();
this.pixel_bits = pixel_bits; this.pixel_bits = pixel_bits;
if (pixel_bits <= 0) { if (pixel_bits <= 0) {
throw new IllegalArgumentException("Number of pixel bits must "+ throw new IllegalArgumentException("Number of pixel bits must "+
...@@ -474,7 +474,7 @@ public abstract class ColorModel implements Transparency{ ...@@ -474,7 +474,7 @@ public abstract class ColorModel implements Transparency{
*/ */
public int[] getComponentSize() { public int[] getComponentSize() {
if (nBits != null) { if (nBits != null) {
return (int[]) nBits.clone(); return nBits.clone();
} }
return null; return null;
...@@ -1692,10 +1692,10 @@ public abstract class ColorModel implements Transparency{ ...@@ -1692,10 +1692,10 @@ public abstract class ColorModel implements Transparency{
static short[] s8Tol16 = null; // 8-bit non-linear sRGB to 16-bit linear LUT static short[] s8Tol16 = null; // 8-bit non-linear sRGB to 16-bit linear LUT
// Maps to hold LUTs for grayscale conversions // Maps to hold LUTs for grayscale conversions
static Map g8Tos8Map = null; // 8-bit gray values to 8-bit sRGB values static Map<ICC_ColorSpace, byte[]> g8Tos8Map = null; // 8-bit gray values to 8-bit sRGB values
static Map lg16Toog8Map = null; // 16-bit linear to 8-bit "other" gray static Map<ICC_ColorSpace, byte[]> lg16Toog8Map = null; // 16-bit linear to 8-bit "other" gray
static Map g16Tos8Map = null; // 16-bit gray values to 8-bit sRGB values static Map<ICC_ColorSpace, byte[]> g16Tos8Map = null; // 16-bit gray values to 8-bit sRGB values
static Map lg16Toog16Map = null; // 16-bit linear to 16-bit "other" gray static Map<ICC_ColorSpace, short[]> lg16Toog16Map = null; // 16-bit linear to 16-bit "other" gray
static boolean isLinearRGBspace(ColorSpace cs) { static boolean isLinearRGBspace(ColorSpace cs) {
// Note: CMM.LINEAR_RGBspace will be null if the linear // Note: CMM.LINEAR_RGBspace will be null if the linear
...@@ -1799,7 +1799,7 @@ public abstract class ColorModel implements Transparency{ ...@@ -1799,7 +1799,7 @@ public abstract class ColorModel implements Transparency{
return getLinearRGB8TosRGB8LUT(); return getLinearRGB8TosRGB8LUT();
} }
if (g8Tos8Map != null) { if (g8Tos8Map != null) {
byte[] g8Tos8LUT = (byte []) g8Tos8Map.get(grayCS); byte[] g8Tos8LUT = g8Tos8Map.get(grayCS);
if (g8Tos8LUT != null) { if (g8Tos8LUT != null) {
return g8Tos8LUT; return g8Tos8LUT;
} }
...@@ -1827,7 +1827,7 @@ public abstract class ColorModel implements Transparency{ ...@@ -1827,7 +1827,7 @@ public abstract class ColorModel implements Transparency{
g8Tos8LUT[i] = tmp[j]; g8Tos8LUT[i] = tmp[j];
} }
if (g8Tos8Map == null) { if (g8Tos8Map == null) {
g8Tos8Map = Collections.synchronizedMap(new WeakHashMap(2)); g8Tos8Map = Collections.synchronizedMap(new WeakHashMap<ICC_ColorSpace, byte[]>(2));
} }
g8Tos8Map.put(grayCS, g8Tos8LUT); g8Tos8Map.put(grayCS, g8Tos8LUT);
return g8Tos8LUT; return g8Tos8LUT;
...@@ -1840,7 +1840,7 @@ public abstract class ColorModel implements Transparency{ ...@@ -1840,7 +1840,7 @@ public abstract class ColorModel implements Transparency{
*/ */
static byte[] getLinearGray16ToOtherGray8LUT(ICC_ColorSpace grayCS) { static byte[] getLinearGray16ToOtherGray8LUT(ICC_ColorSpace grayCS) {
if (lg16Toog8Map != null) { if (lg16Toog8Map != null) {
byte[] lg16Toog8LUT = (byte []) lg16Toog8Map.get(grayCS); byte[] lg16Toog8LUT = lg16Toog8Map.get(grayCS);
if (lg16Toog8LUT != null) { if (lg16Toog8LUT != null) {
return lg16Toog8LUT; return lg16Toog8LUT;
} }
...@@ -1866,7 +1866,7 @@ public abstract class ColorModel implements Transparency{ ...@@ -1866,7 +1866,7 @@ public abstract class ColorModel implements Transparency{
(byte) (((float) (tmp[i] & 0xffff)) * (1.0f /257.0f) + 0.5f); (byte) (((float) (tmp[i] & 0xffff)) * (1.0f /257.0f) + 0.5f);
} }
if (lg16Toog8Map == null) { if (lg16Toog8Map == null) {
lg16Toog8Map = Collections.synchronizedMap(new WeakHashMap(2)); lg16Toog8Map = Collections.synchronizedMap(new WeakHashMap<ICC_ColorSpace, byte[]>(2));
} }
lg16Toog8Map.put(grayCS, lg16Toog8LUT); lg16Toog8Map.put(grayCS, lg16Toog8LUT);
return lg16Toog8LUT; return lg16Toog8LUT;
...@@ -1884,7 +1884,7 @@ public abstract class ColorModel implements Transparency{ ...@@ -1884,7 +1884,7 @@ public abstract class ColorModel implements Transparency{
return getLinearRGB16TosRGB8LUT(); return getLinearRGB16TosRGB8LUT();
} }
if (g16Tos8Map != null) { if (g16Tos8Map != null) {
byte[] g16Tos8LUT = (byte []) g16Tos8Map.get(grayCS); byte[] g16Tos8LUT = g16Tos8Map.get(grayCS);
if (g16Tos8LUT != null) { if (g16Tos8LUT != null) {
return g16Tos8LUT; return g16Tos8LUT;
} }
...@@ -1916,7 +1916,7 @@ public abstract class ColorModel implements Transparency{ ...@@ -1916,7 +1916,7 @@ public abstract class ColorModel implements Transparency{
(byte) (((float) (tmp[j] & 0xffff)) * (1.0f /257.0f) + 0.5f); (byte) (((float) (tmp[j] & 0xffff)) * (1.0f /257.0f) + 0.5f);
} }
if (g16Tos8Map == null) { if (g16Tos8Map == null) {
g16Tos8Map = Collections.synchronizedMap(new WeakHashMap(2)); g16Tos8Map = Collections.synchronizedMap(new WeakHashMap<ICC_ColorSpace, byte[]>(2));
} }
g16Tos8Map.put(grayCS, g16Tos8LUT); g16Tos8Map.put(grayCS, g16Tos8LUT);
return g16Tos8LUT; return g16Tos8LUT;
...@@ -1929,7 +1929,7 @@ public abstract class ColorModel implements Transparency{ ...@@ -1929,7 +1929,7 @@ public abstract class ColorModel implements Transparency{
*/ */
static short[] getLinearGray16ToOtherGray16LUT(ICC_ColorSpace grayCS) { static short[] getLinearGray16ToOtherGray16LUT(ICC_ColorSpace grayCS) {
if (lg16Toog16Map != null) { if (lg16Toog16Map != null) {
short[] lg16Toog16LUT = (short []) lg16Toog16Map.get(grayCS); short[] lg16Toog16LUT = lg16Toog16Map.get(grayCS);
if (lg16Toog16LUT != null) { if (lg16Toog16LUT != null) {
return lg16Toog16LUT; return lg16Toog16LUT;
} }
...@@ -1950,7 +1950,7 @@ public abstract class ColorModel implements Transparency{ ...@@ -1950,7 +1950,7 @@ public abstract class ColorModel implements Transparency{
transformList); transformList);
short[] lg16Toog16LUT = t.colorConvert(tmp, null); short[] lg16Toog16LUT = t.colorConvert(tmp, null);
if (lg16Toog16Map == null) { if (lg16Toog16Map == null) {
lg16Toog16Map = Collections.synchronizedMap(new WeakHashMap(2)); lg16Toog16Map = Collections.synchronizedMap(new WeakHashMap<ICC_ColorSpace, short[]>(2));
} }
lg16Toog16Map.put(grayCS, lg16Toog16LUT); lg16Toog16Map.put(grayCS, lg16Toog16LUT);
return lg16Toog16LUT; return lg16Toog16LUT;
......
...@@ -60,7 +60,8 @@ public final class Boolean implements java.io.Serializable, ...@@ -60,7 +60,8 @@ public final class Boolean implements java.io.Serializable,
* *
* @since JDK1.1 * @since JDK1.1
*/ */
public static final Class<Boolean> TYPE = Class.getPrimitiveClass("boolean"); @SuppressWarnings("unchecked")
public static final Class<Boolean> TYPE = (Class<Boolean>) Class.getPrimitiveClass("boolean");
/** /**
* The value of the Boolean. * The value of the Boolean.
......
...@@ -59,6 +59,7 @@ public final class Byte extends Number implements Comparable<Byte> { ...@@ -59,6 +59,7 @@ public final class Byte extends Number implements Comparable<Byte> {
* The {@code Class} instance representing the primitive type * The {@code Class} instance representing the primitive type
* {@code byte}. * {@code byte}.
*/ */
@SuppressWarnings("unchecked")
public static final Class<Byte> TYPE = (Class<Byte>) Class.getPrimitiveClass("byte"); public static final Class<Byte> TYPE = (Class<Byte>) Class.getPrimitiveClass("byte");
/** /**
......
...@@ -172,7 +172,7 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -172,7 +172,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* @since 1.1 * @since 1.1
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static final Class<Character> TYPE = Class.getPrimitiveClass("char"); public static final Class<Character> TYPE = (Class<Character>) Class.getPrimitiveClass("char");
/* /*
* Normative general types * Normative general types
......
...@@ -101,6 +101,8 @@ class CharacterName { ...@@ -101,6 +101,8 @@ class CharacterName {
if (lookup[cp>>8] == null || if (lookup[cp>>8] == null ||
(off = lookup[cp>>8][cp&0xff]) == 0) (off = lookup[cp>>8][cp&0xff]) == 0)
return null; return null;
return new String(strPool, 0, off >>> 8, off & 0xff); // ASCII @SuppressWarnings("deprecation")
String result = new String(strPool, 0, off >>> 8, off & 0xff); // ASCII
return result;
} }
} }
...@@ -631,6 +631,7 @@ public final ...@@ -631,6 +631,7 @@ public final
* <cite>The Java&trade; Virtual Machine Specification</cite> * <cite>The Java&trade; Virtual Machine Specification</cite>
* @since 1.5 * @since 1.5
*/ */
@SuppressWarnings("unchecked")
public TypeVariable<Class<T>>[] getTypeParameters() { public TypeVariable<Class<T>>[] getTypeParameters() {
if (getGenericSignature() != null) if (getGenericSignature() != null)
return (TypeVariable<Class<T>>[])getGenericInfo().getTypeParameters(); return (TypeVariable<Class<T>>[])getGenericInfo().getTypeParameters();
...@@ -1303,7 +1304,7 @@ public final ...@@ -1303,7 +1304,7 @@ public final
return java.security.AccessController.doPrivileged( return java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Class<?>[]>() { new java.security.PrivilegedAction<Class<?>[]>() {
public Class[] run() { public Class<?>[] run() {
List<Class<?>> list = new ArrayList<>(); List<Class<?>> list = new ArrayList<>();
Class<?> currentClass = Class.this; Class<?> currentClass = Class.this;
while (currentClass != null) { while (currentClass != null) {
...@@ -1315,7 +1316,7 @@ public final ...@@ -1315,7 +1316,7 @@ public final
} }
currentClass = currentClass.getSuperclass(); currentClass = currentClass.getSuperclass();
} }
return list.toArray(new Class[0]); return list.toArray(new Class<?>[0]);
} }
}); });
} }
...@@ -2150,7 +2151,7 @@ public final ...@@ -2150,7 +2151,7 @@ public final
* Return the Virtual Machine's Class object for the named * Return the Virtual Machine's Class object for the named
* primitive type. * primitive type.
*/ */
static native Class getPrimitiveClass(String name); static native Class<?> getPrimitiveClass(String name);
/* /*
...@@ -2395,7 +2396,9 @@ public final ...@@ -2395,7 +2396,9 @@ public final
} }
// No cached value available; request value from VM // No cached value available; request value from VM
if (isInterface()) { if (isInterface()) {
res = new Constructor[0]; @SuppressWarnings("unchecked")
Constructor<T>[] temporaryRes = (Constructor<T>[]) new Constructor<?>[0];
res = temporaryRes;
} else { } else {
res = getDeclaredConstructors0(publicOnly); res = getDeclaredConstructors0(publicOnly);
} }
...@@ -2951,7 +2954,9 @@ public final ...@@ -2951,7 +2954,9 @@ public final
return null; return null;
} }
}); });
enumConstants = (T[])values.invoke(null); @SuppressWarnings("unchecked")
T[] temporaryConstants = (T[])values.invoke(null);
enumConstants = temporaryConstants;
} }
// These can happen when users concoct enum-like classes // These can happen when users concoct enum-like classes
// that don't comply with the enum spec. // that don't comply with the enum spec.
...@@ -2996,6 +3001,7 @@ public final ...@@ -2996,6 +3001,7 @@ public final
* *
* @since 1.5 * @since 1.5
*/ */
@SuppressWarnings("unchecked")
public T cast(Object obj) { public T cast(Object obj) {
if (obj != null && !isInstance(obj)) if (obj != null && !isInstance(obj))
throw new ClassCastException(cannotCastMsg(obj)); throw new ClassCastException(cannotCastMsg(obj));
...@@ -3026,6 +3032,7 @@ public final ...@@ -3026,6 +3032,7 @@ public final
* the class itself). * the class itself).
* @since 1.5 * @since 1.5
*/ */
@SuppressWarnings("unchecked")
public <U> Class<? extends U> asSubclass(Class<U> clazz) { public <U> Class<? extends U> asSubclass(Class<U> clazz) {
if (clazz.isAssignableFrom(this)) if (clazz.isAssignableFrom(this))
return (Class<? extends U>) this; return (Class<? extends U>) this;
...@@ -3037,6 +3044,7 @@ public final ...@@ -3037,6 +3044,7 @@ public final
* @throws NullPointerException {@inheritDoc} * @throws NullPointerException {@inheritDoc}
* @since 1.5 * @since 1.5
*/ */
@SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(Class<A> annotationClass) { public <A extends Annotation> A getAnnotation(Class<A> annotationClass) {
if (annotationClass == null) if (annotationClass == null)
throw new NullPointerException(); throw new NullPointerException();
......
...@@ -1167,7 +1167,8 @@ public abstract class ClassLoader { ...@@ -1167,7 +1167,8 @@ public abstract class ClassLoader {
* @since 1.2 * @since 1.2
*/ */
public Enumeration<URL> getResources(String name) throws IOException { public Enumeration<URL> getResources(String name) throws IOException {
Enumeration[] tmp = new Enumeration[2]; @SuppressWarnings("unchecked")
Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2];
if (parent != null) { if (parent != null) {
tmp[0] = parent.getResources(name); tmp[0] = parent.getResources(name);
} else { } else {
......
...@@ -92,15 +92,15 @@ final class ConditionalSpecialCasing { ...@@ -92,15 +92,15 @@ final class ConditionalSpecialCasing {
}; };
// A hash table that contains the above entries // A hash table that contains the above entries
static Hashtable entryTable = new Hashtable(); static Hashtable<Integer, HashSet<Entry>> entryTable = new Hashtable<>();
static { static {
// create hashtable from the entry // create hashtable from the entry
for (int i = 0; i < entry.length; i ++) { for (int i = 0; i < entry.length; i ++) {
Entry cur = entry[i]; Entry cur = entry[i];
Integer cp = new Integer(cur.getCodePoint()); Integer cp = new Integer(cur.getCodePoint());
HashSet set = (HashSet)entryTable.get(cp); HashSet<Entry> set = entryTable.get(cp);
if (set == null) { if (set == null) {
set = new HashSet(); set = new HashSet<Entry>();
} }
set.add(cur); set.add(cur);
entryTable.put(cp, set); entryTable.put(cp, set);
...@@ -151,13 +151,13 @@ final class ConditionalSpecialCasing { ...@@ -151,13 +151,13 @@ final class ConditionalSpecialCasing {
} }
private static char[] lookUpTable(String src, int index, Locale locale, boolean bLowerCasing) { private static char[] lookUpTable(String src, int index, Locale locale, boolean bLowerCasing) {
HashSet set = (HashSet)entryTable.get(new Integer(src.codePointAt(index))); HashSet<Entry> set = entryTable.get(new Integer(src.codePointAt(index)));
if (set != null) { if (set != null) {
Iterator iter = set.iterator(); Iterator<Entry> iter = set.iterator();
String currentLang = locale.getLanguage(); String currentLang = locale.getLanguage();
while (iter.hasNext()) { while (iter.hasNext()) {
Entry entry = (Entry)iter.next(); Entry entry = iter.next();
String conditionLang= entry.getLanguage(); String conditionLang= entry.getLanguage();
if (((conditionLang == null) || (conditionLang.equals(currentLang))) && if (((conditionLang == null) || (conditionLang.equals(currentLang))) &&
isConditionMet(src, index, locale, entry.getCondition())) { isConditionMet(src, index, locale, entry.getCondition())) {
......
...@@ -128,6 +128,7 @@ public final class Double extends Number implements Comparable<Double> { ...@@ -128,6 +128,7 @@ public final class Double extends Number implements Comparable<Double> {
* *
* @since JDK1.1 * @since JDK1.1
*/ */
@SuppressWarnings("unchecked")
public static final Class<Double> TYPE = (Class<Double>) Class.getPrimitiveClass("double"); public static final Class<Double> TYPE = (Class<Double>) Class.getPrimitiveClass("double");
/** /**
...@@ -715,7 +716,7 @@ public final class Double extends Number implements Comparable<Double> { ...@@ -715,7 +716,7 @@ public final class Double extends Number implements Comparable<Double> {
* @return the {@code double} value represented by this object * @return the {@code double} value represented by this object
*/ */
public double doubleValue() { public double doubleValue() {
return (double)value; return value;
} }
/** /**
......
...@@ -36,6 +36,7 @@ package java.lang; ...@@ -36,6 +36,7 @@ package java.lang;
* @see java.lang.reflect.AnnotatedElement * @see java.lang.reflect.AnnotatedElement
* @since 1.5 * @since 1.5
*/ */
@SuppressWarnings("rawtypes") /* rawtypes are part of the public api */
public class EnumConstantNotPresentException extends RuntimeException { public class EnumConstantNotPresentException extends RuntimeException {
private static final long serialVersionUID = -6046998521960521108L; private static final long serialVersionUID = -6046998521960521108L;
......
...@@ -126,7 +126,8 @@ public final class Float extends Number implements Comparable<Float> { ...@@ -126,7 +126,8 @@ public final class Float extends Number implements Comparable<Float> {
* *
* @since JDK1.1 * @since JDK1.1
*/ */
public static final Class<Float> TYPE = Class.getPrimitiveClass("float"); @SuppressWarnings("unchecked")
public static final Class<Float> TYPE = (Class<Float>) Class.getPrimitiveClass("float");
/** /**
* Returns a string representation of the {@code float} * Returns a string representation of the {@code float}
......
...@@ -68,6 +68,7 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -68,6 +68,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* *
* @since JDK1.1 * @since JDK1.1
*/ */
@SuppressWarnings("unchecked")
public static final Class<Integer> TYPE = (Class<Integer>) Class.getPrimitiveClass("int"); public static final Class<Integer> TYPE = (Class<Integer>) Class.getPrimitiveClass("int");
/** /**
......
...@@ -66,6 +66,7 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -66,6 +66,7 @@ public final class Long extends Number implements Comparable<Long> {
* *
* @since JDK1.1 * @since JDK1.1
*/ */
@SuppressWarnings("unchecked")
public static final Class<Long> TYPE = (Class<Long>) Class.getPrimitiveClass("long"); public static final Class<Long> TYPE = (Class<Long>) Class.getPrimitiveClass("long");
/** /**
...@@ -734,7 +735,7 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -734,7 +735,7 @@ public final class Long extends Number implements Comparable<Long> {
* {@code long} value. * {@code long} value.
*/ */
public long longValue() { public long longValue() {
return (long)value; return value;
} }
/** /**
......
...@@ -58,6 +58,7 @@ public final class Short extends Number implements Comparable<Short> { ...@@ -58,6 +58,7 @@ public final class Short extends Number implements Comparable<Short> {
* The {@code Class} instance representing the primitive type * The {@code Class} instance representing the primitive type
* {@code short}. * {@code short}.
*/ */
@SuppressWarnings("unchecked")
public static final Class<Short> TYPE = (Class<Short>) Class.getPrimitiveClass("short"); public static final Class<Short> TYPE = (Class<Short>) Class.getPrimitiveClass("short");
/** /**
......
...@@ -1032,7 +1032,7 @@ public final class System { ...@@ -1032,7 +1032,7 @@ public final class System {
*/ */
@Deprecated @Deprecated
public static void runFinalizersOnExit(boolean value) { public static void runFinalizersOnExit(boolean value) {
Runtime.getRuntime().runFinalizersOnExit(value); Runtime.runFinalizersOnExit(value);
} }
/** /**
......
...@@ -144,8 +144,11 @@ public class ThreadLocal<T> { ...@@ -144,8 +144,11 @@ public class ThreadLocal<T> {
ThreadLocalMap map = getMap(t); ThreadLocalMap map = getMap(t);
if (map != null) { if (map != null) {
ThreadLocalMap.Entry e = map.getEntry(this); ThreadLocalMap.Entry e = map.getEntry(this);
if (e != null) if (e != null) {
return (T)e.value; @SuppressWarnings("unchecked")
T result = (T)e.value;
return result;
}
} }
return setInitialValue(); return setInitialValue();
} }
...@@ -268,11 +271,11 @@ public class ThreadLocal<T> { ...@@ -268,11 +271,11 @@ public class ThreadLocal<T> {
* entry can be expunged from table. Such entries are referred to * entry can be expunged from table. Such entries are referred to
* as "stale entries" in the code that follows. * as "stale entries" in the code that follows.
*/ */
static class Entry extends WeakReference<ThreadLocal> { static class Entry extends WeakReference<ThreadLocal<?>> {
/** The value associated with this ThreadLocal. */ /** The value associated with this ThreadLocal. */
Object value; Object value;
Entry(ThreadLocal k, Object v) { Entry(ThreadLocal<?> k, Object v) {
super(k); super(k);
value = v; value = v;
} }
...@@ -325,7 +328,7 @@ public class ThreadLocal<T> { ...@@ -325,7 +328,7 @@ public class ThreadLocal<T> {
* ThreadLocalMaps are constructed lazily, so we only create * ThreadLocalMaps are constructed lazily, so we only create
* one when we have at least one entry to put in it. * one when we have at least one entry to put in it.
*/ */
ThreadLocalMap(ThreadLocal firstKey, Object firstValue) { ThreadLocalMap(ThreadLocal<?> firstKey, Object firstValue) {
table = new Entry[INITIAL_CAPACITY]; table = new Entry[INITIAL_CAPACITY];
int i = firstKey.threadLocalHashCode & (INITIAL_CAPACITY - 1); int i = firstKey.threadLocalHashCode & (INITIAL_CAPACITY - 1);
table[i] = new Entry(firstKey, firstValue); table[i] = new Entry(firstKey, firstValue);
...@@ -348,7 +351,8 @@ public class ThreadLocal<T> { ...@@ -348,7 +351,8 @@ public class ThreadLocal<T> {
for (int j = 0; j < len; j++) { for (int j = 0; j < len; j++) {
Entry e = parentTable[j]; Entry e = parentTable[j];
if (e != null) { if (e != null) {
ThreadLocal key = e.get(); @SuppressWarnings("unchecked")
ThreadLocal<Object> key = (ThreadLocal<Object>) e.get();
if (key != null) { if (key != null) {
Object value = key.childValue(e.value); Object value = key.childValue(e.value);
Entry c = new Entry(key, value); Entry c = new Entry(key, value);
...@@ -372,7 +376,7 @@ public class ThreadLocal<T> { ...@@ -372,7 +376,7 @@ public class ThreadLocal<T> {
* @param key the thread local object * @param key the thread local object
* @return the entry associated with key, or null if no such * @return the entry associated with key, or null if no such
*/ */
private Entry getEntry(ThreadLocal key) { private Entry getEntry(ThreadLocal<?> key) {
int i = key.threadLocalHashCode & (table.length - 1); int i = key.threadLocalHashCode & (table.length - 1);
Entry e = table[i]; Entry e = table[i];
if (e != null && e.get() == key) if (e != null && e.get() == key)
...@@ -390,12 +394,12 @@ public class ThreadLocal<T> { ...@@ -390,12 +394,12 @@ public class ThreadLocal<T> {
* @param e the entry at table[i] * @param e the entry at table[i]
* @return the entry associated with key, or null if no such * @return the entry associated with key, or null if no such
*/ */
private Entry getEntryAfterMiss(ThreadLocal key, int i, Entry e) { private Entry getEntryAfterMiss(ThreadLocal<?> key, int i, Entry e) {
Entry[] tab = table; Entry[] tab = table;
int len = tab.length; int len = tab.length;
while (e != null) { while (e != null) {
ThreadLocal k = e.get(); ThreadLocal<?> k = e.get();
if (k == key) if (k == key)
return e; return e;
if (k == null) if (k == null)
...@@ -413,7 +417,7 @@ public class ThreadLocal<T> { ...@@ -413,7 +417,7 @@ public class ThreadLocal<T> {
* @param key the thread local object * @param key the thread local object
* @param value the value to be set * @param value the value to be set
*/ */
private void set(ThreadLocal key, Object value) { private void set(ThreadLocal<?> key, Object value) {
// We don't use a fast path as with get() because it is at // We don't use a fast path as with get() because it is at
// least as common to use set() to create new entries as // least as common to use set() to create new entries as
...@@ -427,7 +431,7 @@ public class ThreadLocal<T> { ...@@ -427,7 +431,7 @@ public class ThreadLocal<T> {
for (Entry e = tab[i]; for (Entry e = tab[i];
e != null; e != null;
e = tab[i = nextIndex(i, len)]) { e = tab[i = nextIndex(i, len)]) {
ThreadLocal k = e.get(); ThreadLocal<?> k = e.get();
if (k == key) { if (k == key) {
e.value = value; e.value = value;
...@@ -449,7 +453,7 @@ public class ThreadLocal<T> { ...@@ -449,7 +453,7 @@ public class ThreadLocal<T> {
/** /**
* Remove the entry for key. * Remove the entry for key.
*/ */
private void remove(ThreadLocal key) { private void remove(ThreadLocal<?> key) {
Entry[] tab = table; Entry[] tab = table;
int len = tab.length; int len = tab.length;
int i = key.threadLocalHashCode & (len-1); int i = key.threadLocalHashCode & (len-1);
...@@ -479,7 +483,7 @@ public class ThreadLocal<T> { ...@@ -479,7 +483,7 @@ public class ThreadLocal<T> {
* @param staleSlot index of the first stale entry encountered while * @param staleSlot index of the first stale entry encountered while
* searching for key. * searching for key.
*/ */
private void replaceStaleEntry(ThreadLocal key, Object value, private void replaceStaleEntry(ThreadLocal<?> key, Object value,
int staleSlot) { int staleSlot) {
Entry[] tab = table; Entry[] tab = table;
int len = tab.length; int len = tab.length;
...@@ -501,7 +505,7 @@ public class ThreadLocal<T> { ...@@ -501,7 +505,7 @@ public class ThreadLocal<T> {
for (int i = nextIndex(staleSlot, len); for (int i = nextIndex(staleSlot, len);
(e = tab[i]) != null; (e = tab[i]) != null;
i = nextIndex(i, len)) { i = nextIndex(i, len)) {
ThreadLocal k = e.get(); ThreadLocal<?> k = e.get();
// If we find key, then we need to swap it // If we find key, then we need to swap it
// with the stale entry to maintain hash table order. // with the stale entry to maintain hash table order.
...@@ -563,7 +567,7 @@ public class ThreadLocal<T> { ...@@ -563,7 +567,7 @@ public class ThreadLocal<T> {
for (i = nextIndex(staleSlot, len); for (i = nextIndex(staleSlot, len);
(e = tab[i]) != null; (e = tab[i]) != null;
i = nextIndex(i, len)) { i = nextIndex(i, len)) {
ThreadLocal k = e.get(); ThreadLocal<?> k = e.get();
if (k == null) { if (k == null) {
e.value = null; e.value = null;
tab[i] = null; tab[i] = null;
...@@ -650,7 +654,7 @@ public class ThreadLocal<T> { ...@@ -650,7 +654,7 @@ public class ThreadLocal<T> {
for (int j = 0; j < oldLen; ++j) { for (int j = 0; j < oldLen; ++j) {
Entry e = oldTab[j]; Entry e = oldTab[j];
if (e != null) { if (e != null) {
ThreadLocal k = e.get(); ThreadLocal<?> k = e.get();
if (k == null) { if (k == null) {
e.value = null; // Help the GC e.value = null; // Help the GC
} else { } else {
......
...@@ -40,7 +40,8 @@ class Void { ...@@ -40,7 +40,8 @@ class Void {
* The {@code Class} object representing the pseudo-type corresponding to * The {@code Class} object representing the pseudo-type corresponding to
* the keyword {@code void}. * the keyword {@code void}.
*/ */
public static final Class<Void> TYPE = Class.getPrimitiveClass("void"); @SuppressWarnings("unchecked")
public static final Class<Void> TYPE = (Class<Void>) Class.getPrimitiveClass("void");
/* /*
* The Void class cannot be instantiated. * The Void class cannot be instantiated.
......
...@@ -72,6 +72,10 @@ public final class HttpCookie implements Cloneable { ...@@ -72,6 +72,10 @@ public final class HttpCookie implements Cloneable {
private boolean httpOnly; // HttpOnly ... i.e. not accessible to scripts private boolean httpOnly; // HttpOnly ... i.e. not accessible to scripts
private int version = 1; // Version=1 ... RFC 2965 style private int version = 1; // Version=1 ... RFC 2965 style
// The original header this cookie was consructed from, if it was
// constructed by parsing a header, otherwise null.
private final String header;
// Hold the creation time (in seconds) of the http cookie for later // Hold the creation time (in seconds) of the http cookie for later
// expiration calculation // expiration calculation
private final long whenCreated; private final long whenCreated;
...@@ -128,6 +132,10 @@ public final class HttpCookie implements Cloneable { ...@@ -128,6 +132,10 @@ public final class HttpCookie implements Cloneable {
* @see #setVersion * @see #setVersion
*/ */
public HttpCookie(String name, String value) { public HttpCookie(String name, String value) {
this(name, value, null /*header*/);
}
private HttpCookie(String name, String value, String header) {
name = name.trim(); name = name.trim();
if (name.length() == 0 || !isToken(name) || isReserved(name)) { if (name.length() == 0 || !isToken(name) || isReserved(name)) {
throw new IllegalArgumentException("Illegal cookie name"); throw new IllegalArgumentException("Illegal cookie name");
...@@ -140,6 +148,7 @@ public final class HttpCookie implements Cloneable { ...@@ -140,6 +148,7 @@ public final class HttpCookie implements Cloneable {
whenCreated = System.currentTimeMillis(); whenCreated = System.currentTimeMillis();
portlist = null; portlist = null;
this.header = header;
} }
/** /**
...@@ -163,6 +172,15 @@ public final class HttpCookie implements Cloneable { ...@@ -163,6 +172,15 @@ public final class HttpCookie implements Cloneable {
* if the header string is {@code null} * if the header string is {@code null}
*/ */
public static List<HttpCookie> parse(String header) { public static List<HttpCookie> parse(String header) {
return parse(header, false);
}
// Private version of parse() that will store the original header used to
// create the cookie, in the cookie itself. This can be useful for filtering
// Set-Cookie[2] headers, using the internal parsing logic defined in this
// class.
private static List<HttpCookie> parse(String header, boolean retainHeader) {
int version = guessCookieVersion(header); int version = guessCookieVersion(header);
// if header start with set-cookie or set-cookie2, strip it off // if header start with set-cookie or set-cookie2, strip it off
...@@ -178,7 +196,7 @@ public final class HttpCookie implements Cloneable { ...@@ -178,7 +196,7 @@ public final class HttpCookie implements Cloneable {
// so the parse logic is slightly different // so the parse logic is slightly different
if (version == 0) { if (version == 0) {
// Netscape draft cookie // Netscape draft cookie
HttpCookie cookie = parseInternal(header); HttpCookie cookie = parseInternal(header, retainHeader);
cookie.setVersion(0); cookie.setVersion(0);
cookies.add(cookie); cookies.add(cookie);
} else { } else {
...@@ -187,7 +205,7 @@ public final class HttpCookie implements Cloneable { ...@@ -187,7 +205,7 @@ public final class HttpCookie implements Cloneable {
// it'll separate them with comma // it'll separate them with comma
List<String> cookieStrings = splitMultiCookies(header); List<String> cookieStrings = splitMultiCookies(header);
for (String cookieStr : cookieStrings) { for (String cookieStr : cookieStrings) {
HttpCookie cookie = parseInternal(cookieStr); HttpCookie cookie = parseInternal(cookieStr, retainHeader);
cookie.setVersion(1); cookie.setVersion(1);
cookies.add(cookie); cookies.add(cookie);
} }
...@@ -804,7 +822,8 @@ public final class HttpCookie implements Cloneable { ...@@ -804,7 +822,8 @@ public final class HttpCookie implements Cloneable {
* @throws IllegalArgumentException * @throws IllegalArgumentException
* if header string violates the cookie specification * if header string violates the cookie specification
*/ */
private static HttpCookie parseInternal(String header) private static HttpCookie parseInternal(String header,
boolean retainHeader)
{ {
HttpCookie cookie = null; HttpCookie cookie = null;
String namevaluePair = null; String namevaluePair = null;
...@@ -819,7 +838,13 @@ public final class HttpCookie implements Cloneable { ...@@ -819,7 +838,13 @@ public final class HttpCookie implements Cloneable {
if (index != -1) { if (index != -1) {
String name = namevaluePair.substring(0, index).trim(); String name = namevaluePair.substring(0, index).trim();
String value = namevaluePair.substring(index + 1).trim(); String value = namevaluePair.substring(index + 1).trim();
cookie = new HttpCookie(name, stripOffSurroundingQuote(value)); if (retainHeader)
cookie = new HttpCookie(name,
stripOffSurroundingQuote(value),
header);
else
cookie = new HttpCookie(name,
stripOffSurroundingQuote(value));
} else { } else {
// no "=" in name-value pair; it's an error // no "=" in name-value pair; it's an error
throw new IllegalArgumentException("Invalid cookie name-value pair"); throw new IllegalArgumentException("Invalid cookie name-value pair");
...@@ -972,6 +997,28 @@ public final class HttpCookie implements Cloneable { ...@@ -972,6 +997,28 @@ public final class HttpCookie implements Cloneable {
} }
} }
static {
sun.misc.SharedSecrets.setJavaNetHttpCookieAccess(
new sun.misc.JavaNetHttpCookieAccess() {
public List<HttpCookie> parse(String header) {
return HttpCookie.parse(header, true);
}
public String header(HttpCookie cookie) {
return cookie.header;
}
}
);
}
/*
* Returns the original header this cookie was consructed from, if it was
* constructed by parsing a header, otherwise null.
*/
private String header() {
return header;
}
/* /*
* Constructs a string representation of this cookie. The string format is * Constructs a string representation of this cookie. The string format is
* as Netscape spec, but without leading "Cookie:" token. * as Netscape spec, but without leading "Cookie:" token.
......
...@@ -373,11 +373,13 @@ public abstract class FileSystemProvider { ...@@ -373,11 +373,13 @@ public abstract class FileSystemProvider {
{ {
if (options.length > 0) { if (options.length > 0) {
for (OpenOption opt: options) { for (OpenOption opt: options) {
if (opt != StandardOpenOption.READ) // All OpenOption values except for APPEND and WRITE are allowed
if (opt == StandardOpenOption.APPEND ||
opt == StandardOpenOption.WRITE)
throw new UnsupportedOperationException("'" + opt + "' not allowed"); throw new UnsupportedOperationException("'" + opt + "' not allowed");
} }
} }
return Channels.newInputStream(Files.newByteChannel(path)); return Channels.newInputStream(Files.newByteChannel(path, options));
} }
/** /**
......
...@@ -737,10 +737,6 @@ public final class Locale implements Cloneable, Serializable { ...@@ -737,10 +737,6 @@ public final class Locale implements Cloneable, Serializable {
*/ */
public static Locale getDefault() { public static Locale getDefault() {
// do not synchronize this method - see 4071298 // do not synchronize this method - see 4071298
// it's OK if more than one default locale happens to be created
if (defaultLocale == null) {
initDefault();
}
return defaultLocale; return defaultLocale;
} }
...@@ -762,16 +758,23 @@ public final class Locale implements Cloneable, Serializable { ...@@ -762,16 +758,23 @@ public final class Locale implements Cloneable, Serializable {
*/ */
public static Locale getDefault(Locale.Category category) { public static Locale getDefault(Locale.Category category) {
// do not synchronize this method - see 4071298 // do not synchronize this method - see 4071298
// it's OK if more than one default locale happens to be created
switch (category) { switch (category) {
case DISPLAY: case DISPLAY:
if (defaultDisplayLocale == null) { if (defaultDisplayLocale == null) {
initDefault(category); synchronized(Locale.class) {
if (defaultDisplayLocale == null) {
defaultDisplayLocale = initDefault(category);
}
}
} }
return defaultDisplayLocale; return defaultDisplayLocale;
case FORMAT: case FORMAT:
if (defaultFormatLocale == null) { if (defaultFormatLocale == null) {
initDefault(category); synchronized(Locale.class) {
if (defaultFormatLocale == null) {
defaultFormatLocale = initDefault(category);
}
}
} }
return defaultFormatLocale; return defaultFormatLocale;
default: default:
...@@ -780,7 +783,7 @@ public final class Locale implements Cloneable, Serializable { ...@@ -780,7 +783,7 @@ public final class Locale implements Cloneable, Serializable {
return getDefault(); return getDefault();
} }
private static void initDefault() { private static Locale initDefault() {
String language, region, script, country, variant; String language, region, script, country, variant;
language = AccessController.doPrivileged( language = AccessController.doPrivileged(
new GetPropertyAction("user.language", "en")); new GetPropertyAction("user.language", "en"));
...@@ -806,16 +809,12 @@ public final class Locale implements Cloneable, Serializable { ...@@ -806,16 +809,12 @@ public final class Locale implements Cloneable, Serializable {
variant = AccessController.doPrivileged( variant = AccessController.doPrivileged(
new GetPropertyAction("user.variant", "")); new GetPropertyAction("user.variant", ""));
} }
defaultLocale = getInstance(language, script, country, variant, null);
}
private static void initDefault(Locale.Category category) { return getInstance(language, script, country, variant, null);
// make sure defaultLocale is initialized }
if (defaultLocale == null) {
initDefault();
}
Locale defaultCategoryLocale = getInstance( private static Locale initDefault(Locale.Category category) {
return getInstance(
AccessController.doPrivileged( AccessController.doPrivileged(
new GetPropertyAction(category.languageKey, defaultLocale.getLanguage())), new GetPropertyAction(category.languageKey, defaultLocale.getLanguage())),
AccessController.doPrivileged( AccessController.doPrivileged(
...@@ -825,15 +824,6 @@ public final class Locale implements Cloneable, Serializable { ...@@ -825,15 +824,6 @@ public final class Locale implements Cloneable, Serializable {
AccessController.doPrivileged( AccessController.doPrivileged(
new GetPropertyAction(category.variantKey, defaultLocale.getVariant())), new GetPropertyAction(category.variantKey, defaultLocale.getVariant())),
null); null);
switch (category) {
case DISPLAY:
defaultDisplayLocale = defaultCategoryLocale;
break;
case FORMAT:
defaultFormatLocale = defaultCategoryLocale;
break;
}
} }
/** /**
...@@ -1916,9 +1906,9 @@ public final class Locale implements Cloneable, Serializable { ...@@ -1916,9 +1906,9 @@ public final class Locale implements Cloneable, Serializable {
*/ */
private transient volatile int hashCodeValue = 0; private transient volatile int hashCodeValue = 0;
private static Locale defaultLocale = null; private volatile static Locale defaultLocale = initDefault();
private static Locale defaultDisplayLocale = null; private volatile static Locale defaultDisplayLocale = null;
private static Locale defaultFormatLocale = null; private volatile static Locale defaultFormatLocale = null;
/** /**
* Return an array of the display names of the variant. * Return an array of the display names of the variant.
......
...@@ -131,8 +131,9 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E> ...@@ -131,8 +131,9 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
/** /**
* Returns item at index i. * Returns item at index i.
*/ */
@SuppressWarnings("unchecked")
final E itemAt(int i) { final E itemAt(int i) {
return this.<E>cast(items[i]); return (E) items[i];
} }
/** /**
...@@ -162,7 +163,8 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E> ...@@ -162,7 +163,8 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
*/ */
private E extract() { private E extract() {
final Object[] items = this.items; final Object[] items = this.items;
E x = this.<E>cast(items[takeIndex]); @SuppressWarnings("unchecked")
E x = (E) items[takeIndex];
items[takeIndex] = null; items[takeIndex] = null;
takeIndex = inc(takeIndex); takeIndex = inc(takeIndex);
--count; --count;
...@@ -647,7 +649,9 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E> ...@@ -647,7 +649,9 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
int n = 0; int n = 0;
int max = count; int max = count;
while (n < max) { while (n < max) {
c.add(this.<E>cast(items[i])); @SuppressWarnings("unchecked")
E x = (E) items[i];
c.add(x);
items[i] = null; items[i] = null;
i = inc(i); i = inc(i);
++n; ++n;
...@@ -684,7 +688,9 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E> ...@@ -684,7 +688,9 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
int n = 0; int n = 0;
int max = (maxElements < count) ? maxElements : count; int max = (maxElements < count) ? maxElements : count;
while (n < max) { while (n < max) {
c.add(this.<E>cast(items[i])); @SuppressWarnings("unchecked")
E x = (E) items[i];
c.add(x);
items[i] = null; items[i] = null;
i = inc(i); i = inc(i);
++n; ++n;
......
...@@ -37,9 +37,6 @@ package java.util.concurrent; ...@@ -37,9 +37,6 @@ package java.util.concurrent;
import java.util.concurrent.locks.*; import java.util.concurrent.locks.*;
import java.util.*; import java.util.*;
import java.io.Serializable; import java.io.Serializable;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
/** /**
* A hash table supporting full concurrency of retrievals and * A hash table supporting full concurrency of retrievals and
...@@ -228,7 +225,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -228,7 +225,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
static { static {
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = HashEntry.class; Class<?> k = HashEntry.class;
nextOffset = UNSAFE.objectFieldOffset nextOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("next")); (k.getDeclaredField("next"));
} catch (Exception e) { } catch (Exception e) {
...@@ -433,7 +430,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -433,7 +430,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
int newCapacity = oldCapacity << 1; int newCapacity = oldCapacity << 1;
threshold = (int)(newCapacity * loadFactor); threshold = (int)(newCapacity * loadFactor);
HashEntry<K,V>[] newTable = HashEntry<K,V>[] newTable =
(HashEntry<K,V>[]) new HashEntry[newCapacity]; (HashEntry<K,V>[]) new HashEntry<?,?>[newCapacity];
int sizeMask = newCapacity - 1; int sizeMask = newCapacity - 1;
for (int i = 0; i < oldCapacity ; i++) { for (int i = 0; i < oldCapacity ; i++) {
HashEntry<K,V> e = oldTable[i]; HashEntry<K,V> e = oldTable[i];
...@@ -677,7 +674,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -677,7 +674,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
int cap = proto.table.length; int cap = proto.table.length;
float lf = proto.loadFactor; float lf = proto.loadFactor;
int threshold = (int)(cap * lf); int threshold = (int)(cap * lf);
HashEntry<K,V>[] tab = (HashEntry<K,V>[])new HashEntry[cap]; HashEntry<K,V>[] tab = (HashEntry<K,V>[])new HashEntry<?,?>[cap];
if ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u)) if ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u))
== null) { // recheck == null) { // recheck
Segment<K,V> s = new Segment<K,V>(lf, threshold, tab); Segment<K,V> s = new Segment<K,V>(lf, threshold, tab);
...@@ -694,7 +691,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -694,7 +691,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
// Hash-based segment and entry accesses // Hash-based segment and entry accesses
/** /**
* Get the segment for the given hash * Gets the segment for the given hash code.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private Segment<K,V> segmentForHash(int h) { private Segment<K,V> segmentForHash(int h) {
...@@ -703,7 +700,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -703,7 +700,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
} }
/** /**
* Gets the table entry for the given segment and hash * Gets the table entry for the given segment and hash code.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
static final <K,V> HashEntry<K,V> entryForHash(Segment<K,V> seg, int h) { static final <K,V> HashEntry<K,V> entryForHash(Segment<K,V> seg, int h) {
...@@ -758,8 +755,8 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -758,8 +755,8 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
// create segments and segments[0] // create segments and segments[0]
Segment<K,V> s0 = Segment<K,V> s0 =
new Segment<K,V>(loadFactor, (int)(cap * loadFactor), new Segment<K,V>(loadFactor, (int)(cap * loadFactor),
(HashEntry<K,V>[])new HashEntry[cap]); (HashEntry<K,V>[])new HashEntry<?,?>[cap]);
Segment<K,V>[] ss = (Segment<K,V>[])new Segment[ssize]; Segment<K,V>[] ss = (Segment<K,V>[])new Segment<?,?>[ssize];
UNSAFE.putOrderedObject(ss, SBASE, s0); // ordered write of segments[0] UNSAFE.putOrderedObject(ss, SBASE, s0); // ordered write of segments[0]
this.segments = ss; this.segments = ss;
} }
...@@ -916,6 +913,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -916,6 +913,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
* *
* @throws NullPointerException if the specified key is null * @throws NullPointerException if the specified key is null
*/ */
@SuppressWarnings("unchecked")
public V get(Object key) { public V get(Object key) {
Segment<K,V> s; // manually integrate access methods to reduce overhead Segment<K,V> s; // manually integrate access methods to reduce overhead
HashEntry<K,V>[] tab; HashEntry<K,V>[] tab;
...@@ -1026,7 +1024,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -1026,7 +1024,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
* full compatibility with class {@link java.util.Hashtable}, * full compatibility with class {@link java.util.Hashtable},
* which supported this method prior to introduction of the * which supported this method prior to introduction of the
* Java Collections framework. * Java Collections framework.
*
* @param value a value to search for * @param value a value to search for
* @return <tt>true</tt> if and only if some key maps to the * @return <tt>true</tt> if and only if some key maps to the
* <tt>value</tt> argument in this table as * <tt>value</tt> argument in this table as
...@@ -1262,7 +1260,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -1262,7 +1260,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
} }
/** /**
* Set nextEntry to first node of next non-empty table * Sets nextEntry to first node of next non-empty table
* (in backwards order, to simplify checks). * (in backwards order, to simplify checks).
*/ */
final void advance() { final void advance() {
...@@ -1326,12 +1324,14 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -1326,12 +1324,14 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
final class WriteThroughEntry final class WriteThroughEntry
extends AbstractMap.SimpleEntry<K,V> extends AbstractMap.SimpleEntry<K,V>
{ {
static final long serialVersionUID = 7249069246763182397L;
WriteThroughEntry(K k, V v) { WriteThroughEntry(K k, V v) {
super(k,v); super(k,v);
} }
/** /**
* Set our entry's value and write through to the map. The * Sets our entry's value and writes through to the map. The
* value to return is somewhat arbitrary here. Since a * value to return is somewhat arbitrary here. Since a
* WriteThroughEntry does not necessarily track asynchronous * WriteThroughEntry does not necessarily track asynchronous
* changes, the most recent "previous" value could be * changes, the most recent "previous" value could be
...@@ -1427,15 +1427,16 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -1427,15 +1427,16 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
/* ---------------- Serialization Support -------------- */ /* ---------------- Serialization Support -------------- */
/** /**
* Save the state of the <tt>ConcurrentHashMap</tt> instance to a * Saves the state of the <tt>ConcurrentHashMap</tt> instance to a
* stream (i.e., serialize it). * stream (i.e., serializes it).
* @param s the stream * @param s the stream
* @serialData * @serialData
* the key (Object) and value (Object) * the key (Object) and value (Object)
* for each key-value mapping, followed by a null pair. * for each key-value mapping, followed by a null pair.
* The key-value mappings are emitted in no particular order. * The key-value mappings are emitted in no particular order.
*/ */
private void writeObject(java.io.ObjectOutputStream s) throws IOException { private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException {
// force all segments for serialization compatibility // force all segments for serialization compatibility
for (int k = 0; k < segments.length; ++k) for (int k = 0; k < segments.length; ++k)
ensureSegment(k); ensureSegment(k);
...@@ -1463,13 +1464,13 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -1463,13 +1464,13 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
} }
/** /**
* Reconstitute the <tt>ConcurrentHashMap</tt> instance from a * Reconstitutes the <tt>ConcurrentHashMap</tt> instance from a
* stream (i.e., deserialize it). * stream (i.e., deserializes it).
* @param s the stream * @param s the stream
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void readObject(java.io.ObjectInputStream s) private void readObject(java.io.ObjectInputStream s)
throws IOException, ClassNotFoundException { throws java.io.IOException, ClassNotFoundException {
s.defaultReadObject(); s.defaultReadObject();
// Re-initialize segments to be minimally sized, and let grow. // Re-initialize segments to be minimally sized, and let grow.
...@@ -1479,7 +1480,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -1479,7 +1480,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
Segment<K,V> seg = segments[k]; Segment<K,V> seg = segments[k];
if (seg != null) { if (seg != null) {
seg.threshold = (int)(cap * seg.loadFactor); seg.threshold = (int)(cap * seg.loadFactor);
seg.table = (HashEntry<K,V>[]) new HashEntry[cap]; seg.table = (HashEntry<K,V>[]) new HashEntry<?,?>[cap];
} }
} }
...@@ -1504,8 +1505,8 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> ...@@ -1504,8 +1505,8 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
int ss, ts; int ss, ts;
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class tc = HashEntry[].class; Class<?> tc = HashEntry[].class;
Class sc = Segment[].class; Class<?> sc = Segment[].class;
TBASE = UNSAFE.arrayBaseOffset(tc); TBASE = UNSAFE.arrayBaseOffset(tc);
SBASE = UNSAFE.arrayBaseOffset(sc); SBASE = UNSAFE.arrayBaseOffset(sc);
ts = UNSAFE.arrayIndexScale(tc); ts = UNSAFE.arrayIndexScale(tc);
......
...@@ -335,7 +335,7 @@ public class ConcurrentLinkedDeque<E> ...@@ -335,7 +335,7 @@ public class ConcurrentLinkedDeque<E>
static { static {
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = Node.class; Class<?> k = Node.class;
prevOffset = UNSAFE.objectFieldOffset prevOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("prev")); (k.getDeclaredField("prev"));
itemOffset = UNSAFE.objectFieldOffset itemOffset = UNSAFE.objectFieldOffset
...@@ -1457,7 +1457,7 @@ public class ConcurrentLinkedDeque<E> ...@@ -1457,7 +1457,7 @@ public class ConcurrentLinkedDeque<E>
NEXT_TERMINATOR.prev = NEXT_TERMINATOR; NEXT_TERMINATOR.prev = NEXT_TERMINATOR;
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = ConcurrentLinkedDeque.class; Class<?> k = ConcurrentLinkedDeque.class;
headOffset = UNSAFE.objectFieldOffset headOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("head")); (k.getDeclaredField("head"));
tailOffset = UNSAFE.objectFieldOffset tailOffset = UNSAFE.objectFieldOffset
......
...@@ -208,7 +208,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E> ...@@ -208,7 +208,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
static { static {
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = Node.class; Class<?> k = Node.class;
itemOffset = UNSAFE.objectFieldOffset itemOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("item")); (k.getDeclaredField("item"));
nextOffset = UNSAFE.objectFieldOffset nextOffset = UNSAFE.objectFieldOffset
...@@ -823,7 +823,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E> ...@@ -823,7 +823,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
static { static {
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = ConcurrentLinkedQueue.class; Class<?> k = ConcurrentLinkedQueue.class;
headOffset = UNSAFE.objectFieldOffset headOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("head")); (k.getDeclaredField("head"));
tailOffset = UNSAFE.objectFieldOffset tailOffset = UNSAFE.objectFieldOffset
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
package java.util.concurrent; package java.util.concurrent;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.*;
/** /**
* A scalable concurrent {@link ConcurrentNavigableMap} implementation. * A scalable concurrent {@link ConcurrentNavigableMap} implementation.
...@@ -90,6 +89,7 @@ import java.util.concurrent.atomic.*; ...@@ -90,6 +89,7 @@ import java.util.concurrent.atomic.*;
* @param <V> the type of mapped values * @param <V> the type of mapped values
* @since 1.6 * @since 1.6
*/ */
@SuppressWarnings("unchecked")
public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
implements ConcurrentNavigableMap<K,V>, implements ConcurrentNavigableMap<K,V>,
Cloneable, Cloneable,
...@@ -352,11 +352,11 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -352,11 +352,11 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
private transient int randomSeed; private transient int randomSeed;
/** Lazily initialized key set */ /** Lazily initialized key set */
private transient KeySet keySet; private transient KeySet<K> keySet;
/** Lazily initialized entry set */ /** Lazily initialized entry set */
private transient EntrySet entrySet; private transient EntrySet<K,V> entrySet;
/** Lazily initialized values collection */ /** Lazily initialized values collection */
private transient Values values; private transient Values<V> values;
/** Lazily initialized descending key set */ /** Lazily initialized descending key set */
private transient ConcurrentNavigableMap<K,V> descendingMap; private transient ConcurrentNavigableMap<K,V> descendingMap;
...@@ -517,7 +517,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -517,7 +517,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
static { static {
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = Node.class; Class<?> k = Node.class;
valueOffset = UNSAFE.objectFieldOffset valueOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("value")); (k.getDeclaredField("value"));
nextOffset = UNSAFE.objectFieldOffset nextOffset = UNSAFE.objectFieldOffset
...@@ -597,7 +597,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -597,7 +597,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
static { static {
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = Index.class; Class<?> k = Index.class;
rightOffset = UNSAFE.objectFieldOffset rightOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("right")); (k.getDeclaredField("right"));
} catch (Exception e) { } catch (Exception e) {
...@@ -933,7 +933,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -933,7 +933,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* direction. * direction.
*/ */
level = max + 1; level = max + 1;
Index<K,V>[] idxs = (Index<K,V>[])new Index[level+1]; Index<K,V>[] idxs = (Index<K,V>[])new Index<?,?>[level+1];
Index<K,V> idx = null; Index<K,V> idx = null;
for (int i = 1; i <= level; ++i) for (int i = 1; i <= level; ++i)
idxs[i] = idx = new Index<K,V>(z, idx, null); idxs[i] = idx = new Index<K,V>(z, idx, null);
...@@ -1436,16 +1436,16 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -1436,16 +1436,16 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* @return a shallow copy of this map * @return a shallow copy of this map
*/ */
public ConcurrentSkipListMap<K,V> clone() { public ConcurrentSkipListMap<K,V> clone() {
ConcurrentSkipListMap<K,V> clone = null;
try { try {
clone = (ConcurrentSkipListMap<K,V>) super.clone(); @SuppressWarnings("unchecked")
ConcurrentSkipListMap<K,V> clone =
(ConcurrentSkipListMap<K,V>) super.clone();
clone.initialize();
clone.buildFromSorted(this);
return clone;
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new InternalError(); throw new InternalError();
} }
clone.initialize();
clone.buildFromSorted(this);
return clone;
} }
/** /**
...@@ -1507,7 +1507,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -1507,7 +1507,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
/* ---------------- Serialization -------------- */ /* ---------------- Serialization -------------- */
/** /**
* Save the state of this map to a stream. * Saves the state of this map to a stream (that is, serializes it).
* *
* @serialData The key (Object) and value (Object) for each * @serialData The key (Object) and value (Object) for each
* key-value mapping represented by the map, followed by * key-value mapping represented by the map, followed by
...@@ -1532,7 +1532,9 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -1532,7 +1532,9 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
} }
/** /**
* Reconstitute the map from a stream. * Reconstitutes the map from a stream (that is, deserializes it).
*
* @param s the stream
*/ */
private void readObject(final java.io.ObjectInputStream s) private void readObject(final java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException { throws java.io.IOException, ClassNotFoundException {
...@@ -1755,13 +1757,13 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -1755,13 +1757,13 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* @return a navigable set view of the keys in this map * @return a navigable set view of the keys in this map
*/ */
public NavigableSet<K> keySet() { public NavigableSet<K> keySet() {
KeySet ks = keySet; KeySet<K> ks = keySet;
return (ks != null) ? ks : (keySet = new KeySet(this)); return (ks != null) ? ks : (keySet = new KeySet<K>(this));
} }
public NavigableSet<K> navigableKeySet() { public NavigableSet<K> navigableKeySet() {
KeySet ks = keySet; KeySet<K> ks = keySet;
return (ks != null) ? ks : (keySet = new KeySet(this)); return (ks != null) ? ks : (keySet = new KeySet<K>(this));
} }
/** /**
...@@ -1783,8 +1785,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -1783,8 +1785,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* reflect any modifications subsequent to construction. * reflect any modifications subsequent to construction.
*/ */
public Collection<V> values() { public Collection<V> values() {
Values vs = values; Values<V> vs = values;
return (vs != null) ? vs : (values = new Values(this)); return (vs != null) ? vs : (values = new Values<V>(this));
} }
/** /**
...@@ -1812,8 +1814,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -1812,8 +1814,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* sorted in ascending key order * sorted in ascending key order
*/ */
public Set<Map.Entry<K,V>> entrySet() { public Set<Map.Entry<K,V>> entrySet() {
EntrySet es = entrySet; EntrySet<K,V> es = entrySet;
return (es != null) ? es : (entrySet = new EntrySet(this)); return (es != null) ? es : (entrySet = new EntrySet<K,V>(this));
} }
public ConcurrentNavigableMap<K,V> descendingMap() { public ConcurrentNavigableMap<K,V> descendingMap() {
...@@ -2304,8 +2306,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -2304,8 +2306,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
static final class KeySet<E> static final class KeySet<E>
extends AbstractSet<E> implements NavigableSet<E> { extends AbstractSet<E> implements NavigableSet<E> {
private final ConcurrentNavigableMap<E,Object> m; private final ConcurrentNavigableMap<E,?> m;
KeySet(ConcurrentNavigableMap<E,Object> map) { m = map; } KeySet(ConcurrentNavigableMap<E,?> map) { m = map; }
public int size() { return m.size(); } public int size() { return m.size(); }
public boolean isEmpty() { return m.isEmpty(); } public boolean isEmpty() { return m.isEmpty(); }
public boolean contains(Object o) { return m.containsKey(o); } public boolean contains(Object o) { return m.containsKey(o); }
...@@ -2319,11 +2321,11 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -2319,11 +2321,11 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
public E first() { return m.firstKey(); } public E first() { return m.firstKey(); }
public E last() { return m.lastKey(); } public E last() { return m.lastKey(); }
public E pollFirst() { public E pollFirst() {
Map.Entry<E,Object> e = m.pollFirstEntry(); Map.Entry<E,?> e = m.pollFirstEntry();
return (e == null) ? null : e.getKey(); return (e == null) ? null : e.getKey();
} }
public E pollLast() { public E pollLast() {
Map.Entry<E,Object> e = m.pollLastEntry(); Map.Entry<E,?> e = m.pollLastEntry();
return (e == null) ? null : e.getKey(); return (e == null) ? null : e.getKey();
} }
public Iterator<E> iterator() { public Iterator<E> iterator() {
...@@ -2374,20 +2376,20 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -2374,20 +2376,20 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
return tailSet(fromElement, true); return tailSet(fromElement, true);
} }
public NavigableSet<E> descendingSet() { public NavigableSet<E> descendingSet() {
return new KeySet(m.descendingMap()); return new KeySet<E>(m.descendingMap());
} }
} }
static final class Values<E> extends AbstractCollection<E> { static final class Values<E> extends AbstractCollection<E> {
private final ConcurrentNavigableMap<Object, E> m; private final ConcurrentNavigableMap<?, E> m;
Values(ConcurrentNavigableMap<Object, E> map) { Values(ConcurrentNavigableMap<?, E> map) {
m = map; m = map;
} }
public Iterator<E> iterator() { public Iterator<E> iterator() {
if (m instanceof ConcurrentSkipListMap) if (m instanceof ConcurrentSkipListMap)
return ((ConcurrentSkipListMap<Object,E>)m).valueIterator(); return ((ConcurrentSkipListMap<?,E>)m).valueIterator();
else else
return ((SubMap<Object,E>)m).valueIterator(); return ((SubMap<?,E>)m).valueIterator();
} }
public boolean isEmpty() { public boolean isEmpty() {
return m.isEmpty(); return m.isEmpty();
...@@ -2421,14 +2423,14 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -2421,14 +2423,14 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
public boolean contains(Object o) { public boolean contains(Object o) {
if (!(o instanceof Map.Entry)) if (!(o instanceof Map.Entry))
return false; return false;
Map.Entry<K1,V1> e = (Map.Entry<K1,V1>)o; Map.Entry<?,?> e = (Map.Entry<?,?>)o;
V1 v = m.get(e.getKey()); V1 v = m.get(e.getKey());
return v != null && v.equals(e.getValue()); return v != null && v.equals(e.getValue());
} }
public boolean remove(Object o) { public boolean remove(Object o) {
if (!(o instanceof Map.Entry)) if (!(o instanceof Map.Entry))
return false; return false;
Map.Entry<K1,V1> e = (Map.Entry<K1,V1>)o; Map.Entry<?,?> e = (Map.Entry<?,?>)o;
return m.remove(e.getKey(), return m.remove(e.getKey(),
e.getValue()); e.getValue());
} }
...@@ -2568,9 +2570,9 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -2568,9 +2570,9 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
if (lo == null) if (lo == null)
return m.findFirst(); return m.findFirst();
else if (loInclusive) else if (loInclusive)
return m.findNear(lo, m.GT|m.EQ); return m.findNear(lo, GT|EQ);
else else
return m.findNear(lo, m.GT); return m.findNear(lo, GT);
} }
/** /**
...@@ -2581,9 +2583,9 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -2581,9 +2583,9 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
if (hi == null) if (hi == null)
return m.findLast(); return m.findLast();
else if (hiInclusive) else if (hiInclusive)
return m.findNear(hi, m.LT|m.EQ); return m.findNear(hi, LT|EQ);
else else
return m.findNear(hi, m.LT); return m.findNear(hi, LT);
} }
/** /**
...@@ -2665,15 +2667,15 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -2665,15 +2667,15 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
*/ */
private Map.Entry<K,V> getNearEntry(K key, int rel) { private Map.Entry<K,V> getNearEntry(K key, int rel) {
if (isDescending) { // adjust relation for direction if (isDescending) { // adjust relation for direction
if ((rel & m.LT) == 0) if ((rel & LT) == 0)
rel |= m.LT; rel |= LT;
else else
rel &= ~m.LT; rel &= ~LT;
} }
if (tooLow(key)) if (tooLow(key))
return ((rel & m.LT) != 0) ? null : lowestEntry(); return ((rel & LT) != 0) ? null : lowestEntry();
if (tooHigh(key)) if (tooHigh(key))
return ((rel & m.LT) != 0) ? highestEntry() : null; return ((rel & LT) != 0) ? highestEntry() : null;
for (;;) { for (;;) {
Node<K,V> n = m.findNear(key, rel); Node<K,V> n = m.findNear(key, rel);
if (n == null || !inBounds(n.key)) if (n == null || !inBounds(n.key))
...@@ -2688,13 +2690,13 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -2688,13 +2690,13 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
// Almost the same as getNearEntry, except for keys // Almost the same as getNearEntry, except for keys
private K getNearKey(K key, int rel) { private K getNearKey(K key, int rel) {
if (isDescending) { // adjust relation for direction if (isDescending) { // adjust relation for direction
if ((rel & m.LT) == 0) if ((rel & LT) == 0)
rel |= m.LT; rel |= LT;
else else
rel &= ~m.LT; rel &= ~LT;
} }
if (tooLow(key)) { if (tooLow(key)) {
if ((rel & m.LT) == 0) { if ((rel & LT) == 0) {
ConcurrentSkipListMap.Node<K,V> n = loNode(); ConcurrentSkipListMap.Node<K,V> n = loNode();
if (isBeforeEnd(n)) if (isBeforeEnd(n))
return n.key; return n.key;
...@@ -2702,7 +2704,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -2702,7 +2704,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
return null; return null;
} }
if (tooHigh(key)) { if (tooHigh(key)) {
if ((rel & m.LT) != 0) { if ((rel & LT) != 0) {
ConcurrentSkipListMap.Node<K,V> n = hiNode(); ConcurrentSkipListMap.Node<K,V> n = hiNode();
if (n != null) { if (n != null) {
K last = n.key; K last = n.key;
...@@ -2734,7 +2736,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -2734,7 +2736,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
public V get(Object key) { public V get(Object key) {
if (key == null) throw new NullPointerException(); if (key == null) throw new NullPointerException();
K k = (K)key; K k = (K)key;
return ((!inBounds(k)) ? null : m.get(k)); return (!inBounds(k)) ? null : m.get(k);
} }
public V put(K key, V value) { public V put(K key, V value) {
...@@ -2901,35 +2903,35 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -2901,35 +2903,35 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
/* ---------------- Relational methods -------------- */ /* ---------------- Relational methods -------------- */
public Map.Entry<K,V> ceilingEntry(K key) { public Map.Entry<K,V> ceilingEntry(K key) {
return getNearEntry(key, (m.GT|m.EQ)); return getNearEntry(key, GT|EQ);
} }
public K ceilingKey(K key) { public K ceilingKey(K key) {
return getNearKey(key, (m.GT|m.EQ)); return getNearKey(key, GT|EQ);
} }
public Map.Entry<K,V> lowerEntry(K key) { public Map.Entry<K,V> lowerEntry(K key) {
return getNearEntry(key, (m.LT)); return getNearEntry(key, LT);
} }
public K lowerKey(K key) { public K lowerKey(K key) {
return getNearKey(key, (m.LT)); return getNearKey(key, LT);
} }
public Map.Entry<K,V> floorEntry(K key) { public Map.Entry<K,V> floorEntry(K key) {
return getNearEntry(key, (m.LT|m.EQ)); return getNearEntry(key, LT|EQ);
} }
public K floorKey(K key) { public K floorKey(K key) {
return getNearKey(key, (m.LT|m.EQ)); return getNearKey(key, LT|EQ);
} }
public Map.Entry<K,V> higherEntry(K key) { public Map.Entry<K,V> higherEntry(K key) {
return getNearEntry(key, (m.GT)); return getNearEntry(key, GT);
} }
public K higherKey(K key) { public K higherKey(K key) {
return getNearKey(key, (m.GT)); return getNearKey(key, GT);
} }
public K firstKey() { public K firstKey() {
...@@ -2960,22 +2962,22 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -2960,22 +2962,22 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
public NavigableSet<K> keySet() { public NavigableSet<K> keySet() {
KeySet<K> ks = keySetView; KeySet<K> ks = keySetView;
return (ks != null) ? ks : (keySetView = new KeySet(this)); return (ks != null) ? ks : (keySetView = new KeySet<K>(this));
} }
public NavigableSet<K> navigableKeySet() { public NavigableSet<K> navigableKeySet() {
KeySet<K> ks = keySetView; KeySet<K> ks = keySetView;
return (ks != null) ? ks : (keySetView = new KeySet(this)); return (ks != null) ? ks : (keySetView = new KeySet<K>(this));
} }
public Collection<V> values() { public Collection<V> values() {
Collection<V> vs = valuesView; Collection<V> vs = valuesView;
return (vs != null) ? vs : (valuesView = new Values(this)); return (vs != null) ? vs : (valuesView = new Values<V>(this));
} }
public Set<Map.Entry<K,V>> entrySet() { public Set<Map.Entry<K,V>> entrySet() {
Set<Map.Entry<K,V>> es = entrySetView; Set<Map.Entry<K,V>> es = entrySetView;
return (es != null) ? es : (entrySetView = new EntrySet(this)); return (es != null) ? es : (entrySetView = new EntrySet<K,V>(this));
} }
public NavigableSet<K> descendingKeySet() { public NavigableSet<K> descendingKeySet() {
...@@ -3109,7 +3111,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> ...@@ -3109,7 +3111,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
static { static {
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = ConcurrentSkipListMap.class; Class<?> k = ConcurrentSkipListMap.class;
headOffset = UNSAFE.objectFieldOffset headOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("head")); (k.getDeclaredField("head"));
} catch (Exception e) { } catch (Exception e) {
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
package java.util.concurrent; package java.util.concurrent;
import java.util.*; import java.util.*;
import sun.misc.Unsafe;
/** /**
* A scalable concurrent {@link NavigableSet} implementation based on * A scalable concurrent {@link NavigableSet} implementation based on
...@@ -158,15 +157,15 @@ public class ConcurrentSkipListSet<E> ...@@ -158,15 +157,15 @@ public class ConcurrentSkipListSet<E>
* @return a shallow copy of this set * @return a shallow copy of this set
*/ */
public ConcurrentSkipListSet<E> clone() { public ConcurrentSkipListSet<E> clone() {
ConcurrentSkipListSet<E> clone = null;
try { try {
clone = (ConcurrentSkipListSet<E>) super.clone(); @SuppressWarnings("unchecked")
clone.setMap(new ConcurrentSkipListMap(m)); ConcurrentSkipListSet<E> clone =
(ConcurrentSkipListSet<E>) super.clone();
clone.setMap(new ConcurrentSkipListMap<E,Object>(m));
return clone;
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new InternalError(); throw new InternalError();
} }
return clone;
} }
/* ---------------- Set operations -------------- */ /* ---------------- Set operations -------------- */
...@@ -322,8 +321,8 @@ public class ConcurrentSkipListSet<E> ...@@ -322,8 +321,8 @@ public class ConcurrentSkipListSet<E>
public boolean removeAll(Collection<?> c) { public boolean removeAll(Collection<?> c) {
// Override AbstractSet version to avoid unnecessary call to size() // Override AbstractSet version to avoid unnecessary call to size()
boolean modified = false; boolean modified = false;
for (Iterator<?> i = c.iterator(); i.hasNext(); ) for (Object e : c)
if (remove(i.next())) if (remove(e))
modified = true; modified = true;
return modified; return modified;
} }
...@@ -468,7 +467,7 @@ public class ConcurrentSkipListSet<E> ...@@ -468,7 +467,7 @@ public class ConcurrentSkipListSet<E>
* @return a reverse order view of this set * @return a reverse order view of this set
*/ */
public NavigableSet<E> descendingSet() { public NavigableSet<E> descendingSet() {
return new ConcurrentSkipListSet(m.descendingMap()); return new ConcurrentSkipListSet<E>(m.descendingMap());
} }
// Support for resetting map in clone // Support for resetting map in clone
...@@ -481,7 +480,7 @@ public class ConcurrentSkipListSet<E> ...@@ -481,7 +480,7 @@ public class ConcurrentSkipListSet<E>
static { static {
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = ConcurrentSkipListSet.class; Class<?> k = ConcurrentSkipListSet.class;
mapOffset = UNSAFE.objectFieldOffset mapOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("m")); (k.getDeclaredField("m"));
} catch (Exception e) { } catch (Exception e) {
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
package java.util.concurrent; package java.util.concurrent;
import java.util.*; import java.util.*;
import java.util.concurrent.locks.*; import java.util.concurrent.locks.*;
import sun.misc.Unsafe;
/** /**
* A thread-safe variant of {@link java.util.ArrayList} in which all mutative * A thread-safe variant of {@link java.util.ArrayList} in which all mutative
...@@ -281,9 +280,11 @@ public class CopyOnWriteArrayList<E> ...@@ -281,9 +280,11 @@ public class CopyOnWriteArrayList<E>
*/ */
public Object clone() { public Object clone() {
try { try {
CopyOnWriteArrayList c = (CopyOnWriteArrayList)(super.clone()); @SuppressWarnings("unchecked")
c.resetLock(); CopyOnWriteArrayList<E> clone =
return c; (CopyOnWriteArrayList<E>) super.clone();
clone.resetLock();
return clone;
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable // this shouldn't happen, since we are Cloneable
throw new InternalError(); throw new InternalError();
...@@ -1330,7 +1331,7 @@ public class CopyOnWriteArrayList<E> ...@@ -1330,7 +1331,7 @@ public class CopyOnWriteArrayList<E>
static { static {
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = CopyOnWriteArrayList.class; Class<?> k = CopyOnWriteArrayList.class;
lockOffset = UNSAFE.objectFieldOffset lockOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("lock")); (k.getDeclaredField("lock"));
} catch (Exception e) { } catch (Exception e) {
......
...@@ -531,7 +531,7 @@ public class DelayQueue<E extends Delayed> extends AbstractQueue<E> ...@@ -531,7 +531,7 @@ public class DelayQueue<E extends Delayed> extends AbstractQueue<E>
// not just a .equals element. // not just a .equals element.
lock.lock(); lock.lock();
try { try {
for (Iterator it = q.iterator(); it.hasNext(); ) { for (Iterator<E> it = q.iterator(); it.hasNext(); ) {
if (it.next() == x) { if (it.next() == x) {
it.remove(); it.remove();
return; return;
......
...@@ -279,6 +279,7 @@ public class Exchanger<V> { ...@@ -279,6 +279,7 @@ public class Exchanger<V> {
* into hole. This class cannot be parameterized as "V" because * into hole. This class cannot be parameterized as "V" because
* of the use of non-V CANCEL sentinels. * of the use of non-V CANCEL sentinels.
*/ */
@SuppressWarnings("serial")
private static final class Node extends AtomicReference<Object> { private static final class Node extends AtomicReference<Object> {
/** The element offered by the Thread creating this node. */ /** The element offered by the Thread creating this node. */
public final Object item; public final Object item;
...@@ -303,6 +304,7 @@ public class Exchanger<V> { ...@@ -303,6 +304,7 @@ public class Exchanger<V> {
* would improve throughput more than enough to outweigh using * would improve throughput more than enough to outweigh using
* extra space. * extra space.
*/ */
@SuppressWarnings("serial")
private static final class Slot extends AtomicReference<Object> { private static final class Slot extends AtomicReference<Object> {
// Improve likelihood of isolation on <= 64 byte cache lines // Improve likelihood of isolation on <= 64 byte cache lines
long q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, qa, qb, qc, qd, qe; long q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, qa, qb, qc, qd, qe;
...@@ -616,13 +618,14 @@ public class Exchanger<V> { ...@@ -616,13 +618,14 @@ public class Exchanger<V> {
* @throws InterruptedException if the current thread was * @throws InterruptedException if the current thread was
* interrupted while waiting * interrupted while waiting
*/ */
@SuppressWarnings("unchecked")
public V exchange(V x) throws InterruptedException { public V exchange(V x) throws InterruptedException {
if (!Thread.interrupted()) { if (!Thread.interrupted()) {
Object v = doExchange((x == null) ? NULL_ITEM : x, false, 0); Object o = doExchange((x == null) ? NULL_ITEM : x, false, 0);
if (v == NULL_ITEM) if (o == NULL_ITEM)
return null; return null;
if (v != CANCEL) if (o != CANCEL)
return (V)v; return (V)o;
Thread.interrupted(); // Clear interrupt status on IE throw Thread.interrupted(); // Clear interrupt status on IE throw
} }
throw new InterruptedException(); throw new InterruptedException();
...@@ -670,15 +673,16 @@ public class Exchanger<V> { ...@@ -670,15 +673,16 @@ public class Exchanger<V> {
* @throws TimeoutException if the specified waiting time elapses * @throws TimeoutException if the specified waiting time elapses
* before another thread enters the exchange * before another thread enters the exchange
*/ */
@SuppressWarnings("unchecked")
public V exchange(V x, long timeout, TimeUnit unit) public V exchange(V x, long timeout, TimeUnit unit)
throws InterruptedException, TimeoutException { throws InterruptedException, TimeoutException {
if (!Thread.interrupted()) { if (!Thread.interrupted()) {
Object v = doExchange((x == null) ? NULL_ITEM : x, Object o = doExchange((x == null) ? NULL_ITEM : x,
true, unit.toNanos(timeout)); true, unit.toNanos(timeout));
if (v == NULL_ITEM) if (o == NULL_ITEM)
return null; return null;
if (v != CANCEL) if (o != CANCEL)
return (V)v; return (V)o;
if (!Thread.interrupted()) if (!Thread.interrupted())
throw new TimeoutException(); throw new TimeoutException();
} }
......
...@@ -2150,7 +2150,7 @@ public class ForkJoinPool extends AbstractExecutorService { ...@@ -2150,7 +2150,7 @@ public class ForkJoinPool extends AbstractExecutorService {
int s; int s;
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = ForkJoinPool.class; Class<?> k = ForkJoinPool.class;
ctlOffset = UNSAFE.objectFieldOffset ctlOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("ctl")); (k.getDeclaredField("ctl"));
stealCountOffset = UNSAFE.objectFieldOffset stealCountOffset = UNSAFE.objectFieldOffset
...@@ -2163,7 +2163,7 @@ public class ForkJoinPool extends AbstractExecutorService { ...@@ -2163,7 +2163,7 @@ public class ForkJoinPool extends AbstractExecutorService {
(k.getDeclaredField("scanGuard")); (k.getDeclaredField("scanGuard"));
nextWorkerNumberOffset = UNSAFE.objectFieldOffset nextWorkerNumberOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("nextWorkerNumber")); (k.getDeclaredField("nextWorkerNumber"));
Class a = ForkJoinTask[].class; Class<?> a = ForkJoinTask[].class;
ABASE = UNSAFE.arrayBaseOffset(a); ABASE = UNSAFE.arrayBaseOffset(a);
s = UNSAFE.arrayIndexScale(a); s = UNSAFE.arrayIndexScale(a);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -520,7 +520,7 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable { ...@@ -520,7 +520,7 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
if (e == null || (ex = e.ex) == null) if (e == null || (ex = e.ex) == null)
return null; return null;
if (e.thrower != Thread.currentThread().getId()) { if (e.thrower != Thread.currentThread().getId()) {
Class ec = ex.getClass(); Class<? extends Throwable> ec = ex.getClass();
try { try {
Constructor<?> noArgCtor = null; Constructor<?> noArgCtor = null;
Constructor<?>[] cs = ec.getConstructors();// public ctors only Constructor<?>[] cs = ec.getConstructors();// public ctors only
......
...@@ -192,7 +192,7 @@ public class ForkJoinWorkerThread extends Thread { ...@@ -192,7 +192,7 @@ public class ForkJoinWorkerThread extends Thread {
/** /**
* The work-stealing queue array. Size must be a power of two. * The work-stealing queue array. Size must be a power of two.
* Initialized when started (as oposed to when constructed), to * Initialized when started (as opposed to when constructed), to
* improve memory locality. * improve memory locality.
*/ */
ForkJoinTask<?>[] queue; ForkJoinTask<?>[] queue;
...@@ -360,7 +360,7 @@ public class ForkJoinWorkerThread extends Thread { ...@@ -360,7 +360,7 @@ public class ForkJoinWorkerThread extends Thread {
*/ */
protected void onStart() { protected void onStart() {
queue = new ForkJoinTask<?>[INITIAL_QUEUE_CAPACITY]; queue = new ForkJoinTask<?>[INITIAL_QUEUE_CAPACITY];
int r = pool.workerSeedGenerator.nextInt(); int r = ForkJoinPool.workerSeedGenerator.nextInt();
seed = (r == 0) ? 1 : r; // must be nonzero seed = (r == 0) ? 1 : r; // must be nonzero
} }
...@@ -846,7 +846,7 @@ public class ForkJoinWorkerThread extends Thread { ...@@ -846,7 +846,7 @@ public class ForkJoinWorkerThread extends Thread {
(b = v.queueBase) != v.queueTop && (b = v.queueBase) != v.queueTop &&
(q = v.queue) != null && (q = v.queue) != null &&
(i = (q.length - 1) & b) >= 0 && (i = (q.length - 1) & b) >= 0 &&
q[i] == t) { q[i] == t) {
long u = (i << ASHIFT) + ABASE; long u = (i << ASHIFT) + ABASE;
if (v.queueBase == b && if (v.queueBase == b &&
UNSAFE.compareAndSwapObject(q, u, t, null)) { UNSAFE.compareAndSwapObject(q, u, t, null)) {
...@@ -984,7 +984,7 @@ public class ForkJoinWorkerThread extends Thread { ...@@ -984,7 +984,7 @@ public class ForkJoinWorkerThread extends Thread {
int s; int s;
try { try {
UNSAFE = sun.misc.Unsafe.getUnsafe(); UNSAFE = sun.misc.Unsafe.getUnsafe();
Class a = ForkJoinTask[].class; Class<?> a = ForkJoinTask[].class;
ABASE = UNSAFE.arrayBaseOffset(a); ABASE = UNSAFE.arrayBaseOffset(a);
s = UNSAFE.arrayIndexScale(a); s = UNSAFE.arrayIndexScale(a);
} catch (Exception e) { } catch (Exception e) {
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册