Examples of LocalVariableBinding


Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding

        if (this.codeStream.lastEntryPC == oldPosition) {
          this.codeStream.lastEntryPC = this.position;
        }
        // end of new code
        if ((this.codeStream.generateAttributes & (ClassFileConstants.ATTR_VARS | ClassFileConstants.ATTR_STACK_MAP)) != 0) {
          LocalVariableBinding locals[] = this.codeStream.locals;
          for (int i = 0, max = locals.length; i < max; i++) {
            LocalVariableBinding local = locals[i];
            if ((local != null) && (local.initializationCount > 0)) {
              if (local.initializationPCs[((local.initializationCount - 1) << 1) + 1] == oldPosition) {
                // we want to prevent interval of size 0 to have a negative size.
                // see PR 1GIRQLA: ITPJCORE:ALL - ClassFormatError for local variable attribute
                local.initializationPCs[((local.initializationCount - 1) << 1) + 1] = this.position;
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding

  }
  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:
          if (flowInfo.isDefinitelyNonNull(local)) {
            if (this.nullCheckTypes[i] == (CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL)) {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding

          }
      }
      switch(this.kind) {
        case ARRAY :
          // allocate #index secret variable (of type int)
          this.indexVariable = new LocalVariableBinding(SecretIndexVariableName, TypeBinding.INT, ClassFileConstants.AccDefault, false);
          scope.addLocalVariable(this.indexVariable);
          this.indexVariable.setConstant(Constant.NotAConstant); // not inlinable
         
          // allocate #max secret variable
          this.maxVariable = new LocalVariableBinding(SecretMaxVariableName, TypeBinding.INT, ClassFileConstants.AccDefault, false);
          scope.addLocalVariable(this.maxVariable);
          this.maxVariable.setConstant(Constant.NotAConstant); // not inlinable
          // add #array secret variable (of collection type)
          this.collectionVariable = new LocalVariableBinding(SecretCollectionVariableName, collectionType, ClassFileConstants.AccDefault, false);
          scope.addLocalVariable(this.collectionVariable);
          this.collectionVariable.setConstant(Constant.NotAConstant); // not inlinable
          break;
        case RAW_ITERABLE :
        case GENERIC_ITERABLE :
          // allocate #index secret variable (of type Iterator)
          this.indexVariable = new LocalVariableBinding(SecretIndexVariableName, scope.getJavaUtilIterator(), ClassFileConstants.AccDefault, false);
          scope.addLocalVariable(this.indexVariable);
          this.indexVariable.setConstant(Constant.NotAConstant); // not inlinable
          break;
        default :
          scope.problemReporter().invalidTypeForCollection(collection);
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding

    this.currentFrame.addStackItem(TypeBinding.NULL);
}
public void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
    // Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
    loop: for (int i = 0; i < visibleLocalsCount; i++) {
        LocalVariableBinding localBinding = visibleLocals[i];
        if (localBinding != null) {
            // Check if the local is definitely assigned
            boolean isDefinitelyAssigned = isDefinitelyAssigned(scope, initStateIndex, localBinding);
            if (!isDefinitelyAssigned) {
                if (this.stateIndexes != null) {
                    for (int j = 0, max = this.stateIndexesCounter; j < max; j++) {
                        if (isDefinitelyAssigned(scope, this.stateIndexes[j], localBinding)) {
                            currentFrame.putLocal(localBinding.resolvedPosition, new VerificationTypeInfo(localBinding.type));
                            if ((localBinding.initializationCount == 0) || (localBinding.initializationPCs[((localBinding.initializationCount - 1) << 1) + 1] != -1)) {
                                /* There are two cases:
                                 * 1) there is no initialization interval opened ==> add an opened interval
                                 * 2) there is already some initialization intervals but the last one is closed ==> add an opened interval
                                 * An opened interval means that the value at localBinding.initializationPCs[localBinding.initializationCount - 1][1]
                                 * is equals to -1.
                                 * initializationPCs is a collection of pairs of int:
                                 *   first value is the startPC and second value is the endPC. -1 one for the last value means that the interval
                                 *   is not closed yet.
                                 */
                                localBinding.recordInitializationStartPC(position);
                            }
                            continue loop;
                        }
                    }
                }
            } else {
                currentFrame.putLocal(localBinding.resolvedPosition, new VerificationTypeInfo(localBinding.type));
                if ((localBinding.initializationCount == 0) || (localBinding.initializationPCs[((localBinding.initializationCount - 1) << 1) + 1] != -1)) {
                    /* There are two cases:
                     * 1) there is no initialization interval opened ==> add an opened interval
                     * 2) there is already some initialization intervals but the last one is closed ==> add an opened interval
                     * An opened interval means that the value at localBinding.initializationPCs[localBinding.initializationCount - 1][1]
                     * is equals to -1.
                     * initializationPCs is a collection of pairs of int:
                     *   first value is the startPC and second value is the endPC. -1 one for the last value means that the interval
                     *   is not closed yet.
                     */
                    localBinding.recordInitializationStartPC(position);
                }
            }
        }
    }
    Integer newValue = new Integer(this.position);
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding

    }
}
public void exitUserScope(BlockScope currentScope) {
    int index = this.visibleLocalsCount - 1;
    while (index >= 0) {
        LocalVariableBinding visibleLocal = visibleLocals[index];
        if (visibleLocal == null) {
            index--;
            continue;
        }
        if (visibleLocal.declaringScope != currentScope) // left currentScope
            break;

        // there may be some preserved locals never initialized
        if (visibleLocal.initializationCount > 0){
            this.currentFrame.removeLocals(visibleLocal.resolvedPosition);
        }
        index--;
    }
    if (currentScope != null) {
        int localIndex = currentScope.localIndex;
        if (localIndex != 0) {
            for (int i = 0; i < localIndex; i++) {
                LocalVariableBinding variableBinding = currentScope.locals[i];
                if (variableBinding != null && variableBinding.useFlag == LocalVariableBinding.USED && variableBinding.resolvedPosition != -1) {
                    this.currentFrame.removeLocals(variableBinding.resolvedPosition);
                }
            }
        }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding

    super.exitUserScope(currentScope);
}
public void exitUserScope(BlockScope currentScope, LocalVariableBinding binding) {
    int index = this.visibleLocalsCount - 1;
    while (index >= 0) {
        LocalVariableBinding visibleLocal = visibleLocals[index];
        if (visibleLocal == null || visibleLocal == binding) {
            index--;
            continue;
        }
        if (visibleLocal.declaringScope != currentScope) // left currentScope
            break;

        // there may be some preserved locals never initialized
        if (visibleLocal.initializationCount > 0){
            this.currentFrame.removeLocals(visibleLocal.resolvedPosition);
        }
        index--;
    }
    if (currentScope != null) {
        int localIndex = currentScope.localIndex;
        if (localIndex != 0) {
            for (int i = 0; i < localIndex; i++) {
                LocalVariableBinding variableBinding = currentScope.locals[i];
                if (variableBinding != null && variableBinding != binding && variableBinding.useFlag == LocalVariableBinding.USED && variableBinding.resolvedPosition != -1) {
                    this.currentFrame.removeLocals(variableBinding.resolvedPosition);
                }
            }
        }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding

          output.append(CharOperation.concatWith(((ReferenceBinding) snr.binding).compoundName, '.'));
        } else if (snr.binding instanceof ParameterizedFieldBinding) {
          ParameterizedFieldBinding pfb = (ParameterizedFieldBinding) snr.binding;
          output.append(pfb.name);
        } else if (snr.binding instanceof LocalVariableBinding) {
          LocalVariableBinding lvb = (LocalVariableBinding) snr.binding;
          output.append(lvb.name);
        } else if (snr.binding instanceof FieldBinding) {
          FieldBinding fb = (FieldBinding) snr.binding;
          ReferenceBinding rb = fb.declaringClass;
          if (fb.isStatic()) {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding

  UnconditionalFlowInfo flowInfo = this.upstreamNullFlowInfo.
    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:
          if (flowInfo.isDefinitelyNonNull(local)) {
            this.nullReferences[i] = null;
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding

        }       
      }
      break;
    case Binding.LOCAL : // reading the first local variable
      if (!needValue) break; // no value needed
      LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
      // regular local variable read
      Constant localConstant = localBinding.constant();
      if (localConstant != Constant.NotAConstant) {
        codeStream.generateConstant(localConstant, 0);
        // no implicit conversion
      } else {
        // outer local?
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding

* @param flowContext the current flow context
* @param flowInfo the upstream flow info; caveat: may get modified
*/
public void checkNPE(BlockScope scope, FlowContext flowContext,
    FlowInfo flowInfo) {
  LocalVariableBinding local = this.localVariableBinding();
  if (local != null &&
      (local.type.tagBits & TagBits.IsBaseType) == 0) {
    if ((this.bits & ASTNode.IsNonNull) == 0) {
      flowContext.recordUsingNullReference(scope, local, this,
          FlowContext.MAY_NULL, flowInfo);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.