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


Java Flags.GENERATEDCONSTR屬性代碼示例

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


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

示例1: rewriteChildren

protected final MethodTree rewriteChildren(MethodTree tree) {
       ModifiersTree mods = (ModifiersTree)translate(tree.getModifiers());
ExpressionTree restype = (ExpressionTree)translateClassRef(tree.getReturnType());
List<? extends TypeParameterTree> typarams = translateStable(tree.getTypeParameters());
List<? extends VariableTree> params = translateStable(tree.getParameters());
List<? extends ExpressionTree> thrown = translate(tree.getThrows());
       ExpressionTree defaultValue = (ExpressionTree)translate(tree.getDefaultValue());
BlockTree body = (BlockTree)translate(tree.getBody());
       
if (restype!=tree.getReturnType() || !typarams.equals(tree.getTypeParameters()) || 
           !params.equals(tree.getParameters()) || !thrown.equals(tree.getThrows()) || 
           mods!=tree.getModifiers() || defaultValue!=tree.getDefaultValue() || 
           body!=tree.getBody()) {
           if ((((JCModifiers) mods).flags & Flags.GENERATEDCONSTR) != 0) {
               mods = make.Modifiers(((JCModifiers) mods).flags & ~Flags.GENERATEDCONSTR, mods.getAnnotations());
           }
           MethodTree n  = make.Method(mods, tree.getName().toString(), restype, typarams,
                                       params, thrown, body, defaultValue);
           
    copyCommentTo(tree,n);
           copyPosTo(tree,n);
    tree = n;
}
return tree;
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:ImmutableTreeTranslator.java

示例2: isSynthetic

private boolean isSynthetic(CompilationUnitTree cut, Tree leaf) {
    JCTree tree = (JCTree) leaf;
    if (tree.pos == (-1))
        return true;
    if (leaf.getKind() == Tree.Kind.METHOD) {
        //check for synthetic constructor:
        return (((JCMethodDecl)leaf).mods.flags & Flags.GENERATEDCONSTR) != 0L;
    }
    //check for synthetic superconstructor call:
    if (leaf.getKind() == Tree.Kind.EXPRESSION_STATEMENT) {
        ExpressionStatementTree est = (ExpressionStatementTree) leaf;
        if (est.getExpression().getKind() == Tree.Kind.METHOD_INVOCATION) {
            MethodInvocationTree mit = (MethodInvocationTree) est.getExpression();
            if (mit.getMethodSelect().getKind() == Tree.Kind.IDENTIFIER) {
                IdentifierTree it = (IdentifierTree) mit.getMethodSelect();
                if ("super".equals(it.getName().toString())) {
                    return sp.getEndPosition(cut, leaf) == (-1);
                }
            }
        }
    }
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:Reformatter.java

示例3: 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

示例4: 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

示例5: isSynthetic

boolean isSynthetic(CompilationUnitTree cut, Tree leaf) throws NullPointerException {
    JCTree tree = (JCTree) leaf;
    
    if (tree.pos == (-1))
        return true;
    
    if (leaf.getKind() == Kind.METHOD) {
        //check for synthetic constructor:
        return (((JCMethodDecl)leaf).mods.flags & Flags.GENERATEDCONSTR) != 0L;
    }
    
    //check for synthetic superconstructor call:
    if (leaf.getKind() == Kind.EXPRESSION_STATEMENT) {
        ExpressionStatementTree est = (ExpressionStatementTree) leaf;
        
        if (est.getExpression().getKind() == Kind.METHOD_INVOCATION) {
            MethodInvocationTree mit = (MethodInvocationTree) est.getExpression();
            
            if (mit.getMethodSelect().getKind() == Kind.IDENTIFIER) {
                IdentifierTree it = (IdentifierTree) mit.getMethodSelect();
                
                if ("super".equals(it.getName().toString())) {
                    SourcePositions sp = info.getTrees().getSourcePositions();
                    
                    return sp.getEndPosition(cut, leaf) == (-1);
                }
            }
        }
    }
    
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:32,代碼來源:TreeUtilities.java

示例6: isSynthetic

private static boolean isSynthetic(CompilationUnitTree cut, Tree leaf) throws NullPointerException {
    JCTree tree = (JCTree) leaf;

    if (tree.pos == (-1))
        return true;

    if (leaf.getKind() == Kind.METHOD) {
        //check for synthetic constructor:
        return (((JCMethodDecl)leaf).mods.flags & Flags.GENERATEDCONSTR) != 0L;
    }

    //check for synthetic superconstructor call:
    if (cut != null && leaf.getKind() == Kind.EXPRESSION_STATEMENT) {
        ExpressionStatementTree est = (ExpressionStatementTree) leaf;

        if (est.getExpression().getKind() == Kind.METHOD_INVOCATION) {
            MethodInvocationTree mit = (MethodInvocationTree) est.getExpression();

            if (mit.getMethodSelect().getKind() == Kind.IDENTIFIER) {
                IdentifierTree it = (IdentifierTree) mit.getMethodSelect();

                if ("super".equals(it.getName().toString())) {
                    return ((JCCompilationUnit) cut).endPositions.getEndPos(tree) == (-1);
                }
            }
        }
    }

    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:Utilities.java

示例7: isSynthetic

static boolean isSynthetic(CompilationInfo info, CompilationUnitTree cut, Tree leaf) throws NullPointerException {
    JCTree tree = (JCTree) leaf;
    
    if (tree.pos == (-1))
        return true;
    
    if (leaf.getKind() == Kind.METHOD) {
        //check for synthetic constructor:
        return (((JCTree.JCMethodDecl)leaf).mods.flags & Flags.GENERATEDCONSTR) != 0L;
    }
    
    //check for synthetic superconstructor call:
    if (leaf.getKind() == Kind.EXPRESSION_STATEMENT) {
        ExpressionStatementTree est = (ExpressionStatementTree) leaf;
        
        if (est.getExpression().getKind() == Kind.METHOD_INVOCATION) {
            MethodInvocationTree mit = (MethodInvocationTree) est.getExpression();
            
            if (mit.getMethodSelect().getKind() == Kind.IDENTIFIER) {
                IdentifierTree it = (IdentifierTree) mit.getMethodSelect();
                
                if ("super".equals(it.getName().toString())) {
                    SourcePositions sp = info.getTrees().getSourcePositions();
                    
                    return sp.getEndPosition(cut, leaf) == (-1);
                }
            }
        }
    }
    
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:32,代碼來源:JavaPluginUtils.java

示例8: process

@Override
void process(Diagnostic<? extends JavaFileObject> diagnostic) {
    Symbol methodSym = (Symbol)methodSym(diagnostic);
    if ((methodSym.flags() & Flags.GENERATEDCONSTR) != 0) {
        //skip resolution of default constructor (put there by javac)
        return;
    }
    Candidate c = getCandidateAtPos(methodSym,
            asJCDiagnostic(diagnostic).getLineNumber(),
            asJCDiagnostic(diagnostic).getColumnNumber());
    if (c == null) {
        return; //nothing to check
    }

    if (c.applicable().length == 0 && c.mostSpecific()) {
        error("Inapplicable method cannot be most specific " + methodSym);
    }

    if (isApplicable(diagnostic) != Arrays.asList(c.applicable()).contains(phase)) {
        error("Invalid candidate's applicability " + methodSym);
    }

    if (success) {
        for (Phase p : c.applicable()) {
            if (phase.ordinal() < p.ordinal()) {
                error("Invalid phase " + p + " on method " + methodSym);
            }
        }
    }

    if (Arrays.asList(c.applicable()).contains(phase)) { //applicable
        if (c.mostSpecific() != mostSpecific) {
            error("Invalid most specific value for method " + methodSym + " " + new ElementKey(methodSym).key);
        }
        MethodType mtype = getSig(diagnostic);
        if (mtype != null) {
            checkSig(c, methodSym, mtype);
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:40,代碼來源:ResolveHarness.java

示例9: isSynthetic

public boolean isSynthetic(Element e) {
    return (((Symbol) e).flags() & Flags.SYNTHETIC) != 0 || (((Symbol) e).flags() & Flags.GENERATEDCONSTR) != 0;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:3,代碼來源:ElementsService.java

示例10: isSynthetic

/**Returns true if the given element is synthetic.
 * 
 *  @param element to check
 *  @return true if and only if the given element is synthetic, false otherwise
 */
public boolean isSynthetic(Element element) {
    return (((Symbol) element).flags() & Flags.SYNTHETIC) != 0 || (((Symbol) element).flags() & Flags.GENERATEDCONSTR) != 0;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:ElementUtilities.java


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