private static boolean isInherited(VisitorState state, String annotationName) { Symbol annotationSym = state.getSymbolFromString(annotationName); if (annotationSym == null) { return false; } try { annotationSym.complete(); } catch (CompletionFailure e) { // @Inherited won't work if the annotation isn't on the classpath, but we can still check // if it's present directly } Symbol inheritedSym = state.getSymtab().inheritedType.tsym; return annotationSym.attribute(inheritedSym) != null; }
public void complete() throws CompletionFailure { other.complete(); }
public void complete() throws CompletionFailure { other.complete(); }
public void complete() throws CompletionFailure { other.complete(); }
public void complete() throws CompletionFailure { other.complete(); }
/** complete up through the enclosing package. */ private void completeOwners(Symbol o) { if (o.kind != PCK) completeOwners(o.owner); o.complete(); }
/** complete up through the enclosing package. */ private void completeOwners(Symbol o) { if (o.kind != PCK) completeOwners(o.owner); o.complete(); }
/** complete up through the enclosing package. */ private void completeOwners(Symbol o) { if (o.kind != PCK) completeOwners(o.owner); o.complete(); }
/** complete up through the enclosing package. */ private void completeOwners(Symbol o) { if (o.kind != PCK) completeOwners(o.owner); o.complete(); }
/** * Returns a symbol given the type's or packages's canonical name, * or null if the name isn't found. */ private <S extends Symbol> S nameToSymbol(String nameStr, Class<S> clazz) { Name name = names.fromString(nameStr); // First check cache. Symbol sym = (clazz == ClassSymbol.class) ? syms.classes.get(name) : syms.packages.get(name); try { if (sym == null) sym = javaCompiler.resolveIdent(nameStr); sym.complete(); return (sym.kind != Kinds.ERR && sym.exists() && clazz.isInstance(sym) && name.equals(sym.getQualifiedName())) ? clazz.cast(sym) : null; } catch (CompletionFailure e) { return null; } }
/** * Returns a symbol given the type's or packages's canonical name, * or null if the name isn't found. */ private <S extends Symbol> S nameToSymbol(String nameStr, Class<S> clazz) { Name name = names.fromString(nameStr); // First check cache. Symbol sym = (clazz == ClassSymbol.class) ? syms.classes.get(name) : syms.packages.get(name); try { if (sym == null) sym = javaCompiler.resolveIdent(nameStr); sym.complete(); return (sym.kind != Kinds.ERR && sym.exists() && clazz.isInstance(sym) && name.equals(sym.getQualifiedName())) ? clazz.cast(sym) : null; } catch (CompletionFailure e) { return null; } }
private static boolean isInherited(VisitorState state, String annotationName) { Symbol annotationSym = state.getSymbolFromString(annotationName); if (annotationSym == null) { return false; } try { annotationSym.complete(); } catch (CompletionFailure e) { // @Inherited won't work if the annotation isn't on the classpath, but we can still check // if it's present directly } Symbol inheritedSym = state.getSymtab().inheritedType.tsym; return annotationSym.attribute(inheritedSym) != null; }
/** * Returns a symbol given the type's or packages's canonical name, * or null if the name isn't found. */ private <S extends Symbol> S nameToSymbol(String nameStr, Class<S> clazz) { Name name = names.fromString(nameStr); // First check cache. Symbol sym = (clazz == ClassSymbol.class) ? syms.classes.get(name) : syms.packages.get(name); try { if (sym == null) sym = javaCompiler.resolveIdent(nameStr); sym.complete(); return (sym.kind != Kinds.ERR && sym.exists() && clazz.isInstance(sym) && name.equals(sym.getQualifiedName())) ? clazz.cast(sym) : null; } catch (CompletionFailure e) { return null; } }
/** * Tries to complete lexically enclosing classes if c looks like a * nested class. This is similar to completeOwners but handles * the situation when a nested class is accessed directly as it is * possible with the Tree API or javax.lang.model.*. */ private void completeEnclosing(ClassSymbol c) { if (c.owner.kind == PCK) { Symbol owner = c.owner; for (Name name : Convert.enclosingCandidates(Convert.shortName(c.name))) { Symbol encl = owner.members().lookup(name).sym; if (encl == null) encl = classes.get(TypeSymbol.formFlatName(name, owner)); if (encl != null) encl.complete(); } } }
/** * Tries to complete lexically enclosing classes if c looks like a * nested class. This is similar to completeOwners but handles * the situation when a nested class is accessed directly as it is * possible with the Tree API or javax.lang.model.*. */ private void completeEnclosing(ClassSymbol c) { if (c.owner.kind == PCK) { Symbol owner = c.owner; for (Name name : Convert.enclosingCandidates(Convert.shortName(c.name))) { Symbol encl = owner.members().lookup(name).sym; if (encl == null) encl = classes.get(TypeSymbol.formFlatName(name, owner)); if (encl != null) encl.complete(); } } }
/** * Tries to complete lexically enclosing classes if c looks like a * nested class. This is similar to completeOwners but handles * the situation when a nested class is accessed directly as it is * possible with the Tree API or javax.lang.model.*. */ private void completeEnclosing(ClassSymbol c) { if (c.owner.kind == PCK) { Symbol owner = c.owner; for (Name name : Convert.enclosingCandidates(Convert.shortName(c.name))) { Symbol encl = owner.members().lookup(name).sym; if (encl == null) encl = classes.get(TypeSymbol.formFlatName(name, owner)); if (encl != null) encl.complete(); } } }
/** * Tries to complete lexically enclosing classes if c looks like a * nested class. This is similar to completeOwners but handles * the situation when a nested class is accessed directly as it is * possible with the Tree API or javax.lang.model.*. */ private void completeEnclosing(ClassSymbol c) { if (c.owner.kind == PCK) { Symbol owner = c.owner; for (Name name : Convert.enclosingCandidates(Convert.shortName(c.name))) { Symbol encl = owner.members().lookup(name).sym; if (encl == null) encl = classes.get(TypeSymbol.formFlatName(name, owner)); if (encl != null) encl.complete(); } } }
public void visitTopLevel(JCCompilationUnit tree) { if (tree.starImportScope.elems != null) { // we must have already processed this toplevel return; } // check that no class exists with same fully qualified name as // toplevel package if (checkClash && tree.pid != null) { Symbol p = tree.packge; while (p.owner != syms.rootPackage) { p.owner.complete(); // enter all class members of p if (syms.classes.get(p.getQualifiedName()) != null) { log.error(tree.pos, "pkg.clashes.with.class.of.same.name", p); } p = p.owner; } } // process package annotations annotateLater(tree.packageAnnotations, env, tree.packge); // Import-on-demand java.lang. importAll(tree.pos, reader.enterPackage(names.java_lang), env); // Process all import clauses. memberEnter(tree.defs, env); }
Symbol p = tree.packge; while (p.owner != syms.rootPackage) { p.owner.complete(); // enter all class members of p if (syms.classes.get(p.getQualifiedName()) != null) { log.error(tree.pos,
public List<VarSymbol> params() { owner.complete(); if (params == null) { List<Name> names = savedParameterNames; savedParameterNames = null; if (names == null) { names = List.nil(); int i = 0; for (Type t : type.getParameterTypes()) names = names.prepend(name.table.fromString("arg" + i++)); names = names.reverse(); } ListBuffer<VarSymbol> buf = new ListBuffer<VarSymbol>(); for (Type t : type.getParameterTypes()) { buf.append(new VarSymbol(PARAMETER, names.head, t, this)); names = names.tail; } params = buf.toList(); } return params; }