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

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


    arguments,
    location.sourceStart,
    location.sourceEnd);
}
public void annotationCannotOverrideMethod(MethodBinding overrideMethod, MethodBinding inheritedMethod) {
  ASTNode location = overrideMethod.sourceMethod();
  this.handle(
    IProblem.AnnotationCannotOverrideMethod,
    new String[] {
        new String(overrideMethod.declaringClass.readableName()),
        new String(inheritedMethod.declaringClass.readableName()),
View Full Code Here


    new String[] {new String(type.shortReadableName())},
    location.sourceStart,
    location.sourceEnd);
}
public void genericTypeCannotExtendThrowable(TypeDeclaration typeDecl) {
  ASTNode location = typeDecl.binding.isAnonymousType() ? typeDecl.allocation.type : typeDecl.superclass;
  this.handle(
    IProblem.GenericTypeCannotExtendThrowable,
    new String[]{ new String(typeDecl.binding.readableName()) },
    new String[]{ new String(typeDecl.binding.shortReadableName()) },
    location.sourceStart,
View Full Code Here

    if (location instanceof InvocationSite) {
      InvocationSite site = (InvocationSite) location;
      start = site.sourceStart();
      end = site.sourceEnd();
    } else if (location instanceof ASTNode) {
      ASTNode node = (ASTNode) location;
      start = node.sourceStart();
      end = node.sourceEnd();
    }
  }
  this.handle(
    IProblem.IsClassPathCorrect,
    arguments,
View Full Code Here

  int severity = computeSeverity(IProblem.UnsafeReturnTypeOverride);
  if (severity == ProblemSeverities.Ignore) return;
  int start = type.sourceStart();
  int end = type.sourceEnd();
  if (currentMethod.declaringClass == type) {
    ASTNode location = ((MethodDeclaration) currentMethod.sourceMethod()).returnType;
    start = location.sourceStart();
    end = location.sourceEnd();
  }
  this.handle(
      IProblem.UnsafeReturnTypeOverride,
      new String[] {
        new String(currentMethod.returnType.readableName()),
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];
      ASTNode location = this.nullReferences[i];
      // final local variable
      switch (this.nullCheckTypes[i] & ~HIDE_NULL_COMPARISON_WARNING_MASK) {
        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] & ~HIDE_NULL_COMPARISON_WARNING_MASK) == (CAN_ONLY_NON_NULL | IN_COMPARISON_NON_NULL)) {
              if ((this.nullCheckTypes[i] & HIDE_NULL_COMPARISON_WARNING) == 0) {
                scope.problemReporter().localVariableRedundantCheckOnNonNull(local, location);
              }
            } else {
              scope.problemReporter().localVariableNonNullComparedToNull(local, location);
            }
            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] & ~HIDE_NULL_COMPARISON_WARNING_MASK) == (CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL)) {
              if ((this.nullCheckTypes[i] & HIDE_NULL_COMPARISON_WARNING) == 0) {
                scope.problemReporter().localVariableRedundantCheckOnNonNull(local, location);
              }
            } else {
              scope.problemReporter().localVariableNonNullComparedToNull(local, location);
            }
            continue;
          }
          if (flowInfo.isDefinitelyNull(local)) {
            this.nullReferences[i] = null;
            if ((this.nullCheckTypes[i] & ~HIDE_NULL_COMPARISON_WARNING_MASK) == (CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NULL)) {
              if ((this.nullCheckTypes[i] & HIDE_NULL_COMPARISON_WARNING) == 0) {
                scope.problemReporter().localVariableRedundantCheckOnNull(local, location);
              }
            } else {
              scope.problemReporter().localVariableNullComparedToNonNull(local, location);
            }
            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:
          Expression expression = (Expression)location;
          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 & ~HIDE_NULL_COMPARISON_WARNING_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.nullCheckTypes[i] & HIDE_NULL_COMPARISON_WARNING) == 0) {
                  scope.problemReporter().localVariableRedundantCheckOnNull(local, expression);
                }
                continue;
              case FlowContext.IN_COMPARISON_NON_NULL:
                if (((this.nullCheckTypes[i] & CHECK_MASK & ~HIDE_NULL_COMPARISON_WARNING_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning
                  scope.problemReporter().localVariableNullReference(local, expression);
                  continue;
                }
                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 & ~HIDE_NULL_COMPARISON_WARNING_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 & ~HIDE_NULL_COMPARISON_WARNING_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, location);
            continue;
          }
          break;
        case ASSIGN_TO_NONNULL:
          int nullStatus = flowInfo.nullStatus(local);
          if (nullStatus != FlowInfo.NON_NULL) {
            this.parent.recordNullityMismatch(scope, (Expression)location, this.providedExpectedTypes[i][0], this.providedExpectedTypes[i][1], nullStatus);
          }
          break;
        case EXIT_RESOURCE:
            FakedTrackingVariable trackingVar = local.closeTracker;
            if (trackingVar != null) {
              if (trackingVar.hasDefinitelyNoResource(flowInfo)) {
                continue; // no resource - no warning.
              }
              if (trackingVar.isClosedInFinallyOfEnclosing(scope)) {
                continue;
              }
              if (this.parent.recordExitAgainstResource(scope, flowInfo, trackingVar, location)) {
                this.nullReferences[i] = null;
                continue;
              }
            }
          break;
        default:
          // never happens
      }
      this.parent.recordUsingNullReference(scope, local, location,
          this.nullCheckTypes[i], flowInfo);
    }
  }
  else {
    // check inconsistent null checks on outermost looping context
    for (int i = 0; i < this.nullCount; i++) {
      ASTNode location = this.nullReferences[i];
      // final local variable
      LocalVariableBinding local = this.nullLocals[i];
      switch (this.nullCheckTypes[i] & ~HIDE_NULL_COMPARISON_WARNING_MASK) {
        case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NULL:
        case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL:
View Full Code Here

private ASTNode getExceptionType(int index) { 
  if (this.exceptionToCatchBlockMap == null) {
    return this.catchArguments[index].type;
  }
  int catchBlock = this.exceptionToCatchBlockMap[index];
  ASTNode node = this.catchArguments[catchBlock].type;
  if (node instanceof UnionTypeReference) {
    TypeReference[] typeRefs = ((UnionTypeReference)node).typeReferences;
    for (int i = 0, len = typeRefs.length; i < len; i++) {
      TypeReference typeRef = typeRefs[i];
      if (TypeBinding.equalsEquals(typeRef.resolvedType, this.handledExceptions[index])) return typeRef;
View Full Code Here

  }

  if (element == null) return element;

  for(int i = 0; i <= this.astPtr; i++){
    ASTNode node = this.astStack[i];
    if (node instanceof AbstractMethodDeclaration){
      AbstractMethodDeclaration method = (AbstractMethodDeclaration) node;
      if (method.declarationSourceEnd == 0){
        element = element.add(method, 0);
        this.lastCheckPoint = method.bodyStart;
View Full Code Here

  int endOfEnumConstant = this.intStack[this.intPtr--];
  final FieldDeclaration fieldDeclaration = (FieldDeclaration) this.astStack[this.astPtr];
  fieldDeclaration.declarationEnd = endOfEnumConstant;
  fieldDeclaration.declarationSourceEnd = endOfEnumConstant;
  // initialize the starting position of the allocation expression
  ASTNode initialization = fieldDeclaration.initialization;
  if (initialization != null) {
    initialization.sourceEnd = endOfEnumConstant;
  }
}
View Full Code Here

  int declarationSourceEnd = anonymousType.declarationSourceEnd;
  fieldDeclaration.declarationSourceEnd = declarationSourceEnd;
  this.intPtr --; // remove end position of the arguments
  this.variablesCounter[this.nestedType] = 0;
  this.nestedType--;
  ASTNode initialization = fieldDeclaration.initialization;
  if (initialization != null) {
    initialization.sourceEnd = declarationSourceEnd;
  }
}
View Full Code Here

    return;
  int[] flag = new int[length + 1]; //plus one -- see <HERE>
  int size1 = 0, size2 = 0, size3 = 0;
  boolean hasAbstractMethods = false;
  for (int i = length - 1; i >= 0; i--) {
    ASTNode astNode = this.astStack[this.astPtr--];
    if (astNode instanceof AbstractMethodDeclaration) {
      //methods and constructors have been regrouped into one single list
      flag[i] = 2;
      size2++;
      if (((AbstractMethodDeclaration) astNode).isAbstract()) {
View Full Code Here

TOP

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

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.