Tue, 20 Jan 2009 18:23:13 -0800
6795903: fix latent build warnings in langtools repository
Reviewed-by: darcy
1.1 --- a/make/build.properties Tue Jan 20 15:17:45 2009 -0800 1.2 +++ b/make/build.properties Tue Jan 20 18:23:13 2009 -0800 1.3 @@ -66,7 +66,7 @@ 1.4 # set the following to -version to verify the versions of javac being used 1.5 javac.version.opt = 1.6 # in time, there should be no exceptions to -Xlint:all 1.7 -javac.lint.opts = -Xlint:all,-deprecation,-fallthrough,-serial,-unchecked,-cast 1.8 +javac.lint.opts = -Xlint:all -Werror 1.9 1.10 # options for the <javadoc> task for javac 1.11 javadoc.jls3.url=http://java.sun.com/docs/books/jls/
2.1 --- a/src/share/classes/com/sun/tools/apt/comp/AnnotationProcessingError.java Tue Jan 20 15:17:45 2009 -0800 2.2 +++ b/src/share/classes/com/sun/tools/apt/comp/AnnotationProcessingError.java Tue Jan 20 18:23:13 2009 -0800 2.3 @@ -26,6 +26,7 @@ 2.4 package com.sun.tools.apt.comp; 2.5 2.6 public class AnnotationProcessingError extends Error { 2.7 + private static final long serialVersionUID = 3279196183341719287L; 2.8 AnnotationProcessingError(Throwable cause) { 2.9 super(cause); 2.10 }
3.1 --- a/src/share/classes/com/sun/tools/apt/comp/Apt.java Tue Jan 20 15:17:45 2009 -0800 3.2 +++ b/src/share/classes/com/sun/tools/apt/comp/Apt.java Tue Jan 20 18:23:13 2009 -0800 3.3 @@ -316,8 +316,13 @@ 3.4 } 3.5 3.6 providers = list.iterator(); 3.7 - } else 3.8 - providers = sun.misc.Service.providers(AnnotationProcessorFactory.class, aptCL); 3.9 + } else { 3.10 + @SuppressWarnings("unchecked") 3.11 + Iterator<AnnotationProcessorFactory> iter = 3.12 + sun.misc.Service.providers(AnnotationProcessorFactory.class, aptCL); 3.13 + providers = iter; 3.14 + 3.15 + } 3.16 } 3.17 3.18 java.util.Map<AnnotationProcessorFactory, Set<AnnotationTypeDeclaration>> factoryToAnnotation =
4.1 --- a/src/share/classes/com/sun/tools/apt/comp/UsageMessageNeededException.java Tue Jan 20 15:17:45 2009 -0800 4.2 +++ b/src/share/classes/com/sun/tools/apt/comp/UsageMessageNeededException.java Tue Jan 20 18:23:13 2009 -0800 4.3 @@ -26,4 +26,6 @@ 4.4 package com.sun.tools.apt.comp; 4.5 4.6 4.7 -public class UsageMessageNeededException extends RuntimeException {} 4.8 +public class UsageMessageNeededException extends RuntimeException { 4.9 + private static final long serialVersionUID = -3265159608992825840L; 4.10 +}
5.1 --- a/src/share/classes/com/sun/tools/apt/main/JavaCompiler.java Tue Jan 20 15:17:45 2009 -0800 5.2 +++ b/src/share/classes/com/sun/tools/apt/main/JavaCompiler.java Tue Jan 20 18:23:13 2009 -0800 5.3 @@ -233,6 +233,7 @@ 5.4 5.5 ListBuffer<ClassSymbol> classes = new ListBuffer<ClassSymbol>(); 5.6 try { 5.7 + JavacFileManager fm = (JavacFileManager)fileManager; 5.8 //parse all files 5.9 ListBuffer<JCCompilationUnit> trees = new ListBuffer<JCCompilationUnit>(); 5.10 for (List<String> l = filenames; l.nonEmpty(); l = l.tail) { 5.11 @@ -250,7 +251,8 @@ 5.12 continue; 5.13 } 5.14 } 5.15 - trees.append(parse(l.head)); 5.16 + JavaFileObject fo = fm.getJavaFileObjectsFromStrings(List.of(l.head)).iterator().next(); 5.17 + trees.append(parse(fo)); 5.18 } 5.19 5.20 //enter symbols for all files
6.1 --- a/src/share/classes/com/sun/tools/apt/mirror/apt/RoundCompleteEventImpl.java Tue Jan 20 15:17:45 2009 -0800 6.2 +++ b/src/share/classes/com/sun/tools/apt/mirror/apt/RoundCompleteEventImpl.java Tue Jan 20 18:23:13 2009 -0800 6.3 @@ -30,6 +30,8 @@ 6.4 import com.sun.mirror.apt.RoundState; 6.5 6.6 public class RoundCompleteEventImpl extends RoundCompleteEvent { 6.7 + private static final long serialVersionUID = 7067621446720784300L; 6.8 + 6.9 public RoundCompleteEventImpl(AnnotationProcessorEnvironment source, 6.10 RoundState rs) { 6.11 super(source, rs);
7.1 --- a/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java Tue Jan 20 15:17:45 2009 -0800 7.2 +++ b/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java Tue Jan 20 18:23:13 2009 -0800 7.3 @@ -252,6 +252,7 @@ 7.4 */ 7.5 private void typeMismatch(final Method method, final Attribute attr) { 7.6 value = new ExceptionProxy() { 7.7 + private static final long serialVersionUID = 8473323277815075163L; 7.8 public String toString() { 7.9 return "<error>"; // eg: @Anno(value=<error>) 7.10 } 7.11 @@ -270,6 +271,7 @@ 7.12 * type. 7.13 */ 7.14 private static class MirroredTypeExceptionProxy extends ExceptionProxy { 7.15 + private static final long serialVersionUID = 6662035281599933545L; 7.16 7.17 private MirroredTypeException ex; 7.18 7.19 @@ -311,6 +313,7 @@ 7.20 * types. 7.21 */ 7.22 private static class MirroredTypesExceptionProxy extends ExceptionProxy { 7.23 + private static final long serialVersionUID = -6670822532616693951L; 7.24 7.25 private MirroredTypesException ex; 7.26
8.1 --- a/src/share/classes/com/sun/tools/apt/mirror/type/TypeVariableImpl.java Tue Jan 20 15:17:45 2009 -0800 8.2 +++ b/src/share/classes/com/sun/tools/apt/mirror/type/TypeVariableImpl.java Tue Jan 20 18:23:13 2009 -0800 8.3 @@ -64,7 +64,7 @@ 8.4 * {@inheritDoc} 8.5 */ 8.6 public TypeParameterDeclaration getDeclaration() { 8.7 - TypeSymbol sym = (TypeSymbol) type.tsym; 8.8 + TypeSymbol sym = type.tsym; 8.9 return env.declMaker.getTypeParameterDeclaration(sym); 8.10 } 8.11
9.1 --- a/src/share/classes/com/sun/tools/classfile/Annotation.java Tue Jan 20 15:17:45 2009 -0800 9.2 +++ b/src/share/classes/com/sun/tools/classfile/Annotation.java Tue Jan 20 18:23:13 2009 -0800 9.3 @@ -37,6 +37,7 @@ 9.4 */ 9.5 public class Annotation { 9.6 static class InvalidAnnotation extends AttributeException { 9.7 + private static final long serialVersionUID = -4620480740735772708L; 9.8 InvalidAnnotation(String msg) { 9.9 super(msg); 9.10 }
10.1 --- a/src/share/classes/com/sun/tools/classfile/AttributeException.java Tue Jan 20 15:17:45 2009 -0800 10.2 +++ b/src/share/classes/com/sun/tools/classfile/AttributeException.java Tue Jan 20 18:23:13 2009 -0800 10.3 @@ -32,6 +32,7 @@ 10.4 * deletion without notice.</b> 10.5 */ 10.6 public class AttributeException extends Exception { 10.7 + private static final long serialVersionUID = -4231486387714867770L; 10.8 AttributeException() { } 10.9 10.10 AttributeException(String msg) {
11.1 --- a/src/share/classes/com/sun/tools/classfile/Code_attribute.java Tue Jan 20 15:17:45 2009 -0800 11.2 +++ b/src/share/classes/com/sun/tools/classfile/Code_attribute.java Tue Jan 20 18:23:13 2009 -0800 11.3 @@ -37,6 +37,7 @@ 11.4 */ 11.5 public class Code_attribute extends Attribute { 11.6 public class InvalidIndex extends AttributeException { 11.7 + private static final long serialVersionUID = -8904527774589382802L; 11.8 InvalidIndex(int index) { 11.9 this.index = index; 11.10 }
12.1 --- a/src/share/classes/com/sun/tools/classfile/ConstantPool.java Tue Jan 20 15:17:45 2009 -0800 12.2 +++ b/src/share/classes/com/sun/tools/classfile/ConstantPool.java Tue Jan 20 18:23:13 2009 -0800 12.3 @@ -38,6 +38,7 @@ 12.4 public class ConstantPool { 12.5 12.6 public class InvalidIndex extends ConstantPoolException { 12.7 + private static final long serialVersionUID = -4350294289300939730L; 12.8 InvalidIndex(int index) { 12.9 super(index); 12.10 } 12.11 @@ -50,6 +51,7 @@ 12.12 } 12.13 12.14 public class UnexpectedEntry extends ConstantPoolException { 12.15 + private static final long serialVersionUID = 6986335935377933211L; 12.16 UnexpectedEntry(int index, int expected_tag, int found_tag) { 12.17 super(index); 12.18 this.expected_tag = expected_tag; 12.19 @@ -67,6 +69,7 @@ 12.20 } 12.21 12.22 public class InvalidEntry extends ConstantPoolException { 12.23 + private static final long serialVersionUID = 1000087545585204447L; 12.24 InvalidEntry(int index, int tag) { 12.25 super(index); 12.26 this.tag = tag; 12.27 @@ -82,6 +85,7 @@ 12.28 } 12.29 12.30 public class EntryNotFound extends ConstantPoolException { 12.31 + private static final long serialVersionUID = 2885537606468581850L; 12.32 EntryNotFound(Object value) { 12.33 super(-1); 12.34 this.value = value;
13.1 --- a/src/share/classes/com/sun/tools/classfile/ConstantPoolException.java Tue Jan 20 15:17:45 2009 -0800 13.2 +++ b/src/share/classes/com/sun/tools/classfile/ConstantPoolException.java Tue Jan 20 18:23:13 2009 -0800 13.3 @@ -33,6 +33,7 @@ 13.4 * deletion without notice.</b> 13.5 */ 13.6 public class ConstantPoolException extends Exception { 13.7 + private static final long serialVersionUID = -2324397349644754565L; 13.8 ConstantPoolException(int index) { 13.9 this.index = index; 13.10 }
14.1 --- a/src/share/classes/com/sun/tools/classfile/Descriptor.java Tue Jan 20 15:17:45 2009 -0800 14.2 +++ b/src/share/classes/com/sun/tools/classfile/Descriptor.java Tue Jan 20 18:23:13 2009 -0800 14.3 @@ -38,6 +38,7 @@ 14.4 */ 14.5 public class Descriptor { 14.6 public class InvalidDescriptor extends DescriptorException { 14.7 + private static final long serialVersionUID = 1L; 14.8 InvalidDescriptor(String desc) { 14.9 this.desc = desc; 14.10 this.index = -1;
15.1 --- a/src/share/classes/com/sun/tools/classfile/DescriptorException.java Tue Jan 20 15:17:45 2009 -0800 15.2 +++ b/src/share/classes/com/sun/tools/classfile/DescriptorException.java Tue Jan 20 18:23:13 2009 -0800 15.3 @@ -33,4 +33,5 @@ 15.4 * deletion without notice.</b> 15.5 */ 15.6 public class DescriptorException extends Exception { 15.7 + private static final long serialVersionUID = 2411890273788901032L; 15.8 }
16.1 --- a/src/share/classes/com/sun/tools/classfile/StackMapTable_attribute.java Tue Jan 20 15:17:45 2009 -0800 16.2 +++ b/src/share/classes/com/sun/tools/classfile/StackMapTable_attribute.java Tue Jan 20 18:23:13 2009 -0800 16.3 @@ -37,6 +37,7 @@ 16.4 */ 16.5 public class StackMapTable_attribute extends Attribute { 16.6 static class InvalidStackMap extends AttributeException { 16.7 + private static final long serialVersionUID = -5659038410855089780L; 16.8 InvalidStackMap(String msg) { 16.9 super(msg); 16.10 }
17.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Tue Jan 20 15:17:45 2009 -0800 17.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Tue Jan 20 18:23:13 2009 -0800 17.3 @@ -119,7 +119,7 @@ 17.4 */ 17.5 protected void generateIndex() { 17.6 for (int i = 0; i < groupList.size(); i++) { 17.7 - String groupname = (String)groupList.get(i); 17.8 + String groupname = groupList.get(i); 17.9 List<PackageDoc> list = groupPackageMap.get(groupname); 17.10 if (list != null && list.size() > 0) { 17.11 printIndexContents(list.toArray(new PackageDoc[list.size()]),
18.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java Tue Jan 20 15:17:45 2009 -0800 18.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java Tue Jan 20 18:23:13 2009 -0800 18.3 @@ -402,7 +402,7 @@ 18.4 public void buildFieldSerializationOverview(ClassDoc classDoc) { 18.5 if (classDoc.definesSerializableFields()) { 18.6 FieldDoc serialPersistentField = 18.7 - (FieldDoc)((Util.asList(classDoc.serializableFields()).get(0))); 18.8 + Util.asList(classDoc.serializableFields()).get(0); 18.9 String comment = serialPersistentField.commentText(); 18.10 if (comment.length() > 0) { 18.11 fieldWriter.writeHeader(
19.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletAbortException.java Tue Jan 20 15:17:45 2009 -0800 19.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletAbortException.java Tue Jan 20 18:23:13 2009 -0800 19.3 @@ -26,6 +26,7 @@ 19.4 package com.sun.tools.doclets.internal.toolkit.util; 19.5 19.6 public class DocletAbortException extends RuntimeException { 19.7 + private static final long serialVersionUID = -9131058909576418984L; 19.8 19.9 public DocletAbortException() { 19.10 }
20.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Tue Jan 20 15:17:45 2009 -0800 20.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Tue Jan 20 18:23:13 2009 -0800 20.3 @@ -471,6 +471,7 @@ 20.4 private int value; 20.5 }; 20.6 protected class CompileStates extends HashMap<Env<AttrContext>,CompileState> { 20.7 + private static final long serialVersionUID = 1812267524140424433L; 20.8 boolean isDone(Env<AttrContext> env, CompileState cs) { 20.9 CompileState ecs = get(env); 20.10 return ecs != null && ecs.isDone(cs);
21.1 --- a/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Tue Jan 20 15:17:45 2009 -0800 21.2 +++ b/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Tue Jan 20 18:23:13 2009 -0800 21.3 @@ -61,6 +61,7 @@ 21.4 * @param opts list of command-line options 21.5 * @param msgs JavacMessages object used for i18n 21.6 */ 21.7 + @SuppressWarnings("fallthrough") 21.8 BasicDiagnosticFormatter(Options opts, JavacMessages msgs) { 21.9 super(msgs, opts, true); 21.10 initAvailableFormats();
22.1 --- a/src/share/classes/com/sun/tools/javadoc/Comment.java Tue Jan 20 15:17:45 2009 -0800 22.2 +++ b/src/share/classes/com/sun/tools/javadoc/Comment.java Tue Jan 20 18:23:13 2009 -0800 22.3 @@ -74,6 +74,7 @@ 22.4 * the tag text. 22.5 * </pre> 22.6 */ 22.7 + @SuppressWarnings("fallthrough") 22.8 class CommentStringParser { 22.9 /** 22.10 * The entry point to the comment string parser
23.1 --- a/src/share/classes/com/sun/tools/javadoc/Messager.java Tue Jan 20 15:17:45 2009 -0800 23.2 +++ b/src/share/classes/com/sun/tools/javadoc/Messager.java Tue Jan 20 18:23:13 2009 -0800 23.3 @@ -111,6 +111,7 @@ 23.4 * @param warnWriter Stream for warnings 23.5 * @param noticeWriter Stream for other messages 23.6 */ 23.7 + @SuppressWarnings("deprecation") 23.8 protected Messager(Context context, 23.9 String programName, 23.10 PrintWriter errWriter,
24.1 --- a/src/share/classes/com/sun/tools/javadoc/TypeMaker.java Tue Jan 20 15:17:45 2009 -0800 24.2 +++ b/src/share/classes/com/sun/tools/javadoc/TypeMaker.java Tue Jan 20 18:23:13 2009 -0800 24.3 @@ -51,6 +51,7 @@ 24.4 * @param errToClassDoc if true, ERROR type results in a ClassDoc; 24.5 * false preserves legacy behavior 24.6 */ 24.7 + @SuppressWarnings("fallthrough") 24.8 public static com.sun.javadoc.Type getType(DocEnv env, Type t, 24.9 boolean errToClassDoc) { 24.10 if (env.legacyDoclet) {
25.1 --- a/src/share/classes/com/sun/tools/javah/Gen.java Tue Jan 20 15:17:45 2009 -0800 25.2 +++ b/src/share/classes/com/sun/tools/javah/Gen.java Tue Jan 20 18:23:13 2009 -0800 25.3 @@ -342,6 +342,6 @@ 25.4 fields.addAll(Arrays.asList(cd.fields())); 25.5 } 25.6 25.7 - return (FieldDoc[]) fields.toArray(new FieldDoc[fields.size()]); 25.8 + return fields.toArray(new FieldDoc[fields.size()]); 25.9 } 25.10 }
26.1 --- a/src/share/classes/com/sun/tools/javap/InternalError.java Tue Jan 20 15:17:45 2009 -0800 26.2 +++ b/src/share/classes/com/sun/tools/javap/InternalError.java Tue Jan 20 18:23:13 2009 -0800 26.3 @@ -32,6 +32,7 @@ 26.4 * deletion without notice.</b> 26.5 */ 26.6 public class InternalError extends Error { 26.7 + private static final long serialVersionUID = 8114054446416187030L; 26.8 InternalError(Throwable t, Object... args) { 26.9 super("Internal error", t); 26.10 this.args = args;
27.1 --- a/src/share/classes/sun/tools/javap/JavapPrinter.java Tue Jan 20 15:17:45 2009 -0800 27.2 +++ b/src/share/classes/sun/tools/javap/JavapPrinter.java Tue Jan 20 18:23:13 2009 -0800 27.3 @@ -719,6 +719,7 @@ 27.4 /** 27.5 * Print constant pool entry information. 27.6 */ 27.7 + @SuppressWarnings("fallthrough") 27.8 public int PrintlnConstantEntry(int cpx) { 27.9 int size=1; 27.10 byte tag=0; 27.11 @@ -757,6 +758,7 @@ 27.12 case CONSTANT_LONG: 27.13 case CONSTANT_DOUBLE: 27.14 size=2; 27.15 + // fall through 27.16 default: 27.17 out.println(str+";"); 27.18 }