com.sun.tools.javac.jvm.ClassReader Java Examples
The following examples show how to use
com.sun.tools.javac.jvm.ClassReader.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Types.java From hottub with GNU General Public License v2.0 | 6 votes |
protected Types(Context context) { context.put(typesKey, this); syms = Symtab.instance(context); names = Names.instance(context); Source source = Source.instance(context); allowBoxing = source.allowBoxing(); allowCovariantReturns = source.allowCovariantReturns(); allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast(); allowDefaultMethods = source.allowDefaultMethods(); reader = ClassReader.instance(context); chk = Check.instance(context); enter = Enter.instance(context); capturedName = names.fromString("<captured wildcard>"); messages = JavacMessages.instance(context); diags = JCDiagnostic.Factory.instance(context); functionDescriptorLookupError = new FunctionDescriptorLookupError(); noWarnings = new Warner(null); }
Example #2
Source File: AsyncJavaSymbolDescriptor.java From netbeans with Apache License 2.0 | 6 votes |
@NonNull private Map<?,?> getPackages(final Symtab cr) { Map<?,?> res = Collections.emptyMap(); try { final Field fld = ClassReader.class.getDeclaredField("packages"); //NOI18N fld.setAccessible(true); final Map<?,?> pkgs = (Map<?,?>) fld.get(cr); if (pkgs != null) { res = pkgs; } } catch (ReflectiveOperationException e) { if (!pkgROELogged) { LOG.warning(e.getMessage()); pkgROELogged = true; } } return res; }
Example #3
Source File: AsyncJavaSymbolDescriptor.java From netbeans with Apache License 2.0 | 6 votes |
@NonNull private Map<?,?> getClasses(final Symtab cr) { Map<?,?> res = Collections.emptyMap(); try { final Field fld = ClassReader.class.getDeclaredField("classes"); //NOI18N fld.setAccessible(true); Map<?,?> clzs = (Map<?,?>) fld.get(cr); if (clzs != null) { res = clzs; } } catch (ReflectiveOperationException e) { if (!clzROELogged) { LOG.warning(e.getMessage()); clzROELogged = true; } } return res; }
Example #4
Source File: Types.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
protected Types(Context context) { context.put(typesKey, this); syms = Symtab.instance(context); names = Names.instance(context); Source source = Source.instance(context); allowBoxing = source.allowBoxing(); allowCovariantReturns = source.allowCovariantReturns(); allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast(); allowDefaultMethods = source.allowDefaultMethods(); reader = ClassReader.instance(context); chk = Check.instance(context); enter = Enter.instance(context); capturedName = names.fromString("<captured wildcard>"); messages = JavacMessages.instance(context); diags = JCDiagnostic.Factory.instance(context); functionDescriptorLookupError = new FunctionDescriptorLookupError(); noWarnings = new Warner(null); }
Example #5
Source File: Types.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected Types(Context context) { context.put(typesKey, this); syms = Symtab.instance(context); names = Names.instance(context); Source source = Source.instance(context); allowBoxing = source.allowBoxing(); allowCovariantReturns = source.allowCovariantReturns(); allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast(); allowDefaultMethods = source.allowDefaultMethods(); reader = ClassReader.instance(context); chk = Check.instance(context); enter = Enter.instance(context); capturedName = names.fromString("<captured wildcard>"); messages = JavacMessages.instance(context); diags = JCDiagnostic.Factory.instance(context); functionDescriptorLookupError = new FunctionDescriptorLookupError(); noWarnings = new Warner(null); }
Example #6
Source File: Enter.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
protected Enter(Context context) { context.put(enterKey, this); log = Log.instance(context); reader = ClassReader.instance(context); make = TreeMaker.instance(context); syms = Symtab.instance(context); chk = Check.instance(context); memberEnter = MemberEnter.instance(context); types = Types.instance(context); annotate = Annotate.instance(context); lint = Lint.instance(context); names = Names.instance(context); predefClassDef = make.ClassDef( make.Modifiers(PUBLIC), syms.predefClass.name, null, null, null, null); predefClassDef.sym = syms.predefClass; todo = Todo.instance(context); fileManager = context.get(JavaFileManager.class); Options options = Options.instance(context); pkginfoOpt = PkgInfo.get(options); }
Example #7
Source File: Types.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
protected Types(Context context) { context.put(typesKey, this); syms = Symtab.instance(context); names = Names.instance(context); Source source = Source.instance(context); allowBoxing = source.allowBoxing(); allowCovariantReturns = source.allowCovariantReturns(); allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast(); allowDefaultMethods = source.allowDefaultMethods(); reader = ClassReader.instance(context); chk = Check.instance(context); enter = Enter.instance(context); capturedName = names.fromString("<captured wildcard>"); messages = JavacMessages.instance(context); diags = JCDiagnostic.Factory.instance(context); functionDescriptorLookupError = new FunctionDescriptorLookupError(); noWarnings = new Warner(null); }
Example #8
Source File: Types.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
protected Types(Context context) { context.put(typesKey, this); syms = Symtab.instance(context); names = Names.instance(context); Source source = Source.instance(context); allowBoxing = source.allowBoxing(); allowCovariantReturns = source.allowCovariantReturns(); allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast(); allowDefaultMethods = source.allowDefaultMethods(); reader = ClassReader.instance(context); chk = Check.instance(context); enter = Enter.instance(context); capturedName = names.fromString("<captured wildcard>"); messages = JavacMessages.instance(context); diags = JCDiagnostic.Factory.instance(context); functionDescriptorLookupError = new FunctionDescriptorLookupError(); noWarnings = new Warner(null); }
Example #9
Source File: Types.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
protected Types(Context context) { context.put(typesKey, this); syms = Symtab.instance(context); names = Names.instance(context); Source source = Source.instance(context); allowBoxing = source.allowBoxing(); allowCovariantReturns = source.allowCovariantReturns(); allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast(); allowDefaultMethods = source.allowDefaultMethods(); reader = ClassReader.instance(context); chk = Check.instance(context); enter = Enter.instance(context); capturedName = names.fromString("<captured wildcard>"); messages = JavacMessages.instance(context); diags = JCDiagnostic.Factory.instance(context); functionDescriptorLookupError = new FunctionDescriptorLookupError(); noWarnings = new Warner(null); }
Example #10
Source File: Enter.java From javaide with GNU General Public License v3.0 | 6 votes |
protected Enter(Context context) { context.put(enterKey, this); log = Log.instance(context); reader = ClassReader.instance(context); make = TreeMaker.instance(context); syms = Symtab.instance(context); chk = Check.instance(context); memberEnter = MemberEnter.instance(context); types = Types.instance(context); annotate = Annotate.instance(context); lint = Lint.instance(context); names = Names.instance(context); predefClassDef = make.ClassDef( make.Modifiers(PUBLIC), syms.predefClass.name, null, null, null, null); predefClassDef.sym = syms.predefClass; todo = Todo.instance(context); fileManager = context.get(JavaFileManager.class); Options options = Options.instance(context); pkginfoOpt = PkgInfo.get(options); }
Example #11
Source File: Types.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected Types(Context context) { context.put(typesKey, this); syms = Symtab.instance(context); names = Names.instance(context); Source source = Source.instance(context); allowBoxing = source.allowBoxing(); allowCovariantReturns = source.allowCovariantReturns(); allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast(); allowDefaultMethods = source.allowDefaultMethods(); reader = ClassReader.instance(context); chk = Check.instance(context); enter = Enter.instance(context); capturedName = names.fromString("<captured wildcard>"); messages = JavacMessages.instance(context); diags = JCDiagnostic.Factory.instance(context); functionDescriptorLookupError = new FunctionDescriptorLookupError(); noWarnings = new Warner(null); }
Example #12
Source File: JavadocClassReader.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void preRegister(Context context) { context.put(classReaderKey, new Context.Factory<ClassReader>() { public ClassReader make(Context c) { return new JavadocClassReader(c); } }); }
Example #13
Source File: JavadocClassReader.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static void preRegister(Context context) { context.put(classReaderKey, new Context.Factory<ClassReader>() { public ClassReader make(Context c) { return new JavadocClassReader(c); } }); }
Example #14
Source File: Types.java From javaide with GNU General Public License v3.0 | 5 votes |
protected Types(Context context) { context.put(typesKey, this); syms = Symtab.instance(context); names = Names.instance(context); Source source = Source.instance(context); allowBoxing = source.allowBoxing(); allowCovariantReturns = source.allowCovariantReturns(); allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast(); reader = ClassReader.instance(context); chk = Check.instance(context); capturedName = names.fromString("<captured wildcard>"); messages = JavacMessages.instance(context); }
Example #15
Source File: NBClassReader.java From netbeans with Apache License 2.0 | 5 votes |
public static void preRegister(Context context) { context.put(classReaderKey, new Context.Factory<ClassReader>() { public ClassReader make(Context c) { return new NBClassReader(c); } }); }
Example #16
Source File: TreeFactory.java From netbeans with Apache License 2.0 | 5 votes |
protected TreeFactory(Context context) { context.put(contextKey, this); model = ASTService.instance(context); names = Names.instance(context); classReader = ClassReader.instance(context); make = com.sun.tools.javac.tree.TreeMaker.instance(context); docMake = com.sun.tools.javac.tree.DocTreeMaker.instance(context); elements = JavacElements.instance(context); types = JavacTypes.instance(context); chs = CommentHandlerService.instance(context); make.toplevel = null; }
Example #17
Source File: JavadocClassReader.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void preRegister(Context context) { context.put(classReaderKey, new Context.Factory<ClassReader>() { public ClassReader make(Context c) { return new JavadocClassReader(c); } }); }
Example #18
Source File: ClassFinder.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** Construct a new class finder. */ protected ClassFinder(Context context) { context.put(classFinderKey, this); reader = ClassReader.instance(context); names = Names.instance(context); syms = Symtab.instance(context); fileManager = context.get(JavaFileManager.class); dependencies = Dependencies.instance(context); if (fileManager == null) throw new AssertionError("FileManager initialization error"); diagFactory = JCDiagnostic.Factory.instance(context); log = Log.instance(context); annotate = Annotate.instance(context); Options options = Options.instance(context); verbose = options.isSet(Option.VERBOSE); cacheCompletionFailure = options.isUnset("dev"); preferSource = "source".equals(options.get("-Xprefer")); userPathsFirst = options.isSet(Option.XXUSERPATHSFIRST); allowSigFiles = context.get(PlatformDescription.class) != null; completionFailureName = options.isSet("failcomplete") ? names.fromString(options.get("failcomplete")) : null; profile = Profile.instance(context); }
Example #19
Source File: JavadocClassReader.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void preRegister(Context context) { context.put(classReaderKey, new Context.Factory<ClassReader>() { public ClassReader make(Context c) { return new JavadocClassReader(c); } }); }
Example #20
Source File: Types.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
protected Types(Context context) { context.put(typesKey, this); syms = Symtab.instance(context); names = Names.instance(context); Source source = Source.instance(context); allowBoxing = source.allowBoxing(); allowCovariantReturns = source.allowCovariantReturns(); allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast(); reader = ClassReader.instance(context); chk = Check.instance(context); capturedName = names.fromString("<captured wildcard>"); messages = JavacMessages.instance(context); }
Example #21
Source File: JavadocClassReader.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void preRegister(Context context) { context.put(classReaderKey, new Context.Factory<ClassReader>() { public ClassReader make(Context c) { return new JavadocClassReader(c); } }); }
Example #22
Source File: JavadocClassReader.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void preRegister(Context context) { context.put(classReaderKey, new Context.Factory<ClassReader>() { public ClassReader make(Context c) { return new JavadocClassReader(c); } }); }
Example #23
Source File: JavadocClassReader.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void preRegister(Context context) { context.put(classReaderKey, new Context.Factory<ClassReader>() { public ClassReader make(Context c) { return new JavadocClassReader(c); } }); }
Example #24
Source File: T6889255.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
void test(String testName, boolean expectNames, String... opts) throws Exception { System.err.println("Test " + testName + ": expectNames:" + expectNames + " javacOpts:" + Arrays.asList(opts)); File outDir = new File(testName); outDir.mkdirs(); compile(outDir, opts); Context ctx = new Context(); JavacFileManager fm = new JavacFileManager(ctx, true, null); fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(outDir)); ClassReader cr = ClassReader.instance(ctx); cr.saveParameterNames = true; Names names = Names.instance(ctx); Set<String> classes = getTopLevelClasses(outDir); Deque<String> work = new LinkedList<String>(classes); String classname; while ((classname = work.poll()) != null) { System.err.println("Checking class " + classname); ClassSymbol sym = cr.enterClass(names.table.fromString(classname)); sym.complete(); if ((sym.flags() & Flags.INTERFACE) != 0 && !testInterfaces) continue; for (Scope.Entry e = sym.members_field.elems; e != null; e = e.sibling) { System.err.println("Checking member " + e.sym); switch (e.sym.kind) { case Kinds.TYP: { String name = e.sym.flatName().toString(); if (!classes.contains(name)) { classes.add(name); work.add(name); } break; } case Kinds.MTH: verify((MethodSymbol) e.sym, expectNames); break; } } } }
Example #25
Source File: JavadocClassReader.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public static JavadocClassReader instance0(Context context) { ClassReader instance = context.get(classReaderKey); if (instance == null) instance = new JavadocClassReader(context); return (JavadocClassReader)instance; }
Example #26
Source File: JavadocClassReader.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public static JavadocClassReader instance0(Context context) { ClassReader instance = context.get(classReaderKey); if (instance == null) instance = new JavadocClassReader(context); return (JavadocClassReader)instance; }
Example #27
Source File: T6889255.java From hottub with GNU General Public License v2.0 | 4 votes |
void test(String testName, boolean expectNames, String... opts) throws Exception { System.err.println("Test " + testName + ": expectNames:" + expectNames + " javacOpts:" + Arrays.asList(opts)); File outDir = new File(testName); outDir.mkdirs(); compile(outDir, opts); Context ctx = new Context(); JavacFileManager fm = new JavacFileManager(ctx, true, null); fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(outDir)); ClassReader cr = ClassReader.instance(ctx); cr.saveParameterNames = true; Names names = Names.instance(ctx); Set<String> classes = getTopLevelClasses(outDir); Deque<String> work = new LinkedList<String>(classes); String classname; while ((classname = work.poll()) != null) { System.err.println("Checking class " + classname); ClassSymbol sym = cr.enterClass(names.table.fromString(classname)); sym.complete(); if ((sym.flags() & Flags.INTERFACE) != 0 && !testInterfaces) continue; for (Scope.Entry e = sym.members_field.elems; e != null; e = e.sibling) { System.err.println("Checking member " + e.sym); switch (e.sym.kind) { case Kinds.TYP: { String name = e.sym.flatName().toString(); if (!classes.contains(name)) { classes.add(name); work.add(name); } break; } case Kinds.MTH: verify((MethodSymbol) e.sym, expectNames); break; } } } }
Example #28
Source File: JavadocClassReader.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static JavadocClassReader instance0(Context context) { ClassReader instance = context.get(classReaderKey); if (instance == null) instance = new JavadocClassReader(context); return (JavadocClassReader)instance; }
Example #29
Source File: T6889255.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
void test(String testName, boolean expectNames, String... opts) throws Exception { System.err.println("Test " + testName + ": expectNames:" + expectNames + " javacOpts:" + Arrays.asList(opts)); File outDir = new File(testName); outDir.mkdirs(); compile(outDir, opts); Context ctx = new Context(); JavacFileManager fm = new JavacFileManager(ctx, true, null); fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(outDir)); ClassReader cr = ClassReader.instance(ctx); cr.saveParameterNames = true; Names names = Names.instance(ctx); Set<String> classes = getTopLevelClasses(outDir); Deque<String> work = new LinkedList<String>(classes); String classname; while ((classname = work.poll()) != null) { System.err.println("Checking class " + classname); ClassSymbol sym = cr.enterClass(names.table.fromString(classname)); sym.complete(); if ((sym.flags() & Flags.INTERFACE) != 0 && !testInterfaces) continue; for (Scope.Entry e = sym.members_field.elems; e != null; e = e.sibling) { System.err.println("Checking member " + e.sym); switch (e.sym.kind) { case Kinds.TYP: { String name = e.sym.flatName().toString(); if (!classes.contains(name)) { classes.add(name); work.add(name); } break; } case Kinds.MTH: verify((MethodSymbol) e.sym, expectNames); break; } } } }
Example #30
Source File: JavadocClassReader.java From hottub with GNU General Public License v2.0 | 4 votes |
public static JavadocClassReader instance0(Context context) { ClassReader instance = context.get(classReaderKey); if (instance == null) instance = new JavadocClassReader(context); return (JavadocClassReader)instance; }