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

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


          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


   
    return this.newCodeFormatter.format(source, compilationUnitDeclaration);
  }

  private TextEdit formatExpression(String source, int indentationLevel, String lineSeparator, int offset, int length) {
    Expression expression = this.codeSnippetParsingUtil.parseExpression(source.toCharArray(), getDefaultCompilerOptions(), true);
   
    if (expression == null) {
      // a problem occured while parsing the source
      return null;
    }
View Full Code Here

      // ignore
    }
    ProbingScanner.setSource((char[]) null);

    // probe for expression
    Expression expression = this.codeSnippetParsingUtil.parseExpression(source.toCharArray(), getDefaultCompilerOptions(), true);
    if (expression != null) {
      return internalFormatExpression(source, indentationLevel, lineSeparator, expression, offset, length);
    }

    // probe for body declarations (fields, methods, constructors)
View Full Code Here

    addPotentialNullInfoFrom(callerFlowInfo.unconditionalInitsWithoutSideEffect());
  if (this.deferNullDiagnostic) {
    // 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)) {
              scope.problemReporter().localVariableRedundantCheckOnNonNull(local, expression);
            } else {
              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)) {
              scope.problemReporter().localVariableRedundantCheckOnNonNull(local, expression);
            } else {
              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)) {
              scope.problemReporter().localVariableRedundantCheckOnNull(local, expression);
            } else {
              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:
                scope.problemReporter().localVariableRedundantCheckOnNull(local, expression);
                continue;
              case FlowContext.IN_COMPARISON_NON_NULL:
                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;
            }
          }
          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

  if (this.arguments != null) {
    boolean argHasError = false;
    int length = this.arguments.length;
    argumentTypes = new TypeBinding[length];
    for (int i = 0; i < length; i++) {
      Expression argument = this.arguments[i];
      if (argument instanceof CastExpression) {
        argument.bits |= DisableUnnecessaryCastCheck; // will check later on
        argsContainCast = true;
      }
      if ((argumentTypes[i] = argument.resolveType(scope)) == null) {
        argHasError = true;
      }
    }
    if (argHasError) {
      return this.resolvedType;
View Full Code Here

    }
 
    /*
     * Field initialization
     */
    final Expression initialization = fieldDeclaration.initialization;
    if (initialization != null) {
      this.scribe.alignFragment(memberAlignment, 1);
      this.scribe.printNextToken(TerminalTokens.TokenNameEQUAL, this.preferences.insert_space_before_assignment_operator);
      if (this.preferences.insert_space_after_assignment_operator) {
        this.scribe.space();
      }
      Alignment assignmentAlignment = this.scribe.createAlignment("fieldDeclarationAssignmentAlignment", this.preferences.alignment_for_assignment, Alignment.R_OUTERMOST, 1, this.scribe.scanner.currentPosition); //$NON-NLS-1$
      this.scribe.enterAlignment(assignmentAlignment);
      boolean ok = false;
      do {
        try {
          this.scribe.alignFragment(assignmentAlignment, 0);
          initialization.traverse(this, scope);
          ok = true;
        } catch(AlignmentException e){
          this.scribe.redoAlignment(e);
        }
      } while (!ok);   
View Full Code Here

          }
       
          /*
           * Field initialization
           */
          final Expression initialization = fieldDeclaration.initialization;
          if (initialization != null) {
            if (i == 0) {
              this.scribe.alignFragment(fieldAlignment, 1);
            }
            this.scribe.printNextToken(TerminalTokens.TokenNameEQUAL, this.preferences.insert_space_before_assignment_operator);
            if (this.preferences.insert_space_after_assignment_operator) {
              this.scribe.space();
            }
            initialization.traverse(this, scope);
          }
         
          if (i != length - 1) {
            this.scribe.printNextToken(TerminalTokens.TokenNameCOMMA, this.preferences.insert_space_before_comma_in_multiple_field_declarations);
            this.scribe.printTrailingComment();
View Full Code Here

  }

  private void formatCascadingMessageSends(CascadingMethodInvocationFragmentBuilder builder, BlockScope scope) {
    int size = builder.size();
    MessageSend[] fragments = builder.fragments();
    Expression fragment = fragments[0].receiver;
    int startingPositionInCascade = 1;
    if (!fragment.isImplicitThis()) {
      fragment.traverse(this, scope);
    } else {
      MessageSend currentMessageSend = fragments[1];
      final int numberOfParens = (currentMessageSend.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
      if (numberOfParens > 0) {
        manageOpeningParenthesizedExpression(currentMessageSend, numberOfParens);
View Full Code Here

         this.scribe.printNextToken(TerminalTokens.TokenNameLBRACKET);
         this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET);
       }
    }
 
    final Expression initialization = localDeclaration.initialization;
    if (initialization != null) {
      /*
       * Print the method name
       */ 
      this.scribe.printNextToken(TerminalTokens.TokenNameEQUAL, this.preferences.insert_space_before_assignment_operator);
      if (this.preferences.insert_space_after_assignment_operator) {
        this.scribe.space();
      }
      Alignment assignmentAlignment = this.scribe.createAlignment("localDeclarationAssignmentAlignment", this.preferences.alignment_for_assignment, Alignment.R_OUTERMOST, 1, this.scribe.scanner.currentPosition); //$NON-NLS-1$
      this.scribe.enterAlignment(assignmentAlignment);
      boolean ok = false;
      do {
        try {
          this.scribe.alignFragment(assignmentAlignment, 0);
          initialization.traverse(this, scope);
          ok = true;
        } catch(AlignmentException e){
          this.scribe.redoAlignment(e);
        }
      } while (!ok);   
View Full Code Here

         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.printTrailingComment();
    return false;
  }
View Full Code Here

TOP

Related Classes of org.aspectj.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.