Package org.eclipse.jdt.internal.compiler.lookup

Examples of org.eclipse.jdt.internal.compiler.lookup.VariableBinding


* @param flowInfo the flow info against which checks must be performed
*/
public void complainOnDeferredFinalChecks(BlockScope scope, FlowInfo flowInfo) {
  // complain on final assignments in loops
  for (int i = 0; i < this.assignCount; i++) {
    VariableBinding variable = this.finalVariables[i];
    if (variable == null) continue;
    boolean complained = false; // remember if have complained on this final assignment
    if (variable instanceof FieldBinding) {
      if (flowInfo.isPotentiallyAssigned((FieldBinding)variable)) {
        complained = true;
View Full Code Here


public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) {
  if (!super.checkNPE(scope, flowContext, flowInfo)) {
    CompilerOptions compilerOptions = scope.compilerOptions();
    if (compilerOptions.isAnnotationBasedNullAnalysisEnabled) {
      VariableBinding var = nullAnnotatedVariableBinding(compilerOptions.sourceLevel >= ClassFileConstants.JDK1_8);
      if (var instanceof FieldBinding) {
        checkNullableFieldDereference(scope, (FieldBinding) var, ((long)this.sourceStart<<32)+this.sourceEnd);
        return true;
      }
    }
View Full Code Here

  if (this.binding.isValidBinding()) {
    switch (this.bits & ASTNode.RestrictiveFlagMASK) {
      case Binding.VARIABLE : // =========only variable============
      case Binding.VARIABLE | Binding.TYPE : //====both variable and type============
        if (this.binding instanceof VariableBinding) {
          VariableBinding variable = (VariableBinding) this.binding;
          TypeBinding variableType;
          if (this.binding instanceof LocalVariableBinding) {
            this.bits &= ~ASTNode.RestrictiveFlagMASK;  // clear bits
            this.bits |= Binding.LOCAL;
            if (!variable.isFinal() && (this.bits & ASTNode.IsCapturedOuterLocal) != 0) {
              if (scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_8) // for 8, defer till effective finality could be ascertained.
                scope.problemReporter().cannotReferToNonFinalOuterLocal((LocalVariableBinding)variable, this);
            }
            variableType = variable.type;
            this.constant = (this.bits & ASTNode.IsStrictlyAssigned) == 0 ? variable.constant() : Constant.NotAConstant;
          } else {
            // a field
            variableType = checkFieldAccess(scope);
          }
          // perform capture conversion if read access
View Full Code Here

      nullityMismatchSpecdNullable(expression, requiredType, this.options.nonNullAnnotationName);
      return;
    }
  }
  if ((nullStatus & FlowInfo.POTENTIALLY_NULL) != 0) {
    VariableBinding var = expression.localVariableBinding();
    if (var == null && expression instanceof Reference) {
      var = ((Reference)expression).lastFieldBinding();
    }
    if (var != null && var.isNullable()) {
      nullityMismatchSpecdNullable(expression, requiredType, annotationName);
      return;
    }
    nullityMismatchPotentiallyNull(expression, requiredType, annotationName);
    return;
View Full Code Here

}

public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) {
  if (!super.checkNPE(scope, flowContext, flowInfo)) {
    VariableBinding var = nullAnnotatedVariableBinding();
    if (var instanceof FieldBinding) {
      checkNullableFieldDereference(scope, (FieldBinding) var, ((long)this.sourceStart<<32)+this.sourceEnd);
      return true;
    }
  }
View Full Code Here

  if (this.binding.isValidBinding()) {
    switch (this.bits & ASTNode.RestrictiveFlagMASK) {
      case Binding.VARIABLE : // =========only variable============
      case Binding.VARIABLE | Binding.TYPE : //====both variable and type============
        if (this.binding instanceof VariableBinding) {
          VariableBinding variable = (VariableBinding) this.binding;
          TypeBinding variableType;
          if (this.binding instanceof LocalVariableBinding) {
            this.bits &= ~ASTNode.RestrictiveFlagMASK;  // clear bits
            this.bits |= Binding.LOCAL;
            if (!variable.isFinal() && (this.bits & ASTNode.DepthMASK) != 0) {
              scope.problemReporter().cannotReferToNonFinalOuterLocal((LocalVariableBinding)variable, this);
            }
            variableType = variable.type;
            this.constant = (this.bits & ASTNode.IsStrictlyAssigned) == 0 ? variable.constant() : Constant.NotAConstant;
          } else {
            // a field
            variableType = checkFieldAccess(scope);
          }
          // perform capture conversion if read access
View Full Code Here

          VariableBinding[] vars = currentMethodScope.getEmulationPath(localBinding);
          if (vars == null) {
            return null;
          }
          assert (vars.length == 1);
          VariableBinding varBinding = vars[0];

          // See if there's an available parameter
          if (varBinding instanceof SyntheticArgumentBinding) {
            JType type = (JType) typeMap.get(varBinding.type);
            String name = String.valueOf(varBinding.name);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.lookup.VariableBinding

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.