當前位置: 首頁>>代碼示例>>Java>>正文


Java NestingKind.ANONYMOUS屬性代碼示例

本文整理匯總了Java中javax.lang.model.element.NestingKind.ANONYMOUS屬性的典型用法代碼示例。如果您正苦於以下問題:Java NestingKind.ANONYMOUS屬性的具體用法?Java NestingKind.ANONYMOUS怎麽用?Java NestingKind.ANONYMOUS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.lang.model.element.NestingKind的用法示例。


在下文中一共展示了NestingKind.ANONYMOUS屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: create

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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:TargetDescription.java

示例2: tooComplexClass

@Hint(
    displayName = "#DN_ClassTooComplex",
    description = "#DESC_ClassTooComplex",
    category = "metrics",
    options = { Hint.Options.HEAVY, Hint.Options.QUERY },
    enabled = false
)
@UseOptions(OPTION_COMPLEXITY_LIMIT)
@TriggerTreeKind(Tree.Kind.CLASS)
public static ErrorDescription tooComplexClass(HintContext ctx) {
    ClassTree clazz = (ClassTree)ctx.getPath().getLeaf();
    TypeElement e = (TypeElement)ctx.getInfo().getTrees().getElement(ctx.getPath());
    if (e.getNestingKind() == NestingKind.ANONYMOUS) {
        return null;
    }
    CyclomaticComplexityVisitor v = new CyclomaticComplexityVisitor();
    v.scan(ctx.getPath(), null);
    
    int complexity = v.getComplexity();
    int limit = ctx.getPreferences().getInt(OPTION_COMPLEXITY_LIMIT, DEFAULT_COMPLEXITY_LIMIT);
    if (complexity > limit) {
        return ErrorDescriptionFactory.forName(ctx, 
                ctx.getPath(), 
                TEXT_ClassTooComplex(clazz.getSimpleName().toString(), complexity));
    } else {
        return null;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:ClassMetrics.java

示例3: getNestingKind

@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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:Symbol.java

示例4: getNestingKind

@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;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:12,代碼來源:TypeElementImpl.java


注:本文中的javax.lang.model.element.NestingKind.ANONYMOUS屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。