Tue, 19 Mar 2013 17:04:03 -0700
8010361: fix some langtools findbugs issues
Reviewed-by: darcy
1.1 --- a/src/share/classes/com/sun/tools/classfile/Code_attribute.java Tue Mar 19 15:13:44 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/classfile/Code_attribute.java Tue Mar 19 17:04:03 2013 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -38,7 +38,7 @@ 1.11 * deletion without notice.</b> 1.12 */ 1.13 public class Code_attribute extends Attribute { 1.14 - public class InvalidIndex extends AttributeException { 1.15 + public static class InvalidIndex extends AttributeException { 1.16 private static final long serialVersionUID = -8904527774589382802L; 1.17 InvalidIndex(int index) { 1.18 this.index = index; 1.19 @@ -143,7 +143,7 @@ 1.20 public final Exception_data[] exception_table; 1.21 public final Attributes attributes; 1.22 1.23 - public class Exception_data { 1.24 + public static class Exception_data { 1.25 Exception_data(ClassReader cr) throws IOException { 1.26 start_pc = cr.readUnsignedShort(); 1.27 end_pc = cr.readUnsignedShort();
2.1 --- a/src/share/classes/com/sun/tools/classfile/Descriptor.java Tue Mar 19 15:13:44 2013 -0700 2.2 +++ b/src/share/classes/com/sun/tools/classfile/Descriptor.java Tue Mar 19 17:04:03 2013 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -37,7 +37,7 @@ 2.11 * deletion without notice.</b> 2.12 */ 2.13 public class Descriptor { 2.14 - public class InvalidDescriptor extends DescriptorException { 2.15 + public static class InvalidDescriptor extends DescriptorException { 2.16 private static final long serialVersionUID = 1L; 2.17 InvalidDescriptor(String desc) { 2.18 this.desc = desc;
3.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Tue Mar 19 15:13:44 2013 -0700 3.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Tue Mar 19 17:04:03 2013 -0700 3.3 @@ -56,7 +56,7 @@ 3.4 /** 3.5 * Exception used to report a problem during setOptions. 3.6 */ 3.7 - public class Fault extends Exception { 3.8 + public static class Fault extends Exception { 3.9 private static final long serialVersionUID = 0; 3.10 3.11 Fault(String msg) {
4.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java Tue Mar 19 15:13:44 2013 -0700 4.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java Tue Mar 19 17:04:03 2013 -0700 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -116,9 +116,9 @@ 4.11 * @param contentTree the content tree to which the documentation will be added 4.12 */ 4.13 public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception { 4.14 - contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") + 4.15 + contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") + 4.16 " " + annotationTypeDoc.name()); 4.17 - Content annotationContentTree = writer.getAnnotationContentHeader(); 4.18 + Content annotationContentTree = writer.getAnnotationContentHeader(); 4.19 buildChildren(node, annotationContentTree); 4.20 contentTree.addContent(annotationContentTree); 4.21 writer.addFooter(contentTree);
5.1 --- a/src/share/classes/com/sun/tools/javah/Util.java Tue Mar 19 15:13:44 2013 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javah/Util.java Tue Mar 19 17:04:03 2013 -0700 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -144,10 +144,6 @@ 5.11 throw new Exit(15); 5.12 } 5.13 5.14 - private void fatal(String msg) throws Exit { 5.15 - fatal(msg, null); 5.16 - } 5.17 - 5.18 private void fatal(String msg, Exception e) throws Exit { 5.19 dl.report(createDiagnostic(Diagnostic.Kind.ERROR, "", msg)); 5.20 throw new Exit(10, e);
6.1 --- a/src/share/classes/com/sun/tools/javap/StackMapWriter.java Tue Mar 19 15:13:44 2013 -0700 6.2 +++ b/src/share/classes/com/sun/tools/javap/StackMapWriter.java Tue Mar 19 17:04:03 2013 -0700 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -269,7 +269,7 @@ 6.11 6.12 } 6.13 6.14 - class StackMap { 6.15 + static class StackMap { 6.16 StackMap(verification_type_info[] locals, verification_type_info[] stack) { 6.17 this.locals = locals; 6.18 this.stack = stack; 6.19 @@ -279,7 +279,7 @@ 6.20 private final verification_type_info[] stack; 6.21 } 6.22 6.23 - class CustomVerificationTypeInfo extends verification_type_info { 6.24 + static class CustomVerificationTypeInfo extends verification_type_info { 6.25 public CustomVerificationTypeInfo(String text) { 6.26 super(-1); 6.27 this.text = text;
7.1 --- a/src/share/classes/com/sun/tools/jdeps/JdepsTask.java Tue Mar 19 15:13:44 2013 -0700 7.2 +++ b/src/share/classes/com/sun/tools/jdeps/JdepsTask.java Tue Mar 19 17:04:03 2013 -0700 7.3 @@ -1,5 +1,5 @@ 7.4 /* 7.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 7.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 7.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.8 * 7.9 * This code is free software; you can redistribute it and/or modify it 7.10 @@ -38,7 +38,7 @@ 7.11 * Implementation for the jdeps tool for static class dependency analysis. 7.12 */ 7.13 class JdepsTask { 7.14 - class BadArgs extends Exception { 7.15 + static class BadArgs extends Exception { 7.16 static final long serialVersionUID = 8765093759964640721L; 7.17 BadArgs(String key, Object... args) { 7.18 super(JdepsTask.getMessage(key, args)); 7.19 @@ -119,7 +119,7 @@ 7.20 } else if ("class".equals(arg)) { 7.21 task.options.verbose = Analyzer.Type.CLASS; 7.22 } else { 7.23 - throw task.new BadArgs("err.invalid.arg.for.option", opt); 7.24 + throw new BadArgs("err.invalid.arg.for.option", opt); 7.25 } 7.26 } 7.27 }, 7.28 @@ -142,7 +142,7 @@ 7.29 void process(JdepsTask task, String opt, String arg) throws BadArgs { 7.30 task.options.showProfile = true; 7.31 if (Profiles.getProfileCount() == 0) { 7.32 - throw task.new BadArgs("err.option.unsupported", opt, getMessage("err.profiles.msg")); 7.33 + throw new BadArgs("err.option.unsupported", opt, getMessage("err.profiles.msg")); 7.34 } 7.35 } 7.36 }, 7.37 @@ -156,7 +156,7 @@ 7.38 try { 7.39 task.options.depth = Integer.parseInt(arg); 7.40 } catch (NumberFormatException e) { 7.41 - throw task.new BadArgs("err.invalid.arg.for.option", opt); 7.42 + throw new BadArgs("err.invalid.arg.for.option", opt); 7.43 } 7.44 } 7.45 }, 7.46 @@ -515,7 +515,6 @@ 7.47 boolean help; 7.48 boolean version; 7.49 boolean fullVersion; 7.50 - boolean showFlags; 7.51 boolean showProfile; 7.52 boolean showSummary; 7.53 boolean wildcard;
8.1 --- a/src/share/classes/com/sun/tools/jdeps/PlatformClassPath.java Tue Mar 19 15:13:44 2013 -0700 8.2 +++ b/src/share/classes/com/sun/tools/jdeps/PlatformClassPath.java Tue Mar 19 17:04:03 2013 -0700 8.3 @@ -1,5 +1,5 @@ 8.4 /* 8.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 8.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 8.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.8 * 8.9 * This code is free software; you can redistribute it and/or modify it 8.10 @@ -49,7 +49,6 @@ 8.11 private static List<Archive> init() { 8.12 List<Archive> result = new ArrayList<Archive>(); 8.13 String javaHome = System.getProperty("java.home"); 8.14 - List<File> files = new ArrayList<File>(); 8.15 File jre = new File(javaHome, "jre"); 8.16 File lib = new File(javaHome, "lib"); 8.17
9.1 --- a/src/share/classes/com/sun/tools/sjavac/Main.java Tue Mar 19 15:13:44 2013 -0700 9.2 +++ b/src/share/classes/com/sun/tools/sjavac/Main.java Tue Mar 19 17:04:03 2013 -0700 9.3 @@ -1,5 +1,5 @@ 9.4 /* 9.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 9.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 9.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.8 * 9.9 * This code is free software; you can redistribute it and/or modify it 9.10 @@ -26,18 +26,13 @@ 9.11 package com.sun.tools.sjavac; 9.12 9.13 import java.io.File; 9.14 -import java.util.HashMap; 9.15 -import java.util.HashSet; 9.16 -import java.util.LinkedList; 9.17 -import java.util.List; 9.18 -import java.util.Map; 9.19 -import java.util.Set; 9.20 -import java.util.regex.Matcher; 9.21 -import java.util.regex.Pattern; 9.22 -import com.sun.tools.sjavac.server.JavacServer; 9.23 import java.io.IOException; 9.24 import java.io.PrintStream; 9.25 import java.util.*; 9.26 +import java.util.regex.Matcher; 9.27 +import java.util.regex.Pattern; 9.28 + 9.29 +import com.sun.tools.sjavac.server.JavacServer; 9.30 9.31 /** 9.32 * The main class of the smart javac wrapper tool. 9.33 @@ -268,12 +263,12 @@ 9.34 // Find all class files allowable for linking. 9.35 // And pickup knowledge of all modules found here. 9.36 // This cannot currently filter classes inside jar files. 9.37 - Map<String,Source> classes_to_link_to = new HashMap<String,Source>(); 9.38 +// Map<String,Source> classes_to_link_to = new HashMap<String,Source>(); 9.39 // findFiles(args, "-classpath", Util.set(".class"), classes_to_link_to, modules, current_module, true); 9.40 9.41 // Find all module sources allowable for linking. 9.42 - Map<String,Source> modules_to_link_to = new HashMap<String,Source>(); 9.43 - // findFiles(args, "-modulepath", Util.set(".class"), modules_to_link_to, modules, current_module, true); 9.44 +// Map<String,Source> modules_to_link_to = new HashMap<String,Source>(); 9.45 +// findFiles(args, "-modulepath", Util.set(".class"), modules_to_link_to, modules, current_module, true); 9.46 9.47 // Add the set of sources to the build database. 9.48 javac_state.now().collectPackagesSourcesAndArtifacts(modules); 9.49 @@ -935,13 +930,13 @@ 9.50 if (roots.contains(root)) { 9.51 throw new ProblemException("\""+r+"\" has already been used for "+option); 9.52 } 9.53 - if (roots.equals(bin_dir)) { 9.54 + if (root.equals(bin_dir)) { 9.55 throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -d"); 9.56 } 9.57 - if (roots.equals(gensrc_dir)) { 9.58 + if (root.equals(gensrc_dir)) { 9.59 throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -s"); 9.60 } 9.61 - if (roots.equals(header_dir)) { 9.62 + if (root.equals(header_dir)) { 9.63 throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -h"); 9.64 } 9.65 roots.add(root);
10.1 --- a/src/share/classes/com/sun/tools/sjavac/comp/Dependencies.java Tue Mar 19 15:13:44 2013 -0700 10.2 +++ b/src/share/classes/com/sun/tools/sjavac/comp/Dependencies.java Tue Mar 19 17:04:03 2013 -0700 10.3 @@ -108,7 +108,7 @@ 10.4 return new_deps; 10.5 } 10.6 10.7 - class CompareNames implements Comparator<Name> { 10.8 + static class CompareNames implements Comparator<Name> { 10.9 public int compare(Name a, Name b) { 10.10 return a.toString().compareTo(b.toString()); 10.11 }