本文整理匯總了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;
}
示例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;
}
示例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());
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例9: isSynthetic
public boolean isSynthetic(Element e) {
return (((Symbol) e).flags() & Flags.SYNTHETIC) != 0 || (((Symbol) e).flags() & Flags.GENERATEDCONSTR) != 0;
}
示例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;
}