Java Code Examples for com.sun.tools.javac.code.Symbol#isLocal()
The following examples show how to use
com.sun.tools.javac.code.Symbol#isLocal() .
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: PostFlowAnalysis.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void visitApply(JCMethodInvocation tree) { boolean prevCheckThis = checkThis; try { Symbol meth = TreeInfo.symbol(tree.meth); Name methName = TreeInfo.name(tree.meth); if (meth != null && meth.name == names.init) { Symbol c = meth.owner; if (c.hasOuterInstance()) { checkThis = false; if (tree.meth.getTag() != JCTree.Tag.SELECT && (c.isLocal() || methName == names._this)) { checkThis(tree.meth.pos(), c.type.getEnclosingType().tsym); } } } super.visitApply(tree); } finally { checkThis = prevCheckThis; } }
Example 2
Source File: Check.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
void checkAccessFromSerializableElement(final JCTree tree, boolean isLambda) { if (warnOnAnyAccessToMembers || (lint.isEnabled(LintCategory.SERIAL) && !lint.isSuppressed(LintCategory.SERIAL) && isLambda)) { Symbol sym = TreeInfo.symbol(tree); if (!sym.kind.matches(KindSelector.VAL_MTH)) { return; } if (sym.kind == VAR) { if ((sym.flags() & PARAMETER) != 0 || sym.isLocal() || sym.name == names._this || sym.name == names._super) { return; } } if (!types.isSubtype(sym.owner.type, syms.serializableType) && isEffectivelyNonPublic(sym)) { if (isLambda) { if (belongsToRestrictedPackage(sym)) { log.warning(LintCategory.SERIAL, tree.pos(), Warnings.AccessToMemberFromSerializableLambda(sym)); } } else { log.warning(tree.pos(), Warnings.AccessToMemberFromSerializableElement(sym)); } } } }
Example 3
Source File: Lower.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
ClassSymbol ownerToCopyFreeVarsFrom(ClassSymbol c) { if (!c.isLocal()) { return null; } Symbol currentOwner = c.owner; while (currentOwner.owner.kind.matches(KindSelector.TYP) && currentOwner.isLocal()) { currentOwner = currentOwner.owner; } if (currentOwner.owner.kind.matches(KindSelector.VAL_MTH) && c.isSubClass(currentOwner, types)) { return (ClassSymbol)currentOwner; } return null; }
Example 4
Source File: PostFlowAnalysis.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void visitNewClass(JCNewClass tree) { super.visitNewClass(tree); Symbol c = tree.constructor != null ? tree.constructor.owner : null; if (c != null && c != syms.noSymbol && c.hasOuterInstance()) { if (tree.encl == null && c.isLocal()) { checkThis(tree.pos(), c.type.getEnclosingType().tsym); } } }