langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocClassFinder.java
changeset 36045 9643bffe2105
parent 35426 374342e56a56
child 36526 3b41f1c69604
equal deleted inserted replaced
36044:8d48ff7e2cf2 36045:9643bffe2105
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    27 
    27 
    28 import java.util.EnumSet;
    28 import java.util.EnumSet;
    29 
    29 
    30 import javax.tools.JavaFileObject;
    30 import javax.tools.JavaFileObject;
    31 
    31 
       
    32 import com.sun.tools.javac.api.JavacTrees;
    32 import com.sun.tools.javac.code.Symbol.PackageSymbol;
    33 import com.sun.tools.javac.code.Symbol.PackageSymbol;
    33 import com.sun.tools.javac.code.ClassFinder;
    34 import com.sun.tools.javac.code.ClassFinder;
    34 import com.sun.tools.javac.util.Context;
    35 import com.sun.tools.javac.util.Context;
    35 
    36 
    36 /** Javadoc uses an extended class finder that records package.html entries
    37 /** Javadoc uses an extended class finder that records package.html entries
    64                                                           JavaFileObject.Kind.SOURCE,
    65                                                           JavaFileObject.Kind.SOURCE,
    65                                                           JavaFileObject.Kind.HTML);
    66                                                           JavaFileObject.Kind.HTML);
    66     private EnumSet<JavaFileObject.Kind> noSource = EnumSet.of(JavaFileObject.Kind.CLASS,
    67     private EnumSet<JavaFileObject.Kind> noSource = EnumSet.of(JavaFileObject.Kind.CLASS,
    67                                                                JavaFileObject.Kind.HTML);
    68                                                                JavaFileObject.Kind.HTML);
    68 
    69 
       
    70     private final JavacTrees trees;
       
    71 
    69     public JavadocClassFinder(Context context) {
    72     public JavadocClassFinder(Context context) {
    70         super(context);
    73         super(context);
    71         docenv = DocEnv.instance(context);
    74         docenv = DocEnv.instance(context);
    72         preferSource = true;
    75         preferSource = true;
       
    76         trees = JavacTrees.instance(context);
    73     }
    77     }
    74 
    78 
    75     /**
    79     /**
    76      * Override getPackageFileKinds to include search for package.html
    80      * Override getPackageFileKinds to include search for package.html
    77      */
    81      */
    83     /**
    87     /**
    84      * Override extraFileActions to check for package documentation
    88      * Override extraFileActions to check for package documentation
    85      */
    89      */
    86     @Override
    90     @Override
    87     protected void extraFileActions(PackageSymbol pack, JavaFileObject fo) {
    91     protected void extraFileActions(PackageSymbol pack, JavaFileObject fo) {
    88         if (fo.isNameCompatible("package", JavaFileObject.Kind.HTML))
    92         if (fo.isNameCompatible("package", JavaFileObject.Kind.HTML)) {
    89             docenv.pkgToJavaFOMap.put(pack, fo);
    93             docenv.pkgToJavaFOMap.put(pack, fo);
       
    94             trees.putJavaFileObject(pack, fo);
       
    95         }
    90     }
    96     }
    91 }
    97 }