Java 类org.eclipse.jdt.core.dom.MarkerAnnotation 实例源码

项目:che    文件:NullAnnotationsRewriteOperations.java   
boolean checkExisting(
    List<IExtendedModifier> existingModifiers,
    ListRewrite listRewrite,
    TextEditGroup editGroup) {
  for (Object mod : existingModifiers) {
    if (mod instanceof MarkerAnnotation) {
      MarkerAnnotation annotation = (MarkerAnnotation) mod;
      String existingName = annotation.getTypeName().getFullyQualifiedName();
      int lastDot = fAnnotationToRemove.lastIndexOf('.');
      if (existingName.equals(fAnnotationToRemove)
          || (lastDot != -1
              && fAnnotationToRemove.substring(lastDot + 1).equals(existingName))) {
        if (!fAllowRemove) return false; // veto this change
        listRewrite.remove(annotation, editGroup);
        return true;
      }
      // paranoia: check if by accident the annotation is already present (shouldn't happen):
      lastDot = fAnnotationToAdd.lastIndexOf('.');
      if (existingName.equals(fAnnotationToAdd)
          || (lastDot != -1 && fAnnotationToAdd.substring(lastDot + 1).equals(existingName))) {
        return false; // already present
      }
    }
  }
  return true;
}
项目:che    文件:VarargsWarningsSubProcessor.java   
@Override
protected ASTRewrite getRewrite() throws CoreException {
  if (fMethodDeclaration == null) {
    CompilationUnit astRoot = ASTResolving.createQuickFixAST(getCompilationUnit(), null);
    fMethodDeclaration = (MethodDeclaration) astRoot.findDeclaringNode(fMethodBinding.getKey());
  }
  AST ast = fMethodDeclaration.getAST();
  ASTRewrite rewrite = ASTRewrite.create(ast);
  ListRewrite listRewrite =
      rewrite.getListRewrite(fMethodDeclaration, MethodDeclaration.MODIFIERS2_PROPERTY);

  MarkerAnnotation annotation = ast.newMarkerAnnotation();
  String importString =
      createImportRewrite((CompilationUnit) fMethodDeclaration.getRoot())
          .addImport("java.lang.SafeVarargs"); // $NON-NLS-1$
  annotation.setTypeName(ast.newName(importString));
  listRewrite.insertFirst(annotation, null);

  // set up linked mode
  addLinkedPosition(rewrite.track(annotation), true, "annotation"); // $NON-NLS-1$

  return rewrite;
}
项目:che    文件:MissingAnnotationAttributesProposal.java   
private Expression newDefaultExpression(
    AST ast, ITypeBinding type, ImportRewriteContext context) {
  if (type.isPrimitive()) {
    String name = type.getName();
    if ("boolean".equals(name)) { // $NON-NLS-1$
      return ast.newBooleanLiteral(false);
    } else {
      return ast.newNumberLiteral("0"); // $NON-NLS-1$
    }
  }
  if (type == ast.resolveWellKnownType("java.lang.String")) { // $NON-NLS-1$
    return ast.newStringLiteral();
  }
  if (type.isArray()) {
    ArrayInitializer initializer = ast.newArrayInitializer();
    initializer.expressions().add(newDefaultExpression(ast, type.getElementType(), context));
    return initializer;
  }
  if (type.isAnnotation()) {
    MarkerAnnotation annotation = ast.newMarkerAnnotation();
    annotation.setTypeName(ast.newName(getImportRewrite().addImport(type, context)));
    return annotation;
  }
  return ast.newNullLiteral();
}
项目:evosuite    文件:TestExtractingVisitor.java   
/** {@inheritDoc} */
@Override
public boolean visit(MarkerAnnotation markerAnnotation) {
    String annotation = markerAnnotation.toString();
    if (annotation.equals("@BeforeClass")) {
        testCase.setCurrentScope(TestScope.BEFORE_CLASS);
    }
    if (annotation.equals("@Before")) {
        testCase.setCurrentScope(TestScope.BEFORE);
    }
    if (annotation.equals("@AfterClass")) {
        testCase.setCurrentScope(TestScope.AFTER_CLASS);
    }
    if (annotation.equals("@After")) {
        testCase.setCurrentScope(TestScope.AFTER);
    }
    return true;
}
项目:Eclipse-Postfix-Code-Completion    文件:PushDownRefactoringProcessor.java   
private MethodDeclaration createNewMethodDeclarationNode(MemberActionInfo info, TypeVariableMaplet[] mapping, CompilationUnitRewrite rewriter, MethodDeclaration oldMethod) throws JavaModelException {
    Assert.isTrue(!info.isFieldInfo());
    IMethod method= (IMethod) info.getMember();
    ASTRewrite rewrite= rewriter.getASTRewrite();
    AST ast= rewrite.getAST();
    MethodDeclaration newMethod= ast.newMethodDeclaration();
    copyBodyOfPushedDownMethod(rewrite, method, oldMethod, newMethod, mapping);
    newMethod.setConstructor(oldMethod.isConstructor());
    copyExtraDimensions(oldMethod, newMethod);
    if (info.copyJavadocToCopiesInSubclasses())
        copyJavadocNode(rewrite, oldMethod, newMethod);
    final IJavaProject project= rewriter.getCu().getJavaProject();
    if (info.isNewMethodToBeDeclaredAbstract() && JavaModelUtil.is50OrHigher(project) && JavaPreferencesSettings.getCodeGenerationSettings(project).overrideAnnotation) {
        final MarkerAnnotation annotation= ast.newMarkerAnnotation();
        annotation.setTypeName(ast.newSimpleName("Override")); //$NON-NLS-1$
        newMethod.modifiers().add(annotation);
    }
    copyAnnotations(oldMethod, newMethod);
    newMethod.modifiers().addAll(ASTNodeFactory.newModifiers(ast, info.getNewModifiersForCopyInSubclass(oldMethod.getModifiers())));
    newMethod.setName(ast.newSimpleName(oldMethod.getName().getIdentifier()));
    copyReturnType(rewrite, method.getCompilationUnit(), oldMethod, newMethod, mapping);
    copyParameters(rewrite, method.getCompilationUnit(), oldMethod, newMethod, mapping);
    copyThrownExceptions(oldMethod, newMethod);
    copyTypeParameters(oldMethod, newMethod);
    return newMethod;
}
项目:Eclipse-Postfix-Code-Completion    文件:PullUpRefactoringProcessor.java   
private void createAbstractMethod(final IMethod sourceMethod, final CompilationUnitRewrite sourceRewriter, final CompilationUnit declaringCuNode, final AbstractTypeDeclaration destination, final TypeVariableMaplet[] mapping, final CompilationUnitRewrite targetRewrite, final Map<IMember, IncomingMemberVisibilityAdjustment> adjustments, final IProgressMonitor monitor, final RefactoringStatus status) throws JavaModelException {
    final MethodDeclaration oldMethod= ASTNodeSearchUtil.getMethodDeclarationNode(sourceMethod, declaringCuNode);
    if (JavaModelUtil.is50OrHigher(sourceMethod.getJavaProject()) && (fSettings.overrideAnnotation || JavaCore.ERROR.equals(sourceMethod.getJavaProject().getOption(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION, true)))) {
        final MarkerAnnotation annotation= sourceRewriter.getAST().newMarkerAnnotation();
        annotation.setTypeName(sourceRewriter.getAST().newSimpleName("Override")); //$NON-NLS-1$
        sourceRewriter.getASTRewrite().getListRewrite(oldMethod, MethodDeclaration.MODIFIERS2_PROPERTY).insertFirst(annotation, sourceRewriter.createCategorizedGroupDescription(RefactoringCoreMessages.PullUpRefactoring_add_override_annotation, SET_PULL_UP));
    }
    final MethodDeclaration newMethod= targetRewrite.getAST().newMethodDeclaration();
    newMethod.setBody(null);
    newMethod.setConstructor(false);
    copyExtraDimensions(oldMethod, newMethod);
    newMethod.setJavadoc(null);
    int modifiers= getModifiersWithUpdatedVisibility(sourceMethod, Modifier.ABSTRACT | JdtFlags.clearFlag(Modifier.NATIVE | Modifier.FINAL, sourceMethod.getFlags()), adjustments, monitor, false, status);
    if (oldMethod.isVarargs())
        modifiers&= ~Flags.AccVarargs;
    newMethod.modifiers().addAll(ASTNodeFactory.newModifiers(targetRewrite.getAST(), modifiers));
    newMethod.setName(((SimpleName) ASTNode.copySubtree(targetRewrite.getAST(), oldMethod.getName())));
    copyReturnType(targetRewrite.getASTRewrite(), getDeclaringType().getCompilationUnit(), oldMethod, newMethod, mapping);
    copyParameters(targetRewrite.getASTRewrite(), getDeclaringType().getCompilationUnit(), oldMethod, newMethod, mapping);
    copyThrownExceptions(oldMethod, newMethod);
    copyTypeParameters(oldMethod, newMethod);
    ImportRewriteContext context= new ContextSensitiveImportRewriteContext(destination, targetRewrite.getImportRewrite());
    ImportRewriteUtil.addImports(targetRewrite, context, oldMethod, new HashMap<Name, String>(), new HashMap<Name, String>(), false);
    targetRewrite.getASTRewrite().getListRewrite(destination, destination.getBodyDeclarationsProperty()).insertAt(newMethod, ASTNodes.getInsertionIndex(newMethod, destination.bodyDeclarations()), targetRewrite.createCategorizedGroupDescription(RefactoringCoreMessages.PullUpRefactoring_add_abstract_method, SET_PULL_UP));
}
项目:Eclipse-Postfix-Code-Completion    文件:NullAnnotationsRewriteOperations.java   
boolean checkExisting(List<IExtendedModifier> existingModifiers, ListRewrite listRewrite, TextEditGroup editGroup) {
    for (Object mod : existingModifiers) {
        if (mod instanceof MarkerAnnotation) {
            MarkerAnnotation annotation= (MarkerAnnotation) mod;
            String existingName= annotation.getTypeName().getFullyQualifiedName();
            int lastDot= fAnnotationToRemove.lastIndexOf('.');
            if (existingName.equals(fAnnotationToRemove) || (lastDot != -1 && fAnnotationToRemove.substring(lastDot + 1).equals(existingName))) {
                if (!fAllowRemove)
                    return false; // veto this change
                listRewrite.remove(annotation, editGroup);
                return true;
            }
            // paranoia: check if by accident the annotation is already present (shouldn't happen):
            lastDot= fAnnotationToAdd.lastIndexOf('.');
            if (existingName.equals(fAnnotationToAdd) || (lastDot != -1 && fAnnotationToAdd.substring(lastDot + 1).equals(existingName))) {
                return false; // already present
            }
        }
    }
    return true;
}
项目:Eclipse-Postfix-Code-Completion    文件:VarargsWarningsSubProcessor.java   
@Override
protected ASTRewrite getRewrite() throws CoreException {
    if (fMethodDeclaration == null) {
        CompilationUnit astRoot= ASTResolving.createQuickFixAST(getCompilationUnit(), null);
        fMethodDeclaration= (MethodDeclaration) astRoot.findDeclaringNode(fMethodBinding.getKey());
    }
    AST ast= fMethodDeclaration.getAST();
    ASTRewrite rewrite= ASTRewrite.create(ast);
    ListRewrite listRewrite= rewrite.getListRewrite(fMethodDeclaration, MethodDeclaration.MODIFIERS2_PROPERTY);

    MarkerAnnotation annotation= ast.newMarkerAnnotation();
    String importString= createImportRewrite((CompilationUnit) fMethodDeclaration.getRoot()).addImport("java.lang.SafeVarargs"); //$NON-NLS-1$
    annotation.setTypeName(ast.newName(importString));
    listRewrite.insertFirst(annotation, null);

    // set up linked mode
    addLinkedPosition(rewrite.track(annotation), true, "annotation"); //$NON-NLS-1$

    return rewrite;
}
项目:Eclipse-Postfix-Code-Completion    文件:MissingAnnotationAttributesProposal.java   
private Expression newDefaultExpression(AST ast, ITypeBinding type, ImportRewriteContext context) {
    if (type.isPrimitive()) {
        String name= type.getName();
        if ("boolean".equals(name)) { //$NON-NLS-1$
            return ast.newBooleanLiteral(false);
        } else {
            return ast.newNumberLiteral("0"); //$NON-NLS-1$
        }
    }
    if (type == ast.resolveWellKnownType("java.lang.String")) { //$NON-NLS-1$
        return ast.newStringLiteral();
    }
    if (type.isArray()) {
        ArrayInitializer initializer= ast.newArrayInitializer();
        initializer.expressions().add(newDefaultExpression(ast, type.getElementType(), context));
        return initializer;
    }
    if (type.isAnnotation()) {
        MarkerAnnotation annotation= ast.newMarkerAnnotation();
        annotation.setTypeName(ast.newName(getImportRewrite().addImport(type, context)));
        return annotation;
    }
    return ast.newNullLiteral();
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:PushDownRefactoringProcessor.java   
private MethodDeclaration createNewMethodDeclarationNode(MemberActionInfo info, TypeVariableMaplet[] mapping, CompilationUnitRewrite rewriter, MethodDeclaration oldMethod) throws JavaModelException {
    Assert.isTrue(!info.isFieldInfo());
    IMethod method= (IMethod) info.getMember();
    ASTRewrite rewrite= rewriter.getASTRewrite();
    AST ast= rewrite.getAST();
    MethodDeclaration newMethod= ast.newMethodDeclaration();
    copyBodyOfPushedDownMethod(rewrite, method, oldMethod, newMethod, mapping);
    newMethod.setConstructor(oldMethod.isConstructor());
    newMethod.setExtraDimensions(oldMethod.getExtraDimensions());
    if (info.copyJavadocToCopiesInSubclasses())
        copyJavadocNode(rewrite, oldMethod, newMethod);
    final IJavaProject project= rewriter.getCu().getJavaProject();
    if (info.isNewMethodToBeDeclaredAbstract() && JavaModelUtil.is50OrHigher(project) && JavaPreferencesSettings.getCodeGenerationSettings(project).overrideAnnotation) {
        final MarkerAnnotation annotation= ast.newMarkerAnnotation();
        annotation.setTypeName(ast.newSimpleName("Override")); //$NON-NLS-1$
        newMethod.modifiers().add(annotation);
    }
    copyAnnotations(oldMethod, newMethod);
    newMethod.modifiers().addAll(ASTNodeFactory.newModifiers(ast, info.getNewModifiersForCopyInSubclass(oldMethod.getModifiers())));
    newMethod.setName(ast.newSimpleName(oldMethod.getName().getIdentifier()));
    copyReturnType(rewrite, method.getCompilationUnit(), oldMethod, newMethod, mapping);
    copyParameters(rewrite, method.getCompilationUnit(), oldMethod, newMethod, mapping);
    copyThrownExceptions(oldMethod, newMethod);
    copyTypeParameters(oldMethod, newMethod);
    return newMethod;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:PullUpRefactoringProcessor.java   
private void createAbstractMethod(final IMethod sourceMethod, final CompilationUnitRewrite sourceRewriter, final CompilationUnit declaringCuNode, final AbstractTypeDeclaration destination, final TypeVariableMaplet[] mapping, final CompilationUnitRewrite targetRewrite, final Map<IMember, IncomingMemberVisibilityAdjustment> adjustments, final IProgressMonitor monitor, final RefactoringStatus status) throws JavaModelException {
    final MethodDeclaration oldMethod= ASTNodeSearchUtil.getMethodDeclarationNode(sourceMethod, declaringCuNode);
    if (JavaModelUtil.is50OrHigher(sourceMethod.getJavaProject()) && (fSettings.overrideAnnotation || JavaCore.ERROR.equals(sourceMethod.getJavaProject().getOption(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION, true)))) {
        final MarkerAnnotation annotation= sourceRewriter.getAST().newMarkerAnnotation();
        annotation.setTypeName(sourceRewriter.getAST().newSimpleName("Override")); //$NON-NLS-1$
        sourceRewriter.getASTRewrite().getListRewrite(oldMethod, MethodDeclaration.MODIFIERS2_PROPERTY).insertFirst(annotation, sourceRewriter.createCategorizedGroupDescription(RefactoringCoreMessages.PullUpRefactoring_add_override_annotation, SET_PULL_UP));
    }
    final MethodDeclaration newMethod= targetRewrite.getAST().newMethodDeclaration();
    newMethod.setBody(null);
    newMethod.setConstructor(false);
    newMethod.setExtraDimensions(oldMethod.getExtraDimensions());
    newMethod.setJavadoc(null);
    int modifiers= getModifiersWithUpdatedVisibility(sourceMethod, Modifier.ABSTRACT | JdtFlags.clearFlag(Modifier.NATIVE | Modifier.FINAL, sourceMethod.getFlags()), adjustments, monitor, false, status);
    if (oldMethod.isVarargs())
        modifiers&= ~Flags.AccVarargs;
    newMethod.modifiers().addAll(ASTNodeFactory.newModifiers(targetRewrite.getAST(), modifiers));
    newMethod.setName(((SimpleName) ASTNode.copySubtree(targetRewrite.getAST(), oldMethod.getName())));
    copyReturnType(targetRewrite.getASTRewrite(), getDeclaringType().getCompilationUnit(), oldMethod, newMethod, mapping);
    copyParameters(targetRewrite.getASTRewrite(), getDeclaringType().getCompilationUnit(), oldMethod, newMethod, mapping);
    copyThrownExceptions(oldMethod, newMethod);
    ImportRewriteContext context= new ContextSensitiveImportRewriteContext(destination, targetRewrite.getImportRewrite());
    ImportRewriteUtil.addImports(targetRewrite, context, newMethod, new HashMap<Name, String>(), new HashMap<Name, String>(), false);
    targetRewrite.getASTRewrite().getListRewrite(destination, destination.getBodyDeclarationsProperty()).insertAt(newMethod, ASTNodes.getInsertionIndex(newMethod, destination.bodyDeclarations()), targetRewrite.createCategorizedGroupDescription(RefactoringCoreMessages.PullUpRefactoring_add_abstract_method, SET_PULL_UP));
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:VarargsWarningsSubProcessor.java   
@Override
protected ASTRewrite getRewrite() throws CoreException {
    if (fMethodDeclaration == null) {
        CompilationUnit astRoot= ASTResolving.createQuickFixAST(getCompilationUnit(), null);
        fMethodDeclaration= (MethodDeclaration) astRoot.findDeclaringNode(fMethodBinding.getKey());
    }
    AST ast= fMethodDeclaration.getAST();
    ASTRewrite rewrite= ASTRewrite.create(ast);
    ListRewrite listRewrite= rewrite.getListRewrite(fMethodDeclaration, MethodDeclaration.MODIFIERS2_PROPERTY);

    MarkerAnnotation annotation= ast.newMarkerAnnotation();
    String importString= createImportRewrite((CompilationUnit) fMethodDeclaration.getRoot()).addImport("java.lang.SafeVarargs"); //$NON-NLS-1$
    annotation.setTypeName(ast.newName(importString));
    listRewrite.insertFirst(annotation, null);

    // set up linked mode
    addLinkedPosition(rewrite.track(annotation), true, "annotation"); //$NON-NLS-1$

    return rewrite;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:MissingAnnotationAttributesProposal.java   
private Expression newDefaultExpression(AST ast, ITypeBinding type, ImportRewriteContext context) {
    if (type.isPrimitive()) {
        String name= type.getName();
        if ("boolean".equals(name)) { //$NON-NLS-1$
            return ast.newBooleanLiteral(false);
        } else {
            return ast.newNumberLiteral("0"); //$NON-NLS-1$
        }
    }
    if (type == ast.resolveWellKnownType("java.lang.String")) { //$NON-NLS-1$
        return ast.newStringLiteral();
    }
    if (type.isArray()) {
        ArrayInitializer initializer= ast.newArrayInitializer();
        initializer.expressions().add(newDefaultExpression(ast, type.getElementType(), context));
        return initializer;
    }
    if (type.isAnnotation()) {
        MarkerAnnotation annotation= ast.newMarkerAnnotation();
        annotation.setTypeName(ast.newName(getImportRewrite().addImport(type, context)));
        return annotation;
    }
    return ast.newNullLiteral();
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:NullRewriteOperations.java   
boolean checkExisting(List<IExtendedModifier> existingModifiers, ListRewrite listRewrite, TextEditGroup editGroup) {
    for (Object mod : existingModifiers) {
        if (mod instanceof MarkerAnnotation) {
            MarkerAnnotation annotation= (MarkerAnnotation) mod;
            String existingName= annotation.getTypeName().getFullyQualifiedName();
            int lastDot= fAnnotationToRemove.lastIndexOf('.');
            if (existingName.equals(fAnnotationToRemove) || (lastDot != -1 && fAnnotationToRemove.substring(lastDot + 1).equals(existingName))) {
                if (!fAllowRemove)
                    return false; // veto this change
                listRewrite.remove(annotation, editGroup);
                return true;
            }
            // paranoia: check if by accident the annotation is already present (shouldn't happen):
            lastDot= fAnnotationToAdd.lastIndexOf('.');
            if (existingName.equals(fAnnotationToAdd) || (lastDot != -1 && fAnnotationToAdd.substring(lastDot + 1).equals(existingName))) {
                return false; // already present
            }
        }
    }
    return true;
}
项目:j2d    文件:J2dVisitor.java   
@Override
public boolean visit(MarkerAnnotation node) {
    //System.out.println("Found: " + node.getClass());
    String name = node.getTypeName().getFullyQualifiedName();
    if (name.equals("Override")) {
        if (inOverriddenMethod) {
            print("override ");
        }
    } else if (name.equals("Deprecated")){
        print("deprecated ");
    } else {
        print("@_j2d_" + name + " ");
        //System.out.println("MarkerAnnotation: " + node);
        //throw new RuntimeException();
    }
    return false;
}
项目:jsr305CleanUp    文件:Jsr305CleanUpFix.java   
private static void addAnnotation(final AST ast, final ASTRewrite rewriter, String annotationName,
        Collection<TypeDeclaration> nodes) {
    for (final TypeDeclaration node : nodes) {
        final ListRewrite listRewrite = rewriter.getListRewrite(node, TypeDeclaration.MODIFIERS2_PROPERTY);
        final MarkerAnnotation markerAnnotation = ast.newMarkerAnnotation();
        markerAnnotation.setTypeName(ast.newName(annotationName));
        listRewrite.insertFirst(markerAnnotation, null);
    }
}
项目:codemodify    文件:JUnit4Converter.java   
protected void createMarkerAnnotation(AST ast, ASTRewrite rewriter, MethodDeclaration methodDeclaration,
        String annotationName) {
    if (!isAnnotationExisting(methodDeclaration.modifiers(), annotationName)) {
        MarkerAnnotation testAnnotation = ast.newMarkerAnnotation();
        testAnnotation.setTypeName(ast.newName(annotationName));

        ListRewrite listRewrite = rewriter.getListRewrite(methodDeclaration, MethodDeclaration.MODIFIERS2_PROPERTY);
        listRewrite.insertFirst(testAnnotation, null);
    }
}
项目:asup    文件:JDTProgramWriter.java   
@SuppressWarnings("unchecked")
public void writeProgramAnnotation(QProgram program) {
    QConversion conversion = program.getFacet(QConversion.class);
    if (conversion != null) {
        MarkerAnnotation conversionAnnotation = getAST().newMarkerAnnotation();

        switch (conversion.getStatus()) {
        case POSSIBLE:
            break;
        case SUPPORTED:
            writeImport(Supported.class);
            conversionAnnotation.setTypeName(getAST().newSimpleName(Supported.class.getSimpleName()));
            getTarget().modifiers().add(conversionAnnotation);
            break;
        case TODO:
            writeImport(ToDo.class);
            conversionAnnotation.setTypeName(getAST().newSimpleName(ToDo.class.getSimpleName()));
            getTarget().modifiers().add(conversionAnnotation);
            break;
        case UNSUPPORTED:
            writeImport(Unsupported.class);
            conversionAnnotation.setTypeName(getAST().newSimpleName(Unsupported.class.getSimpleName()));
            getTarget().modifiers().add(conversionAnnotation);
            break;
        }
    }

    // @Program(name=)
    NormalAnnotation programAnnotation = getAST().newNormalAnnotation();
    programAnnotation.setTypeName(getAST().newSimpleName(Program.class.getSimpleName()));
    MemberValuePair memberValuePair = getAST().newMemberValuePair();
    memberValuePair.setName(getAST().newSimpleName("name"));
    StringLiteral stringLiteral = getAST().newStringLiteral();
    stringLiteral.setLiteralValue(program.getName());
    memberValuePair.setValue(stringLiteral);
    programAnnotation.values().add(memberValuePair);

    getTarget().modifiers().add(0, programAnnotation);
}
项目:j2d    文件:J2dVisitor.java   
private boolean hasOverrideModifier(BodyDeclaration node) {
    for (Object o : node.modifiers()) {
        if (o instanceof MarkerAnnotation) {
            MarkerAnnotation ma = (MarkerAnnotation)o;
            if (ma.getTypeName().getFullyQualifiedName().equals("Override")) {
                return true;
            }
        }
    }
    return false;
}
项目:eclipse-optimus    文件:ImportsGenerationVisitor.java   
/**
 * Checks Import Generation for Marker Annotation
 */
@Override
public boolean visit(MarkerAnnotation node) {
    if (node == null)
        return super.visit(node);

    ITypeBinding typeBinding = node.resolveTypeBinding();
    if (typeBinding == null)
        return super.visit(node);

    Name typeName = node.getTypeName();
    this.checkType(node, typeName, typeBinding);
    return super.visit(node);
}
项目:BUILD_file_generator    文件:ReferencedClassesParser.java   
@Override
public boolean visit(MarkerAnnotation node) {
  return visitAnnotation(node);
}
项目:junit2spock    文件:ASTNodeFactory.java   
public Annotation markerAnnotation(String name) {
    MarkerAnnotation annotation = ast.get().newMarkerAnnotation();
    annotation.setTypeName(simpleName(name));
    return annotation;
}
项目:RefDiff    文件:DependenciesAstVisitor.java   
@Override
public final boolean visit(MarkerAnnotation node) {
    ITypeBinding typeBinding = node.getTypeName().resolveTypeBinding();
    handleTypeBinding(node, typeBinding, true);
    return true;
}
项目:RefDiff    文件:DependenciesAstVisitor.java   
@Override
public final boolean visit(MarkerAnnotation node) {
    ITypeBinding typeBinding = node.getTypeName().resolveTypeBinding();
    handleTypeBinding(node, typeBinding, true);
    return true;
}
项目:SparkBuilderGenerator    文件:MarkerAnnotationAttacher.java   
public void attachAnnotation(AST ast, MethodDeclaration method, String annotationName) {
    MarkerAnnotation nonNullAnnotation = createMarkerAnnotation(ast, annotationName);
    method.modifiers().add(0, nonNullAnnotation);
}
项目:SparkBuilderGenerator    文件:MarkerAnnotationAttacher.java   
public void attachAnnotation(AST ast, SingleVariableDeclaration methodParameterDeclaration, String annotationName) {
    MarkerAnnotation nonNullAnnotation = createMarkerAnnotation(ast, annotationName);
    methodParameterDeclaration.modifiers().add(0, nonNullAnnotation);
}
项目:SparkBuilderGenerator    文件:MarkerAnnotationAttacher.java   
private MarkerAnnotation createMarkerAnnotation(AST ast, String annotation) {
    MarkerAnnotation markerAnnotation = ast.newMarkerAnnotation();
    markerAnnotation.setTypeName(ast.newSimpleName(annotation));
    return markerAnnotation;
}
项目:eclipse.jdt.ls    文件:ImportReferencesCollector.java   
@Override
public boolean visit(MarkerAnnotation node) {
    typeRefFound(node.getTypeName());
    return false;
}
项目:eclipse.jdt.ls    文件:FlowAnalyzer.java   
@Override
public void endVisit(MarkerAnnotation node) {
    // nothing to do for marker annotations;
}
项目:che    文件:ImportReferencesCollector.java   
@Override
public boolean visit(MarkerAnnotation node) {
  typeRefFound(node.getTypeName());
  return false;
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public void endVisit(MarkerAnnotation node) {
    logger.warn("Method endVisitMarkerAnnotation for " + node + " for " + node + " not implemented!");
    super.endVisit(node);
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public boolean visit(MarkerAnnotation node) {
    logger.warn("Method visitMarkerAnnotation for " + node + " not implemented!");
    return super.visit(node);
}
项目:Beagle    文件:NotRecursingAstVisitor.java   
@Override
public boolean visit(final MarkerAnnotation node) {
    return false;
}
项目:Beagle    文件:InstrumentableAstNodeLister.java   
@Override
public boolean visit(final MarkerAnnotation node) {
    // not instrumentable, contains no instrumentable nodes
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:FlowAnalyzer.java   
@Override
public void endVisit(MarkerAnnotation node) {
    // nothing to do for marker annotations;
}
项目:Eclipse-Postfix-Code-Completion    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(MarkerAnnotation node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:ConstraintCollector.java   
@Override
public boolean visit(MarkerAnnotation node) {
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public void endVisit(MarkerAnnotation node) {
    endVisitNode(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public boolean visit(MarkerAnnotation node) {
    return visitNode(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:ImportReferencesCollector.java   
@Override
public boolean visit(MarkerAnnotation node) {
    typeRefFound(node.getTypeName());
    return false;
}