Java Code Examples for javax.lang.model.element.NestingKind#LOCAL
The following examples show how to use
javax.lang.model.element.NestingKind#LOCAL .
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: TargetDescription.java From netbeans with Apache License 2.0 | 6 votes |
public static TargetDescription create(CompilationInfo info, TypeElement type, TreePath path, boolean allowForDuplicates, boolean iface) { boolean canStatic = true; if (iface) { // interface cannot have static methods canStatic = false; } else { if (type.getNestingKind() == NestingKind.ANONYMOUS || type.getNestingKind() == NestingKind.LOCAL || (type.getNestingKind() != NestingKind.TOP_LEVEL && !type.getModifiers().contains(Modifier.STATIC))) { canStatic = false; } } return new TargetDescription(Utilities.target2String(type), ElementHandle.create(type), TreePathHandle.create(path, info), allowForDuplicates, type.getSimpleName().length() == 0, iface, canStatic); }
Example 2
Source File: Symbol.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
@DefinedBy(Api.LANGUAGE_MODEL) public NestingKind getNestingKind() { complete(); if (owner.kind == PCK) return NestingKind.TOP_LEVEL; else if (name.isEmpty()) return NestingKind.ANONYMOUS; else if (owner.kind == MTH) return NestingKind.LOCAL; else return NestingKind.MEMBER; }
Example 3
Source File: InstanceRefFinder.java From netbeans with Apache License 2.0 | 5 votes |
/** * If the variable is typed as a local class, record the local class; it may need to go along * with the factored expression, unless the expression only uses some specific interface * implemented by the local class. * * @param el */ private void addLocalClassVariable(Element el) { TypeMirror tm = el.asType(); if (tm.getKind() != TypeKind.DECLARED) { return; } Element e = ((DeclaredType)tm).asElement(); if (!(e instanceof TypeElement)) { return; } TypeElement t = (TypeElement)e; if (t.getNestingKind() == NestingKind.LOCAL) { addLocalReference(t); } }
Example 4
Source File: Symbol.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@DefinedBy(Api.LANGUAGE_MODEL) public NestingKind getNestingKind() { complete(); if (owner.kind == PCK) return NestingKind.TOP_LEVEL; else if (name.isEmpty()) return NestingKind.ANONYMOUS; else if (owner.kind == MTH) return NestingKind.LOCAL; else return NestingKind.MEMBER; }
Example 5
Source File: TypeElementImpl.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public NestingKind getNestingKind() { ReferenceBinding refBinding = (ReferenceBinding)_binding; if (refBinding.isAnonymousType()) { return NestingKind.ANONYMOUS; } else if (refBinding.isLocalType()) { return NestingKind.LOCAL; } else if (refBinding.isMemberType()) { return NestingKind.MEMBER; } return NestingKind.TOP_LEVEL; }
Example 6
Source File: JavaEnvironment.java From j2cl with Apache License 2.0 | 4 votes |
private static boolean isLocal(TypeElement typeElement) { return typeElement.getNestingKind() == NestingKind.LOCAL; }
Example 7
Source File: ElementUtil.java From j2objc with Apache License 2.0 | 4 votes |
public static boolean isLocal(TypeElement type) { NestingKind nestingKind = type.getNestingKind(); return nestingKind == NestingKind.ANONYMOUS || nestingKind == NestingKind.LOCAL; }