/** Return the enclosing {@code PackageSymbol} of the given symbol, or {@code null}. */ public static PackageSymbol enclosingPackage(Symbol sym) { return sym.packge(); }
/** Return true if the given symbol is defined in the current package. */ public static boolean inSamePackage(Symbol targetSymbol, VisitorState state) { JCCompilationUnit compilationUnit = (JCCompilationUnit) state.getPath().getCompilationUnit(); PackageSymbol usePackage = compilationUnit.packge; PackageSymbol targetPackage = targetSymbol.packge(); return targetPackage != null && usePackage != null && targetPackage.getQualifiedName().equals(usePackage.getQualifiedName()); }
Id(int value, @Nullable Symbol rSymbol) { this.value = value; if (rSymbol != null) { ClassName className = ClassName.get(rSymbol.packge().getQualifiedName().toString(), R, rSymbol.enclClass().name.toString()); String resourceName = rSymbol.name.toString(); this.code = className.topLevelClassName().equals(ANDROID_R) ? CodeBlock.of("$L.$N", className, resourceName) : CodeBlock.of("$T.$N", className, resourceName); this.qualifed = true; } else { this.code = CodeBlock.of("$L", value); this.qualifed = false; } }
case 0: case Flags.PROTECTED: if (member.packge() != pkg) { continue OUTER;
/** Return the enclosing {@code PackageSymbol} of the given symbol, or {@code null}. */ public static PackageSymbol enclosingPackage(Symbol sym) { return sym.packge(); }
public PackageSymbol packge() { return other.packge(); } public boolean isSubClass(Symbol base, Types types) { return other.isSubClass(base, types); }
public PackageSymbol packge() { return other.packge(); } public boolean isSubClass(Symbol base, Types types) { return other.isSubClass(base, types); }
/** Collect dependencies in the enclosing class * @param from The enclosing class sym * @param to The enclosing classes references this sym. * */ @Override public void reportDependence(Symbol from, Symbol to) { // Capture dependencies between the packages. deps.collect(from.packge().fullname, to.packge().fullname); } }
boolean staticImportAccessible(Symbol sym, PackageSymbol packge) { int flags = (int)(sym.flags() & AccessFlags); switch (flags) { default: case PUBLIC: return true; case PRIVATE: return false; case 0: case PROTECTED: return sym.packge() == packge; } }
private boolean isEffectivelyNonPublic(Symbol sym) { if (sym.packge() == syms.rootPackage) { return false; } while (sym.kind != Kinds.PCK) { if ((sym.flags() & PUBLIC) == 0) { return true; } sym = sym.owner; } return false; }
boolean staticImportAccessible(Symbol sym, PackageSymbol packge) { int flags = (int)(sym.flags() & AccessFlags); switch (flags) { default: case PUBLIC: return true; case PRIVATE: return false; case 0: case PROTECTED: return sym.packge() == packge; } }
public PackageElement getPackageOf(Element e) { return cast(Symbol.class, e).packge(); }
boolean staticImportAccessible(Symbol sym, PackageSymbol packge) { int flags = (int)(sym.flags() & AccessFlags); switch (flags) { default: case PUBLIC: return true; case PRIVATE: return false; case 0: case PROTECTED: return sym.packge() == packge; } }
public PackageElement getPackageOf(Element e) { return cast(Symbol.class, e).packge(); }
boolean staticImportAccessible(Symbol sym, PackageSymbol packge) { int flags = (int)(sym.flags() & AccessFlags); switch (flags) { default: case PUBLIC: return true; case PRIVATE: return false; case 0: case PROTECTED: return sym.packge() == packge; } }
public PackageElement getPackageOf(Element e) { return cast(Symbol.class, e).packge(); }
public PackageElement getPackageOf(Element e) { return cast(Symbol.class, e).packge(); }
/** * Returns true if the given symbol belongs to the base package for this checker or a package * under it. */ private boolean isInMatchingPackage(Symbol symbol) { String packageName = symbol.packge().fullname.toString(); return !isIgnoredPackage(packageName) && (packageName.equals(basePackage) || packageName.startsWith(basePackagePlusDot)); }
/** Return true if the given symbol is defined in the current package. */ public static boolean inSamePackage(Symbol targetSymbol, VisitorState state) { JCCompilationUnit compilationUnit = (JCCompilationUnit) state.getPath().getCompilationUnit(); PackageSymbol usePackage = compilationUnit.packge; PackageSymbol targetPackage = targetSymbol.packge(); return targetPackage != null && usePackage != null && targetPackage.getQualifiedName().equals(usePackage.getQualifiedName()); }
/** Do we need an access method to reference symbol in other package? */ boolean needsProtectedAccess(Symbol sym, JCTree tree) { if ((sym.flags() & PROTECTED) == 0 || sym.owner.owner == currentClass.owner || // fast special case sym.packge() == currentClass.packge()) return false; if (!currentClass.isSubClass(sym.owner, types)) return true; if ((sym.flags() & STATIC) != 0 || tree.getTag() != JCTree.SELECT || TreeInfo.name(((JCFieldAccess) tree).selected) == names._super) return false; return !((JCFieldAccess) tree).selected.type.tsym.isSubClass(currentClass, types); }