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

项目:junit-tools    文件:TestCasesGenerator.java   
/**
 * @param expression
 */
public void analyze(Expression expression) {
    // param == null, null == param
    if (expression.getNodeType() == ASTNode.NULL_LITERAL) {
    setNullLiteral((NullLiteral) expression);
    } else if (expression.getNodeType() == ASTNode.SIMPLE_NAME) {
    setSimpleName((SimpleName) expression);
    } else if (expression.getNodeType() == ASTNode.NUMBER_LITERAL) {
    setNumberLiteral((NumberLiteral) expression);
    } else if (expression.getNodeType() == ASTNode.PREFIX_EXPRESSION) {
    setPrefixExpression((PrefixExpression) expression);
    } else if (expression.getNodeType() == ASTNode.POSTFIX_EXPRESSION) {
    setPostfixExpression((PostfixExpression) expression);
    } else if (expression.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION
        || expression.getNodeType() == ASTNode.INFIX_EXPRESSION
        || expression.getNodeType() == ASTNode.METHOD_INVOCATION) {
    // addTestCasesToMerge(processIfExpressions(expression,
    // tmlMethod));
    } else {
    // TODO
    System.out.println("Expression could not be analyzed: "
        + expression.getNodeType() + ". Expression: "
        + expression.toString());
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:ExtractClassRefactoring.java   
private Expression getAssignedValue(ParameterObjectFactory pof, String parameterName, IJavaProject javaProject, RefactoringStatus status, ASTRewrite rewrite, ParameterInfo pi, boolean useSuper, ITypeBinding typeBinding, Expression qualifier, ASTNode replaceNode, ITypeRoot typeRoot) {
    AST ast= rewrite.getAST();
    boolean is50OrHigher= JavaModelUtil.is50OrHigher(javaProject);
    Expression assignedValue= handleSimpleNameAssignment(replaceNode, pof, parameterName, ast, javaProject, useSuper);
    if (assignedValue == null) {
        NullLiteral marker= qualifier == null ? null : ast.newNullLiteral();
        Expression fieldReadAccess= pof.createFieldReadAccess(pi, parameterName, ast, javaProject, useSuper, marker);
        assignedValue= GetterSetterUtil.getAssignedValue(replaceNode, rewrite, fieldReadAccess, typeBinding, is50OrHigher);
        boolean markerReplaced= replaceMarker(rewrite, qualifier, assignedValue, marker);
        if (markerReplaced) {
            switch (qualifier.getNodeType()) {
                case ASTNode.METHOD_INVOCATION:
                case ASTNode.CLASS_INSTANCE_CREATION:
                case ASTNode.SUPER_METHOD_INVOCATION:
                case ASTNode.PARENTHESIZED_EXPRESSION:
                    status.addWarning(RefactoringCoreMessages.ExtractClassRefactoring_warning_semantic_change, JavaStatusContext.create(typeRoot, replaceNode));
                    break;
            }
        }
    }
    return assignedValue;
}
项目:Eclipse-Postfix-Code-Completion    文件:ExtractClassRefactoring.java   
private boolean replaceMarker(final ASTRewrite rewrite, final Expression qualifier, Expression assignedValue, final NullLiteral marker) {
    class MarkerReplacer extends ASTVisitor {

        private boolean fReplaced= false;

        @Override
        public boolean visit(NullLiteral node) {
            if (node == marker) {
                rewrite.replace(node, rewrite.createCopyTarget(qualifier), null);
                fReplaced= true;
                return false;
            }
            return true;
        }
    }
    if (assignedValue != null && qualifier != null) {
        MarkerReplacer visitor= new MarkerReplacer();
        assignedValue.accept(visitor);
        return visitor.fReplaced;
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:ExtractTempRefactoring.java   
private RefactoringStatus checkExpression() throws JavaModelException {
    Expression selectedExpression= getSelectedExpression().getAssociatedExpression();
    if (selectedExpression != null) {
        final ASTNode parent= selectedExpression.getParent();
        if (selectedExpression instanceof NullLiteral) {
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_null_literals);
        } else if (selectedExpression instanceof ArrayInitializer) {
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_array_initializer);
        } else if (selectedExpression instanceof Assignment) {
            if (parent instanceof Expression && !(parent instanceof ParenthesizedExpression))
                return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_assignment);
            else
                return null;
        } else if (selectedExpression instanceof SimpleName) {
            if ((((SimpleName) selectedExpression)).isDeclaration())
                return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_names_in_declarations);
            if (parent instanceof QualifiedName && selectedExpression.getLocationInParent() == QualifiedName.NAME_PROPERTY || parent instanceof FieldAccess && selectedExpression.getLocationInParent() == FieldAccess.NAME_PROPERTY)
                return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_select_expression);
        } else if (selectedExpression instanceof VariableDeclarationExpression && parent instanceof TryStatement) {
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_resource_in_try_with_resources);
        }
    }

    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:ExtractConstantRefactoring.java   
private RefactoringStatus checkExpression() throws JavaModelException {
    RefactoringStatus result= new RefactoringStatus();
    result.merge(checkExpressionBinding());
    if(result.hasFatalError())
        return result;
    checkAllStaticFinal();

    IExpressionFragment selectedExpression= getSelectedExpression();
    Expression associatedExpression= selectedExpression.getAssociatedExpression();
    if (associatedExpression instanceof NullLiteral)
        result.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractConstantRefactoring_null_literals));
    else if (!ConstantChecks.isLoadTimeConstant(selectedExpression))
        result.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractConstantRefactoring_not_load_time_constant));
    else if (associatedExpression instanceof SimpleName) {
        if (associatedExpression.getParent() instanceof QualifiedName && associatedExpression.getLocationInParent() == QualifiedName.NAME_PROPERTY
                || associatedExpression.getParent() instanceof FieldAccess && associatedExpression.getLocationInParent() == FieldAccess.NAME_PROPERTY)
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractConstantRefactoring_select_expression);
    }

    return result;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ExtractClassRefactoring.java   
private Expression getAssignedValue(ParameterObjectFactory pof, String parameterName, IJavaProject javaProject, RefactoringStatus status, ASTRewrite rewrite, ParameterInfo pi, boolean useSuper, ITypeBinding typeBinding, Expression qualifier, ASTNode replaceNode, ITypeRoot typeRoot) {
    AST ast= rewrite.getAST();
    boolean is50OrHigher= JavaModelUtil.is50OrHigher(javaProject);
    Expression assignedValue= handleSimpleNameAssignment(replaceNode, pof, parameterName, ast, javaProject, useSuper);
    if (assignedValue == null) {
        NullLiteral marker= qualifier == null ? null : ast.newNullLiteral();
        Expression fieldReadAccess= pof.createFieldReadAccess(pi, parameterName, ast, javaProject, useSuper, marker);
        assignedValue= GetterSetterUtil.getAssignedValue(replaceNode, rewrite, fieldReadAccess, typeBinding, is50OrHigher);
        boolean markerReplaced= replaceMarker(rewrite, qualifier, assignedValue, marker);
        if (markerReplaced) {
            switch (qualifier.getNodeType()) {
                case ASTNode.METHOD_INVOCATION:
                case ASTNode.CLASS_INSTANCE_CREATION:
                case ASTNode.SUPER_METHOD_INVOCATION:
                case ASTNode.PARENTHESIZED_EXPRESSION:
                    status.addWarning(RefactoringCoreMessages.ExtractClassRefactoring_warning_semantic_change, JavaStatusContext.create(typeRoot, replaceNode));
                    break;
            }
        }
    }
    return assignedValue;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ExtractClassRefactoring.java   
private boolean replaceMarker(final ASTRewrite rewrite, final Expression qualifier, Expression assignedValue, final NullLiteral marker) {
    class MarkerReplacer extends ASTVisitor {

        private boolean fReplaced= false;

        @Override
        public boolean visit(NullLiteral node) {
            if (node == marker) {
                rewrite.replace(node, rewrite.createCopyTarget(qualifier), null);
                fReplaced= true;
                return false;
            }
            return true;
        }
    }
    if (assignedValue != null && qualifier != null) {
        MarkerReplacer visitor= new MarkerReplacer();
        assignedValue.accept(visitor);
        return visitor.fReplaced;
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ExtractTempRefactoring.java   
private RefactoringStatus checkExpression() throws JavaModelException {
    Expression selectedExpression= getSelectedExpression().getAssociatedExpression();
    if (selectedExpression != null) {
        final ASTNode parent= selectedExpression.getParent();
        if (selectedExpression instanceof NullLiteral) {
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_null_literals);
        } else if (selectedExpression instanceof ArrayInitializer) {
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_array_initializer);
        } else if (selectedExpression instanceof Assignment) {
            if (parent instanceof Expression && !(parent instanceof ParenthesizedExpression))
                return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_assignment);
            else
                return null;
        } else if (selectedExpression instanceof SimpleName) {
            if ((((SimpleName) selectedExpression)).isDeclaration())
                return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_names_in_declarations);
            if (parent instanceof QualifiedName && selectedExpression.getLocationInParent() == QualifiedName.NAME_PROPERTY || parent instanceof FieldAccess && selectedExpression.getLocationInParent() == FieldAccess.NAME_PROPERTY)
                return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_select_expression);
        } else if (selectedExpression instanceof VariableDeclarationExpression && parent instanceof TryStatement) {
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_resource_in_try_with_resources);
        }
    }

    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ExtractConstantRefactoring.java   
private RefactoringStatus checkExpression() throws JavaModelException {
    RefactoringStatus result= new RefactoringStatus();
    result.merge(checkExpressionBinding());
    if(result.hasFatalError())
        return result;
    checkAllStaticFinal();

    IExpressionFragment selectedExpression= getSelectedExpression();
    Expression associatedExpression= selectedExpression.getAssociatedExpression();
    if (associatedExpression instanceof NullLiteral)
        result.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractConstantRefactoring_null_literals));
    else if (!ConstantChecks.isLoadTimeConstant(selectedExpression))
        result.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractConstantRefactoring_not_load_time_constant));
    else if (associatedExpression instanceof SimpleName) {
        if (associatedExpression.getParent() instanceof QualifiedName && associatedExpression.getLocationInParent() == QualifiedName.NAME_PROPERTY
                || associatedExpression.getParent() instanceof FieldAccess && associatedExpression.getLocationInParent() == FieldAccess.NAME_PROPERTY)
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractConstantRefactoring_select_expression);
    }

    return result;
}
项目:che    文件:ExtractTempRefactoring.java   
private RefactoringStatus checkExpression() throws JavaModelException {
  Expression selectedExpression = getSelectedExpression().getAssociatedExpression();
  if (selectedExpression != null) {
    final ASTNode parent = selectedExpression.getParent();
    if (selectedExpression instanceof NullLiteral) {
      return RefactoringStatus.createFatalErrorStatus(
          RefactoringCoreMessages.ExtractTempRefactoring_null_literals);
    } else if (selectedExpression instanceof ArrayInitializer) {
      return RefactoringStatus.createFatalErrorStatus(
          RefactoringCoreMessages.ExtractTempRefactoring_array_initializer);
    } else if (selectedExpression instanceof Assignment) {
      if (parent instanceof Expression && !(parent instanceof ParenthesizedExpression))
        return RefactoringStatus.createFatalErrorStatus(
            RefactoringCoreMessages.ExtractTempRefactoring_assignment);
      else return null;
    } else if (selectedExpression instanceof SimpleName) {
      if ((((SimpleName) selectedExpression)).isDeclaration())
        return RefactoringStatus.createFatalErrorStatus(
            RefactoringCoreMessages.ExtractTempRefactoring_names_in_declarations);
      if (parent instanceof QualifiedName
              && selectedExpression.getLocationInParent() == QualifiedName.NAME_PROPERTY
          || parent instanceof FieldAccess
              && selectedExpression.getLocationInParent() == FieldAccess.NAME_PROPERTY)
        return RefactoringStatus.createFatalErrorStatus(
            RefactoringCoreMessages.ExtractTempRefactoring_select_expression);
    } else if (selectedExpression instanceof VariableDeclarationExpression
        && parent instanceof TryStatement) {
      return RefactoringStatus.createFatalErrorStatus(
          RefactoringCoreMessages.ExtractTempRefactoring_resource_in_try_with_resources);
    }
  }

  return null;
}
项目:che    文件:ExtractConstantRefactoring.java   
private RefactoringStatus checkExpression() throws JavaModelException {
  RefactoringStatus result = new RefactoringStatus();
  result.merge(checkExpressionBinding());
  if (result.hasFatalError()) return result;
  checkAllStaticFinal();

  IExpressionFragment selectedExpression = getSelectedExpression();
  Expression associatedExpression = selectedExpression.getAssociatedExpression();
  if (associatedExpression instanceof NullLiteral)
    result.merge(
        RefactoringStatus.createFatalErrorStatus(
            RefactoringCoreMessages.ExtractConstantRefactoring_null_literals));
  else if (!ConstantChecks.isLoadTimeConstant(selectedExpression))
    result.merge(
        RefactoringStatus.createFatalErrorStatus(
            RefactoringCoreMessages.ExtractConstantRefactoring_not_load_time_constant));
  else if (associatedExpression instanceof SimpleName) {
    if (associatedExpression.getParent() instanceof QualifiedName
            && associatedExpression.getLocationInParent() == QualifiedName.NAME_PROPERTY
        || associatedExpression.getParent() instanceof FieldAccess
            && associatedExpression.getLocationInParent() == FieldAccess.NAME_PROPERTY)
      return RefactoringStatus.createFatalErrorStatus(
          RefactoringCoreMessages.ExtractConstantRefactoring_select_expression);
  }

  return result;
}
项目:evosuite    文件:TestExtractingVisitor.java   
private VariableReference retrieveVariableReference(NullLiteral nullLiteral,
        Class<?> varType) {
    if (varType == null) {
        varType = retrieveTypeClass(nullLiteral.getParent());
    }
    PrimitiveStatement<?> nullAssignment = new NullStatement(testCase.getReference(),
            varType);
    testCase.addStatement(nullAssignment);
    return nullAssignment.getReturnValue();
}
项目:Eclipse-Postfix-Code-Completion    文件:IntroduceParameterRefactoring.java   
private RefactoringStatus checkExpression() {
    //TODO: adjust error messages (or generalize for all refactorings on expression-selections?)
    Expression selectedExpression= fSelectedExpression;

    if (selectedExpression instanceof Name && selectedExpression.getParent() instanceof ClassInstanceCreation)
        return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_name_in_new);
        //TODO: let's just take the CIC automatically (no ambiguity -> no problem -> no dialog ;-)

    if (selectedExpression instanceof NullLiteral) {
        return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_null_literals);
    } else if (selectedExpression instanceof ArrayInitializer) {
        return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_array_initializer);
    } else if (selectedExpression instanceof Assignment) {
        if (selectedExpression.getParent() instanceof Expression)
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_assignment);
        else
            return null;

    } else if (selectedExpression instanceof SimpleName){
        if ((((SimpleName)selectedExpression)).isDeclaration())
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_names_in_declarations);
        if (selectedExpression.getParent() instanceof QualifiedName && selectedExpression.getLocationInParent() == QualifiedName.NAME_PROPERTY
                || selectedExpression.getParent() instanceof FieldAccess && selectedExpression.getLocationInParent() == FieldAccess.NAME_PROPERTY)
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_select_expression);
    }

    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:IntroduceParameterRefactoring.java   
