< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolEnvironment.java

Print this page




 141 
 142         messager = Messager.instance0(context);
 143         syms = Symtab.instance(context);
 144         finder = JavadocClassFinder.instance(context);
 145         enter = JavadocEnter.instance(context);
 146         names = Names.instance(context);
 147         externalizableSym = syms.enterClass(syms.java_base, names.fromString("java.io.Externalizable"));
 148         chk = Check.instance(context);
 149         types = com.sun.tools.javac.code.Types.instance(context);
 150         fileManager = context.get(JavaFileManager.class);
 151         if (fileManager instanceof JavacFileManager) {
 152             ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
 153         }
 154         docTrees = JavacTrees.instance(context);
 155         source = Source.instance(context);
 156         elements =  JavacElements.instance(context);
 157         typeutils = JavacTypes.instance(context);
 158         elementToTreePath = new HashMap<>();
 159     }
 160 
 161     public void initialize(Map<ToolOption, Object> toolOpts) {
 162         this.quiet = (boolean)toolOpts.getOrDefault(ToolOption.QUIET, false);
 163         this.ignoreSourceErrors = (boolean)toolOpts.getOrDefault(ToolOption.IGNORE_SOURCE_ERRORS, false);
 164     }
 165 
 166     /**
 167      * Load a class by qualified name.
 168      */
 169     public TypeElement loadClass(String name) {
 170         try {
 171             Name nameImpl = names.fromString(name);
 172             ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl));
 173             ClassSymbol c = finder.loadClass(mod != null ? mod : syms.errModule, nameImpl);
 174             return c;
 175         } catch (CompletionFailure ex) {
 176             chk.completionError(null, ex);
 177             return null;
 178         }
 179     }
 180 
 181     boolean isSynthetic(Symbol sym) {
 182         return (sym.flags() & Flags.SYNTHETIC) != 0;
 183     }




 141 
 142         messager = Messager.instance0(context);
 143         syms = Symtab.instance(context);
 144         finder = JavadocClassFinder.instance(context);
 145         enter = JavadocEnter.instance(context);
 146         names = Names.instance(context);
 147         externalizableSym = syms.enterClass(syms.java_base, names.fromString("java.io.Externalizable"));
 148         chk = Check.instance(context);
 149         types = com.sun.tools.javac.code.Types.instance(context);
 150         fileManager = context.get(JavaFileManager.class);
 151         if (fileManager instanceof JavacFileManager) {
 152             ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
 153         }
 154         docTrees = JavacTrees.instance(context);
 155         source = Source.instance(context);
 156         elements =  JavacElements.instance(context);
 157         typeutils = JavacTypes.instance(context);
 158         elementToTreePath = new HashMap<>();
 159     }
 160 
 161     public void initialize(ToolOptions options) {
 162         this.quiet = options.quiet();
 163         this.ignoreSourceErrors = options.ignoreSourceErrors();
 164     }
 165 
 166     /**
 167      * Load a class by qualified name.
 168      */
 169     public TypeElement loadClass(String name) {
 170         try {
 171             Name nameImpl = names.fromString(name);
 172             ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl));
 173             ClassSymbol c = finder.loadClass(mod != null ? mod : syms.errModule, nameImpl);
 174             return c;
 175         } catch (CompletionFailure ex) {
 176             chk.completionError(null, ex);
 177             return null;
 178         }
 179     }
 180 
 181     boolean isSynthetic(Symbol sym) {
 182         return (sym.flags() & Flags.SYNTHETIC) != 0;
 183     }


< prev index next >