提交 14082957 编写于 作者: L lana

Merge

......@@ -239,7 +239,7 @@ classes : $(CLASSES_INIT) .delete.classlist .compile.classlist
$(CAT) $<.filtered; \
$(ECHO) "# Running javac: $$numfiles files; in $(CURDIR)"; \
$(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"; \
fi
@$(java-vm-cleanup)
......
......@@ -25,15 +25,15 @@
# Properties for jprt
# Release to build for
# Locked down to jdk8
jprt.tools.default.release=jdk8
# The different build flavors we want, we override here so we just get these 2
jprt.build.flavors=product,fastdebug
# Standard list of jprt build targets for this source tree
jprt.build.targets= \
solaris_sparc_5.10-{product|fastdebug}, \
jprt.build.targets= \
solaris_sparc_5.10-{product|fastdebug}, \
solaris_sparcv9_5.10-{product|fastdebug}, \
solaris_i586_5.10-{product|fastdebug}, \
solaris_x64_5.10-{product|fastdebug}, \
......@@ -45,247 +45,59 @@ jprt.build.targets= \
# User can select the test set with jprt submit "-testset name" option
jprt.my.test.set=${jprt.test.set}
# Standard vm test target
jprt.vm.default.test.targets= \
solaris_sparc_5.10-product-c1-jvm98, \
solaris_sparcv9_5.10-product-c2-jvm98, \
solaris_i586_5.10-product-c1-jvm98, \
solaris_x64_5.10-product-c2-jvm98, \
linux_i586_2.6-product-{c1|c2}-jvm98, \
linux_x64_2.6-product-c2-jvm98, \
windows_i586_5.1-product-c1-jvm98, \
windows_x64_5.2-product-c2-jvm98
# Test target list (no fastdebug & limited c2 testing)
jprt.my.test.target.set= \
solaris_sparc_5.10-product-c1-TESTNAME, \
solaris_sparcv9_5.10-product-c2-TESTNAME, \
solaris_i586_5.10-product-c1-TESTNAME, \
solaris_x64_5.10-product-c2-TESTNAME, \
linux_i586_2.6-product-{c1|c2}-TESTNAME, \
linux_x64_2.6-product-c2-TESTNAME, \
windows_i586_5.1-product-c1-TESTNAME, \
windows_x64_5.2-product-c2-TESTNAME
# Select vm testlist to use (allow for testset to be empty too)
jprt.vm.all.test.targets=${jprt.vm.default.test.targets}
jprt.vm..test.targets=${jprt.vm.default.test.targets}
jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets}
# Default vm test targets (testset=default)
jprt.vm.default.test.targets= \
${jprt.my.test.target.set:TESTNAME=jvm98}
# Default jdk test targets in test/Makefile (no fastdebug & limited c2)
# Default jdk test targets (testset=default)
jprt.make.rule.default.test.targets= \
\
solaris_sparc_5.10-product-c1-jdk_beans1, \
solaris_sparcv9_5.10-product-c2-jdk_beans1, \
solaris_i586_5.10-product-c1-jdk_beans1, \
solaris_x64_5.10-product-c2-jdk_beans1, \
linux_i586_2.6-product-{c1|c2}-jdk_beans1, \
linux_x64_2.6-product-c2-jdk_beans1, \
windows_i586_5.1-product-c1-jdk_beans1, \
windows_x64_5.2-product-c2-jdk_beans1, \
\
solaris_sparc_5.10-product-c1-jdk_io, \
solaris_sparcv9_5.10-product-c2-jdk_io, \
solaris_i586_5.10-product-c1-jdk_io, \
solaris_x64_5.10-product-c2-jdk_io, \
linux_i586_2.6-product-{c1|c2}-jdk_io, \
linux_x64_2.6-product-c2-jdk_io, \
windows_i586_5.1-product-c1-jdk_io, \
windows_x64_5.2-product-c2-jdk_io, \
\
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
${jprt.my.test.target.set:TESTNAME=jdk_beans1}, \
${jprt.my.test.target.set:TESTNAME=jdk_io}, \
${jprt.my.test.target.set:TESTNAME=jdk_lang}, \
${jprt.my.test.target.set:TESTNAME=jdk_math}, \
${jprt.my.test.target.set:TESTNAME=jdk_misc}, \
${jprt.my.test.target.set:TESTNAME=jdk_net}, \
${jprt.my.test.target.set:TESTNAME=jdk_nio1}, \
${jprt.my.test.target.set:TESTNAME=jdk_nio2}, \
${jprt.my.test.target.set:TESTNAME=jdk_nio3}, \
${jprt.my.test.target.set:TESTNAME=jdk_security1}, \
${jprt.my.test.target.set:TESTNAME=jdk_text}, \
${jprt.my.test.target.set:TESTNAME=jdk_util}
# All vm test targets (testset=all)
jprt.vm.all.test.targets= \
${jprt.vm.default.test.targets}, \
${jprt.my.test.target.set:TESTNAME=runThese}, \
${jprt.my.test.target.set:TESTNAME=jbb_default}
# 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.default.test.targets}, \
\
solaris_sparc_5.10-product-c1-jdk_awt, \
solaris_sparcv9_5.10-product-c2-jdk_awt, \
solaris_i586_5.10-product-c1-jdk_awt, \
solaris_x64_5.10-product-c2-jdk_awt, \
linux_i586_2.6-product-{c1|c2}-jdk_awt, \
linux_x64_2.6-product-c2-jdk_awt, \
windows_i586_5.1-product-c1-jdk_awt, \
windows_x64_5.2-product-c2-jdk_awt, \
\
solaris_sparc_5.10-product-c1-jdk_beans2, \
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
${jprt.make.rule.default.test.targets}, \
${jprt.my.test.target.set:TESTNAME=jdk_awt}, \
${jprt.my.test.target.set:TESTNAME=jdk_beans2}, \
${jprt.my.test.target.set:TESTNAME=jdk_beans3}, \
${jprt.my.test.target.set:TESTNAME=jdk_management1}, \
${jprt.my.test.target.set:TESTNAME=jdk_management2}, \
${jprt.my.test.target.set:TESTNAME=jdk_rmi}, \
${jprt.my.test.target.set:TESTNAME=jdk_security2}, \
${jprt.my.test.target.set:TESTNAME=jdk_security3}, \
${jprt.my.test.target.set:TESTNAME=jdk_sound}, \
${jprt.my.test.target.set:TESTNAME=jdk_swing}, \
${jprt.my.test.target.set:TESTNAME=jdk_tools1}, \
${jprt.my.test.target.set:TESTNAME=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= \
solaris_sparc_5.10-product-c1-JCK7TESTRULE, \
solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \
......@@ -301,8 +113,10 @@ jprt.make.rule.jck.test.targets= \
${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7compiler}
# 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.${jprt.my.test.set}.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.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
jprt.bundle.exclude.src.dirs=build dist webrev
......
......@@ -35,7 +35,7 @@ class ArrayRegionTypeNode extends AbstractSimpleTypeNode {
}
String javaType() {
return "List";
return "List<?>";
}
public void genJavaWrite(PrintWriter writer, int depth,
......
......@@ -89,7 +89,7 @@ class OutNode extends AbstractTypeListNode {
if (Main.genDebug) {
indent(writer, depth+1);
writer.println(
"if ((vm.traceFlags & vm.TRACE_SENDS) != 0) {");
"if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) {");
indent(writer, depth+2);
writer.print(
"vm.printTrace(\"Sending Command(id=\" + ps.pkt.id + \") ");
......
......@@ -33,6 +33,7 @@ package com.sun.jdi;
*/
public class AbsentInformationException extends Exception
{
private static final long serialVersionUID = 4988939309582416373L;
public AbsentInformationException()
{
super();
......
......@@ -69,6 +69,7 @@ package com.sun.jdi;
*/
public class ClassNotLoadedException extends Exception
{
private static final long serialVersionUID = -6242978768444298722L;
private String className;
public ClassNotLoadedException(String className) {
......
......@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class ClassNotPreparedException extends RuntimeException {
private static final long serialVersionUID = -6120698967144079642L;
public ClassNotPreparedException()
{
super();
......
......@@ -34,6 +34,7 @@ package com.sun.jdi;
*/
public class IncompatibleThreadStateException extends Exception
{
private static final long serialVersionUID = 6199174323414551389L;
public IncompatibleThreadStateException()
{
super();
......
......@@ -35,6 +35,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class InconsistentDebugInfoException extends RuntimeException {
private static final long serialVersionUID = 7964236415376861808L;
public InconsistentDebugInfoException() {
super();
}
......
......@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class InternalException extends RuntimeException {
private static final long serialVersionUID = -9171606393104480607L;
private int errorCode;
public InternalException() {
......
......@@ -36,6 +36,7 @@ package com.sun.jdi;
*/
@Deprecated
public class InvalidCodeIndexException extends RuntimeException {
private static final long serialVersionUID = 7416010225133747805L;
public InvalidCodeIndexException() {
super();
}
......
......@@ -36,6 +36,7 @@ package com.sun.jdi;
*/
@Deprecated
public class InvalidLineNumberException extends RuntimeException {
private static final long serialVersionUID = 4048709912372692875L;
public InvalidLineNumberException() {
super();
}
......
......@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class InvalidStackFrameException extends RuntimeException {
private static final long serialVersionUID = -1919378296505827922L;
public InvalidStackFrameException() {
super();
}
......
......@@ -34,6 +34,7 @@ package com.sun.jdi;
*/
public class InvalidTypeException extends Exception
{
private static final long serialVersionUID = 2256667231949650806L;
public InvalidTypeException()
{
super();
......
......@@ -34,6 +34,7 @@ package com.sun.jdi;
*/
public class InvocationException extends Exception
{
private static final long serialVersionUID = 6066780907971918568L;
ObjectReference exception;
public InvocationException(ObjectReference exception)
......
......@@ -79,7 +79,7 @@ package com.sun.jdi;
*/
public final class JDIPermission extends java.security.BasicPermission {
private static final long serialVersionUID = -6988461416938786271L;
/**
* The <code>JDIPermission</code> class represents access rights to the
* <code>VirtualMachineManager</code>
......
......@@ -34,6 +34,7 @@ package com.sun.jdi;
*/
public class NativeMethodException extends RuntimeException {
private static final long serialVersionUID = 3924951669039469992L;
public NativeMethodException() {
super();
}
......
......@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class ObjectCollectedException extends RuntimeException {
private static final long serialVersionUID = -1928428056197269588L;
public ObjectCollectedException() {
super();
}
......
......@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.5
*/
public class VMCannotBeModifiedException extends UnsupportedOperationException {
private static final long serialVersionUID = -4063879815130164009L;
public VMCannotBeModifiedException() {
super();
}
......
......@@ -35,6 +35,7 @@ package com.sun.jdi;
*/
public class VMDisconnectedException extends RuntimeException {
private static final long serialVersionUID = 2892975269768351637L;
public VMDisconnectedException() {
super();
}
......
......@@ -34,6 +34,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class VMMismatchException extends RuntimeException {
private static final long serialVersionUID = 289169358790459564L;
public VMMismatchException() {
super();
}
......
......@@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class VMOutOfMemoryException extends RuntimeException {
private static final long serialVersionUID = 71504228548910686L;
public VMOutOfMemoryException() {
super();
}
......
......@@ -38,6 +38,7 @@ import java.util.Collections;
*/
public class IllegalConnectorArgumentsException extends Exception
{
private static final long serialVersionUID = -3042212603611350941L;
List<String> names;
/**
......
......@@ -55,7 +55,7 @@ package com.sun.jdi.connect;
* @since 1.5
*/
public class TransportTimeoutException extends java.io.IOException {
private static final long serialVersionUID = 4107035242623365074L;
/**
* Constructs a <tt>TransportTimeoutException</tt> with no detail
* message.
......
......@@ -36,6 +36,7 @@ package com.sun.jdi.connect;
*/
public class VMStartException extends Exception
{
private static final long serialVersionUID = 6408644824640801020L;
Process process;
public VMStartException(Process process) {
......
......@@ -46,7 +46,7 @@ package com.sun.jdi.connect.spi;
* @since 1.5
*/
public class ClosedConnectionException extends java.io.IOException {
private static final long serialVersionUID = 3877032124297204774L;
/**
* Constructs a <tt>ClosedConnectionException</tt> with no detail
* message.
......
......@@ -33,6 +33,7 @@ package com.sun.jdi.request;
*/
public class DuplicateRequestException extends RuntimeException
{
private static final long serialVersionUID = -3719784920313411060L;
public DuplicateRequestException()
{
super();
......
......@@ -36,6 +36,7 @@ package com.sun.jdi.request;
* @since 1.3
*/
public class InvalidRequestStateException extends RuntimeException {
private static final long serialVersionUID = -3774632428543322148L;
public InvalidRequestStateException()
{
super();
......
......@@ -70,8 +70,8 @@ public class ArrayReferenceImpl extends ObjectReferenceImpl
}
public Value getValue(int index) {
List list = getValues(index, 1);
return (Value)list.get(0);
List<Value> list = getValues(index, 1);
return list.get(0);
}
public List<Value> getValues() {
......
......@@ -61,7 +61,7 @@ public class ArrayTypeImpl extends ReferenceTypeImpl
return findType(componentSignature());
}
void addVisibleMethods(Map map) {
void addVisibleMethods(Map<String, Method> map) {
// arrays don't have methods
}
......@@ -83,10 +83,10 @@ public class ArrayTypeImpl extends ReferenceTypeImpl
if (PacketStream.isObjectTag(tag)) {
// It's a reference type
JNITypeParser parser = new JNITypeParser(componentSignature());
List list = vm.classesByName(parser.typeName());
Iterator iter = list.iterator();
List<ReferenceType> list = vm.classesByName(parser.typeName());
Iterator<ReferenceType> iter = list.iterator();
while (iter.hasNext()) {
ReferenceType type = (ReferenceType)iter.next();
ReferenceType type = iter.next();
ClassLoaderReference cl = type.classLoader();
if ((cl == null)?
(classLoader() == null) :
......
......@@ -78,7 +78,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl
}
public int intValue() {
return(int)((value)?1:0);
return (value)?1:0;
}
public long longValue() {
......@@ -90,7 +90,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl
}
public double doubleValue() {
return(double)((value)?1.0:0.0);
return (value)?1.0:0.0;
}
public String toString() {
......
......@@ -75,7 +75,7 @@ public class CharValueImpl extends PrimitiveValueImpl
}
public char charValue() {
return(char)value;
return value;
}
public short shortValue() {
......
......@@ -80,7 +80,7 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl
classes = Collections.unmodifiableList(classes);
if (local != null) {
local.visibleClasses = classes;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() +
" temporarily caching visible classes (count = " +
classes.size() + ")");
......@@ -95,9 +95,9 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl
Type findType(String signature) throws ClassNotLoadedException {
List<ReferenceType> types = visibleClasses();
Iterator iter = types.iterator();
Iterator<ReferenceType> iter = types.iterator();
while (iter.hasNext()) {
ReferenceType type = (ReferenceType)iter.next();
ReferenceType type = iter.next();
if (type.signature().equals(signature)) {
return type;
}
......
......@@ -76,7 +76,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
List<InterfaceType> immediate = interfaces();
list.addAll(interfaces());
Iterator iter = immediate.iterator();
Iterator<InterfaceType> iter = immediate.iterator();
while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
interfaze.addSuperinterfaces(list);
......@@ -389,7 +389,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
* overwrite them in the hash table
*/
Iterator iter = interfaces().iterator();
Iterator<InterfaceType> iter = interfaces().iterator();
while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
interfaze.addVisibleMethods(methodMap);
......@@ -411,7 +411,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
return true;
} else {
List<InterfaceType> interfaces = interfaces();
Iterator iter = interfaces.iterator();
Iterator<InterfaceType> iter = interfaces.iterator();
while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
if (interfaze.isAssignableTo(type)) {
......
......@@ -192,7 +192,7 @@ public class ConcreteMethodImpl extends MethodImpl {
return super.codeIndexToLineInfo(stratum, codeIndex);
}
Iterator iter = lineLocations.iterator();
Iterator<Location> iter = lineLocations.iterator();
/*
* Treat code before the beginning of the first line table
* entry as part of the first line. javac will generate
......@@ -221,9 +221,9 @@ public class ConcreteMethodImpl extends MethodImpl {
List<LocalVariable> variables = getVariables();
List<LocalVariable> retList = new ArrayList<LocalVariable>(2);
Iterator iter = variables.iterator();
Iterator<LocalVariable> iter = variables.iterator();
while(iter.hasNext()) {
LocalVariable variable = (LocalVariable)iter.next();
LocalVariable variable = iter.next();
if (variable.name().equals(name)) {
retList.add(variable);
}
......@@ -235,9 +235,9 @@ public class ConcreteMethodImpl extends MethodImpl {
List<LocalVariable> variables = getVariables();
List<LocalVariable> retList = new ArrayList<LocalVariable>(variables.size());
Iterator iter = variables.iterator();
Iterator<LocalVariable> iter = variables.iterator();
while(iter.hasNext()) {
LocalVariable variable = (LocalVariable)iter.next();
LocalVariable variable = iter.next();
if (variable.isArgument()) {
retList.add(variable);
}
......@@ -291,7 +291,7 @@ public class ConcreteMethodImpl extends MethodImpl {
SDE.LineStratum lastLineStratum = null;
SDE.Stratum baseStratum =
declaringType.stratum(SDE.BASE_STRATUM_NAME);
Iterator it = getBaseLocations().lineLocations.iterator();
Iterator<Location> it = getBaseLocations().lineLocations.iterator();
while(it.hasNext()) {
LocationImpl loc = (LocationImpl)it.next();
int baseLineNumber = loc.lineNumber(baseStratum);
......
......@@ -47,9 +47,9 @@ abstract class ConnectorImpl implements Connector {
public Map<String,Argument> defaultArguments() {
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()) {
ArgumentImpl argument = (ArgumentImpl)iter.next();
defaults.put(argument.name(), (Argument)argument.clone());
......@@ -96,7 +96,7 @@ abstract class ConnectorImpl implements Connector {
mustSpecify, list));
}
ArgumentImpl argument(String name, Map arguments)
ArgumentImpl argument(String name, Map<String, ? extends Argument> arguments)
throws IllegalConnectorArgumentsException {
ArgumentImpl argument = (ArgumentImpl)arguments.get(name);
......@@ -130,7 +130,7 @@ abstract class ConnectorImpl implements Connector {
public String toString() {
String string = name() + " (defaults: ";
Iterator iter = defaultArguments().values().iterator();
Iterator<Argument> iter = defaultArguments().values().iterator();
boolean first = true;
while (iter.hasNext()) {
ArgumentImpl argument = (ArgumentImpl)iter.next();
......@@ -222,7 +222,7 @@ abstract class ConnectorImpl implements Connector {
class BooleanArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.BooleanArgument {
private static final long serialVersionUID = 1624542968639361316L;
BooleanArgumentImpl(String name, String label, String description,
boolean value,
boolean mustSpecify) {
......@@ -277,7 +277,7 @@ abstract class ConnectorImpl implements Connector {
class IntegerArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.IntegerArgument {
private static final long serialVersionUID = 763286081923797770L;
private final int min;
private final int max;
......@@ -378,7 +378,7 @@ abstract class ConnectorImpl implements Connector {
class StringArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.StringArgument {
private static final long serialVersionUID = 7500484902692107464L;
StringArgumentImpl(String name, String label, String description,
String value,
boolean mustSpecify) {
......@@ -396,7 +396,7 @@ abstract class ConnectorImpl implements Connector {
class SelectedArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.SelectedArgument {
private static final long serialVersionUID = -5689584530908382517L;
private final List<String> choices;
SelectedArgumentImpl(String name, String label, String description,
......
......@@ -101,7 +101,7 @@ public class DoubleValueImpl extends PrimitiveValueImpl
}
public double doubleValue() {
return(double)value;
return value;
}
byte checkedByteValue() throws InvalidTypeException {
......
......@@ -43,7 +43,7 @@ import java.util.*;
class EventRequestManagerImpl extends MirrorImpl
implements EventRequestManager
{
List[] requestLists;
List<? extends EventRequest>[] requestLists;
private static int methodExitEventCmd = 0;
static int JDWPtoJDISuspendPolicy(byte jdwpPolicy) {
......@@ -91,7 +91,7 @@ class EventRequestManagerImpl extends MirrorImpl
* access/modification should be protected by synchronizing on
* the enclosing instance of EventRequestImpl.
*/
List filters = new ArrayList();
List<Object> filters = new ArrayList<>();
boolean isEnabled = false;
boolean deleted = false;
......@@ -195,7 +195,6 @@ class EventRequestManagerImpl extends MirrorImpl
*/
synchronized void set() {
JDWP.EventRequest.Set.Modifier[] mods =
(JDWP.EventRequest.Set.Modifier[])
filters.toArray(
new JDWP.EventRequest.Set.Modifier[filters.size()]);
try {
......@@ -582,10 +581,10 @@ class EventRequestManagerImpl extends MirrorImpl
/*
* Make sure this isn't a duplicate
*/
List requests = stepRequests();
Iterator iter = requests.iterator();
List<StepRequest> requests = stepRequests();
Iterator<StepRequest> iter = requests.iterator();
while (iter.hasNext()) {
StepRequest request = (StepRequest)iter.next();
StepRequest request = iter.next();
if ((request != this) &&
request.isEnabled() &&
request.thread().equals(thread)) {
......@@ -735,7 +734,7 @@ class EventRequestManagerImpl extends MirrorImpl
}
requestLists = new List[highest+1];
for (int i=0; i <= highest; i++) {
requestLists[i] = new ArrayList();
requestLists[i] = new ArrayList<>();
}
}
......@@ -852,7 +851,7 @@ class EventRequestManagerImpl extends MirrorImpl
public void deleteEventRequests(List<? extends EventRequest> eventRequests) {
validateMirrors(eventRequests);
// copy the eventRequests to avoid ConcurrentModificationException
Iterator iter = (new ArrayList(eventRequests)).iterator();
Iterator<? extends EventRequest> iter = (new ArrayList<>(eventRequests)).iterator();
while (iter.hasNext()) {
((EventRequestImpl)iter.next()).delete();
}
......@@ -869,76 +868,76 @@ class EventRequestManagerImpl extends MirrorImpl
}
public List<StepRequest> stepRequests() {
return unmodifiableRequestList(JDWP.EventKind.SINGLE_STEP);
return (List<StepRequest>)unmodifiableRequestList(JDWP.EventKind.SINGLE_STEP);
}
public List<ClassPrepareRequest> classPrepareRequests() {
return unmodifiableRequestList(JDWP.EventKind.CLASS_PREPARE);
return (List<ClassPrepareRequest>)unmodifiableRequestList(JDWP.EventKind.CLASS_PREPARE);
}
public List<ClassUnloadRequest> classUnloadRequests() {
return unmodifiableRequestList(JDWP.EventKind.CLASS_UNLOAD);
return (List<ClassUnloadRequest>)unmodifiableRequestList(JDWP.EventKind.CLASS_UNLOAD);
}
public List<ThreadStartRequest> threadStartRequests() {
return unmodifiableRequestList(JDWP.EventKind.THREAD_START);
return (List<ThreadStartRequest>)unmodifiableRequestList(JDWP.EventKind.THREAD_START);
}
public List<ThreadDeathRequest> threadDeathRequests() {
return unmodifiableRequestList(JDWP.EventKind.THREAD_DEATH);
return (List<ThreadDeathRequest>)unmodifiableRequestList(JDWP.EventKind.THREAD_DEATH);
}
public List<ExceptionRequest> exceptionRequests() {
return unmodifiableRequestList(JDWP.EventKind.EXCEPTION);
return (List<ExceptionRequest>)unmodifiableRequestList(JDWP.EventKind.EXCEPTION);
}
public List<BreakpointRequest> breakpointRequests() {
return unmodifiableRequestList(JDWP.EventKind.BREAKPOINT);
return (List<BreakpointRequest>)unmodifiableRequestList(JDWP.EventKind.BREAKPOINT);
}
public List<AccessWatchpointRequest> accessWatchpointRequests() {
return unmodifiableRequestList(JDWP.EventKind.FIELD_ACCESS);
return (List<AccessWatchpointRequest>)unmodifiableRequestList(JDWP.EventKind.FIELD_ACCESS);
}
public List<ModificationWatchpointRequest> modificationWatchpointRequests() {
return unmodifiableRequestList(JDWP.EventKind.FIELD_MODIFICATION);
return (List<ModificationWatchpointRequest>)unmodifiableRequestList(JDWP.EventKind.FIELD_MODIFICATION);
}
public List<MethodEntryRequest> methodEntryRequests() {
return unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY);
return (List<MethodEntryRequest>)unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY);
}
public List<MethodExitRequest> methodExitRequests() {
return unmodifiableRequestList(
return (List<MethodExitRequest>)unmodifiableRequestList(
EventRequestManagerImpl.methodExitEventCmd);
}
public List<MonitorContendedEnterRequest> monitorContendedEnterRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTER);
return (List<MonitorContendedEnterRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTER);
}
public List<MonitorContendedEnteredRequest> monitorContendedEnteredRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTERED);
return (List<MonitorContendedEnteredRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTERED);
}
public List<MonitorWaitRequest> monitorWaitRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_WAIT);
return (List<MonitorWaitRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_WAIT);
}
public List<MonitorWaitedRequest> monitorWaitedRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_WAITED);
return (List<MonitorWaitedRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_WAITED);
}
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));
}
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--) {
EventRequestImpl er = (EventRequestImpl)rl.get(i);
if (er.id == requestId) {
......
......@@ -47,7 +47,7 @@ enum EventDestination {UNKNOWN_EVENT, INTERNAL_EVENT, CLIENT_EVENT};
* that is on the queues are all for client requests.
*/
public class EventSetImpl extends ArrayList<Event> implements EventSet {
private static final long serialVersionUID = -4857338819787924570L;
private VirtualMachineImpl vm; // we implement Mirror
private Packet pkt;
private byte suspendPolicy;
......@@ -607,7 +607,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
PacketStream ps = new PacketStream(vm, pkt);
JDWP.Event.Composite compEvt = new JDWP.Event.Composite(vm, ps);
suspendPolicy = compEvt.suspendPolicy;
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
switch(suspendPolicy) {
case JDWP.SuspendPolicy.ALL:
vm.printTrace("EventSet: SUSPEND_ALL");
......@@ -626,7 +626,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
ThreadReference fix6485605 = null;
for (int i = 0; i < compEvt.events.length; i++) {
EventImpl evt = createEvent(compEvt.events[i]);
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
try {
vm.printTrace("Event: " + evt);
} catch (VMDisconnectedException ee) {
......
......@@ -97,7 +97,7 @@ public class FloatValueImpl extends PrimitiveValueImpl
}
public float floatValue() {
return(float)value;
return value;
}
public double doubleValue() {
......
......@@ -105,7 +105,7 @@ public class GenericAttachingConnector
/**
* 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
{
String ts = argument(ARG_TIMEOUT, args).value();
......
......@@ -83,7 +83,7 @@ public class IntegerValueImpl extends PrimitiveValueImpl
}
public int intValue() {
return(int)value;
return value;
}
public long longValue() {
......
......@@ -128,9 +128,9 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl
* list being built.
*/
List<InterfaceType> immediate = new ArrayList<InterfaceType>(superinterfaces());
Iterator iter = immediate.iterator();
Iterator<InterfaceType> iter = immediate.iterator();
while (iter.hasNext()) {
InterfaceType interfaze = (InterfaceType)iter.next();
InterfaceType interfaze = iter.next();
if (list.contains(interfaze)) {
iter.remove();
}
......
......@@ -59,7 +59,7 @@ public class InternalEventHandler implements Runnable
ClassUnloadEvent cuEvent = (ClassUnloadEvent)event;
vm.removeReferenceType(cuEvent.classSignature());
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
vm.printTrace("Handled Unload Event for " +
cuEvent.classSignature());
}
......@@ -68,7 +68,7 @@ public class InternalEventHandler implements Runnable
((ReferenceTypeImpl)cpEvent.referenceType())
.markPrepared();
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
vm.printTrace("Handled Prepare Event for " +
cpEvent.referenceType().name());
}
......
......@@ -27,7 +27,7 @@ package com.sun.tools.jdi;
import com.sun.jdi.*;
class JDWPException extends Exception {
private static final long serialVersionUID = -6321344442751299874L;
short errorCode;
JDWPException(short errorCode) {
......
......@@ -93,7 +93,7 @@ public class LongValueImpl extends PrimitiveValueImpl
}
public long longValue() {
return(long)value;
return value;
}
public float floatValue() {
......
......@@ -362,7 +362,7 @@ public abstract class MethodImpl extends TypeComponentImpl
int argSize = arguments.size();
JNITypeParser parser = new JNITypeParser(signature());
List signatures = parser.argumentSignatures();
List<String> signatures = parser.argumentSignatures();
if (signatures.size() != argSize) {
throw new IllegalArgumentException("Invalid argument count: expected " +
......
......@@ -83,8 +83,8 @@ abstract class MirrorImpl extends Object implements Mirror {
* Throw NullPointerException on null mirrors.
* Throw VMMismatchException on wrong VM.
*/
void validateMirrors(Collection mirrors) {
Iterator iter = mirrors.iterator();
void validateMirrors(Collection<? extends Mirror> mirrors) {
Iterator<? extends Mirror> iter = mirrors.iterator();
while (iter.hasNext()) {
MirrorImpl mirror = (MirrorImpl)iter.next();
if (!vm.equals(mirror.vm)) {
......@@ -96,8 +96,8 @@ abstract class MirrorImpl extends Object implements Mirror {
* Allow null mirrors.
* Throw VMMismatchException on wrong VM.
*/
void validateMirrorsOrNulls(Collection mirrors) {
Iterator iter = mirrors.iterator();
void validateMirrorsOrNulls(Collection<? extends Mirror> mirrors) {
Iterator<? extends Mirror> iter = mirrors.iterator();
while (iter.hasNext()) {
MirrorImpl mirror = (MirrorImpl)iter.next();
if ((mirror != null) && !vm.equals(mirror.vm)) {
......
......@@ -110,7 +110,7 @@ public class ObjectReferenceImpl extends ValueImpl
public boolean vmNotSuspended(VMAction action) {
// make sure that cache and listener management are synchronized
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());
}
disableCache();
......@@ -163,8 +163,8 @@ public class ObjectReferenceImpl extends ValueImpl
public Value getValue(Field sig) {
List<Field> list = new ArrayList<Field>(1);
list.add(sig);
Map map = getValues(list);
return(Value)map.get(sig);
Map<Field, Value> map = getValues(list);
return map.get(sig);
}
public Map<Field,Value> getValues(List<? extends Field> theFields) {
......@@ -487,7 +487,7 @@ public class ObjectReferenceImpl extends ValueImpl
info = JDWP.ObjectReference.MonitorInfo.process(vm, this);
if (local != null) {
local.monitorInfo = info;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("ObjectReference " + uniqueID() +
" temporarily caching monitor info");
}
......
......@@ -127,7 +127,7 @@ public class ProcessAttachingConnector
} else {
if (lib.equals("dt_shmem")) {
try {
Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
ts = (TransportService)c.newInstance();
} catch (Exception x) { }
}
......
......@@ -53,7 +53,7 @@ public class RawCommandLineLauncher extends AbstractLauncher implements Launchin
super();
try {
Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
transportService = (TransportService)c.newInstance();
transport = new Transport() {
public String name() {
......
......@@ -99,7 +99,7 @@ implements ReferenceType {
// Fetch all methods for the class, check performance impact
// Needs no synchronization now, since methods() returns
// unmodifiable local data
Iterator it = methods().iterator();
Iterator<Method> it = methods().iterator();
while (it.hasNext()) {
MethodImpl method = (MethodImpl)it.next();
if (method.ref() == ref) {
......@@ -113,7 +113,7 @@ implements ReferenceType {
// Fetch all fields for the class, check performance impact
// Needs no synchronization now, since fields() returns
// unmodifiable local data
Iterator it = fields().iterator();
Iterator<Field>it = fields().iterator();
while (it.hasNext()) {
FieldImpl field = (FieldImpl)it.next();
if (field.ref() == ref) {
......@@ -385,7 +385,7 @@ implements ReferenceType {
/* Add inherited, visible fields */
List<? extends ReferenceType> types = inheritedTypes();
Iterator iter = types.iterator();
Iterator<? extends ReferenceType> iter = types.iterator();
while (iter.hasNext()) {
/*
* TO DO: Be defensive and check for cyclic interface inheritance
......@@ -419,7 +419,7 @@ implements ReferenceType {
/* Add inherited fields */
List<? extends ReferenceType> types = inheritedTypes();
Iterator iter = types.iterator();
Iterator<? extends ReferenceType> iter = types.iterator();
while (iter.hasNext()) {
ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
type.addAllFields(fieldList, typeSet);
......@@ -434,13 +434,10 @@ implements ReferenceType {
}
public Field fieldByName(String fieldName) {
java.util.List searchList;
Field f;
searchList = visibleFields();
List<Field> searchList = visibleFields();
for (int i=0; i<searchList.size(); i++) {
f = (Field)searchList.get(i);
Field f = searchList.get(i);
if (f.name().equals(fieldName)) {
return f;
......@@ -575,13 +572,13 @@ implements ReferenceType {
}
public List<ReferenceType> nestedTypes() {
List all = vm.allClasses();
List<ReferenceType> all = vm.allClasses();
List<ReferenceType> nested = new ArrayList<ReferenceType>();
String outername = name();
int outerlen = outername.length();
Iterator iter = all.iterator();
Iterator<ReferenceType> iter = all.iterator();
while (iter.hasNext()) {
ReferenceType refType = (ReferenceType)iter.next();
ReferenceType refType = iter.next();
String name = refType.name();
int len = name.length();
/* The separator is historically '$' but could also be '#' */
......@@ -598,8 +595,8 @@ implements ReferenceType {
public Value getValue(Field sig) {
List<Field> list = new ArrayList<Field>(1);
list.add(sig);
Map map = getValues(list);
return(Value)map.get(sig);
Map<Field, Value> map = getValues(list);
return map.get(sig);
}
......@@ -847,7 +844,7 @@ implements ReferenceType {
SDE.Stratum stratum = stratum(stratumID);
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();
try {
list.addAll(
......@@ -887,7 +884,7 @@ implements ReferenceType {
List<Location> list = new ArrayList<Location>();
Iterator iter = methods.iterator();
Iterator<Method> iter = methods.iterator();
while(iter.hasNext()) {
MethodImpl method = (MethodImpl)iter.next();
// eliminate native and abstract to eliminate
......
......@@ -79,7 +79,7 @@ public class ShortValueImpl extends PrimitiveValueImpl
}
public short shortValue() {
return(short)value;
return value;
}
public int intValue() {
......
......@@ -64,7 +64,7 @@ public class SunCommandLineLauncher extends AbstractLauncher implements Launchin
* transport or the socket transport
*/
try {
Class c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
Class<?> c = Class.forName("com.sun.tools.jdi.SharedMemoryTransportService");
transportService = (TransportService)c.newInstance();
transport = new Transport() {
public String name() {
......
......@@ -178,7 +178,7 @@ public class TargetVM implements Runnable {
// Closing a queue causes a VMDisconnectEvent to
// be put onto the queue.
synchronized(eventQueues) {
Iterator iter = eventQueues.iterator();
Iterator<EventQueue> iter = eventQueues.iterator();
while (iter.hasNext()) {
((EventQueueImpl)iter.next()).close();
}
......@@ -187,9 +187,9 @@ public class TargetVM implements Runnable {
// indirectly throw VMDisconnectedException to
// command requesters.
synchronized(waitingQueue) {
Iterator iter = waitingQueue.values().iterator();
Iterator<Packet> iter = waitingQueue.values().iterator();
while (iter.hasNext()) {
Packet packet = (Packet)iter.next();
Packet packet = iter.next();
synchronized(packet) {
packet.notify();
}
......@@ -252,7 +252,7 @@ public class TargetVM implements Runnable {
void notifyDequeueEventSet() {
int maxQueueSize = 0;
synchronized(eventQueues) {
Iterator iter = eventQueues.iterator();
Iterator<EventQueue> iter = eventQueues.iterator();
while (iter.hasNext()) {
EventQueueImpl queue = (EventQueueImpl)iter.next();
maxQueueSize = Math.max(maxQueueSize, queue.size());
......@@ -265,7 +265,7 @@ public class TargetVM implements Runnable {
int maxQueueSize = 0;
synchronized(eventQueues) {
Iterator iter = eventQueues.iterator();
Iterator<EventQueue> iter = eventQueues.iterator();
while (iter.hasNext()) {
EventQueueImpl queue = (EventQueueImpl)iter.next();
queue.enqueue(eventSet);
......
......@@ -33,6 +33,7 @@ import java.util.EventObject;
* with JDI events.
*/
class ThreadAction extends EventObject {
private static final long serialVersionUID = 5690763191100515283L;
// Event ids
/*static final int THREAD_SUSPENDED = 1;*/
static final int THREAD_RESUMABLE = 2;
......
......@@ -118,7 +118,7 @@ public class ThreadGroupReferenceImpl extends ObjectReferenceImpl
.process(vm, this);
if (local != null) {
local.kids = kids;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() +
" temporarily caching children ");
}
......
......@@ -240,7 +240,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
public void stop(ObjectReference throwable) throws InvalidTypeException {
validateMirror(throwable);
// 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);
if ((throwable == null) ||
!throwableClass.isAssignableFrom(throwable)) {
......@@ -296,10 +296,10 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
try {
StackFrame frame = frame(0);
Location location = frame.location();
List requests = vm.eventRequestManager().breakpointRequests();
Iterator iter = requests.iterator();
List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests();
Iterator<BreakpointRequest> iter = requests.iterator();
while (iter.hasNext()) {
BreakpointRequest request = (BreakpointRequest)iter.next();
BreakpointRequest request = iter.next();
if (location.equals(request.location())) {
return true;
}
......@@ -352,8 +352,8 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
}
public StackFrame frame(int index) throws IncompatibleThreadStateException {
List list = privateFrames(index, 1);
return (StackFrame)list.get(0);
List<StackFrame> list = privateFrames(index, 1);
return list.get(0);
}
/**
......@@ -447,7 +447,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
snapshot.ownedMonitors = Arrays.asList(
(ObjectReference[])JDWP.ThreadReference.OwnedMonitors.
process(vm, this).owned);
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() +
" temporarily caching owned monitors"+
" (count = " + snapshot.ownedMonitors.size() + ")");
......@@ -475,7 +475,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
process(vm, this).monitor;
snapshot.triedCurrentContended = true;
if ((snapshot.contendedMonitor != null) &&
((vm.traceFlags & vm.TRACE_OBJREFS) != 0)) {
((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0)) {
vm.printTrace(description() +
" temporarily caching contended monitor"+
" (id = " + snapshot.contendedMonitor.uniqueID() + ")");
......@@ -509,7 +509,7 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
snapshot.ownedMonitorsInfo.add(mon);
}
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() +
" temporarily caching owned monitors"+
" (count = " + snapshot.ownedMonitorsInfo.size() + ")");
......@@ -601,9 +601,9 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
void removeListener(ThreadListener listener) {
synchronized (vm.state()) {
Iterator iter = listeners.iterator();
Iterator<WeakReference<ThreadListener>> iter = listeners.iterator();
while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next();
WeakReference<ThreadListener> ref = iter.next();
if (listener.equals(ref.get())) {
iter.remove();
break;
......@@ -619,10 +619,10 @@ public class ThreadReferenceImpl extends ObjectReferenceImpl
*/
private void processThreadAction(ThreadAction action) {
synchronized (vm.state()) {
Iterator iter = listeners.iterator();
Iterator<WeakReference<ThreadListener>> iter = listeners.iterator();
while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next();
ThreadListener listener = (ThreadListener)ref.get();
WeakReference<ThreadListener> ref = iter.next();
ThreadListener listener = ref.get();
if (listener != null) {
switch (action.id()) {
case ThreadAction.THREAD_RESUMABLE:
......
......@@ -33,6 +33,8 @@ import java.util.EventObject;
* with JDI events.
*/
class VMAction extends EventObject {
private static final long serialVersionUID = -1701944679310296090L;
// Event ids
static final int VM_SUSPENDED = 1;
static final int VM_NOT_SUSPENDED = 2;
......
......@@ -34,7 +34,7 @@ class VMState {
private final VirtualMachineImpl vm;
// 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)
/*
......@@ -129,7 +129,7 @@ class VMState {
*/
synchronized void thaw(ThreadReference resumingThread) {
if (cache != null) {
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("Clearing VM suspended cache");
}
disableCache();
......@@ -142,10 +142,10 @@ class VMState {
// Prevent recursion
notifyingListeners = true;
Iterator iter = listeners.iterator();
Iterator<WeakReference<VMListener>> iter = listeners.iterator();
while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next();
VMListener listener = (VMListener)ref.get();
WeakReference<VMListener> ref = iter.next();
VMListener listener = ref.get();
if (listener != null) {
boolean keep = true;
switch (action.id()) {
......@@ -178,9 +178,9 @@ class VMState {
}
synchronized void removeListener(VMListener listener) {
Iterator iter = listeners.iterator();
Iterator<WeakReference<VMListener>> iter = listeners.iterator();
while (iter.hasNext()) {
WeakReference ref = (WeakReference)iter.next();
WeakReference<VMListener> ref = iter.next();
if (listener.equals(ref.get())) {
iter.remove();
break;
......@@ -202,7 +202,7 @@ class VMState {
process(vm).threads);
if (local != null) {
local.threads = threads;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("Caching all threads (count = " +
threads.size() + ") while VM suspended");
}
......@@ -229,7 +229,7 @@ class VMState {
process(vm).groups);
if (local != null) {
local.groups = groups;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(
"Caching top level thread groups (count = " +
groups.size() + ") while VM suspended");
......
......@@ -300,9 +300,9 @@ class VirtualMachineImpl extends MirrorImpl
if (!canRedefineClasses()) {
throw new UnsupportedOperationException();
}
Iterator it = classToBytes.entrySet().iterator();
Iterator<?> it = classToBytes.entrySet().iterator();
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();
validateMirror(refType);
defs[i] = new JDWP.VirtualMachine.RedefineClasses
......@@ -801,7 +801,7 @@ class VirtualMachineImpl extends MirrorImpl
* we can't differentiate here, we first remove all
* matching classes from our cache...
*/
Iterator iter = typesBySignature.iterator();
Iterator<ReferenceType> iter = typesBySignature.iterator();
int matches = 0;
while (iter.hasNext()) {
ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
......@@ -833,7 +833,7 @@ class VirtualMachineImpl extends MirrorImpl
if (typesByID == null) {
return new ArrayList<ReferenceType>(0);
}
Iterator iter = typesBySignature.iterator();
Iterator<ReferenceType> iter = typesBySignature.iterator();
List<ReferenceType> list = new ArrayList<ReferenceType>();
while (iter.hasNext()) {
ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
......@@ -1041,10 +1041,10 @@ class VirtualMachineImpl extends MirrorImpl
}
Type findBootType(String signature) throws ClassNotLoadedException {
List types = allClasses();
Iterator iter = types.iterator();
List<ReferenceType> types = allClasses();
Iterator<ReferenceType> iter = types.iterator();
while (iter.hasNext()) {
ReferenceType type = (ReferenceType)iter.next();
ReferenceType type = iter.next();
if ((type.classLoader() == null) &&
(type.signature().equals(signature))) {
return type;
......@@ -1227,7 +1227,7 @@ class VirtualMachineImpl extends MirrorImpl
}
private void processQueue() {
Reference ref;
Reference<?> ref;
//if ((traceFlags & TRACE_OBJREFS) != 0) {
// printTrace("Checking for softly reachable objects");
//}
......
......@@ -60,7 +60,8 @@ public final class Boolean implements java.io.Serializable,
*
* @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.
......
......@@ -59,6 +59,7 @@ public final class Byte extends Number implements Comparable<Byte> {
* The {@code Class} instance representing the primitive type
* {@code byte}.
*/
@SuppressWarnings("unchecked")
public static final Class<Byte> TYPE = (Class<Byte>) Class.getPrimitiveClass("byte");
/**
......
......@@ -172,7 +172,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* @since 1.1
*/
@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
......
......@@ -101,6 +101,8 @@ class CharacterName {
if (lookup[cp>>8] == null ||
(off = lookup[cp>>8][cp&0xff]) == 0)
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
* <cite>The Java&trade; Virtual Machine Specification</cite>
* @since 1.5
*/
@SuppressWarnings("unchecked")
public TypeVariable<Class<T>>[] getTypeParameters() {
if (getGenericSignature() != null)
return (TypeVariable<Class<T>>[])getGenericInfo().getTypeParameters();
......@@ -1303,7 +1304,7 @@ public final
return java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Class<?>[]>() {
public Class[] run() {
public Class<?>[] run() {
List<Class<?>> list = new ArrayList<>();
Class<?> currentClass = Class.this;
while (currentClass != null) {
......@@ -1315,7 +1316,7 @@ public final
}
currentClass = currentClass.getSuperclass();
}
return list.toArray(new Class[0]);
return list.toArray(new Class<?>[0]);
}
});
}
......@@ -2150,7 +2151,7 @@ public final
* Return the Virtual Machine's Class object for the named
* primitive type.
*/
static native Class getPrimitiveClass(String name);
static native Class<?> getPrimitiveClass(String name);
/*
......@@ -2395,7 +2396,9 @@ public final
}
// No cached value available; request value from VM
if (isInterface()) {
res = new Constructor[0];
@SuppressWarnings("unchecked")
Constructor<T>[] temporaryRes = (Constructor<T>[]) new Constructor<?>[0];
res = temporaryRes;
} else {
res = getDeclaredConstructors0(publicOnly);
}
......@@ -2951,7 +2954,9 @@ public final
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
// that don't comply with the enum spec.
......@@ -2996,6 +3001,7 @@ public final
*
* @since 1.5
*/
@SuppressWarnings("unchecked")
public T cast(Object obj) {
if (obj != null && !isInstance(obj))
throw new ClassCastException(cannotCastMsg(obj));
......@@ -3026,6 +3032,7 @@ public final
* the class itself).
* @since 1.5
*/
@SuppressWarnings("unchecked")
public <U> Class<? extends U> asSubclass(Class<U> clazz) {
if (clazz.isAssignableFrom(this))
return (Class<? extends U>) this;
......@@ -3037,6 +3044,7 @@ public final
* @throws NullPointerException {@inheritDoc}
* @since 1.5
*/
@SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(Class<A> annotationClass) {
if (annotationClass == null)
throw new NullPointerException();
......
......@@ -1167,7 +1167,8 @@ public abstract class ClassLoader {
* @since 1.2
*/
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) {
tmp[0] = parent.getResources(name);
} else {
......
......@@ -92,15 +92,15 @@ final class ConditionalSpecialCasing {
};
// A hash table that contains the above entries
static Hashtable entryTable = new Hashtable();
static Hashtable<Integer, HashSet<Entry>> entryTable = new Hashtable<>();
static {
// create hashtable from the entry
for (int i = 0; i < entry.length; i ++) {
Entry cur = entry[i];
Integer cp = new Integer(cur.getCodePoint());
HashSet set = (HashSet)entryTable.get(cp);
HashSet<Entry> set = entryTable.get(cp);
if (set == null) {
set = new HashSet();
set = new HashSet<Entry>();
}
set.add(cur);
entryTable.put(cp, set);
......@@ -151,13 +151,13 @@ final class ConditionalSpecialCasing {
}
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) {
Iterator iter = set.iterator();
Iterator<Entry> iter = set.iterator();
String currentLang = locale.getLanguage();
while (iter.hasNext()) {
Entry entry = (Entry)iter.next();
Entry entry = iter.next();
String conditionLang= entry.getLanguage();
if (((conditionLang == null) || (conditionLang.equals(currentLang))) &&
isConditionMet(src, index, locale, entry.getCondition())) {
......
......@@ -128,6 +128,7 @@ public final class Double extends Number implements Comparable<Double> {
*
* @since JDK1.1
*/
@SuppressWarnings("unchecked")
public static final Class<Double> TYPE = (Class<Double>) Class.getPrimitiveClass("double");
/**
......@@ -715,7 +716,7 @@ public final class Double extends Number implements Comparable<Double> {
* @return the {@code double} value represented by this object
*/
public double doubleValue() {
return (double)value;
return value;
}
/**
......
......@@ -36,6 +36,7 @@ package java.lang;
* @see java.lang.reflect.AnnotatedElement
* @since 1.5
*/
@SuppressWarnings("rawtypes") /* rawtypes are part of the public api */
public class EnumConstantNotPresentException extends RuntimeException {
private static final long serialVersionUID = -6046998521960521108L;
......
......@@ -126,7 +126,8 @@ public final class Float extends Number implements Comparable<Float> {
*
* @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}
......
......@@ -68,6 +68,7 @@ public final class Integer extends Number implements Comparable<Integer> {
*
* @since JDK1.1
*/
@SuppressWarnings("unchecked")
public static final Class<Integer> TYPE = (Class<Integer>) Class.getPrimitiveClass("int");
/**
......
......@@ -66,6 +66,7 @@ public final class Long extends Number implements Comparable<Long> {
*
* @since JDK1.1
*/
@SuppressWarnings("unchecked")
public static final Class<Long> TYPE = (Class<Long>) Class.getPrimitiveClass("long");
/**
......@@ -734,7 +735,7 @@ public final class Long extends Number implements Comparable<Long> {
* {@code long} value.
*/
public long longValue() {
return (long)value;
return value;
}
/**
......
......@@ -58,6 +58,7 @@ public final class Short extends Number implements Comparable<Short> {
* The {@code Class} instance representing the primitive type
* {@code short}.
*/
@SuppressWarnings("unchecked")
public static final Class<Short> TYPE = (Class<Short>) Class.getPrimitiveClass("short");
/**
......
......@@ -1032,7 +1032,7 @@ public final class System {
*/
@Deprecated
public static void runFinalizersOnExit(boolean value) {
Runtime.getRuntime().runFinalizersOnExit(value);
Runtime.runFinalizersOnExit(value);
}
/**
......
......@@ -144,8 +144,11 @@ public class ThreadLocal<T> {
ThreadLocalMap map = getMap(t);
if (map != null) {
ThreadLocalMap.Entry e = map.getEntry(this);
if (e != null)
return (T)e.value;
if (e != null) {
@SuppressWarnings("unchecked")
T result = (T)e.value;
return result;
}
}
return setInitialValue();
}
......@@ -268,11 +271,11 @@ public class ThreadLocal<T> {
* entry can be expunged from table. Such entries are referred to
* 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. */
Object value;
Entry(ThreadLocal k, Object v) {
Entry(ThreadLocal<?> k, Object v) {
super(k);
value = v;
}
......@@ -325,7 +328,7 @@ public class ThreadLocal<T> {
* ThreadLocalMaps are constructed lazily, so we only create
* 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];
int i = firstKey.threadLocalHashCode & (INITIAL_CAPACITY - 1);
table[i] = new Entry(firstKey, firstValue);
......@@ -348,7 +351,8 @@ public class ThreadLocal<T> {
for (int j = 0; j < len; j++) {
Entry e = parentTable[j];
if (e != null) {
ThreadLocal key = e.get();
@SuppressWarnings("unchecked")
ThreadLocal<Object> key = (ThreadLocal<Object>) e.get();
if (key != null) {
Object value = key.childValue(e.value);
Entry c = new Entry(key, value);
......@@ -372,7 +376,7 @@ public class ThreadLocal<T> {
* @param key the thread local object
* @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);
Entry e = table[i];
if (e != null && e.get() == key)
......@@ -390,12 +394,12 @@ public class ThreadLocal<T> {
* @param e the entry at table[i]
* @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;
int len = tab.length;
while (e != null) {
ThreadLocal k = e.get();
ThreadLocal<?> k = e.get();
if (k == key)
return e;
if (k == null)
......@@ -413,7 +417,7 @@ public class ThreadLocal<T> {
* @param key the thread local object
* @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
// least as common to use set() to create new entries as
......@@ -427,7 +431,7 @@ public class ThreadLocal<T> {
for (Entry e = tab[i];
e != null;
e = tab[i = nextIndex(i, len)]) {
ThreadLocal k = e.get();
ThreadLocal<?> k = e.get();
if (k == key) {
e.value = value;
......@@ -449,7 +453,7 @@ public class ThreadLocal<T> {
/**
* Remove the entry for key.
*/
private void remove(ThreadLocal key) {
private void remove(ThreadLocal<?> key) {
Entry[] tab = table;
int len = tab.length;
int i = key.threadLocalHashCode & (len-1);
......@@ -479,7 +483,7 @@ public class ThreadLocal<T> {
* @param staleSlot index of the first stale entry encountered while
* searching for key.
*/
private void replaceStaleEntry(ThreadLocal key, Object value,
private void replaceStaleEntry(ThreadLocal<?> key, Object value,
int staleSlot) {
Entry[] tab = table;
int len = tab.length;
......@@ -501,7 +505,7 @@ public class ThreadLocal<T> {
for (int i = nextIndex(staleSlot, len);
(e = tab[i]) != null;
i = nextIndex(i, len)) {
ThreadLocal k = e.get();
ThreadLocal<?> k = e.get();
// If we find key, then we need to swap it
// with the stale entry to maintain hash table order.
......@@ -563,7 +567,7 @@ public class ThreadLocal<T> {
for (i = nextIndex(staleSlot, len);
(e = tab[i]) != null;
i = nextIndex(i, len)) {
ThreadLocal k = e.get();
ThreadLocal<?> k = e.get();
if (k == null) {
e.value = null;
tab[i] = null;
......@@ -650,7 +654,7 @@ public class ThreadLocal<T> {
for (int j = 0; j < oldLen; ++j) {
Entry e = oldTab[j];
if (e != null) {
ThreadLocal k = e.get();
ThreadLocal<?> k = e.get();
if (k == null) {
e.value = null; // Help the GC
} else {
......
......@@ -40,7 +40,8 @@ class Void {
* The {@code Class} object representing the pseudo-type corresponding to
* 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.
......
......@@ -72,6 +72,10 @@ public final class HttpCookie implements Cloneable {
private boolean httpOnly; // HttpOnly ... i.e. not accessible to scripts
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
// expiration calculation
private final long whenCreated;
......@@ -128,6 +132,10 @@ public final class HttpCookie implements Cloneable {
* @see #setVersion
*/
public HttpCookie(String name, String value) {
this(name, value, null /*header*/);
}
private HttpCookie(String name, String value, String header) {
name = name.trim();
if (name.length() == 0 || !isToken(name) || isReserved(name)) {
throw new IllegalArgumentException("Illegal cookie name");
......@@ -140,6 +148,7 @@ public final class HttpCookie implements Cloneable {
whenCreated = System.currentTimeMillis();
portlist = null;
this.header = header;
}
/**
......@@ -163,6 +172,15 @@ public final class HttpCookie implements Cloneable {
* if the header string is {@code null}
*/
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);
// if header start with set-cookie or set-cookie2, strip it off
......@@ -178,7 +196,7 @@ public final class HttpCookie implements Cloneable {
// so the parse logic is slightly different
if (version == 0) {
// Netscape draft cookie
HttpCookie cookie = parseInternal(header);
HttpCookie cookie = parseInternal(header, retainHeader);
cookie.setVersion(0);
cookies.add(cookie);
} else {
......@@ -187,7 +205,7 @@ public final class HttpCookie implements Cloneable {
// it'll separate them with comma
List<String> cookieStrings = splitMultiCookies(header);
for (String cookieStr : cookieStrings) {
HttpCookie cookie = parseInternal(cookieStr);
HttpCookie cookie = parseInternal(cookieStr, retainHeader);
cookie.setVersion(1);
cookies.add(cookie);
}
......@@ -804,7 +822,8 @@ public final class HttpCookie implements Cloneable {
* @throws IllegalArgumentException
* if header string violates the cookie specification
*/
private static HttpCookie parseInternal(String header)
private static HttpCookie parseInternal(String header,
boolean retainHeader)
{
HttpCookie cookie = null;
String namevaluePair = null;
......@@ -819,7 +838,13 @@ public final class HttpCookie implements Cloneable {
if (index != -1) {
String name = namevaluePair.substring(0, index).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 {
// no "=" in name-value pair; it's an error
throw new IllegalArgumentException("Invalid cookie name-value pair");
......@@ -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
* as Netscape spec, but without leading "Cookie:" token.
......
......@@ -373,11 +373,13 @@ public abstract class FileSystemProvider {
{
if (options.length > 0) {
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");
}
}
return Channels.newInputStream(Files.newByteChannel(path));
return Channels.newInputStream(Files.newByteChannel(path, options));
}
/**
......
......@@ -737,10 +737,6 @@ public final class Locale implements Cloneable, Serializable {
*/
public static Locale getDefault() {
// 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;
}
......@@ -762,16 +758,23 @@ public final class Locale implements Cloneable, Serializable {
*/
public static Locale getDefault(Locale.Category category) {
// do not synchronize this method - see 4071298
// it's OK if more than one default locale happens to be created
switch (category) {
case DISPLAY:
if (defaultDisplayLocale == null) {
initDefault(category);
synchronized(Locale.class) {
if (defaultDisplayLocale == null) {
defaultDisplayLocale = initDefault(category);
}
}
}
return defaultDisplayLocale;
case FORMAT:
if (defaultFormatLocale == null) {
initDefault(category);
synchronized(Locale.class) {
if (defaultFormatLocale == null) {
defaultFormatLocale = initDefault(category);
}
}
}
return defaultFormatLocale;
default:
......@@ -780,7 +783,7 @@ public final class Locale implements Cloneable, Serializable {
return getDefault();
}
private static void initDefault() {
private static Locale initDefault() {
String language, region, script, country, variant;
language = AccessController.doPrivileged(
new GetPropertyAction("user.language", "en"));
......@@ -806,16 +809,12 @@ public final class Locale implements Cloneable, Serializable {
variant = AccessController.doPrivileged(
new GetPropertyAction("user.variant", ""));
}
defaultLocale = getInstance(language, script, country, variant, null);
}
private static void initDefault(Locale.Category category) {
// make sure defaultLocale is initialized
if (defaultLocale == null) {
initDefault();
}
return getInstance(language, script, country, variant, null);
}
Locale defaultCategoryLocale = getInstance(
private static Locale initDefault(Locale.Category category) {
return getInstance(
AccessController.doPrivileged(
new GetPropertyAction(category.languageKey, defaultLocale.getLanguage())),
AccessController.doPrivileged(
......@@ -825,15 +824,6 @@ public final class Locale implements Cloneable, Serializable {
AccessController.doPrivileged(
new GetPropertyAction(category.variantKey, defaultLocale.getVariant())),
null);
switch (category) {
case DISPLAY:
defaultDisplayLocale = defaultCategoryLocale;
break;
case FORMAT:
defaultFormatLocale = defaultCategoryLocale;
break;
}
}
/**
......@@ -1916,9 +1906,9 @@ public final class Locale implements Cloneable, Serializable {
*/
private transient volatile int hashCodeValue = 0;
private static Locale defaultLocale = null;
private static Locale defaultDisplayLocale = null;
private static Locale defaultFormatLocale = null;
private volatile static Locale defaultLocale = initDefault();
private volatile static Locale defaultDisplayLocale = null;
private volatile static Locale defaultFormatLocale = null;
/**
* Return an array of the display names of the variant.
......
......@@ -131,8 +131,9 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
/**
* Returns item at index i.
*/
@SuppressWarnings("unchecked")
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>
*/
private E extract() {
final Object[] items = this.items;
E x = this.<E>cast(items[takeIndex]);
@SuppressWarnings("unchecked")
E x = (E) items[takeIndex];
items[takeIndex] = null;
takeIndex = inc(takeIndex);
--count;
......@@ -647,7 +649,9 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
int n = 0;
int max = count;
while (n < max) {
c.add(this.<E>cast(items[i]));
@SuppressWarnings("unchecked")
E x = (E) items[i];
c.add(x);
items[i] = null;
i = inc(i);
++n;
......@@ -684,7 +688,9 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E>
int n = 0;
int max = (maxElements < count) ? maxElements : count;
while (n < max) {
c.add(this.<E>cast(items[i]));
@SuppressWarnings("unchecked")
E x = (E) items[i];
c.add(x);
items[i] = null;
i = inc(i);
++n;
......
......@@ -37,9 +37,6 @@ package java.util.concurrent;
import java.util.concurrent.locks.*;
import java.util.*;
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
......@@ -228,7 +225,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = HashEntry.class;
Class<?> k = HashEntry.class;
nextOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("next"));
} catch (Exception e) {
......@@ -433,7 +430,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
int newCapacity = oldCapacity << 1;
threshold = (int)(newCapacity * loadFactor);
HashEntry<K,V>[] newTable =
(HashEntry<K,V>[]) new HashEntry[newCapacity];
(HashEntry<K,V>[]) new HashEntry<?,?>[newCapacity];
int sizeMask = newCapacity - 1;
for (int i = 0; i < oldCapacity ; i++) {
HashEntry<K,V> e = oldTable[i];
......@@ -677,7 +674,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
int cap = proto.table.length;
float lf = proto.loadFactor;
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))
== null) { // recheck
Segment<K,V> s = new Segment<K,V>(lf, threshold, tab);
......@@ -694,7 +691,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
// Hash-based segment and entry accesses
/**
* Get the segment for the given hash
* Gets the segment for the given hash code.
*/
@SuppressWarnings("unchecked")
private Segment<K,V> segmentForHash(int h) {
......@@ -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")
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>
// create segments and segments[0]
Segment<K,V> s0 =
new Segment<K,V>(loadFactor, (int)(cap * loadFactor),
(HashEntry<K,V>[])new HashEntry[cap]);
Segment<K,V>[] ss = (Segment<K,V>[])new Segment[ssize];
(HashEntry<K,V>[])new HashEntry<?,?>[cap]);
Segment<K,V>[] ss = (Segment<K,V>[])new Segment<?,?>[ssize];
UNSAFE.putOrderedObject(ss, SBASE, s0); // ordered write of segments[0]
this.segments = ss;
}
......@@ -916,6 +913,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
*
* @throws NullPointerException if the specified key is null
*/
@SuppressWarnings("unchecked")
public V get(Object key) {
Segment<K,V> s; // manually integrate access methods to reduce overhead
HashEntry<K,V>[] tab;
......@@ -1026,7 +1024,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
* full compatibility with class {@link java.util.Hashtable},
* which supported this method prior to introduction of the
* Java Collections framework.
*
* @param value a value to search for
* @return <tt>true</tt> if and only if some key maps to the
* <tt>value</tt> argument in this table as
......@@ -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).
*/
final void advance() {
......@@ -1326,12 +1324,14 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
final class WriteThroughEntry
extends AbstractMap.SimpleEntry<K,V>
{
static final long serialVersionUID = 7249069246763182397L;
WriteThroughEntry(K k, V 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
* WriteThroughEntry does not necessarily track asynchronous
* changes, the most recent "previous" value could be
......@@ -1427,15 +1427,16 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
/* ---------------- Serialization Support -------------- */
/**
* Save the state of the <tt>ConcurrentHashMap</tt> instance to a
* stream (i.e., serialize it).
* Saves the state of the <tt>ConcurrentHashMap</tt> instance to a
* stream (i.e., serializes it).
* @param s the stream
* @serialData
* the key (Object) and value (Object)
* for each key-value mapping, followed by a null pair.
* 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
for (int k = 0; k < segments.length; ++k)
ensureSegment(k);
......@@ -1463,13 +1464,13 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
}
/**
* Reconstitute the <tt>ConcurrentHashMap</tt> instance from a
* stream (i.e., deserialize it).
* Reconstitutes the <tt>ConcurrentHashMap</tt> instance from a
* stream (i.e., deserializes it).
* @param s the stream
*/
@SuppressWarnings("unchecked")
private void readObject(java.io.ObjectInputStream s)
throws IOException, ClassNotFoundException {
throws java.io.IOException, ClassNotFoundException {
s.defaultReadObject();
// Re-initialize segments to be minimally sized, and let grow.
......@@ -1479,7 +1480,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
Segment<K,V> seg = segments[k];
if (seg != null) {
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>
int ss, ts;
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class tc = HashEntry[].class;
Class sc = Segment[].class;
Class<?> tc = HashEntry[].class;
Class<?> sc = Segment[].class;
TBASE = UNSAFE.arrayBaseOffset(tc);
SBASE = UNSAFE.arrayBaseOffset(sc);
ts = UNSAFE.arrayIndexScale(tc);
......
......@@ -335,7 +335,7 @@ public class ConcurrentLinkedDeque<E>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = Node.class;
Class<?> k = Node.class;
prevOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("prev"));
itemOffset = UNSAFE.objectFieldOffset
......@@ -1457,7 +1457,7 @@ public class ConcurrentLinkedDeque<E>
NEXT_TERMINATOR.prev = NEXT_TERMINATOR;
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = ConcurrentLinkedDeque.class;
Class<?> k = ConcurrentLinkedDeque.class;
headOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("head"));
tailOffset = UNSAFE.objectFieldOffset
......
......@@ -208,7 +208,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = Node.class;
Class<?> k = Node.class;
itemOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("item"));
nextOffset = UNSAFE.objectFieldOffset
......@@ -823,7 +823,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = ConcurrentLinkedQueue.class;
Class<?> k = ConcurrentLinkedQueue.class;
headOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("head"));
tailOffset = UNSAFE.objectFieldOffset
......
......@@ -35,7 +35,6 @@
package java.util.concurrent;
import java.util.*;
import java.util.concurrent.atomic.*;
/**
* A scalable concurrent {@link ConcurrentNavigableMap} implementation.
......@@ -90,6 +89,7 @@ import java.util.concurrent.atomic.*;
* @param <V> the type of mapped values
* @since 1.6
*/
@SuppressWarnings("unchecked")
public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
implements ConcurrentNavigableMap<K,V>,
Cloneable,
......@@ -352,11 +352,11 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
private transient int randomSeed;
/** Lazily initialized key set */
private transient KeySet keySet;
private transient KeySet<K> keySet;
/** Lazily initialized entry set */
private transient EntrySet entrySet;
private transient EntrySet<K,V> entrySet;
/** Lazily initialized values collection */
private transient Values values;
private transient Values<V> values;
/** Lazily initialized descending key set */
private transient ConcurrentNavigableMap<K,V> descendingMap;
......@@ -517,7 +517,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = Node.class;
Class<?> k = Node.class;
valueOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("value"));
nextOffset = UNSAFE.objectFieldOffset
......@@ -597,7 +597,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = Index.class;
Class<?> k = Index.class;
rightOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("right"));
} catch (Exception e) {
......@@ -933,7 +933,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* direction.
*/
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;
for (int i = 1; i <= level; ++i)
idxs[i] = idx = new Index<K,V>(z, idx, null);
......@@ -1436,16 +1436,16 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* @return a shallow copy of this map
*/
public ConcurrentSkipListMap<K,V> clone() {
ConcurrentSkipListMap<K,V> clone = null;
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) {
throw new InternalError();
}
clone.initialize();
clone.buildFromSorted(this);
return clone;
}
/**
......@@ -1507,7 +1507,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
/* ---------------- 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
* key-value mapping represented by the map, followed by
......@@ -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)
throws java.io.IOException, ClassNotFoundException {
......@@ -1755,13 +1757,13 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* @return a navigable set view of the keys in this map
*/
public NavigableSet<K> keySet() {
KeySet ks = keySet;
return (ks != null) ? ks : (keySet = new KeySet(this));
KeySet<K> ks = keySet;
return (ks != null) ? ks : (keySet = new KeySet<K>(this));
}
public NavigableSet<K> navigableKeySet() {
KeySet ks = keySet;
return (ks != null) ? ks : (keySet = new KeySet(this));
KeySet<K> ks = keySet;
return (ks != null) ? ks : (keySet = new KeySet<K>(this));
}
/**
......@@ -1783,8 +1785,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* reflect any modifications subsequent to construction.
*/
public Collection<V> values() {
Values vs = values;
return (vs != null) ? vs : (values = new Values(this));
Values<V> vs = values;
return (vs != null) ? vs : (values = new Values<V>(this));
}
/**
......@@ -1812,8 +1814,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* sorted in ascending key order
*/
public Set<Map.Entry<K,V>> entrySet() {
EntrySet es = entrySet;
return (es != null) ? es : (entrySet = new EntrySet(this));
EntrySet<K,V> es = entrySet;
return (es != null) ? es : (entrySet = new EntrySet<K,V>(this));
}
public ConcurrentNavigableMap<K,V> descendingMap() {
......@@ -2304,8 +2306,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
static final class KeySet<E>
extends AbstractSet<E> implements NavigableSet<E> {
private final ConcurrentNavigableMap<E,Object> m;
KeySet(ConcurrentNavigableMap<E,Object> map) { m = map; }
private final ConcurrentNavigableMap<E,?> m;
KeySet(ConcurrentNavigableMap<E,?> map) { m = map; }
public int size() { return m.size(); }
public boolean isEmpty() { return m.isEmpty(); }
public boolean contains(Object o) { return m.containsKey(o); }
......@@ -2319,11 +2321,11 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
public E first() { return m.firstKey(); }
public E last() { return m.lastKey(); }
public E pollFirst() {
Map.Entry<E,Object> e = m.pollFirstEntry();
Map.Entry<E,?> e = m.pollFirstEntry();
return (e == null) ? null : e.getKey();
}
public E pollLast() {
Map.Entry<E,Object> e = m.pollLastEntry();
Map.Entry<E,?> e = m.pollLastEntry();
return (e == null) ? null : e.getKey();
}
public Iterator<E> iterator() {
......@@ -2374,20 +2376,20 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
return tailSet(fromElement, true);
}
public NavigableSet<E> descendingSet() {
return new KeySet(m.descendingMap());
return new KeySet<E>(m.descendingMap());
}
}
static final class Values<E> extends AbstractCollection<E> {
private final ConcurrentNavigableMap<Object, E> m;
Values(ConcurrentNavigableMap<Object, E> map) {
private final ConcurrentNavigableMap<?, E> m;
Values(ConcurrentNavigableMap<?, E> map) {
m = map;
}
public Iterator<E> iterator() {
if (m instanceof ConcurrentSkipListMap)
return ((ConcurrentSkipListMap<Object,E>)m).valueIterator();
return ((ConcurrentSkipListMap<?,E>)m).valueIterator();
else
return ((SubMap<Object,E>)m).valueIterator();
return ((SubMap<?,E>)m).valueIterator();
}
public boolean isEmpty() {
return m.isEmpty();
......@@ -2421,14 +2423,14 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
public boolean contains(Object o) {
if (!(o instanceof Map.Entry))
return false;
Map.Entry<K1,V1> e = (Map.Entry<K1,V1>)o;
Map.Entry<?,?> e = (Map.Entry<?,?>)o;
V1 v = m.get(e.getKey());
return v != null && v.equals(e.getValue());
}
public boolean remove(Object o) {
if (!(o instanceof Map.Entry))
return false;
Map.Entry<K1,V1> e = (Map.Entry<K1,V1>)o;
Map.Entry<?,?> e = (Map.Entry<?,?>)o;
return m.remove(e.getKey(),
e.getValue());
}
......@@ -2568,9 +2570,9 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
if (lo == null)
return m.findFirst();
else if (loInclusive)
return m.findNear(lo, m.GT|m.EQ);
return m.findNear(lo, GT|EQ);
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>
if (hi == null)
return m.findLast();
else if (hiInclusive)
return m.findNear(hi, m.LT|m.EQ);
return m.findNear(hi, LT|EQ);
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>
*/
private Map.Entry<K,V> getNearEntry(K key, int rel) {
if (isDescending) { // adjust relation for direction
if ((rel & m.LT) == 0)
rel |= m.LT;
if ((rel & LT) == 0)
rel |= LT;
else
rel &= ~m.LT;
rel &= ~LT;
}
if (tooLow(key))
return ((rel & m.LT) != 0) ? null : lowestEntry();
return ((rel & LT) != 0) ? null : lowestEntry();
if (tooHigh(key))
return ((rel & m.LT) != 0) ? highestEntry() : null;
return ((rel & LT) != 0) ? highestEntry() : null;
for (;;) {
Node<K,V> n = m.findNear(key, rel);
if (n == null || !inBounds(n.key))
......@@ -2688,13 +2690,13 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
// Almost the same as getNearEntry, except for keys
private K getNearKey(K key, int rel) {
if (isDescending) { // adjust relation for direction
if ((rel & m.LT) == 0)
rel |= m.LT;
if ((rel & LT) == 0)
rel |= LT;
else
rel &= ~m.LT;
rel &= ~LT;
}
if (tooLow(key)) {
if ((rel & m.LT) == 0) {
if ((rel & LT) == 0) {
ConcurrentSkipListMap.Node<K,V> n = loNode();
if (isBeforeEnd(n))
return n.key;
......@@ -2702,7 +2704,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
return null;
}
if (tooHigh(key)) {
if ((rel & m.LT) != 0) {
if ((rel & LT) != 0) {
ConcurrentSkipListMap.Node<K,V> n = hiNode();
if (n != null) {
K last = n.key;
......@@ -2734,7 +2736,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
public V get(Object key) {
if (key == null) throw new NullPointerException();
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) {
......@@ -2901,35 +2903,35 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
/* ---------------- Relational methods -------------- */
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) {
return getNearKey(key, (m.GT|m.EQ));
return getNearKey(key, GT|EQ);
}
public Map.Entry<K,V> lowerEntry(K key) {
return getNearEntry(key, (m.LT));
return getNearEntry(key, LT);
}
public K lowerKey(K key) {
return getNearKey(key, (m.LT));
return getNearKey(key, LT);
}
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) {
return getNearKey(key, (m.LT|m.EQ));
return getNearKey(key, LT|EQ);
}
public Map.Entry<K,V> higherEntry(K key) {
return getNearEntry(key, (m.GT));
return getNearEntry(key, GT);
}
public K higherKey(K key) {
return getNearKey(key, (m.GT));
return getNearKey(key, GT);
}
public K firstKey() {
......@@ -2960,22 +2962,22 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
public NavigableSet<K> keySet() {
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() {
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() {
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() {
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() {
......@@ -3109,7 +3111,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = ConcurrentSkipListMap.class;
Class<?> k = ConcurrentSkipListMap.class;
headOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("head"));
} catch (Exception e) {
......
......@@ -35,7 +35,6 @@
package java.util.concurrent;
import java.util.*;
import sun.misc.Unsafe;
/**
* A scalable concurrent {@link NavigableSet} implementation based on
......@@ -158,15 +157,15 @@ public class ConcurrentSkipListSet<E>
* @return a shallow copy of this set
*/
public ConcurrentSkipListSet<E> clone() {
ConcurrentSkipListSet<E> clone = null;
try {
clone = (ConcurrentSkipListSet<E>) super.clone();
clone.setMap(new ConcurrentSkipListMap(m));
@SuppressWarnings("unchecked")
ConcurrentSkipListSet<E> clone =
(ConcurrentSkipListSet<E>) super.clone();
clone.setMap(new ConcurrentSkipListMap<E,Object>(m));
return clone;
} catch (CloneNotSupportedException e) {
throw new InternalError();
}
return clone;
}
/* ---------------- Set operations -------------- */
......@@ -322,8 +321,8 @@ public class ConcurrentSkipListSet<E>
public boolean removeAll(Collection<?> c) {
// Override AbstractSet version to avoid unnecessary call to size()
boolean modified = false;
for (Iterator<?> i = c.iterator(); i.hasNext(); )
if (remove(i.next()))
for (Object e : c)
if (remove(e))
modified = true;
return modified;
}
......@@ -468,7 +467,7 @@ public class ConcurrentSkipListSet<E>
* @return a reverse order view of this set
*/
public NavigableSet<E> descendingSet() {
return new ConcurrentSkipListSet(m.descendingMap());
return new ConcurrentSkipListSet<E>(m.descendingMap());
}
// Support for resetting map in clone
......@@ -481,7 +480,7 @@ public class ConcurrentSkipListSet<E>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = ConcurrentSkipListSet.class;
Class<?> k = ConcurrentSkipListSet.class;
mapOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("m"));
} catch (Exception e) {
......
......@@ -36,7 +36,6 @@
package java.util.concurrent;
import java.util.*;
import java.util.concurrent.locks.*;
import sun.misc.Unsafe;
/**
* A thread-safe variant of {@link java.util.ArrayList} in which all mutative
......@@ -281,9 +280,11 @@ public class CopyOnWriteArrayList<E>
*/
public Object clone() {
try {
CopyOnWriteArrayList c = (CopyOnWriteArrayList)(super.clone());
c.resetLock();
return c;
@SuppressWarnings("unchecked")
CopyOnWriteArrayList<E> clone =
(CopyOnWriteArrayList<E>) super.clone();
clone.resetLock();
return clone;
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
......@@ -1330,7 +1331,7 @@ public class CopyOnWriteArrayList<E>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = CopyOnWriteArrayList.class;
Class<?> k = CopyOnWriteArrayList.class;
lockOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("lock"));
} catch (Exception e) {
......
......@@ -531,7 +531,7 @@ public class DelayQueue<E extends Delayed> extends AbstractQueue<E>
// not just a .equals element.
lock.lock();
try {
for (Iterator it = q.iterator(); it.hasNext(); ) {
for (Iterator<E> it = q.iterator(); it.hasNext(); ) {
if (it.next() == x) {
it.remove();
return;
......
......@@ -279,6 +279,7 @@ public class Exchanger<V> {
* into hole. This class cannot be parameterized as "V" because
* of the use of non-V CANCEL sentinels.
*/
@SuppressWarnings("serial")
private static final class Node extends AtomicReference<Object> {
/** The element offered by the Thread creating this node. */
public final Object item;
......@@ -303,6 +304,7 @@ public class Exchanger<V> {
* would improve throughput more than enough to outweigh using
* extra space.
*/
@SuppressWarnings("serial")
private static final class Slot extends AtomicReference<Object> {
// 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;
......@@ -616,13 +618,14 @@ public class Exchanger<V> {
* @throws InterruptedException if the current thread was
* interrupted while waiting
*/
@SuppressWarnings("unchecked")
public V exchange(V x) throws InterruptedException {
if (!Thread.interrupted()) {
Object v = doExchange((x == null) ? NULL_ITEM : x, false, 0);
if (v == NULL_ITEM)
Object o = doExchange((x == null) ? NULL_ITEM : x, false, 0);
if (o == NULL_ITEM)
return null;
if (v != CANCEL)
return (V)v;
if (o != CANCEL)
return (V)o;
Thread.interrupted(); // Clear interrupt status on IE throw
}
throw new InterruptedException();
......@@ -670,15 +673,16 @@ public class Exchanger<V> {
* @throws TimeoutException if the specified waiting time elapses
* before another thread enters the exchange
*/
@SuppressWarnings("unchecked")
public V exchange(V x, long timeout, TimeUnit unit)
throws InterruptedException, TimeoutException {
if (!Thread.interrupted()) {
Object v = doExchange((x == null) ? NULL_ITEM : x,
Object o = doExchange((x == null) ? NULL_ITEM : x,
true, unit.toNanos(timeout));
if (v == NULL_ITEM)
if (o == NULL_ITEM)
return null;
if (v != CANCEL)
return (V)v;
if (o != CANCEL)
return (V)o;
if (!Thread.interrupted())
throw new TimeoutException();
}
......
......@@ -2150,7 +2150,7 @@ public class ForkJoinPool extends AbstractExecutorService {
int s;
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = ForkJoinPool.class;
Class<?> k = ForkJoinPool.class;
ctlOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("ctl"));
stealCountOffset = UNSAFE.objectFieldOffset
......@@ -2163,7 +2163,7 @@ public class ForkJoinPool extends AbstractExecutorService {
(k.getDeclaredField("scanGuard"));
nextWorkerNumberOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("nextWorkerNumber"));
Class a = ForkJoinTask[].class;
Class<?> a = ForkJoinTask[].class;
ABASE = UNSAFE.arrayBaseOffset(a);
s = UNSAFE.arrayIndexScale(a);
} catch (Exception e) {
......
......@@ -520,7 +520,7 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
if (e == null || (ex = e.ex) == null)
return null;
if (e.thrower != Thread.currentThread().getId()) {
Class ec = ex.getClass();
Class<? extends Throwable> ec = ex.getClass();
try {
Constructor<?> noArgCtor = null;
Constructor<?>[] cs = ec.getConstructors();// public ctors only
......
......@@ -192,7 +192,7 @@ public class ForkJoinWorkerThread extends Thread {
/**
* 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.
*/
ForkJoinTask<?>[] queue;
......@@ -360,7 +360,7 @@ public class ForkJoinWorkerThread extends Thread {
*/
protected void onStart() {
queue = new ForkJoinTask<?>[INITIAL_QUEUE_CAPACITY];
int r = pool.workerSeedGenerator.nextInt();
int r = ForkJoinPool.workerSeedGenerator.nextInt();
seed = (r == 0) ? 1 : r; // must be nonzero
}
......@@ -846,7 +846,7 @@ public class ForkJoinWorkerThread extends Thread {
(b = v.queueBase) != v.queueTop &&
(q = v.queue) != null &&
(i = (q.length - 1) & b) >= 0 &&
q[i] == t) {
q[i] == t) {
long u = (i << ASHIFT) + ABASE;
if (v.queueBase == b &&
UNSAFE.compareAndSwapObject(q, u, t, null)) {
......@@ -984,7 +984,7 @@ public class ForkJoinWorkerThread extends Thread {
int s;
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class a = ForkJoinTask[].class;
Class<?> a = ForkJoinTask[].class;
ABASE = UNSAFE.arrayBaseOffset(a);
s = UNSAFE.arrayIndexScale(a);
} catch (Exception e) {
......
......@@ -330,8 +330,8 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
* of less-contended queues. During spins threads check their
* interrupt status and generate a thread-local random number
* to decide to occasionally perform a Thread.yield. While
* yield has underdefined specs, we assume that might it help,
* and will not hurt in limiting impact of spinning on busy
* yield has underdefined specs, we assume that it might help,
* and will not hurt, in limiting impact of spinning on busy
* systems. We also use smaller (1/2) spins for nodes that are
* not known to be front but whose predecessors have not
* blocked -- these "chained" spins avoid artifacts of
......@@ -542,7 +542,7 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = Node.class;
Class<?> k = Node.class;
itemOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("item"));
nextOffset = UNSAFE.objectFieldOffset
......@@ -627,7 +627,7 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
break; // unless slack < 2
}
LockSupport.unpark(p.waiter);
return this.<E>cast(item);
return LinkedTransferQueue.<E>cast(item);
}
}
Node n = p.next;
......@@ -705,7 +705,7 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
if (item != e) { // matched
// assert item != s;
s.forgetContents(); // avoid garbage
return this.<E>cast(item);
return LinkedTransferQueue.<E>cast(item);
}
if ((w.isInterrupted() || (timed && nanos <= 0)) &&
s.casItem(e, s)) { // cancel
......@@ -786,7 +786,7 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
Object item = p.item;
if (p.isData) {
if (item != null && item != p)
return this.<E>cast(item);
return LinkedTransferQueue.<E>cast(item);
}
else if (item == null)
return null;
......@@ -1008,7 +1008,6 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
return false;
}
/**
* Creates an initially empty {@code LinkedTransferQueue}.
*/
......@@ -1045,7 +1044,8 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
* return {@code false}.
*
* @return {@code true} (as specified by
* {@link BlockingQueue#offer(Object,long,TimeUnit) BlockingQueue.offer})
* {@link java.util.concurrent.BlockingQueue#offer(Object,long,TimeUnit)
* BlockingQueue.offer})
* @throws NullPointerException if the specified element is null
*/
public boolean offer(E e, long timeout, TimeUnit unit) {
......@@ -1162,8 +1162,7 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
if (c == this)
throw new IllegalArgumentException();
int n = 0;
E e;
while ( (e = poll()) != null) {
for (E e; (e = poll()) != null;) {
c.add(e);
++n;
}
......@@ -1180,8 +1179,7 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
if (c == this)
throw new IllegalArgumentException();
int n = 0;
E e;
while (n < maxElements && (e = poll()) != null) {
for (E e; n < maxElements && (e = poll()) != null;) {
c.add(e);
++n;
}
......@@ -1288,7 +1286,8 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
* {@code LinkedTransferQueue} is not capacity constrained.
*
* @return {@code Integer.MAX_VALUE} (as specified by
* {@link BlockingQueue#remainingCapacity()})
* {@link java.util.concurrent.BlockingQueue#remainingCapacity()
* BlockingQueue.remainingCapacity})
*/
public int remainingCapacity() {
return Integer.MAX_VALUE;
......@@ -1320,7 +1319,8 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
throws java.io.IOException, ClassNotFoundException {
s.defaultReadObject();
for (;;) {
@SuppressWarnings("unchecked") E item = (E) s.readObject();
@SuppressWarnings("unchecked")
E item = (E) s.readObject();
if (item == null)
break;
else
......@@ -1337,7 +1337,7 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = LinkedTransferQueue.class;
Class<?> k = LinkedTransferQueue.class;
headOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("head"));
tailOffset = UNSAFE.objectFieldOffset
......
......@@ -1142,7 +1142,7 @@ public class Phaser {
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = Phaser.class;
Class<?> k = Phaser.class;
stateOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("state"));
} catch (Exception e) {
......
......@@ -94,6 +94,7 @@ import java.util.*;
* @author Doug Lea
* @param <E> the type of elements held in this collection
*/
@SuppressWarnings("unchecked")
public class PriorityBlockingQueue<E> extends AbstractQueue<E>
implements BlockingQueue<E>, java.io.Serializable {
private static final long serialVersionUID = 5595510919245408276L;
......@@ -168,7 +169,7 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E>
* to maintain compatibility with previous versions
* of this class. Non-null only during serialization/deserialization.
*/
private PriorityQueue q;
private PriorityQueue<E> q;
/**
* Creates a {@code PriorityBlockingQueue} with the default
......@@ -968,7 +969,7 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = PriorityBlockingQueue.class;
Class<?> k = PriorityBlockingQueue.class;
allocationSpinLockOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("allocationSpinLock"));
} catch (Exception e) {
......
......@@ -34,8 +34,10 @@
*/
package java.util.concurrent;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
import java.util.*;
/**
......@@ -166,7 +168,7 @@ public class ScheduledThreadPoolExecutor
* Sequence number to break scheduling ties, and in turn to
* guarantee FIFO order among tied entries.
*/
private static final AtomicLong sequencer = new AtomicLong(0);
private static final AtomicLong sequencer = new AtomicLong();
/**
* Returns current nanosecond time.
......@@ -231,7 +233,7 @@ public class ScheduledThreadPoolExecutor
}
public long getDelay(TimeUnit unit) {
return unit.convert(time - now(), TimeUnit.NANOSECONDS);
return unit.convert(time - now(), NANOSECONDS);
}
public int compareTo(Delayed other) {
......@@ -249,8 +251,8 @@ public class ScheduledThreadPoolExecutor
else
return 1;
}
long d = (getDelay(TimeUnit.NANOSECONDS) -
other.getDelay(TimeUnit.NANOSECONDS));
long d = (getDelay(NANOSECONDS) -
other.getDelay(NANOSECONDS));
return (d == 0) ? 0 : ((d < 0) ? -1 : 1);
}
......@@ -424,7 +426,7 @@ public class ScheduledThreadPoolExecutor
* @throws IllegalArgumentException if {@code corePoolSize < 0}
*/
public ScheduledThreadPoolExecutor(int corePoolSize) {
super(corePoolSize, Integer.MAX_VALUE, 0, TimeUnit.NANOSECONDS,
super(corePoolSize, Integer.MAX_VALUE, 0, NANOSECONDS,
new DelayedWorkQueue());
}
......@@ -441,7 +443,7 @@ public class ScheduledThreadPoolExecutor
*/
public ScheduledThreadPoolExecutor(int corePoolSize,
ThreadFactory threadFactory) {
super(corePoolSize, Integer.MAX_VALUE, 0, TimeUnit.NANOSECONDS,
super(corePoolSize, Integer.MAX_VALUE, 0, NANOSECONDS,
new DelayedWorkQueue(), threadFactory);
}
......@@ -458,7 +460,7 @@ public class ScheduledThreadPoolExecutor
*/
public ScheduledThreadPoolExecutor(int corePoolSize,
RejectedExecutionHandler handler) {
super(corePoolSize, Integer.MAX_VALUE, 0, TimeUnit.NANOSECONDS,
super(corePoolSize, Integer.MAX_VALUE, 0, NANOSECONDS,
new DelayedWorkQueue(), handler);
}
......@@ -479,7 +481,7 @@ public class ScheduledThreadPoolExecutor
public ScheduledThreadPoolExecutor(int corePoolSize,
ThreadFactory threadFactory,
RejectedExecutionHandler handler) {
super(corePoolSize, Integer.MAX_VALUE, 0, TimeUnit.NANOSECONDS,
super(corePoolSize, Integer.MAX_VALUE, 0, NANOSECONDS,
new DelayedWorkQueue(), threadFactory, handler);
}
......@@ -508,7 +510,7 @@ public class ScheduledThreadPoolExecutor
private long overflowFree(long delay) {
Delayed head = (Delayed) super.getQueue().peek();
if (head != null) {
long headDelay = head.getDelay(TimeUnit.NANOSECONDS);
long headDelay = head.getDelay(NANOSECONDS);
if (headDelay < 0 && (delay - headDelay < 0))
delay = Long.MAX_VALUE + headDelay;
}
......@@ -616,7 +618,7 @@ public class ScheduledThreadPoolExecutor
* @throws NullPointerException {@inheritDoc}
*/
public void execute(Runnable command) {
schedule(command, 0, TimeUnit.NANOSECONDS);
schedule(command, 0, NANOSECONDS);
}
// Override AbstractExecutorService methods
......@@ -626,7 +628,7 @@ public class ScheduledThreadPoolExecutor
* @throws NullPointerException {@inheritDoc}
*/
public Future<?> submit(Runnable task) {
return schedule(task, 0, TimeUnit.NANOSECONDS);
return schedule(task, 0, NANOSECONDS);
}
/**
......@@ -634,8 +636,7 @@ public class ScheduledThreadPoolExecutor
* @throws NullPointerException {@inheritDoc}
*/
public <T> Future<T> submit(Runnable task, T result) {
return schedule(Executors.callable(task, result),
0, TimeUnit.NANOSECONDS);
return schedule(Executors.callable(task, result), 0, NANOSECONDS);
}
/**
......@@ -643,7 +644,7 @@ public class ScheduledThreadPoolExecutor
* @throws NullPointerException {@inheritDoc}
*/
public <T> Future<T> submit(Callable<T> task) {
return schedule(task, 0, TimeUnit.NANOSECONDS);
return schedule(task, 0, NANOSECONDS);
}
/**
......@@ -831,8 +832,8 @@ public class ScheduledThreadPoolExecutor
*/
private static final int INITIAL_CAPACITY = 16;
private RunnableScheduledFuture[] queue =
new RunnableScheduledFuture[INITIAL_CAPACITY];
private RunnableScheduledFuture<?>[] queue =
new RunnableScheduledFuture<?>[INITIAL_CAPACITY];
private final ReentrantLock lock = new ReentrantLock();
private int size = 0;
......@@ -863,7 +864,7 @@ public class ScheduledThreadPoolExecutor
/**
* Set f's heapIndex if it is a ScheduledFutureTask.
*/
private void setIndex(RunnableScheduledFuture f, int idx) {
private void setIndex(RunnableScheduledFuture<?> f, int idx) {
if (f instanceof ScheduledFutureTask)
((ScheduledFutureTask)f).heapIndex = idx;
}
......@@ -872,10 +873,10 @@ public class ScheduledThreadPoolExecutor
* Sift element added at bottom up to its heap-ordered spot.
* Call only when holding lock.
*/
private void siftUp(int k, RunnableScheduledFuture key) {
private void siftUp(int k, RunnableScheduledFuture<?> key) {
while (k > 0) {
int parent = (k - 1) >>> 1;
RunnableScheduledFuture e = queue[parent];
RunnableScheduledFuture<?> e = queue[parent];
if (key.compareTo(e) >= 0)
break;
queue[k] = e;
......@@ -890,11 +891,11 @@ public class ScheduledThreadPoolExecutor
* Sift element added at top down to its heap-ordered spot.
* Call only when holding lock.
*/
private void siftDown(int k, RunnableScheduledFuture key) {
private void siftDown(int k, RunnableScheduledFuture<?> key) {
int half = size >>> 1;
while (k < half) {
int child = (k << 1) + 1;
RunnableScheduledFuture c = queue[child];
RunnableScheduledFuture<?> c = queue[child];
int right = child + 1;
if (right < size && c.compareTo(queue[right]) > 0)
c = queue[child = right];
......@@ -959,7 +960,7 @@ public class ScheduledThreadPoolExecutor
setIndex(queue[i], -1);
int s = --size;
RunnableScheduledFuture replacement = queue[s];
RunnableScheduledFuture<?> replacement = queue[s];
queue[s] = null;
if (s != i) {
siftDown(i, replacement);
......@@ -990,7 +991,7 @@ public class ScheduledThreadPoolExecutor
return Integer.MAX_VALUE;
}
public RunnableScheduledFuture peek() {
public RunnableScheduledFuture<?> peek() {
final ReentrantLock lock = this.lock;
lock.lock();
try {
......@@ -1003,7 +1004,7 @@ public class ScheduledThreadPoolExecutor
public boolean offer(Runnable x) {
if (x == null)
throw new NullPointerException();
RunnableScheduledFuture e = (RunnableScheduledFuture)x;
RunnableScheduledFuture<?> e = (RunnableScheduledFuture<?>)x;
final ReentrantLock lock = this.lock;
lock.lock();
try {
......@@ -1045,9 +1046,9 @@ public class ScheduledThreadPoolExecutor
* holding lock.
* @param f the task to remove and return
*/
private RunnableScheduledFuture finishPoll(RunnableScheduledFuture f) {
private RunnableScheduledFuture<?> finishPoll(RunnableScheduledFuture<?> f) {
int s = --size;
RunnableScheduledFuture x = queue[s];
RunnableScheduledFuture<?> x = queue[s];
queue[s] = null;
if (s != 0)
siftDown(0, x);
......@@ -1055,12 +1056,12 @@ public class ScheduledThreadPoolExecutor
return f;
}
public RunnableScheduledFuture poll() {
public RunnableScheduledFuture<?> poll() {
final ReentrantLock lock = this.lock;
lock.lock();
try {
RunnableScheduledFuture first = queue[0];
if (first == null || first.getDelay(TimeUnit.NANOSECONDS) > 0)
RunnableScheduledFuture<?> first = queue[0];
if (first == null || first.getDelay(NANOSECONDS) > 0)
return null;
else
return finishPoll(first);
......@@ -1069,16 +1070,16 @@ public class ScheduledThreadPoolExecutor
}
}
public RunnableScheduledFuture take() throws InterruptedException {
public RunnableScheduledFuture<?> take() throws InterruptedException {
final ReentrantLock lock = this.lock;
lock.lockInterruptibly();
try {
for (;;) {
RunnableScheduledFuture first = queue[0];
RunnableScheduledFuture<?> first = queue[0];
if (first == null)
available.await();
else {
long delay = first.getDelay(TimeUnit.NANOSECONDS);
long delay = first.getDelay(NANOSECONDS);
if (delay <= 0)
return finishPoll(first);
else if (leader != null)
......@@ -1102,21 +1103,21 @@ public class ScheduledThreadPoolExecutor
}
}
public RunnableScheduledFuture poll(long timeout, TimeUnit unit)
public RunnableScheduledFuture<?> poll(long timeout, TimeUnit unit)
throws InterruptedException {
long nanos = unit.toNanos(timeout);
final ReentrantLock lock = this.lock;
lock.lockInterruptibly();
try {
for (;;) {
RunnableScheduledFuture first = queue[0];
RunnableScheduledFuture<?> first = queue[0];
if (first == null) {
if (nanos <= 0)
return null;
else
nanos = available.awaitNanos(nanos);
} else {
long delay = first.getDelay(TimeUnit.NANOSECONDS);
long delay = first.getDelay(NANOSECONDS);
if (delay <= 0)
return finishPoll(first);
if (nanos <= 0)
......@@ -1148,7 +1149,7 @@ public class ScheduledThreadPoolExecutor
lock.lock();
try {
for (int i = 0; i < size; i++) {
RunnableScheduledFuture t = queue[i];
RunnableScheduledFuture<?> t = queue[i];
if (t != null) {
queue[i] = null;
setIndex(t, -1);
......@@ -1164,9 +1165,10 @@ public class ScheduledThreadPoolExecutor
* Return and remove first element only if it is expired.
* Used only by drainTo. Call only when holding lock.
*/
private RunnableScheduledFuture pollExpired() {
RunnableScheduledFuture first = queue[0];
if (first == null || first.getDelay(TimeUnit.NANOSECONDS) > 0)
private RunnableScheduledFuture<?> pollExpired() {
// assert lock.isHeldByCurrentThread();
RunnableScheduledFuture<?> first = queue[0];
if (first == null || first.getDelay(NANOSECONDS) > 0)
return null;
return finishPoll(first);
}
......@@ -1179,7 +1181,7 @@ public class ScheduledThreadPoolExecutor
final ReentrantLock lock = this.lock;
lock.lock();
try {
RunnableScheduledFuture first;
RunnableScheduledFuture<?> first;
int n = 0;
while ((first = pollExpired()) != null) {
c.add(first);
......@@ -1201,7 +1203,7 @@ public class ScheduledThreadPoolExecutor
final ReentrantLock lock = this.lock;
lock.lock();
try {
RunnableScheduledFuture first;
RunnableScheduledFuture<?> first;
int n = 0;
while (n < maxElements && (first = pollExpired()) != null) {
c.add(first);
......
......@@ -36,7 +36,6 @@
package java.util.concurrent;
import java.util.concurrent.locks.*;
import java.util.concurrent.atomic.*;
import java.util.*;
/**
......@@ -163,7 +162,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
/**
* Shared internal API for dual stacks and queues.
*/
abstract static class Transferer {
abstract static class Transferer<E> {
/**
* Performs a put or take.
*
......@@ -177,7 +176,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
* the caller can distinguish which of these occurred
* by checking Thread.interrupted.
*/
abstract Object transfer(Object e, boolean timed, long nanos);
abstract E transfer(E e, boolean timed, long nanos);
}
/** The number of CPUs, for spin control */
......@@ -206,7 +205,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
static final long spinForTimeoutThreshold = 1000L;
/** Dual stack */
static final class TransferStack extends Transferer {
static final class TransferStack<E> extends Transferer<E> {
/*
* This extends Scherer-Scott dual stack algorithm, differing,
* among other ways, by using "covering" nodes rather than
......@@ -286,7 +285,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = SNode.class;
Class<?> k = SNode.class;
matchOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("match"));
nextOffset = UNSAFE.objectFieldOffset
......@@ -322,7 +321,8 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
/**
* Puts or takes an item.
*/
Object transfer(Object e, boolean timed, long nanos) {
@SuppressWarnings("unchecked")
E transfer(E e, boolean timed, long nanos) {
/*
* Basic algorithm is to loop trying one of three actions:
*
......@@ -363,7 +363,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
}
if ((h = head) != null && h.next == s)
casHead(h, s.next); // help s's fulfiller
return (mode == REQUEST) ? m.item : s.item;
return (E) ((mode == REQUEST) ? m.item : s.item);
}
} else if (!isFulfilling(h.mode)) { // try to fulfill
if (h.isCancelled()) // already cancelled
......@@ -379,7 +379,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
SNode mn = m.next;
if (m.tryMatch(s)) {
casHead(s, mn); // pop both s and m
return (mode == REQUEST) ? m.item : s.item;
return (E) ((mode == REQUEST) ? m.item : s.item);
} else // lost match
s.casNext(m, mn); // help unlink
}
......@@ -513,7 +513,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = TransferStack.class;
Class<?> k = TransferStack.class;
headOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("head"));
} catch (Exception e) {
......@@ -523,7 +523,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
}
/** Dual Queue */
static final class TransferQueue extends Transferer {
static final class TransferQueue<E> extends Transferer<E> {
/*
* This extends Scherer-Scott dual queue algorithm, differing,
* among other ways, by using modes within nodes rather than
......@@ -583,7 +583,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = QNode.class;
Class<?> k = QNode.class;
itemOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("item"));
nextOffset = UNSAFE.objectFieldOffset
......@@ -640,7 +640,8 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
/**
* Puts or takes an item.
*/
Object transfer(Object e, boolean timed, long nanos) {
@SuppressWarnings("unchecked")
E transfer(E e, boolean timed, long nanos) {
/* Basic algorithm is to loop trying to take either of
* two actions:
*
......@@ -703,7 +704,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
s.item = s;
s.waiter = null;
}
return (x != null) ? x : e;
return (x != null) ? (E)x : e;
} else { // complementary-mode
QNode m = h.next; // node to fulfill
......@@ -720,7 +721,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
advanceHead(h, m); // successfully fulfilled
LockSupport.unpark(m.waiter);
return (x != null) ? x : e;
return (x != null) ? (E)x : e;
}
}
}
......@@ -734,7 +735,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
* @param nanos timeout value
* @return matched item, or s if cancelled
*/
Object awaitFulfill(QNode s, Object e, boolean timed, long nanos) {
Object awaitFulfill(QNode s, E e, boolean timed, long nanos) {
/* Same idea as TransferStack.awaitFulfill */
long lastTime = timed ? System.nanoTime() : 0;
Thread w = Thread.currentThread();
......@@ -827,7 +828,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class k = TransferQueue.class;
Class<?> k = TransferQueue.class;
headOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("head"));
tailOffset = UNSAFE.objectFieldOffset
......@@ -847,7 +848,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
* isn't a noticeable performance penalty for using volatile
* instead of final here.
*/
private transient volatile Transferer transferer;
private transient volatile Transferer<E> transferer;
/**
* Creates a <tt>SynchronousQueue</tt> with nonfair access policy.
......@@ -863,7 +864,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
* access; otherwise the order is unspecified.
*/
public SynchronousQueue(boolean fair) {
transferer = fair ? new TransferQueue() : new TransferStack();
transferer = fair ? new TransferQueue<E>() : new TransferStack<E>();
}
/**
......@@ -922,9 +923,9 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
* @throws InterruptedException {@inheritDoc}
*/
public E take() throws InterruptedException {
Object e = transferer.transfer(null, false, 0);
E e = transferer.transfer(null, false, 0);
if (e != null)
return (E)e;
return e;
Thread.interrupted();
throw new InterruptedException();
}
......@@ -939,9 +940,9 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
* @throws InterruptedException {@inheritDoc}
*/
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
Object e = transferer.transfer(null, true, unit.toNanos(timeout));
E e = transferer.transfer(null, true, unit.toNanos(timeout));
if (e != null || !Thread.interrupted())
return (E)e;
return e;
throw new InterruptedException();
}
......@@ -953,7 +954,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
* element is available.
*/
public E poll() {
return (E)transferer.transfer(null, true, 0);
return transferer.transfer(null, true, 0);
}
/**
......@@ -1065,8 +1066,19 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
*
* @return an empty iterator
*/
@SuppressWarnings("unchecked")
public Iterator<E> iterator() {
return Collections.emptyIterator();
return (Iterator<E>) EmptyIterator.EMPTY_ITERATOR;
}
// Replicated from a previous version of Collections
private static class EmptyIterator<E> implements Iterator<E> {
static final EmptyIterator<Object> EMPTY_ITERATOR
= new EmptyIterator<Object>();
public boolean hasNext() { return false; }
public E next() { throw new NoSuchElementException(); }
public void remove() { throw new IllegalStateException(); }
}
/**
......@@ -1103,8 +1115,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
if (c == this)
throw new IllegalArgumentException();
int n = 0;
E e;
while ( (e = poll()) != null) {
for (E e; (e = poll()) != null;) {
c.add(e);
++n;
}
......@@ -1123,8 +1134,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
if (c == this)
throw new IllegalArgumentException();
int n = 0;
E e;
while (n < maxElements && (e = poll()) != null) {
for (E e; n < maxElements && (e = poll()) != null;) {
c.add(e);
++n;
}
......@@ -1139,6 +1149,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
* object is ever serialized or deserialized.
*/
@SuppressWarnings("serial")
static class WaitQueue implements java.io.Serializable { }
static class LifoWaitQueue extends WaitQueue {
private static final long serialVersionUID = -3633113410248163686L;
......@@ -1151,7 +1162,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
private WaitQueue waitingConsumers;
/**
* Save the state to a stream (that is, serialize it).
* Saves the state to a stream (that is, serializes it).
*
* @param s the stream
*/
......@@ -1175,9 +1186,9 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
throws java.io.IOException, ClassNotFoundException {
s.defaultReadObject();
if (waitingProducers instanceof FifoWaitQueue)
transferer = new TransferQueue();
transferer = new TransferQueue<E>();
else
transferer = new TransferStack();
transferer = new TransferStack<E>();
}
// Unsafe mechanics
......
......@@ -183,7 +183,7 @@ class JarFile extends ZipFile {
} else {
man = new Manifest(super.getInputStream(manEntry));
}
manRef = new SoftReference(man);
manRef = new SoftReference<>(man);
}
}
return man;
......@@ -233,13 +233,13 @@ class JarFile extends ZipFile {
* Returns an enumeration of the zip file entries.
*/
public Enumeration<JarEntry> entries() {
final Enumeration enum_ = super.entries();
final Enumeration<? extends ZipEntry> enum_ = super.entries();
return new Enumeration<JarEntry>() {
public boolean hasMoreElements() {
return enum_.hasMoreElements();
}
public JarFileEntry nextElement() {
ZipEntry ze = (ZipEntry)enum_.nextElement();
ZipEntry ze = enum_.nextElement();
return new JarFileEntry(ze);
}
};
......@@ -608,7 +608,7 @@ class JarFile extends ZipFile {
}
// screen out entries which are never signed
final Enumeration enum_ = super.entries();
final Enumeration<? extends ZipEntry> enum_ = super.entries();
return new Enumeration<JarEntry>() {
ZipEntry entry;
......@@ -618,7 +618,7 @@ class JarFile extends ZipFile {
return true;
}
while (enum_.hasMoreElements()) {
ZipEntry ze = (ZipEntry) enum_.nextElement();
ZipEntry ze = enum_.nextElement();
if (JarVerifier.isSigningRelated(ze.getName())) {
continue;
}
......@@ -649,7 +649,7 @@ class JarFile extends ZipFile {
* JAR file has no signed content. Is there a non-signing
* code source?
*/
Enumeration unsigned = unsignedEntryNames();
Enumeration<String> unsigned = unsignedEntryNames();
if (unsigned.hasMoreElements()) {
return new CodeSource[]{JarVerifier.getUnsignedCS(url)};
} else {
......@@ -658,7 +658,7 @@ class JarFile extends ZipFile {
}
private Enumeration<String> unsignedEntryNames() {
final Enumeration entries = entries();
final Enumeration<JarEntry> entries = entries();
return new Enumeration<String>() {
String name;
......@@ -673,7 +673,7 @@ class JarFile extends ZipFile {
}
while (entries.hasMoreElements()) {
String value;
ZipEntry e = (ZipEntry) entries.nextElement();
ZipEntry e = entries.nextElement();
value = e.getName();
if (e.isDirectory() || JarVerifier.isSigningRelated(value)) {
continue;
......@@ -726,11 +726,11 @@ class JarFile extends ZipFile {
}
}
List getManifestDigests() {
List<Object> getManifestDigests() {
ensureInitialization();
if (jv != null) {
return jv.getManifestDigests();
}
return new ArrayList();
return new ArrayList<Object>();
}
}
......@@ -51,7 +51,7 @@ public class Manifest implements Cloneable {
private Attributes attr = new Attributes();
// manifest entries
private Map entries = new HashMap();
private Map<String, Attributes> entries = new HashMap<>();
/**
* Constructs a new, empty Manifest.
......@@ -148,11 +148,11 @@ public class Manifest implements Cloneable {
// Write out the main attributes for the manifest
attr.writeMain(dos);
// Now write out the pre-entry attributes
Iterator it = entries.entrySet().iterator();
Iterator<Map.Entry<String, Attributes>> it = entries.entrySet().iterator();
while (it.hasNext()) {
Map.Entry e = (Map.Entry)it.next();
Map.Entry<String, Attributes> e = it.next();
StringBuffer buffer = new StringBuffer("Name: ");
String value = (String)e.getKey();
String value = e.getKey();
if (value != null) {
byte[] vb = value.getBytes("UTF8");
value = new String(vb, 0, 0, vb.length);
......@@ -161,7 +161,7 @@ public class Manifest implements Cloneable {
buffer.append("\r\n");
make72Safe(buffer);
dos.writeBytes(buffer.toString());
((Attributes)e.getValue()).write(dos);
e.getValue().write(dos);
}
dos.flush();
}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册