mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
8010361: fix some langtools findbugs issues
Reviewed-by: darcy
This commit is contained in:
parent
a52c1dd51a
commit
ab8f7a3762
10 changed files with 31 additions and 42 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -38,7 +38,7 @@ import java.util.NoSuchElementException;
|
||||||
* deletion without notice.</b>
|
* deletion without notice.</b>
|
||||||
*/
|
*/
|
||||||
public class Code_attribute extends Attribute {
|
public class Code_attribute extends Attribute {
|
||||||
public class InvalidIndex extends AttributeException {
|
public static class InvalidIndex extends AttributeException {
|
||||||
private static final long serialVersionUID = -8904527774589382802L;
|
private static final long serialVersionUID = -8904527774589382802L;
|
||||||
InvalidIndex(int index) {
|
InvalidIndex(int index) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
|
@ -143,7 +143,7 @@ public class Code_attribute extends Attribute {
|
||||||
public final Exception_data[] exception_table;
|
public final Exception_data[] exception_table;
|
||||||
public final Attributes attributes;
|
public final Attributes attributes;
|
||||||
|
|
||||||
public class Exception_data {
|
public static class Exception_data {
|
||||||
Exception_data(ClassReader cr) throws IOException {
|
Exception_data(ClassReader cr) throws IOException {
|
||||||
start_pc = cr.readUnsignedShort();
|
start_pc = cr.readUnsignedShort();
|
||||||
end_pc = cr.readUnsignedShort();
|
end_pc = cr.readUnsignedShort();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -37,7 +37,7 @@ import java.io.IOException;
|
||||||
* deletion without notice.</b>
|
* deletion without notice.</b>
|
||||||
*/
|
*/
|
||||||
public class Descriptor {
|
public class Descriptor {
|
||||||
public class InvalidDescriptor extends DescriptorException {
|
public static class InvalidDescriptor extends DescriptorException {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
InvalidDescriptor(String desc) {
|
InvalidDescriptor(String desc) {
|
||||||
this.desc = desc;
|
this.desc = desc;
|
||||||
|
|
|
@ -56,7 +56,7 @@ public abstract class Configuration {
|
||||||
/**
|
/**
|
||||||
* Exception used to report a problem during setOptions.
|
* Exception used to report a problem during setOptions.
|
||||||
*/
|
*/
|
||||||
public class Fault extends Exception {
|
public static class Fault extends Exception {
|
||||||
private static final long serialVersionUID = 0;
|
private static final long serialVersionUID = 0;
|
||||||
|
|
||||||
Fault(String msg) {
|
Fault(String msg) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -116,9 +116,9 @@ public class AnnotationTypeBuilder extends AbstractBuilder {
|
||||||
* @param contentTree the content tree to which the documentation will be added
|
* @param contentTree the content tree to which the documentation will be added
|
||||||
*/
|
*/
|
||||||
public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception {
|
public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception {
|
||||||
contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") +
|
contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") +
|
||||||
" " + annotationTypeDoc.name());
|
" " + annotationTypeDoc.name());
|
||||||
Content annotationContentTree = writer.getAnnotationContentHeader();
|
Content annotationContentTree = writer.getAnnotationContentHeader();
|
||||||
buildChildren(node, annotationContentTree);
|
buildChildren(node, annotationContentTree);
|
||||||
contentTree.addContent(annotationContentTree);
|
contentTree.addContent(annotationContentTree);
|
||||||
writer.addFooter(contentTree);
|
writer.addFooter(contentTree);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -144,10 +144,6 @@ public class Util {
|
||||||
throw new Exit(15);
|
throw new Exit(15);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fatal(String msg) throws Exit {
|
|
||||||
fatal(msg, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fatal(String msg, Exception e) throws Exit {
|
private void fatal(String msg, Exception e) throws Exit {
|
||||||
dl.report(createDiagnostic(Diagnostic.Kind.ERROR, "", msg));
|
dl.report(createDiagnostic(Diagnostic.Kind.ERROR, "", msg));
|
||||||
throw new Exit(10, e);
|
throw new Exit(10, e);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -269,7 +269,7 @@ public class StackMapWriter extends InstructionDetailWriter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class StackMap {
|
static class StackMap {
|
||||||
StackMap(verification_type_info[] locals, verification_type_info[] stack) {
|
StackMap(verification_type_info[] locals, verification_type_info[] stack) {
|
||||||
this.locals = locals;
|
this.locals = locals;
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
|
@ -279,7 +279,7 @@ public class StackMapWriter extends InstructionDetailWriter {
|
||||||
private final verification_type_info[] stack;
|
private final verification_type_info[] stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomVerificationTypeInfo extends verification_type_info {
|
static class CustomVerificationTypeInfo extends verification_type_info {
|
||||||
public CustomVerificationTypeInfo(String text) {
|
public CustomVerificationTypeInfo(String text) {
|
||||||
super(-1);
|
super(-1);
|
||||||
this.text = text;
|
this.text = text;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -38,7 +38,7 @@ import java.util.regex.Pattern;
|
||||||
* Implementation for the jdeps tool for static class dependency analysis.
|
* Implementation for the jdeps tool for static class dependency analysis.
|
||||||
*/
|
*/
|
||||||
class JdepsTask {
|
class JdepsTask {
|
||||||
class BadArgs extends Exception {
|
static class BadArgs extends Exception {
|
||||||
static final long serialVersionUID = 8765093759964640721L;
|
static final long serialVersionUID = 8765093759964640721L;
|
||||||
BadArgs(String key, Object... args) {
|
BadArgs(String key, Object... args) {
|
||||||
super(JdepsTask.getMessage(key, args));
|
super(JdepsTask.getMessage(key, args));
|
||||||
|
@ -119,7 +119,7 @@ class JdepsTask {
|
||||||
} else if ("class".equals(arg)) {
|
} else if ("class".equals(arg)) {
|
||||||
task.options.verbose = Analyzer.Type.CLASS;
|
task.options.verbose = Analyzer.Type.CLASS;
|
||||||
} else {
|
} else {
|
||||||
throw task.new BadArgs("err.invalid.arg.for.option", opt);
|
throw new BadArgs("err.invalid.arg.for.option", opt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -142,7 +142,7 @@ class JdepsTask {
|
||||||
void process(JdepsTask task, String opt, String arg) throws BadArgs {
|
void process(JdepsTask task, String opt, String arg) throws BadArgs {
|
||||||
task.options.showProfile = true;
|
task.options.showProfile = true;
|
||||||
if (Profiles.getProfileCount() == 0) {
|
if (Profiles.getProfileCount() == 0) {
|
||||||
throw task.new BadArgs("err.option.unsupported", opt, getMessage("err.profiles.msg"));
|
throw new BadArgs("err.option.unsupported", opt, getMessage("err.profiles.msg"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -156,7 +156,7 @@ class JdepsTask {
|
||||||
try {
|
try {
|
||||||
task.options.depth = Integer.parseInt(arg);
|
task.options.depth = Integer.parseInt(arg);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
throw task.new BadArgs("err.invalid.arg.for.option", opt);
|
throw new BadArgs("err.invalid.arg.for.option", opt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -515,7 +515,6 @@ class JdepsTask {
|
||||||
boolean help;
|
boolean help;
|
||||||
boolean version;
|
boolean version;
|
||||||
boolean fullVersion;
|
boolean fullVersion;
|
||||||
boolean showFlags;
|
|
||||||
boolean showProfile;
|
boolean showProfile;
|
||||||
boolean showSummary;
|
boolean showSummary;
|
||||||
boolean wildcard;
|
boolean wildcard;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -49,7 +49,6 @@ class PlatformClassPath {
|
||||||
private static List<Archive> init() {
|
private static List<Archive> init() {
|
||||||
List<Archive> result = new ArrayList<Archive>();
|
List<Archive> result = new ArrayList<Archive>();
|
||||||
String javaHome = System.getProperty("java.home");
|
String javaHome = System.getProperty("java.home");
|
||||||
List<File> files = new ArrayList<File>();
|
|
||||||
File jre = new File(javaHome, "jre");
|
File jre = new File(javaHome, "jre");
|
||||||
File lib = new File(javaHome, "lib");
|
File lib = new File(javaHome, "lib");
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -26,18 +26,13 @@
|
||||||
package com.sun.tools.sjavac;
|
package com.sun.tools.sjavac;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import com.sun.tools.sjavac.server.JavacServer;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import com.sun.tools.sjavac.server.JavacServer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main class of the smart javac wrapper tool.
|
* The main class of the smart javac wrapper tool.
|
||||||
|
@ -268,12 +263,12 @@ public class Main {
|
||||||
// Find all class files allowable for linking.
|
// Find all class files allowable for linking.
|
||||||
// And pickup knowledge of all modules found here.
|
// And pickup knowledge of all modules found here.
|
||||||
// This cannot currently filter classes inside jar files.
|
// This cannot currently filter classes inside jar files.
|
||||||
Map<String,Source> classes_to_link_to = new HashMap<String,Source>();
|
// Map<String,Source> classes_to_link_to = new HashMap<String,Source>();
|
||||||
// findFiles(args, "-classpath", Util.set(".class"), classes_to_link_to, modules, current_module, true);
|
// findFiles(args, "-classpath", Util.set(".class"), classes_to_link_to, modules, current_module, true);
|
||||||
|
|
||||||
// Find all module sources allowable for linking.
|
// Find all module sources allowable for linking.
|
||||||
Map<String,Source> modules_to_link_to = new HashMap<String,Source>();
|
// Map<String,Source> modules_to_link_to = new HashMap<String,Source>();
|
||||||
// findFiles(args, "-modulepath", Util.set(".class"), modules_to_link_to, modules, current_module, true);
|
// findFiles(args, "-modulepath", Util.set(".class"), modules_to_link_to, modules, current_module, true);
|
||||||
|
|
||||||
// Add the set of sources to the build database.
|
// Add the set of sources to the build database.
|
||||||
javac_state.now().collectPackagesSourcesAndArtifacts(modules);
|
javac_state.now().collectPackagesSourcesAndArtifacts(modules);
|
||||||
|
@ -935,13 +930,13 @@ public class Main {
|
||||||
if (roots.contains(root)) {
|
if (roots.contains(root)) {
|
||||||
throw new ProblemException("\""+r+"\" has already been used for "+option);
|
throw new ProblemException("\""+r+"\" has already been used for "+option);
|
||||||
}
|
}
|
||||||
if (roots.equals(bin_dir)) {
|
if (root.equals(bin_dir)) {
|
||||||
throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -d");
|
throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -d");
|
||||||
}
|
}
|
||||||
if (roots.equals(gensrc_dir)) {
|
if (root.equals(gensrc_dir)) {
|
||||||
throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -s");
|
throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -s");
|
||||||
}
|
}
|
||||||
if (roots.equals(header_dir)) {
|
if (root.equals(header_dir)) {
|
||||||
throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -h");
|
throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -h");
|
||||||
}
|
}
|
||||||
roots.add(root);
|
roots.add(root);
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class Dependencies {
|
||||||
return new_deps;
|
return new_deps;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CompareNames implements Comparator<Name> {
|
static class CompareNames implements Comparator<Name> {
|
||||||
public int compare(Name a, Name b) {
|
public int compare(Name a, Name b) {
|
||||||
return a.toString().compareTo(b.toString());
|
return a.toString().compareTo(b.toString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue