Package org.eclipse.jdt.internal.compiler.ast

Examples of org.eclipse.jdt.internal.compiler.ast.Expression


         this.scribe.printNextToken(TerminalTokens.TokenNameLBRACKET);
         this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET);
       }
    }

    Expression defaultValue = annotationTypeMemberDeclaration.defaultValue;
    if (defaultValue != null) {
      this.scribe.printNextToken(TerminalTokens.TokenNamedefault, true);
      this.scribe.space();
      defaultValue.traverse(this, (BlockScope) null);
    }
    this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
    this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
    return false;
  }
View Full Code Here


      this.preferences.insert_space_after_opening_paren_in_enum_constant,
      this.preferences.insert_space_before_comma_in_enum_constant_arguments,
      this.preferences.insert_space_after_comma_in_enum_constant_arguments,
      this.preferences.alignment_for_arguments_in_enum_constant);

    Expression initialization = enumConstant.initialization;
    if (initialization instanceof QualifiedAllocationExpression) {
      TypeDeclaration typeDeclaration = ((QualifiedAllocationExpression) initialization).anonymousType;
      int fieldsCount = typeDeclaration.fields == null ? 0 : typeDeclaration.fields.length;
      int methodsCount = typeDeclaration.methods == null ? 0 : typeDeclaration.methods.length;
      int membersCount = typeDeclaration.memberTypes == null ? 0 : typeDeclaration.memberTypes.length;
View Full Code Here

    BlockScope scope) {

    if (explicitConstructor.isImplicitSuper()) {
      return false;
    }
    final Expression qualification = explicitConstructor.qualification;
    if (qualification != null) {
      qualification.traverse(this, scope);
      this.scribe.printNextToken(TerminalTokens.TokenNameDOT);
    }

    TypeReference[] typeArguments = explicitConstructor.typeArguments;
    if (typeArguments != null) {
View Full Code Here

          }
        }
      }
    }
    this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon_in_for);
    final Expression condition = forStatement.condition;
    if (condition != null) {
      if (this.preferences.insert_space_after_semicolon_in_for) {
        this.scribe.space();
      }
      condition.traverse(this, scope);
    }
    this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon_in_for);
    final Statement[] increments = forStatement.increments;
    if (increments != null) {
      if (this.preferences.insert_space_after_semicolon_in_for) {
View Full Code Here

    final int numberOfParens = (qualifiedAllocationExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
    if (numberOfParens > 0) {
      manageOpeningParenthesizedExpression(qualifiedAllocationExpression, numberOfParens);
    }
    final Expression enclosingInstance = qualifiedAllocationExpression.enclosingInstance;
    if (enclosingInstance != null) {
      enclosingInstance.traverse(this, scope);
      this.scribe.printNextToken(TerminalTokens.TokenNameDOT);
    }

    this.scribe.printNextToken(TerminalTokens.TokenNamenew);
    // used for the new line on wrap style of formatting
View Full Code Here

   * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.ReturnStatement, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
   */
  public boolean visit(ReturnStatement returnStatement, BlockScope scope) {

    this.scribe.printNextToken(TerminalTokens.TokenNamereturn);
    final Expression expression = returnStatement.expression;
    if (expression != null) {
      final int numberOfParens = (expression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
      if ((numberOfParens != 0 && this.preferences.insert_space_before_parenthesized_expression_in_return)
          || numberOfParens == 0) {
        this.scribe.space();
      }
      expression.traverse(this, scope);
    }
    /*
     * Print the semi-colon
     */
    this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
View Full Code Here

          this.nullReferences[i]this.nullCheckTypes[i], flowInfo);
    }
  }
  else { // no enclosing loop, be as precise as possible right now
    for (int i = 0; i < this.nullCount; i++) {
      Expression expression = this.nullReferences[i];
      // final local variable
      LocalVariableBinding local = this.nullLocals[i];
      switch (this.nullCheckTypes[i]) {
        case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NULL:
        case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL:
View Full Code Here

  // all related catch blocks are marked as reachable... instead of those only
  // until the point where it is safely handled (Smarter - see comment at the end)
  FlowContext traversedContext = this;
  ArrayList abruptlyExitedLoops = null;
  if (scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_7 && location instanceof ThrowStatement) {
    Expression throwExpression = ((ThrowStatement)location).exception;
    LocalVariableBinding throwArgBinding = throwExpression.localVariableBinding();
    if (throwExpression instanceof SingleNameReference // https://bugs.eclipse.org/bugs/show_bug.cgi?id=350361
        && throwArgBinding instanceof CatchParameterBinding && throwArgBinding.isEffectivelyFinal()) {
      CatchParameterBinding parameter = (CatchParameterBinding) throwArgBinding;
      checkExceptionHandlers(parameter.getPreciseTypes(), location, flowInfo, scope);
      return;
View Full Code Here

  this.visitIfNeeded(methodDeclaration);

  if (isInRange) {
    if (methodDeclaration instanceof AnnotationMethodDeclaration) {
      AnnotationMethodDeclaration annotationMethodDeclaration = (AnnotationMethodDeclaration) methodDeclaration;
      Expression expression = annotationMethodDeclaration.defaultValue;
      if (expression != null) {
        requestor.exitMethod(methodDeclaration.declarationSourceEnd, expression);
        return;
      }
    }
View Full Code Here

    addPotentialNullInfoFrom(callerFlowInfo.unconditionalInitsWithoutSideEffect());
  if ((this.tagBits & FlowContext.DEFER_NULL_DIAGNOSTIC) != 0) {
    // check only immutable null checks on innermost looping context
    for (int i = 0; i < this.nullCount; i++) {
      LocalVariableBinding local = this.nullLocals[i];
      Expression expression = this.nullReferences[i];
      // final local variable
      switch (this.nullCheckTypes[i]) {
        case CAN_ONLY_NON_NULL | IN_COMPARISON_NULL:
        case CAN_ONLY_NON_NULL | IN_COMPARISON_NON_NULL:
          if (flowInfo.isDefinitelyNonNull(local)) {
            this.nullReferences[i] = null;
            if (this.nullCheckTypes[i] == (CAN_ONLY_NON_NULL | IN_COMPARISON_NON_NULL)) {
              if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) {
                scope.problemReporter().localVariableRedundantCheckOnNonNull(local, expression);
              }
            } else {
              if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) {
                scope.problemReporter().localVariableNonNullComparedToNull(local, expression);
              }
            }
            continue;
          }
          break;
        case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NULL:
        case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL:
          if (flowInfo.isDefinitelyNonNull(local)) {
            this.nullReferences[i] = null;
            if (this.nullCheckTypes[i] == (CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL)) {
              if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) {
                scope.problemReporter().localVariableRedundantCheckOnNonNull(local, expression);
              }
            } else {
              if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) {
                scope.problemReporter().localVariableNonNullComparedToNull(local, expression);
              }
            }
            continue;
          }
          if (flowInfo.isDefinitelyNull(local)) {
            this.nullReferences[i] = null;
            if (this.nullCheckTypes[i] == (CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NULL)) {
              if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) {
                scope.problemReporter().localVariableRedundantCheckOnNull(local, expression);
              }
            } else {
              if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) {
                scope.problemReporter().localVariableNullComparedToNonNull(local, expression);
              }
            }
            continue;
          }
          break;
        case CAN_ONLY_NULL | IN_COMPARISON_NULL:
        case CAN_ONLY_NULL | IN_COMPARISON_NON_NULL:
        case CAN_ONLY_NULL | IN_ASSIGNMENT:
        case CAN_ONLY_NULL | IN_INSTANCEOF:
          if (flowInfo.isDefinitelyNull(local)) {
            this.nullReferences[i] = null;
            switch(this.nullCheckTypes[i] & CONTEXT_MASK) {
              case FlowContext.IN_COMPARISON_NULL:
                if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning
                  scope.problemReporter().localVariableNullReference(local, expression);
                  continue;
                }
                if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) {
                  scope.problemReporter().localVariableRedundantCheckOnNull(local, expression);
                }
                continue;
              case FlowContext.IN_COMPARISON_NON_NULL:
                if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning
                  scope.problemReporter().localVariableNullReference(local, expression);
                  continue;
                }
                if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) {
                  scope.problemReporter().localVariableNullComparedToNonNull(local, expression);
                }
                continue;
              case FlowContext.IN_ASSIGNMENT:
                scope.problemReporter().localVariableRedundantNullAssignment(local, expression);
                continue;
              case FlowContext.IN_INSTANCEOF:
                scope.problemReporter().localVariableNullInstanceof(local, expression);
                continue;
            }
          } else if (flowInfo.isPotentiallyNull(local)) {
            switch(this.nullCheckTypes[i] & CONTEXT_MASK) {
              case FlowContext.IN_COMPARISON_NULL:
                this.nullReferences[i] = null;
                if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning
                  scope.problemReporter().localVariablePotentialNullReference(local, expression);
                  continue;
                }
                break;
              case FlowContext.IN_COMPARISON_NON_NULL:
                this.nullReferences[i] = null;
                if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning
                  scope.problemReporter().localVariablePotentialNullReference(local, expression);
                  continue;
                }
                break;
            }
          } 
          break;
        case MAY_NULL:
          if (flowInfo.isDefinitelyNull(local)) {
            this.nullReferences[i] = null;
            scope.problemReporter().localVariableNullReference(local, expression);
            continue;
          }
          break;
        default:
          // never happens
      }
      this.parent.recordUsingNullReference(scope, local, expression,
          this.nullCheckTypes[i], flowInfo);
    }
  }
  else {
    // check inconsistent null checks on outermost looping context
    for (int i = 0; i < this.nullCount; i++) {
      Expression expression = this.nullReferences[i];
      // final local variable
      LocalVariableBinding local = this.nullLocals[i];
      switch (this.nullCheckTypes[i]) {
        case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NULL:
        case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL:
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ast.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.