private RefactoringStatus checkExpression() {
    //TODO: adjust error messages (or generalize for all refactorings on expression-selections?)
    Expression selectedExpression= fSelectedExpression;

    if (selectedExpression instanceof Name && selectedExpression.getParent() instanceof ClassInstanceCreation)
        return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_name_in_new);
        //TODO: let's just take the CIC automatically (no ambiguity -> no problem -> no dialog ;-)

    if (selectedExpression instanceof NullLiteral) {
        return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_null_literals);
    } else if (selectedExpression instanceof ArrayInitializer) {
        return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_array_initializer);
    } else if (selectedExpression instanceof Assignment) {
        if (selectedExpression.getParent() instanceof Expression)
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_assignment);
        else
            return null;

    } else if (selectedExpression instanceof SimpleName){
        if ((((SimpleName)selectedExpression)).isDeclaration())
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_names_in_declarations);
        if (selectedExpression.getParent() instanceof QualifiedName && selectedExpression.getLocationInParent() == QualifiedName.NAME_PROPERTY
                || selectedExpression.getParent() instanceof FieldAccess && selectedExpression.getLocationInParent() == FieldAccess.NAME_PROPERTY)
            return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_select_expression);
    }

    return null;
}
项目:junit2spock    文件:ASTNodeFactory.java   
public NullLiteral nullLiteral() {
    return ast.get().newNullLiteral();
}
项目:eclipse.jdt.ls    文件:FlowAnalyzer.java   
@Override
public void endVisit(NullLiteral node) {
    // Leaf node.
}
项目:junit-tools    文件:TestCasesGenerator.java   
public void setNullLiteral(NullLiteral nullLiteral) {
    this.expressionOrder.put(nullLiteral, filledCount++);
    this.nullLiterals.add(nullLiteral);
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public void endVisit(NullLiteral node) {
    logger.warn("Method endVisitNullLiteral for " + node + " for " + node + " not implemented!");
    super.endVisit(node);
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public boolean visit(NullLiteral node) {
    logger.warn("Method visitNullLiteral for " + node + " not implemented!");
    return super.visit(node);
}
项目:Beagle    文件:NotRecursingAstVisitor.java   
@Override
public boolean visit(final NullLiteral node) {
    return false;
}
项目:Beagle    文件:InstrumentableAstNodeLister.java   
@Override
public boolean visit(final NullLiteral node) {
    // not instrumentable, contains no instrumentable nodes
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:ExtractClassRefactoring.java   
private RefactoringStatus replaceReferences(ParameterObjectFactory pof, SearchResultGroup group, CompilationUnitRewrite cuRewrite) {
    TextEditGroup writeGroup= cuRewrite.createGroupDescription(RefactoringCoreMessages.ExtractClassRefactoring_group_replace_write);
    TextEditGroup readGroup= cuRewrite.createGroupDescription(RefactoringCoreMessages.ExtractClassRefactoring_group_replace_read);
    ITypeRoot typeRoot= cuRewrite.getCu();
    IJavaProject javaProject= typeRoot.getJavaProject();
    AST ast= cuRewrite.getAST();

    RefactoringStatus status= new RefactoringStatus();
    String parameterName= fDescriptor.getFieldName();

    SearchMatch[] searchResults= group.getSearchResults();
    for (int j= 0; j < searchResults.length; j++) {
        SearchMatch searchMatch= searchResults[j];
        ASTNode node= NodeFinder.perform(cuRewrite.getRoot(), searchMatch.getOffset(), searchMatch.getLength());
        ASTNode parent= node.getParent();
        boolean isDeclaration= parent instanceof VariableDeclaration && ((VariableDeclaration)parent).getInitializer() != node;
        if (!isDeclaration && node instanceof SimpleName) {
            ASTRewrite rewrite= cuRewrite.getASTRewrite();
            if (parent.getNodeType() == ASTNode.SWITCH_CASE)
                status.addError(RefactoringCoreMessages.ExtractClassRefactoring_error_switch, JavaStatusContext.create(typeRoot, node));

            SimpleName name= (SimpleName) node;
            ParameterInfo pi= getFieldInfo(name.getIdentifier()).pi;
            boolean writeAccess= ASTResolving.isWriteAccess(name);
            if (writeAccess && fDescriptor.isCreateGetterSetter()) {
                boolean useSuper= parent.getNodeType() == ASTNode.SUPER_FIELD_ACCESS;
                Expression qualifier= getQualifier(parent);
                ASTNode replaceNode= getReplacementNode(parent, useSuper, qualifier);
                Expression assignedValue= getAssignedValue(pof, parameterName, javaProject, status, rewrite, pi, useSuper, name.resolveTypeBinding(), qualifier, replaceNode, typeRoot);
                if (assignedValue == null) {
                    status.addError(RefactoringCoreMessages.ExtractClassRefactoring_error_unable_to_convert_node, JavaStatusContext.create(typeRoot, replaceNode));
                } else {
                    NullLiteral marker= qualifier == null ? null : ast.newNullLiteral();
                    Expression access= pof.createFieldWriteAccess(pi, parameterName, ast, javaProject, assignedValue, useSuper, marker);
                    replaceMarker(rewrite, qualifier, access, marker);
                    rewrite.replace(replaceNode, access, writeGroup);
                }
            } else {
                Expression fieldReadAccess= pof.createFieldReadAccess(pi, parameterName, ast, javaProject, false, null); //qualifier is already there
                rewrite.replace(name, fieldReadAccess, readGroup);
            }
        }
    }
    return status;
}
项目:Eclipse-Postfix-Code-Completion    文件:SuperTypeConstraintsCreator.java   
@Override
public final void endVisit(final NullLiteral node) {
    node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, fModel.createImmutableTypeVariable(node.resolveTypeBinding()));
}
项目:Eclipse-Postfix-Code-Completion    文件:FlowAnalyzer.java   
@Override
public void endVisit(NullLiteral node) {
    // Leaf node.
}
项目:Eclipse-Postfix-Code-Completion    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(NullLiteral node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:ConstraintCollector.java   
@Override
public boolean visit(NullLiteral node) {
    add(fCreator.create(node));
    return true;
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public void endVisit(NullLiteral node) {
    endVisitNode(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public boolean visit(NullLiteral node) {
    return visitNode(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ExtractClassRefactoring.java   
private RefactoringStatus replaceReferences(ParameterObjectFactory pof, SearchResultGroup group, CompilationUnitRewrite cuRewrite) {
    TextEditGroup writeGroup= cuRewrite.createGroupDescription(RefactoringCoreMessages.ExtractClassRefactoring_group_replace_write);
    TextEditGroup readGroup= cuRewrite.createGroupDescription(RefactoringCoreMessages.ExtractClassRefactoring_group_replace_read);
    ITypeRoot typeRoot= cuRewrite.getCu();
    IJavaProject javaProject= typeRoot.getJavaProject();
    AST ast= cuRewrite.getAST();

    RefactoringStatus status= new RefactoringStatus();
    String parameterName= fDescriptor.getFieldName();

    SearchMatch[] searchResults= group.getSearchResults();
    for (int j= 0; j < searchResults.length; j++) {
        SearchMatch searchMatch= searchResults[j];
        ASTNode node= NodeFinder.perform(cuRewrite.getRoot(), searchMatch.getOffset(), searchMatch.getLength());
        ASTNode parent= node.getParent();
        boolean isDeclaration= parent instanceof VariableDeclaration && ((VariableDeclaration)parent).getInitializer() != node;
        if (!isDeclaration && node instanceof SimpleName) {
            ASTRewrite rewrite= cuRewrite.getASTRewrite();
            if (parent.getNodeType() == ASTNode.SWITCH_CASE)
                status.addError(RefactoringCoreMessages.ExtractClassRefactoring_error_switch, JavaStatusContext.create(typeRoot, node));

            SimpleName name= (SimpleName) node;
            ParameterInfo pi= getFieldInfo(name.getIdentifier()).pi;
            boolean writeAccess= ASTResolving.isWriteAccess(name);
            if (writeAccess && fDescriptor.isCreateGetterSetter()) {
                boolean useSuper= parent.getNodeType() == ASTNode.SUPER_FIELD_ACCESS;
                Expression qualifier= getQualifier(parent);
                ASTNode replaceNode= getReplacementNode(parent, useSuper, qualifier);
                Expression assignedValue= getAssignedValue(pof, parameterName, javaProject, status, rewrite, pi, useSuper, name.resolveTypeBinding(), qualifier, replaceNode, typeRoot);
                if (assignedValue == null) {
                    status.addError(RefactoringCoreMessages.ExtractClassRefactoring_error_unable_to_convert_node, JavaStatusContext.create(typeRoot, replaceNode));
                } else {
                    NullLiteral marker= qualifier == null ? null : ast.newNullLiteral();
                    Expression access= pof.createFieldWriteAccess(pi, parameterName, ast, javaProject, assignedValue, useSuper, marker);
                    replaceMarker(rewrite, qualifier, access, marker);
                    rewrite.replace(replaceNode, access, writeGroup);
                }
            } else {
                Expression fieldReadAccess= pof.createFieldReadAccess(pi, parameterName, ast, javaProject, false, null); //qualifier is already there
                rewrite.replace(name, fieldReadAccess, readGroup);
            }
        }
    }
    return status;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SuperTypeConstraintsCreator.java   
@Override
public final void endVisit(final NullLiteral node) {
    node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, fModel.createImmutableTypeVariable(node.resolveTypeBinding()));
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:FlowAnalyzer.java   
@Override
public void endVisit(NullLiteral node) {
    // Leaf node.
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(NullLiteral node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ConstraintCollector.java   
@Override
public boolean visit(NullLiteral node) {
    add(fCreator.create(node));
    return true;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:HierarchicalASTVisitor.java   
@Override
public boolean visit(NullLiteral node) {
    return visit((Expression)node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:HierarchicalASTVisitor.java   
@Override
public void endVisit(NullLiteral node) {
    endVisit((Expression)node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ASTFlattener.java   
@Override
public boolean visit(NullLiteral node) {
    this.fBuffer.append("null");//$NON-NLS-1$
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenericVisitor.java   
@Override
public boolean visit(NullLiteral node) {
    return visitNode(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenericVisitor.java   
@Override
public void endVisit(NullLiteral node) {
    endVisitNode(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:NaiveASTFlattener.java   
public boolean visit(NullLiteral node) {
    this.buffer.append("null");//$NON-NLS-1$
    return false;
}
项目:eclipse-i18ntools    文件:ASTNodeFinder.java   
@Override
public boolean visit(final NullLiteral node) {
    return this.internalVisit(node);
}