提交 72284490 编写于 作者: J jjg

6795903: fix latent build warnings in langtools repository

Reviewed-by: darcy
上级 1d56195a
......@@ -66,7 +66,7 @@ javac.no.jdk.warnings = -XDignore.symbol.file=true
# set the following to -version to verify the versions of javac being used
javac.version.opt =
# in time, there should be no exceptions to -Xlint:all
javac.lint.opts = -Xlint:all,-deprecation,-fallthrough,-serial,-unchecked,-cast
javac.lint.opts = -Xlint:all -Werror
# options for the <javadoc> task for javac
javadoc.jls3.url=http://java.sun.com/docs/books/jls/
......
......@@ -26,6 +26,7 @@
package com.sun.tools.apt.comp;
public class AnnotationProcessingError extends Error {
private static final long serialVersionUID = 3279196183341719287L;
AnnotationProcessingError(Throwable cause) {
super(cause);
}
......
......@@ -316,8 +316,13 @@ public class Apt extends ListBuffer<Env<AttrContext>> {
}
providers = list.iterator();
} else
providers = sun.misc.Service.providers(AnnotationProcessorFactory.class, aptCL);
} else {
@SuppressWarnings("unchecked")
Iterator<AnnotationProcessorFactory> iter =
sun.misc.Service.providers(AnnotationProcessorFactory.class, aptCL);
providers = iter;
}
}
java.util.Map<AnnotationProcessorFactory, Set<AnnotationTypeDeclaration>> factoryToAnnotation =
......
......@@ -26,4 +26,6 @@
package com.sun.tools.apt.comp;
public class UsageMessageNeededException extends RuntimeException {}
public class UsageMessageNeededException extends RuntimeException {
private static final long serialVersionUID = -3265159608992825840L;
}
......@@ -233,6 +233,7 @@ public class JavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
ListBuffer<ClassSymbol> classes = new ListBuffer<ClassSymbol>();
try {
JavacFileManager fm = (JavacFileManager)fileManager;
//parse all files
ListBuffer<JCCompilationUnit> trees = new ListBuffer<JCCompilationUnit>();
for (List<String> l = filenames; l.nonEmpty(); l = l.tail) {
......@@ -250,7 +251,8 @@ public class JavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
continue;
}
}
trees.append(parse(l.head));
JavaFileObject fo = fm.getJavaFileObjectsFromStrings(List.of(l.head)).iterator().next();
trees.append(parse(fo));
}
//enter symbols for all files
......
......@@ -30,6 +30,8 @@ import com.sun.mirror.apt.RoundCompleteEvent;
import com.sun.mirror.apt.RoundState;
public class RoundCompleteEventImpl extends RoundCompleteEvent {
private static final long serialVersionUID = 7067621446720784300L;
public RoundCompleteEventImpl(AnnotationProcessorEnvironment source,
RoundState rs) {
super(source, rs);
......
......@@ -252,6 +252,7 @@ class AnnotationProxyMaker {
*/
private void typeMismatch(final Method method, final Attribute attr) {
value = new ExceptionProxy() {
private static final long serialVersionUID = 8473323277815075163L;
public String toString() {
return "<error>"; // eg: @Anno(value=<error>)
}
......@@ -270,6 +271,7 @@ class AnnotationProxyMaker {
* type.
*/
private static class MirroredTypeExceptionProxy extends ExceptionProxy {
private static final long serialVersionUID = 6662035281599933545L;
private MirroredTypeException ex;
......@@ -311,6 +313,7 @@ class AnnotationProxyMaker {
* types.
*/
private static class MirroredTypesExceptionProxy extends ExceptionProxy {
private static final long serialVersionUID = -6670822532616693951L;
private MirroredTypesException ex;
......
......@@ -64,7 +64,7 @@ public class TypeVariableImpl extends TypeMirrorImpl implements TypeVariable {
* {@inheritDoc}
*/
public TypeParameterDeclaration getDeclaration() {
TypeSymbol sym = (TypeSymbol) type.tsym;
TypeSymbol sym = type.tsym;
return env.declMaker.getTypeParameterDeclaration(sym);
}
......
......@@ -37,6 +37,7 @@ import java.io.IOException;
*/
public class Annotation {
static class InvalidAnnotation extends AttributeException {
private static final long serialVersionUID = -4620480740735772708L;
InvalidAnnotation(String msg) {
super(msg);
}
......
......@@ -32,6 +32,7 @@ package com.sun.tools.classfile;
* deletion without notice.</b>
*/
public class AttributeException extends Exception {
private static final long serialVersionUID = -4231486387714867770L;
AttributeException() { }
AttributeException(String msg) {
......
......@@ -37,6 +37,7 @@ import java.io.IOException;
*/
public class Code_attribute extends Attribute {
public class InvalidIndex extends AttributeException {
private static final long serialVersionUID = -8904527774589382802L;
InvalidIndex(int index) {
this.index = index;
}
......
......@@ -38,6 +38,7 @@ import java.io.IOException;
public class ConstantPool {
public class InvalidIndex extends ConstantPoolException {
private static final long serialVersionUID = -4350294289300939730L;
InvalidIndex(int index) {
super(index);
}
......@@ -50,6 +51,7 @@ public class ConstantPool {
}
public class UnexpectedEntry extends ConstantPoolException {
private static final long serialVersionUID = 6986335935377933211L;
UnexpectedEntry(int index, int expected_tag, int found_tag) {
super(index);
this.expected_tag = expected_tag;
......@@ -67,6 +69,7 @@ public class ConstantPool {
}
public class InvalidEntry extends ConstantPoolException {
private static final long serialVersionUID = 1000087545585204447L;
InvalidEntry(int index, int tag) {
super(index);
this.tag = tag;
......@@ -82,6 +85,7 @@ public class ConstantPool {
}
public class EntryNotFound extends ConstantPoolException {
private static final long serialVersionUID = 2885537606468581850L;
EntryNotFound(Object value) {
super(-1);
this.value = value;
......
......@@ -33,6 +33,7 @@ package com.sun.tools.classfile;
* deletion without notice.</b>
*/
public class ConstantPoolException extends Exception {
private static final long serialVersionUID = -2324397349644754565L;
ConstantPoolException(int index) {
this.index = index;
}
......
......@@ -38,6 +38,7 @@ import java.io.IOException;
*/
public class Descriptor {
public class InvalidDescriptor extends DescriptorException {
private static final long serialVersionUID = 1L;
InvalidDescriptor(String desc) {
this.desc = desc;
this.index = -1;
......
......@@ -33,4 +33,5 @@ package com.sun.tools.classfile;
* deletion without notice.</b>
*/
public class DescriptorException extends Exception {
private static final long serialVersionUID = 2411890273788901032L;
}
......@@ -37,6 +37,7 @@ import java.io.IOException;
*/
public class StackMapTable_attribute extends Attribute {
static class InvalidStackMap extends AttributeException {
private static final long serialVersionUID = -5659038410855089780L;
InvalidStackMap(String msg) {
super(msg);
}
......
......@@ -119,7 +119,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
*/
protected void generateIndex() {
for (int i = 0; i < groupList.size(); i++) {
String groupname = (String)groupList.get(i);
String groupname = groupList.get(i);
List<PackageDoc> list = groupPackageMap.get(groupname);
if (list != null && list.size() > 0) {
printIndexContents(list.toArray(new PackageDoc[list.size()]),
......
......@@ -402,7 +402,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
public void buildFieldSerializationOverview(ClassDoc classDoc) {
if (classDoc.definesSerializableFields()) {
FieldDoc serialPersistentField =
(FieldDoc)((Util.asList(classDoc.serializableFields()).get(0)));
Util.asList(classDoc.serializableFields()).get(0);
String comment = serialPersistentField.commentText();
if (comment.length() > 0) {
fieldWriter.writeHeader(
......
......@@ -26,6 +26,7 @@
package com.sun.tools.doclets.internal.toolkit.util;
public class DocletAbortException extends RuntimeException {
private static final long serialVersionUID = -9131058909576418984L;
public DocletAbortException() {
}
......
......@@ -471,6 +471,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
private int value;
};
protected class CompileStates extends HashMap<Env<AttrContext>,CompileState> {
private static final long serialVersionUID = 1812267524140424433L;
boolean isDone(Env<AttrContext> env, CompileState cs) {
CompileState ecs = get(env);
return ecs != null && ecs.isDone(cs);
......
......@@ -61,6 +61,7 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter {
* @param opts list of command-line options
* @param msgs JavacMessages object used for i18n
*/
@SuppressWarnings("fallthrough")
BasicDiagnosticFormatter(Options opts, JavacMessages msgs) {
super(msgs, opts, true);
initAvailableFormats();
......
......@@ -74,6 +74,7 @@ class Comment {
* the tag text.
* </pre>
*/
@SuppressWarnings("fallthrough")
class CommentStringParser {
/**
* The entry point to the comment string parser
......
......@@ -111,6 +111,7 @@ public class Messager extends Log implements DocErrorReporter {
* @param warnWriter Stream for warnings
* @param noticeWriter Stream for other messages
*/
@SuppressWarnings("deprecation")
protected Messager(Context context,
String programName,
PrintWriter errWriter,
......
......@@ -51,6 +51,7 @@ public class TypeMaker {
* @param errToClassDoc if true, ERROR type results in a ClassDoc;
* false preserves legacy behavior
*/
@SuppressWarnings("fallthrough")
public static com.sun.javadoc.Type getType(DocEnv env, Type t,
boolean errToClassDoc) {
if (env.legacyDoclet) {
......
......@@ -342,6 +342,6 @@ public abstract class Gen {
fields.addAll(Arrays.asList(cd.fields()));
}
return (FieldDoc[]) fields.toArray(new FieldDoc[fields.size()]);
return fields.toArray(new FieldDoc[fields.size()]);
}
}
......@@ -32,6 +32,7 @@ package com.sun.tools.javap;
* deletion without notice.</b>
*/
public class InternalError extends Error {
private static final long serialVersionUID = 8114054446416187030L;
InternalError(Throwable t, Object... args) {
super("Internal error", t);
this.args = args;
......
......@@ -719,6 +719,7 @@ public class JavapPrinter {
/**
* Print constant pool entry information.
*/
@SuppressWarnings("fallthrough")
public int PrintlnConstantEntry(int cpx) {
int size=1;
byte tag=0;
......@@ -757,6 +758,7 @@ public class JavapPrinter {
case CONSTANT_LONG:
case CONSTANT_DOUBLE:
size=2;
// fall through
default:
out.println(str+";");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册