diff options
Diffstat (limited to 'libjava/classpath/tools/gnu/classpath/tools/gjdoc')
14 files changed, 221 insertions, 234 deletions
diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ClassDocImpl.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ClassDocImpl.java index b38c2b08379..b0e2127c89a 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ClassDocImpl.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ClassDocImpl.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.ClassDocImpl - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -103,9 +103,9 @@ public class ClassDocImpl return filter ? filteredFields : unfilteredFields; } - private static Set primitiveNames; + private static Set<String> primitiveNames; static { - primitiveNames = new HashSet(); + primitiveNames = new HashSet<String>(); primitiveNames.add("int"); primitiveNames.add("long"); primitiveNames.add("char"); @@ -116,11 +116,11 @@ public class ClassDocImpl primitiveNames.add("boolean"); } - private Map findClassCache = new HashMap(); + private Map<String,ClassDoc> findClassCache = new HashMap<String,ClassDoc>(); public ClassDoc findClass(String className, String dimension) { - ClassDoc cached = (ClassDoc)findClassCache.get(className + dimension); + ClassDoc cached = findClassCache.get(className + dimension); if (null != cached) { return cached; } @@ -324,7 +324,7 @@ public class ClassDocImpl ClassDoc[] importedClasses, PackageDoc[] importedPackages, char[] source, int startIndex, int endIndex, - List importStatementList) throws ParseException, IOException { + List<String> importStatementList) throws ParseException, IOException { String superclassName = "java.lang.Object"; @@ -334,7 +334,7 @@ public class ClassDocImpl importedPackages, null); rc.setImportStatementList(importStatementList); - List implementedInterfaces = new ArrayList(); + List<String> implementedInterfaces = new ArrayList<String>(); String word=""; int item=0; @@ -511,7 +511,7 @@ public class ClassDocImpl ClassDoc[] interfaces=new ClassDoc[implementedInterfaces.size()]; for (int i=0; i<interfaces.length; ++i) { - interfaces[i]=new ClassDocProxy((String)implementedInterfaces.get(i), rc); + interfaces[i]=new ClassDocProxy(implementedInterfaces.get(i), rc); } rc.setInterfaces(interfaces); @@ -643,10 +643,10 @@ public class ClassDocImpl } } - List isSerMethodList=new ArrayList(); + List<MethodDoc> isSerMethodList = new ArrayList<MethodDoc>(); if (null != maybeSerMethodList) { - for (Iterator it=maybeSerMethodList.iterator(); it.hasNext(); ) { + for (Iterator<MethodDoc> it = maybeSerMethodList.iterator(); it.hasNext(); ) { MethodDocImpl method=(MethodDocImpl)it.next(); method.resolve(); @@ -664,7 +664,7 @@ public class ClassDocImpl isSerMethodList.add(method); } } - this.serializationMethods=(MethodDoc[])isSerMethodList.toArray(new MethodDoc[0]); + this.serializationMethods = isSerMethodList.toArray(new MethodDoc[isSerMethodList.size()]); maybeSerMethodList=null; } } @@ -795,10 +795,10 @@ public class ClassDocImpl this.importedClasses=importedClasses; } - private static Map typeMap = new HashMap(); + private static Map<String,Type> typeMap = new HashMap<String,Type>(); Type typeForString(String typeName) throws ParseException { - String orgTypename=typeName; + //String orgTypename=typeName; int ndx=typeName.indexOf('['); String dim=""; if (ndx>=0) { @@ -815,7 +815,7 @@ public class ClassDocImpl return classDoc; } - Type type = (Type)typeMap.get(typeName+dim); + Type type = typeMap.get(typeName+dim); if (null!=type) { try { if (type.dimension().equals(dim)) { @@ -995,9 +995,9 @@ public class ClassDocImpl return (o!=null) && (o instanceof ClassDoc) && ((ClassDoc)o).qualifiedName().equals(qualifiedName()); } - private List maybeSerMethodList; + private List<MethodDoc> maybeSerMethodList; - void setMaybeSerMethodList(List maybeSerMethodList) { + void setMaybeSerMethodList(List<MethodDoc> maybeSerMethodList) { this.maybeSerMethodList=maybeSerMethodList; } @@ -1061,7 +1061,7 @@ public class ClassDocImpl private Object findFieldValue(String identifier, ClassDoc classDoc, String fieldName, - Set visitedFields) + Set<FieldDoc> visitedFields) throws UnknownIdentifierException, IllegalExpressionException { while (classDoc != null) { @@ -1097,7 +1097,7 @@ public class ClassDocImpl throw new UnknownIdentifierException(identifier); } - public Object getValue(String identifier, Set visitedFields) + public Object getValue(String identifier, Set<FieldDoc> visitedFields) throws UnknownIdentifierException, IllegalExpressionException { int ndx = identifier.lastIndexOf('.'); @@ -1124,13 +1124,13 @@ public class ClassDocImpl } // Compares this Object with the specified Object for order. - public int compareTo(java.lang.Object o) { + public int compareTo(Doc d) { int rc; - if (o instanceof ClassDocImpl) { + if (d instanceof ClassDocImpl) { ClassDocImpl c1 = this; - ClassDocImpl c2 = (ClassDocImpl)o; + ClassDocImpl c2 = (ClassDocImpl)d; if (null != c1.containingClass() && null == c2.containingClass()) { rc = c1.containingClass().compareTo(c2); @@ -1153,10 +1153,10 @@ public class ClassDocImpl } } - rc = super.compareTo(o); + rc = super.compareTo(d); if (0 == rc) { return Main.getInstance().getCollator().compare(containingPackage().name(), - ((ClassDocImpl)o).containingPackage().name()); + c2.containingPackage().name()); } else { return rc; @@ -1167,11 +1167,11 @@ public class ClassDocImpl } } - private List importStatementList; + private List<String> importStatementList; - public void setImportStatementList(List importStatementList) + public void setImportStatementList(List<String> importStatementList) { - this.importStatementList = new LinkedList(); + this.importStatementList = new LinkedList<String>(); this.importStatementList.addAll(importStatementList); } diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ClassDocProxy.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ClassDocProxy.java index 253cf5ec415..aa06addf7fa 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ClassDocProxy.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ClassDocProxy.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.ClassDocProxy - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -155,13 +155,8 @@ public class ClassDocProxy implements ClassDoc, WritableType { } // Compares this Object with the specified Object for order. - public int compareTo(java.lang.Object o) { - if (o instanceof Doc) { - return Main.getInstance().getCollator().compare(name(), ((Doc)o).name()); - } - else { - return 0; - } + public int compareTo(Doc d) { + return Main.getInstance().getCollator().compare(name(), d.name()); } public TypeVariable[] typeParameters() { return new TypeVariable[0]; } diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ClassDocReflectedImpl.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ClassDocReflectedImpl.java index 9a81cb793f0..9b911d31003 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ClassDocReflectedImpl.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ClassDocReflectedImpl.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.ClassDocReflectedImpl - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,7 +37,17 @@ package gnu.classpath.tools.gjdoc; -import com.sun.javadoc.*; +import com.sun.javadoc.Doc; +import com.sun.javadoc.ClassDoc; +import com.sun.javadoc.ConstructorDoc; +import com.sun.javadoc.FieldDoc; +import com.sun.javadoc.MethodDoc; +import com.sun.javadoc.PackageDoc; +import com.sun.javadoc.SeeTag; +import com.sun.javadoc.SourcePosition; +import com.sun.javadoc.Tag; +import com.sun.javadoc.TypeVariable; + import java.util.Map; import java.util.HashMap; @@ -104,7 +114,7 @@ public class ClassDocReflectedImpl public boolean definesSerializableFields() { return false; } public FieldDoc[] fields() { return new FieldDoc[0]; } public FieldDoc[] fields(boolean filtered) { return new FieldDoc[0]; } - public ClassDoc findClass(java.lang.String className) { return null; } + public ClassDoc findClass(String className) { return null; } public ClassDoc[] importedClasses() { return new ClassDoc[0]; } public PackageDoc[] importedPackages() { return new PackageDoc[0]; } public ClassDoc[] innerClasses() { return new ClassDoc[0]; } @@ -195,13 +205,8 @@ public class ClassDocReflectedImpl public String toString() { return "ClassDocReflectedImpl{"+qualifiedName()+"}"; } - public int compareTo(java.lang.Object o) { - if (o instanceof Doc) { - return Main.getInstance().getCollator().compare(name(), ((Doc)o).name()); - } - else { - return 0; - } + public int compareTo(Doc d) { + return Main.getInstance().getCollator().compare(name(), d.name()); } public String dimension() { return dimension; } diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/DocImpl.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/DocImpl.java index ecd8100402c..dfa1a7a3c61 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/DocImpl.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/DocImpl.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.DocImpl - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -71,8 +71,8 @@ public abstract class DocImpl implements Doc, TagContainer { } // Compares this Object with the specified Object for order. - public int compareTo(java.lang.Object o) { - return Main.getInstance().getCollator().compare(name(), ((Doc)o).name()); + public int compareTo(Doc d) { + return Main.getInstance().getCollator().compare(name(), d.name()); } // Return the first sentence of the comment as tags. diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ExecutableMemberDocImpl.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ExecutableMemberDocImpl.java index d5b1b1eb018..8f2a49c99c5 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ExecutableMemberDocImpl.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/ExecutableMemberDocImpl.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.ExecutableMemberDocImpl - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -402,14 +402,14 @@ public class ExecutableMemberDocImpl extends MemberDocImpl implements Executable } - public int compareTo(Object other) { + public int compareTo(Doc d) { int rc; - if (other instanceof MemberDocImpl) { - MemberDocImpl otherMember = (MemberDocImpl)other; + if (d instanceof MemberDocImpl) { + MemberDocImpl otherMember = (MemberDocImpl)d; rc = name().compareTo(otherMember.name()); if (0 == rc) { - if (other instanceof ExecutableMemberDocImpl) { - rc = signature().compareTo(((ExecutableMemberDocImpl)other).signature()); + if (d instanceof ExecutableMemberDocImpl) { + rc = signature().compareTo(((ExecutableMemberDocImpl)d).signature()); if (0 == rc) { return containingClass().compareTo(otherMember.containingClass()); } diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/FieldDocImpl.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/FieldDocImpl.java index f99024daa70..4fa8e5d6bf1 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/FieldDocImpl.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/FieldDocImpl.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.FieldDocImpl - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -95,11 +95,11 @@ public class FieldDocImpl } } - public static Collection createFromSource(ClassDoc containingClass, - PackageDoc containingPackage, - char[] source, int startIndex, int endIndex) { + public static Collection<FieldDoc> createFromSource(ClassDoc containingClass, + PackageDoc containingPackage, + char[] source, int startIndex, int endIndex) { - List rcList=new ArrayList(); + List<FieldDoc> rcList=new ArrayList<FieldDoc>(); FieldDocImpl fd=new FieldDocImpl(containingClass, containingPackage, @@ -120,7 +120,6 @@ public class FieldDocImpl final int STATE_COMMENT = 7; final int STATE_LINECOMMENT = 8; - int lastFieldDefStart = ndx; int state = STATE_FIELDNAME; int prevState = state; @@ -298,7 +297,7 @@ public class FieldDocImpl return constantValue(new HashSet()); } - public Object constantValue(Set visitedFields) { + public Object constantValue(Set<FieldDoc> visitedFields) { if (!isStatic() || !isFinal() || (!type().isPrimitive() && !"java.lang.String".equals(type().qualifiedTypeName())) diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java index d0fd296e600..feb30863d9a 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.Main - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -142,11 +142,6 @@ public final class Main private String option_doclet = "gnu.classpath.tools.doclets.htmldoclet.HtmlDoclet"; /** - * Option "-overview": path to the special overview file. - */ - private String option_overview; - - /** * Option "-coverage": which members to include in generated documentation. */ private int option_coverage = COVERAGE_PROTECTED; @@ -162,30 +157,10 @@ public final class Main private String option_docletpath; /** - * Option "-classpath": path to additional classes. - */ - private String option_classpath; - - /** * Option "-sourcepath": path to the Java source files to be documented. * FIXME: this should be a list of paths */ - private List option_sourcepath = new ArrayList(); - - /** - * Option "-extdirs": path to Java extension files. - */ - private String option_extdirs; - - /** - * Option "-verbose": Be verbose when generating documentation. - */ - private boolean option_verbose; - - /** - * Option "-nowarn": Do not print warnings. - */ - private boolean option_nowarn; + private List<File> option_sourcepath = new ArrayList<File>(); /** * Option "-locale:" Specify the locale charset of Java source files. @@ -198,11 +173,6 @@ public final class Main private String option_encoding; /** - * Option "-J": Specify flags to be passed to Java runtime. - */ - private List option_java_flags = new LinkedList(); //ArrayList(); - - /** * Option "-source:" should be 1.4 to handle assertions, 1.1 is no * longer supported. */ @@ -212,12 +182,12 @@ public final class Main * Option "-subpackages": list of subpackages to be recursively * added. */ - private List option_subpackages = new ArrayList(); + private List<String> option_subpackages = new ArrayList<String>(); /** * Option "-exclude": list of subpackages to exclude. */ - private List option_exclude = new ArrayList(); + private List<String> option_exclude = new ArrayList<String>(); /** * Option "-breakiterator" - whether to use BreakIterator for @@ -263,7 +233,7 @@ public final class Main * * @param allOptions List of all command line tokens */ - private boolean startDoclet(List allOptions) + private boolean startDoclet(List<String> allOptions) { try @@ -273,7 +243,7 @@ public final class Main Debug.log(1, "loading doclet class..."); - Class docletClass; + Class<?> docletClass; if (null != option_docletpath) { try { @@ -341,14 +311,14 @@ public final class Main //--- Feed the custom command line tokens to the Doclet // stores all recognized options - List options = new LinkedList(); + List<String[]> options = new LinkedList<String[]>(); // stores packages and classes defined on the command line - List packageAndClasses = new LinkedList(); + List<String> packageAndClasses = new LinkedList<String>(); - for (Iterator it = allOptions.iterator(); it.hasNext();) + for (Iterator<String> it = allOptions.iterator(); it.hasNext();) { - String option = (String) it.next(); + String option = it.next(); Debug.log(9, "parsing option '" + option + "'"); @@ -448,13 +418,13 @@ public final class Main // check that it exists and find out whether it is a class // or a package - for (Iterator it = option_subpackages.iterator(); it.hasNext();) + for (Iterator<String> it = option_subpackages.iterator(); it.hasNext();) { - String subpackage = (String) it.next(); - Set foundPackages = new LinkedHashSet(); + String subpackage = it.next(); + Set<String> foundPackages = new LinkedHashSet<String>(); - for (Iterator pit = option_sourcepath.iterator(); pit.hasNext(); ) { - File sourceDir = (File)pit.next(); + for (Iterator<File> pit = option_sourcepath.iterator(); pit.hasNext(); ) { + File sourceDir = pit.next(); File packageDir = new File(sourceDir, subpackage.replace('.', File.separatorChar)); findPackages(subpackage, packageDir, foundPackages); } @@ -463,14 +433,14 @@ public final class Main } if (option_all) { - Set foundPackages = new LinkedHashSet(); - for (Iterator pit = option_sourcepath.iterator(); pit.hasNext(); ) { - File sourceDir = (File)pit.next(); + Set<String> foundPackages = new LinkedHashSet<String>(); + for (Iterator<File> pit = option_sourcepath.iterator(); pit.hasNext(); ) { + File sourceDir = pit.next(); findPackages("", sourceDir, foundPackages); } addFoundPackages(null, foundPackages); - for (Iterator packageIt = foundPackages.iterator(); packageIt.hasNext(); ) { - String packageName = (String)packageIt.next(); + for (Iterator<String> packageIt = foundPackages.iterator(); packageIt.hasNext(); ) { + String packageName = packageIt.next(); if (null == packageName) { packageName = ""; } @@ -478,16 +448,16 @@ public final class Main } } - for (Iterator it = packageAndClasses.iterator(); it.hasNext();) + for (Iterator<String> it = packageAndClasses.iterator(); it.hasNext();) { - String classOrPackage = (String) it.next(); + String classOrPackage = it.next(); boolean foundSourceFile = false; if (classOrPackage.endsWith(".java")) { - for (Iterator pit = option_sourcepath.iterator(); pit.hasNext() && !foundSourceFile; ) { - File sourceDir = (File)pit.next(); + for (Iterator<File> pit = option_sourcepath.iterator(); pit.hasNext() && !foundSourceFile; ) { + File sourceDir = pit.next(); File sourceFile = new File(sourceDir, classOrPackage); if (sourceFile.exists() && !sourceFile.isDirectory()) { rootDoc.addSpecifiedSourceFile(sourceFile); @@ -525,8 +495,8 @@ public final class Main //--- Create one file object each for a possible package directory // and a possible class file, and find out if they exist. - List packageDirs = rootDoc.findSourceFiles(classOrPackageRelPath); - List sourceFiles = rootDoc.findSourceFiles(classOrPackageRelPath + ".java"); + List<File> packageDirs = rootDoc.findSourceFiles(classOrPackageRelPath); + List<File> sourceFiles = rootDoc.findSourceFiles(classOrPackageRelPath + ".java"); boolean packageDirExists = !packageDirs.isEmpty(); boolean sourceFileExists = !sourceFiles.isEmpty(); @@ -554,10 +524,10 @@ public final class Main else if (packageDirExists) { - Iterator packageDirIt = packageDirs.iterator(); + Iterator<File> packageDirIt = packageDirs.iterator(); boolean packageDirFound = false; while (packageDirIt.hasNext()) { - File packageDir = (File)packageDirIt.next(); + File packageDir = packageDirIt.next(); if (packageDir.isDirectory()) { rootDoc.addSpecifiedPackageName(classOrPackage); packageDirFound = true; @@ -671,19 +641,19 @@ public final class Main } } - private void addFoundPackages(String subpackage, Set foundPackages) + private void addFoundPackages(String subpackage, Set<String> foundPackages) { if (foundPackages.isEmpty()) { reporter.printWarning("No classes found under subpackage " + subpackage); } else { boolean onePackageAdded = false; - for (Iterator rit = foundPackages.iterator(); rit.hasNext();) { - String foundPackage = (String)rit.next(); + for (Iterator<String> rit = foundPackages.iterator(); rit.hasNext();) { + String foundPackage = rit.next(); boolean excludeThisPackage = false; - for (Iterator eit = option_exclude.iterator(); eit.hasNext();) { - String excludePackage = (String)eit.next(); + for (Iterator<String> eit = option_exclude.iterator(); eit.hasNext();) { + String excludePackage = eit.next(); if (foundPackage.equals(excludePackage) || foundPackage.startsWith(excludePackage + ":")) { excludeThisPackage = true; @@ -817,7 +787,7 @@ public final class Main */ private void findPackages(String subpackage, File packageDir, - Set result) + Set<String> result) { File[] files = packageDir.listFiles(); if (null != files) { @@ -1026,7 +996,7 @@ public final class Main //--- Collect unparsed arguments in array and resolve references // to external argument files. - List arguments = new ArrayList(args.length); + List<String> arguments = new ArrayList<String>(args.length); for (int i = 0; i < args.length; ++i) { @@ -1062,7 +1032,7 @@ public final class Main // Contains objects of type String[], where each entry // specifies an option along with its aguments. - List options = new LinkedList(); + List<String[]> options = new LinkedList<String[]>(); //--- This will hold all command line tokens not recognized // to be part of a standard option. @@ -1070,17 +1040,17 @@ public final class Main // Contains objects of type String, where each entry is // one unrecognized token. - List customOptions = new LinkedList(); + List<String> customOptions = new LinkedList<String>(); rootDoc = new RootDocImpl(); reporter = rootDoc.getReporter(); //--- Iterate over all options given on the command line - for (Iterator it = arguments.iterator(); it.hasNext();) + for (Iterator<String> it = arguments.iterator(); it.hasNext();) { - String arg = (String) it.next(); + String arg = it.next(); //--- Check if gjdoc recognizes this option as a standard option // and remember the options' argument count @@ -1129,8 +1099,7 @@ public final class Main //--- Create an array of String arrays from the dynamic array built above - String[][] optionArr = (String[][]) options.toArray(new String[options - .size()][0]); + String[][] optionArr = options.toArray(new String[options.size()][0]); //--- Validate all options and issue warnings/errors @@ -1181,6 +1150,7 @@ public final class Main return reporter.getErrorCount(); } + /* private void addJavaLangClasses() throws IOException { @@ -1201,6 +1171,7 @@ public final class Main } } } + */ /** * Helper class for parsing command line arguments. An instance of this class @@ -1241,7 +1212,7 @@ public final class Main * Initialized only once by method initOptions(). FIXME: Rename to * 'optionProcessors'. */ - private static Map options = null; + private static Map<String,OptionProcessor> options = null; /** * Initialize all OptionProcessor objects needed to scan/parse command line @@ -1251,7 +1222,7 @@ public final class Main private void initOptions() { - options = new HashMap(); + options = new HashMap<String,OptionProcessor>(); //--- Put one OptionProcessor object into the map // for each option recognized. @@ -1261,7 +1232,7 @@ public final class Main void process(String[] args) { - option_overview = args[0]; + System.err.println("WARNING: Unsupported option -overview ignored"); } }); options.put("-public", new OptionProcessor(1) @@ -1328,7 +1299,7 @@ public final class Main void process(String[] args) { - option_nowarn = true; + System.err.println("WARNING: Unsupported option -nowarn ignored"); } }); options.put("-source", new OptionProcessor(2) @@ -1412,7 +1383,6 @@ public final class Main void process(String[] args) { - option_verbose = true; System.err.println("WARNING: Unsupported option -verbose ignored"); } }); diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/MemberDocImpl.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/MemberDocImpl.java index acc8128630c..87ed585fe01 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/MemberDocImpl.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/MemberDocImpl.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.MemberDocImpl - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -170,15 +170,15 @@ public abstract class MemberDocImpl extends ProgramElementDocImpl implements Mem return Main.getInstance().includeAccessLevel(accessLevel); } - public int compareTo(Object o) { - if (o instanceof MemberDocImpl) { - int rc=name().compareTo(((MemberDocImpl)o).name()); + public int compareTo(Doc d) { + if (d instanceof MemberDocImpl) { + int rc=name().compareTo(((MemberDocImpl)d).name()); if (rc==0) - rc=containingClass().qualifiedName().compareTo(((MemberDocImpl)o).containingClass().qualifiedName()); + rc=containingClass().qualifiedName().compareTo(((MemberDocImpl)d).containingClass().qualifiedName()); return rc; } else { - return super.compareTo(o); + return super.compareTo(d); } } diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/PackageDocImpl.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/PackageDocImpl.java index 84960bcf349..770a6275655 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/PackageDocImpl.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/PackageDocImpl.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.PackageDocImpl - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -46,11 +46,11 @@ class PackageDocImpl extends DocImpl implements GjdocPackageDoc { private String packageName; private File packageDirectory; - private Set allClassesSet = new TreeSet(); - private List ordinaryClassesList = new ArrayList(); - private List exceptionsList = new ArrayList(); - private List interfacesList = new ArrayList(); - private List errorsList = new ArrayList(); + private Set<ClassDoc> allClassesSet = new TreeSet<ClassDoc>(); + private List<ClassDoc> ordinaryClassesList = new ArrayList<ClassDoc>(); + private List<ClassDoc> exceptionsList = new ArrayList<ClassDoc>(); + private List<ClassDoc> interfacesList = new ArrayList<ClassDoc>(); + private List<ClassDoc> errorsList = new ArrayList<ClassDoc>(); private ClassDoc[] allClasses; private ClassDoc[] ordinaryClasses; @@ -70,8 +70,8 @@ class PackageDocImpl extends DocImpl implements GjdocPackageDoc { } public void resolve() { - for (Iterator it=allClassesSet.iterator(); it.hasNext(); ) { - ClassDocImpl classDoc=(ClassDocImpl)it.next(); + for (Iterator<ClassDoc> it = allClassesSet.iterator(); it.hasNext(); ) { + ClassDocImpl classDoc = (ClassDocImpl) it.next(); try { classDoc.resolve(); } catch (ParseException e) { @@ -153,9 +153,9 @@ class PackageDocImpl extends DocImpl implements GjdocPackageDoc { return this.errors; } - private ClassDoc[] toClassDocArray(Collection classDocList) + private ClassDoc[] toClassDocArray(Collection<ClassDoc> classDocList) { - ClassDoc[] result = (ClassDoc[])classDocList.toArray(new ClassDoc[classDocList.size()]); + ClassDoc[] result = classDocList.toArray(new ClassDoc[classDocList.size()]); Arrays.sort(result); return result; } @@ -193,9 +193,9 @@ class PackageDocImpl extends DocImpl implements GjdocPackageDoc { return packageName; } - public int compareTo(Object o) { - if (o!=null && o instanceof PackageDocImpl) - return name().compareTo(((PackageDocImpl)o).name()); + public int compareTo(Doc d) { + if (d !=null && d instanceof PackageDocImpl) + return name().compareTo(((PackageDocImpl)d).name()); else return 0; } diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Parser.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Parser.java index d355b5384cc..af6b6b432a2 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Parser.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Parser.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.Parser - Copyright (C) 2001, 2005, 2008 Free Software Foundation, Inc. + Copyright (C) 2001, 2005, 2008, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,21 +37,38 @@ package gnu.classpath.tools.gjdoc; -import java.io.*; +import com.sun.javadoc.ClassDoc; +import com.sun.javadoc.ConstructorDoc; +import com.sun.javadoc.FieldDoc; +import com.sun.javadoc.MethodDoc; +import com.sun.javadoc.PackageDoc; + +import gnu.classpath.tools.IOToolkit; +import gnu.classpath.tools.NotifyingInputStreamReader; +import gnu.classpath.tools.MalformedInputListener; +import gnu.classpath.tools.MalformedInputEvent; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.IOException; +import java.io.Reader; + import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import java.nio.charset.CoderResult; import java.nio.charset.CodingErrorAction; -import java.util.*; -import com.sun.javadoc.*; - -import gnu.classpath.tools.IOToolkit; -import gnu.classpath.tools.NotifyingInputStreamReader; -import gnu.classpath.tools.MalformedInputListener; -import gnu.classpath.tools.MalformedInputEvent; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.Stack; class IgnoredFileParseException extends ParseException { @@ -356,11 +373,11 @@ import gnu.classpath.tools.MalformedInputEvent; if (endIndex-startIndex<=1) return endIndex; //assert (parser.ctx!=null); - Collection fields=FieldDocImpl.createFromSource(parser.ctx.classDoc, - parser.ctx.classDoc.containingPackage(), - source, startIndex, endIndex); + Collection<FieldDoc> fields = FieldDocImpl.createFromSource(parser.ctx.classDoc, + parser.ctx.classDoc.containingPackage(), + source, startIndex, endIndex); - for (Iterator it=fields.iterator(); it.hasNext(); ) { + for (Iterator<FieldDoc> it=fields.iterator(); it.hasNext(); ) { FieldDocImpl field=(FieldDocImpl)it.next(); boolean fieldHasSerialTag=!field.isTransient() && !field.isStatic(); //field.hasSerialTag(); if ((field.isIncluded() || fieldHasSerialTag) && parser.getAddComments()) { @@ -408,27 +425,26 @@ import gnu.classpath.tools.MalformedInputEvent; parser.setLastComment(null); if (execDoc.isMethod()) { - parser.ctx.methodList.add(execDoc); - if (execDoc.isIncluded()) { - parser.ctx.filteredMethodList.add(execDoc); + MethodDoc methDoc = (MethodDoc) execDoc; + parser.ctx.methodList.add(methDoc); + if (methDoc.isIncluded()) { + parser.ctx.filteredMethodList.add(methDoc); } - } - else { - parser.ctx.constructorList.add(execDoc); - if (execDoc.isIncluded()) { - parser.ctx.filteredConstructorList.add(execDoc); - } - } - - if (execDoc.isMethod() - && (execDoc.name().equals("readObject") - || execDoc.name().equals("writeObject") - || execDoc.name().equals("readExternal") - || execDoc.name().equals("writeExternal") - || execDoc.name().equals("readResolve"))) { + if (methDoc.name().equals("readObject") + || methDoc.name().equals("writeObject") + || methDoc.name().equals("readExternal") + || methDoc.name().equals("writeExternal") + || methDoc.name().equals("readResolve")) { // FIXME: add readExternal here? - parser.ctx.maybeSerMethodList.add(execDoc); + parser.ctx.maybeSerMethodList.add(methDoc); + } + } else { + ConstructorDoc constDoc = (ConstructorDoc) execDoc; + parser.ctx.constructorList.add(constDoc); + if (constDoc.isIncluded()) { + parser.ctx.filteredConstructorList.add(constDoc); + } } return endIndex; @@ -764,7 +780,7 @@ public class Parser { return processedFiles.size(); } - static Set processedFiles = new HashSet(); + static Set<File> processedFiles = new HashSet<File>(); ClassDocImpl processSourceFile(File file, boolean addComments, String encoding, String expectedPackageName) @@ -803,8 +819,8 @@ public class Parser { try { parse(source, 0, sourceLevelComponents); - ClassDoc[] importedClasses=(ClassDoc[])importedClassesList.toArray(new ClassDoc[0]); - PackageDoc[] importedPackages=(PackageDoc[])importedPackagesList.toArray(new PackageDoc[0]); + ClassDoc[] importedClasses = importedClassesList.toArray(new ClassDoc[importedClassesList.size()]); + PackageDoc[] importedPackages = importedPackagesList.toArray(new PackageDoc[importedPackagesList.size()]); if (Main.DESCEND_IMPORTED) { for (int i=0; i<importedClasses.length; ++i) { @@ -909,7 +925,7 @@ public class Parser { ClassDocImpl classDoc = ClassDocImpl.createInstance((ctx!=null)?(ctx.classDoc):null, currentPackage, null, - (PackageDoc[])importedPackagesList.toArray(new PackageDoc[0]), + importedPackagesList.toArray(new PackageDoc[importedPackagesList.size()]), source, startIndex, endIndex, importedStatementList); @@ -921,11 +937,11 @@ public class Parser { } if (importedClassesList.isEmpty()) { - for (Iterator it=importedStringList.iterator(); it.hasNext(); ) { - importedClassesList.add(new ClassDocProxy((String)it.next(), classDoc)); + for (Iterator<String> it=importedStringList.iterator(); it.hasNext(); ) { + importedClassesList.add(new ClassDocProxy(it.next(), classDoc)); } } - classDoc.setImportedClasses((ClassDoc[])importedClassesList.toArray(new ClassDoc[0])); + classDoc.setImportedClasses(importedClassesList.toArray(new ClassDoc[importedClassesList.size()])); currentPackage.addClass(classDoc); @@ -945,26 +961,24 @@ public class Parser { //Debug.log(9,"ctx="+ctx); } - private Doc[] toArray(List list, Doc[] template) + private <T> T[] toArray(List<T> list, T[] template) { - Doc[] result = (Doc[])list.toArray(template); - return result; + return list.toArray(template); } void classClosed() throws ParseException, IOException { - ctx.classDoc.setFields((FieldDoc[])toArray(ctx.fieldList, - new FieldDoc[0])); - ctx.classDoc.setFilteredFields((FieldDoc[])toArray(ctx.filteredFieldList, - new FieldDoc[0])); - ctx.classDoc.setSerializableFields((FieldDoc[])toArray(ctx.sfieldList, new FieldDoc[0])); - ctx.classDoc.setMethods((MethodDoc[])toArray(ctx.methodList, new MethodDoc[0])); - ctx.classDoc.setFilteredMethods((MethodDoc[])toArray(ctx.filteredMethodList, new MethodDoc[0])); + ctx.classDoc.setFields(toArray(ctx.fieldList,new FieldDoc[ctx.fieldList.size()])); + ctx.classDoc.setFilteredFields(toArray(ctx.filteredFieldList,new FieldDoc[ctx.filteredFieldList.size()])); + ctx.classDoc.setSerializableFields(toArray(ctx.sfieldList, new FieldDoc[ctx.sfieldList.size()])); + ctx.classDoc.setMethods(toArray(ctx.methodList, new MethodDoc[ctx.methodList.size()])); + ctx.classDoc.setFilteredMethods(toArray(ctx.filteredMethodList, new MethodDoc[ctx.filteredMethodList.size()])); ctx.classDoc.setMaybeSerMethodList(ctx.maybeSerMethodList); - ctx.classDoc.setConstructors((ConstructorDoc[])toArray(ctx.constructorList, new ConstructorDoc[0])); - ctx.classDoc.setFilteredConstructors((ConstructorDoc[])toArray(ctx.filteredConstructorList, new ConstructorDoc[0])); - - ctx.classDoc.setInnerClasses((ClassDocImpl[])toArray(ctx.innerClassesList, new ClassDocImpl[0])); - ctx.classDoc.setFilteredInnerClasses((ClassDocImpl[])toArray(ctx.filteredInnerClassesList, new ClassDocImpl[0])); + ctx.classDoc.setConstructors(toArray(ctx.constructorList, new ConstructorDoc[ctx.constructorList.size()])); + ctx.classDoc.setFilteredConstructors(toArray(ctx.filteredConstructorList, + new ConstructorDoc[ctx.filteredConstructorList.size()])); + ctx.classDoc.setInnerClasses(toArray(ctx.innerClassesList, new ClassDocImpl[ctx.innerClassesList.size()])); + ctx.classDoc.setFilteredInnerClasses(toArray(ctx.filteredInnerClassesList, + new ClassDocImpl[ctx.filteredInnerClassesList.size()])); ctx.classDoc.setBoilerplateComment(boilerplateComment); Main.getRootDoc().addClassDoc(ctx.classDoc); @@ -993,16 +1007,16 @@ public class Parser { class Context { Context(ClassDocImpl classDoc) { this.classDoc=classDoc; } ClassDocImpl classDoc = null; - List fieldList = new LinkedList(); - List filteredFieldList = new LinkedList(); - List sfieldList = new LinkedList(); - List methodList = new LinkedList(); - List filteredMethodList = new LinkedList(); - List maybeSerMethodList = new LinkedList(); - List constructorList = new LinkedList(); - List filteredConstructorList = new LinkedList(); - List innerClassesList = new LinkedList(); - List filteredInnerClassesList = new LinkedList(); + List<FieldDoc> fieldList = new LinkedList<FieldDoc>(); + List<FieldDoc> filteredFieldList = new LinkedList<FieldDoc>(); + List<FieldDoc> sfieldList = new LinkedList<FieldDoc>(); + List<MethodDoc> methodList = new LinkedList<MethodDoc>(); + List<MethodDoc> filteredMethodList = new LinkedList<MethodDoc>(); + List<MethodDoc> maybeSerMethodList = new LinkedList<MethodDoc>(); + List<ConstructorDoc> constructorList = new LinkedList<ConstructorDoc>(); + List<ConstructorDoc> filteredConstructorList = new LinkedList<ConstructorDoc>(); + List<ClassDocImpl> innerClassesList = new LinkedList<ClassDocImpl>(); + List<ClassDocImpl> filteredInnerClassesList = new LinkedList<ClassDocImpl>(); } File currentFile = null; @@ -1016,10 +1030,10 @@ public class Parser { List allClassesList = new LinkedList(); List interfacesList = new LinkedList(); - List importedClassesList = new LinkedList(); - List importedStringList = new LinkedList(); - List importedPackagesList = new LinkedList(); - List importedStatementList = new LinkedList(); + List<ClassDoc> importedClassesList = new LinkedList<ClassDoc>(); + List<String> importedStringList = new LinkedList<String>(); + List<PackageDoc> importedPackagesList = new LinkedList<PackageDoc>(); + List<String> importedStatementList = new LinkedList<String>(); List referencedClassesList = new LinkedList(); diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/RootDocImpl.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/RootDocImpl.java index 09d1be73b9e..dd76ffada96 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/RootDocImpl.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/RootDocImpl.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.RootDocImpl - Copyright (C) 2001, 2007 Free Software Foundation, Inc. + Copyright (C) 2001, 2007, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -409,11 +409,11 @@ public class RootDocImpl } } - List findSourceFiles(String relPath) { + List<File> findSourceFiles(String relPath) { - List result = new LinkedList(); - for (Iterator it = sourcePath.iterator(); it.hasNext(); ) { - File path = (File)it.next(); + List<File> result = new LinkedList<File>(); + for (Iterator<File> it = sourcePath.iterator(); it.hasNext(); ) { + File path = it.next(); File file = new File(path, relPath); if (file.exists()) { result.add(file); diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/expr/Evaluator.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/expr/Evaluator.java index d12da3519b1..efa88603c66 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/expr/Evaluator.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/expr/Evaluator.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.expr.Evaluator - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.classpath.tools.gjdoc.expr; +import com.sun.javadoc.FieldDoc; + import java.io.StringReader; import java.math.BigInteger; import antlr.RecognitionException; @@ -68,7 +70,7 @@ public class Evaluator * array access) or references unknown static fields. */ public static Object evaluate(String expression, - Set visitedFields, + Set<FieldDoc> visitedFields, EvaluatorEnvironment environment) throws IllegalExpressionException { diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/expr/EvaluatorEnvironment.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/expr/EvaluatorEnvironment.java index cf4df8938b4..cdb1f90488d 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/expr/EvaluatorEnvironment.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/expr/EvaluatorEnvironment.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.expr.EvaluatorEnvironment - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,10 +37,12 @@ exception statement from your version. */ package gnu.classpath.tools.gjdoc.expr; +import com.sun.javadoc.FieldDoc; + import java.util.Set; public interface EvaluatorEnvironment { - public Object getValue(String identifier, Set visitedFields) + public Object getValue(String identifier, Set<FieldDoc> visitedFields) throws IllegalExpressionException, UnknownIdentifierException; } diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/expr/Type.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/expr/Type.java index 92382c41a70..4e0ef0ea4d9 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/expr/Type.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/expr/Type.java @@ -1,5 +1,5 @@ /* gnu.classpath.tools.gjdoc.expr.Type - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,9 +51,9 @@ class Type public static final Type STRING = new Type(String.class); public static final Type NULL = new Type(null); - private Class clazz; + private Class<?> clazz; - private Type(Class clazz) + private Type(Class<?> clazz) { this.clazz = clazz; } |