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


Java Flags.FINAL屬性代碼示例

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


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

示例1: modifiersToFlags

public static long modifiersToFlags(Set<Modifier> flagset) {
    long flags = 0L;
    for (Modifier mod : flagset)
        switch (mod) {
            case PUBLIC: flags |= Flags.PUBLIC; break;
            case PROTECTED: flags |= Flags.PROTECTED; break;
            case PRIVATE: flags |= Flags.PRIVATE; break;
            case ABSTRACT: flags |= Flags.ABSTRACT; break;
            case STATIC: flags |= Flags.STATIC; break;
            case FINAL: flags |= Flags.FINAL; break;
            case TRANSIENT: flags |= Flags.TRANSIENT; break;
            case VOLATILE: flags |= Flags.VOLATILE; break;
            case SYNCHRONIZED: flags |= Flags.SYNCHRONIZED; break;
            case NATIVE: flags |= Flags.NATIVE; break;
            case STRICTFP: flags |= Flags.STRICTFP; break;
            case DEFAULT: flags |= Flags.DEFAULT; break;
            default:
                throw new AssertionError("Unknown Modifier: " + mod); //NOI18N
        }
    return flags;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:TreeFactory.java

示例2: addModifiersModifier

public ModifiersTree addModifiersModifier(ModifiersTree modifiers, Modifier modifier) {
    long c = ((JCModifiers) modifiers).flags & ~Flags.GENERATEDCONSTR;
    switch (modifier) {
        case ABSTRACT: c = c | Flags.ABSTRACT; break;
        case FINAL: c = c | Flags.FINAL; break;
        case NATIVE: c = c | Flags.NATIVE; break;
        case PRIVATE: c = c | Flags.PRIVATE; break;
        case PROTECTED: c = c | Flags.PROTECTED; break;
        case PUBLIC: c = c | Flags.PUBLIC; break;
        case STATIC: c = c | Flags.STATIC; break;
        case STRICTFP: c = c | Flags.STRICTFP; break;
        case SYNCHRONIZED: c = c | Flags.SYNCHRONIZED; break;
        case TRANSIENT: c = c | Flags.TRANSIENT; break;
        case VOLATILE: c = c | Flags.VOLATILE; break;
        case DEFAULT: c = c | Flags.DEFAULT; break;
        default:
            break;
    }
    return Modifiers(c, modifiers.getAnnotations());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:TreeMaker.java

示例3: removeModifiersModifier

public ModifiersTree removeModifiersModifier(ModifiersTree modifiers, Modifier modifier) {
    long c = ((JCModifiers) modifiers).flags & ~Flags.GENERATEDCONSTR;
    switch (modifier) {
        case ABSTRACT: c = c & ~Flags.ABSTRACT; break;
        case FINAL: c = c & ~Flags.FINAL; break;
        case NATIVE: c = c & ~Flags.NATIVE; break;
        case PRIVATE: c = c & ~Flags.PRIVATE; break;
        case PROTECTED: c = c & ~Flags.PROTECTED; break;
        case PUBLIC: c = c & ~Flags.PUBLIC; break;
        case STATIC: c = c & ~Flags.STATIC; break;
        case STRICTFP: c = c & ~Flags.STRICTFP; break;
        case SYNCHRONIZED: c = c & ~Flags.SYNCHRONIZED; break;
        case TRANSIENT: c = c & ~Flags.TRANSIENT; break;
        case VOLATILE: c = c & ~Flags.VOLATILE; break;
        case DEFAULT: c = c & ~Flags.DEFAULT; break;
        default:
            break;
    }
    return Modifiers(c, modifiers.getAnnotations());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:TreeMaker.java

示例4: processConstants

ListBuffer<JCTree> processConstants(Element constNode, HashMap<String, Integer> scope) {
    String baseName = constNode.getAttribute("basename");
    int count = 1;
    try {
        count = Integer.parseInt(constNode.getAttribute("count"));
    } catch (Exception e) {} // nothing to do, will use count = 1

    long declFlags = Flags.PUBLIC | Flags.STATIC | Flags.FINAL | Flags.ENUM;
    ListBuffer<JCTree> fields = new ListBuffer<>();

    for (int i = 0; i < count; i++) {
        String declName = baseName +
                          ((count == 1) ? "" : getUniqIndex(scope, baseName));

        JCVariableDecl constDecl = make.VarDef(
                                       make.Modifiers(declFlags),
                                       names.fromString(declName),
                                       null,  // no need for type in enum decl
                                       null); // no init

        fields.append(constDecl);
    }
    return fields;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:PackageGenerator.java

示例5: getFlagByName

long getFlagByName(String modifierName) {
    switch (modifierName) {
        case "public":
            return Flags.PUBLIC;
        case "private":
            return Flags.PRIVATE;
        case "protected":
            return Flags.PROTECTED;
        case "static":
            return Flags.STATIC;
        case "final":
            return Flags.FINAL;
        case "abstract":
            return Flags.ABSTRACT;
        case "strictfp":
            return Flags.STRICTFP;
        default:
            return 0;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:PackageGenerator.java

示例6: createArrayLengthSymbol

private Element createArrayLengthSymbol(AnalyzeTask at, TypeMirror site) {
    Name length = Names.instance(at.getContext()).length;
    Type intType = Symtab.instance(at.getContext()).intType;

    return new VarSymbol(Flags.PUBLIC | Flags.FINAL, length, intType, ((Type) site).tsym);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:SourceCodeAnalysisImpl.java

示例7: isEffectivelyFinal

/** Check whether the given variable is effectively final or final.
 * 
 * @param e variable to check for effectively final status
 * @return true if the given variable is effectively final or final
 * @since 0.112
 */
public boolean isEffectivelyFinal(VariableElement e) {
    return (((Symbol) e).flags() & (Flags.EFFECTIVELY_FINAL | Flags.FINAL)) != 0;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:ElementUtilities.java


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