Package org.eclipse.jdt.internal.compiler.flow

Examples of org.eclipse.jdt.internal.compiler.flow.ExceptionHandlingFlowContext


    FlowInfo flowInfo) {

    if (this.ignoreFurtherInvestigation)
      return;
    try {
      ExceptionHandlingFlowContext clinitContext =
        new ExceptionHandlingFlowContext(
          staticInitializerFlowContext.parent,
          this,
          Binding.NO_EXCEPTIONS,
          staticInitializerFlowContext,
          this.scope,
View Full Code Here


      // may be in a non necessary <clinit> for innerclass with static final constant fields
      if (this.binding.isAbstract() || this.binding.isNative())
        return;

      ExceptionHandlingFlowContext methodContext =
        new ExceptionHandlingFlowContext(
          initializationContext,
          this,
          this.binding.thrownExceptions,
          null,
          this.scope,
          FlowInfo.DEAD_END);

      // tag parameters as being set
      if (this.arguments != null) {
        for (int i = 0, count = this.arguments.length; i < count; i++) {
          flowInfo.markAsDefinitelyAssigned(this.arguments[i].binding);
          // if this method uses a type parameter declared by the declaring class,
          // it can't be static. https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
          if (this.arguments[i].binding != null && (this.arguments[i].binding.type instanceof TypeVariableBinding)) {
            Binding declaringElement = ((TypeVariableBinding)this.arguments[i].binding.type).declaringElement;
            if (this.binding != null && this.binding.declaringClass == declaringElement)
              this.bits &= ~ASTNode.CanBeStatic;
          }
        }
      }
      if (this.binding.declaringClass instanceof MemberTypeBinding && !this.binding.declaringClass.isStatic()) {
        // method of a non-static member type can't be static.
        this.bits &= ~ASTNode.CanBeStatic;
      }
      // propagate to statements
      if (this.statements != null) {
        int complaintLevel = (flowInfo.reachMode() & FlowInfo.UNREACHABLE) == 0 ? Statement.NOT_COMPLAINED : Statement.COMPLAINED_FAKE_REACHABLE;
        for (int i = 0, count = this.statements.length; i < count; i++) {
          Statement stat = this.statements[i];
          if ((complaintLevel = stat.complainIfUnreachable(flowInfo, this.scope, complaintLevel)) < Statement.COMPLAINED_UNREACHABLE) {
            flowInfo = stat.analyseCode(this.scope, methodContext, flowInfo);
          }
        }
      } else {
        // method with empty body should not be flagged as static.
        this.bits &= ~ASTNode.CanBeStatic;
      }
      // check for missing returning path
      TypeBinding returnTypeBinding = this.binding.returnType;
      if ((returnTypeBinding == TypeBinding.VOID) || isAbstract()) {
        if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) {
          this.bits |= ASTNode.NeedFreeReturn;
        }
      } else {
        if (flowInfo != FlowInfo.DEAD_END) {
          this.scope.problemReporter().shouldReturn(returnTypeBinding, this);
        }
      }
      // check unreachable catch blocks
      methodContext.complainIfUnusedExceptionHandlers(this);
      // check unused parameters
      this.scope.checkUnusedParameters(this.binding);
      // check if the method could have been static
      if (!this.binding.isStatic() && (this.bits & ASTNode.CanBeStatic) != 0) {
        if(!this.binding.isOverriding() && !this.binding.isImplementing()) {
View Full Code Here

    FlowInfo flowInfo) {

    if (this.ignoreFurtherInvestigation)
      return;
    try {
      ExceptionHandlingFlowContext clinitContext =
        new ExceptionHandlingFlowContext(
          staticInitializerFlowContext.parent,
          this,
          Binding.NO_EXCEPTIONS,
          staticInitializerFlowContext,
          this.scope,
View Full Code Here

      // may be in a non necessary <clinit> for innerclass with static final constant fields
      if (this.binding.isAbstract() || this.binding.isNative())
        return;

      ExceptionHandlingFlowContext methodContext =
        new ExceptionHandlingFlowContext(
          initializationContext,
          this,
          this.binding.thrownExceptions,
          null,
          this.scope,
          FlowInfo.DEAD_END);

      // tag parameters as being set
      if (this.arguments != null) {
        for (int i = 0, count = this.arguments.length; i < count; i++) {
          flowInfo.markAsDefinitelyAssigned(this.arguments[i].binding);
        }
      }
      // propagate to statements
      if (this.statements != null) {
        int complaintLevel = (flowInfo.reachMode() & FlowInfo.UNREACHABLE) == 0 ? Statement.NOT_COMPLAINED : Statement.COMPLAINED_FAKE_REACHABLE;
        for (int i = 0, count = this.statements.length; i < count; i++) {
          Statement stat = this.statements[i];
          if ((complaintLevel = stat.complainIfUnreachable(flowInfo, this.scope, complaintLevel)) < Statement.COMPLAINED_UNREACHABLE) {
            flowInfo = stat.analyseCode(this.scope, methodContext, flowInfo);
          }
        }
      }
      // check for missing returning path
      TypeBinding returnTypeBinding = this.binding.returnType;
      if ((returnTypeBinding == TypeBinding.VOID) || isAbstract()) {
        if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) {
          this.bits |= ASTNode.NeedFreeReturn;
        }
      } else {
        if (flowInfo != FlowInfo.DEAD_END) {
          this.scope.problemReporter().shouldReturn(returnTypeBinding, this);
        }
      }
      // check unreachable catch blocks
      methodContext.complainIfUnusedExceptionHandlers(this);
      // check unused parameters
      this.scope.checkUnusedParameters(this.binding);
    } catch (AbortMethod e) {
      this.ignoreFurtherInvestigation = true;
    }
View Full Code Here

      // may be in a non necessary <clinit> for innerclass with static final constant fields
      if (this.binding.isAbstract() || this.binding.isNative())
        return;

      ExceptionHandlingFlowContext methodContext =
        new ExceptionHandlingFlowContext(
          flowContext,
          this,
          this.binding.thrownExceptions,
          null,
          this.scope,
          FlowInfo.DEAD_END);

      // nullity and mark as assigned
      analyseArguments(flowInfo);

      if (this.arguments != null) {
        for (int i = 0, count = this.arguments.length; i < count; i++) {
          // if this method uses a type parameter declared by the declaring class,
          // it can't be static. https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
          if (this.arguments[i].binding != null && (this.arguments[i].binding.type instanceof TypeVariableBinding)) {
            Binding declaringElement = ((TypeVariableBinding)this.arguments[i].binding.type).declaringElement;
            if (this.binding != null && this.binding.declaringClass == declaringElement)
              this.bits &= ~ASTNode.CanBeStatic;
          }
        }
      }
      if (this.binding.declaringClass instanceof MemberTypeBinding && !this.binding.declaringClass.isStatic()) {
        // method of a non-static member type can't be static.
        this.bits &= ~ASTNode.CanBeStatic;
      }
      // propagate to statements
      if (this.statements != null) {
        int complaintLevel = (flowInfo.reachMode() & FlowInfo.UNREACHABLE) == 0 ? Statement.NOT_COMPLAINED : Statement.COMPLAINED_FAKE_REACHABLE;
        for (int i = 0, count = this.statements.length; i < count; i++) {
          Statement stat = this.statements[i];
          if ((complaintLevel = stat.complainIfUnreachable(flowInfo, this.scope, complaintLevel, true)) < Statement.COMPLAINED_UNREACHABLE) {
            flowInfo = stat.analyseCode(this.scope, methodContext, flowInfo);
          }
        }
      } else {
        // method with empty body should not be flagged as static.
        this.bits &= ~ASTNode.CanBeStatic;
      }
      // check for missing returning path
      TypeBinding returnTypeBinding = this.binding.returnType;
      if ((returnTypeBinding == TypeBinding.VOID) || isAbstract()) {
        if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) {
          this.bits |= ASTNode.NeedFreeReturn;
        }
      } else {
        if (flowInfo != FlowInfo.DEAD_END) {
          this.scope.problemReporter().shouldReturn(returnTypeBinding, this);
        }
      }
      // check unreachable catch blocks
      methodContext.complainIfUnusedExceptionHandlers(this);
      // check unused parameters
      this.scope.checkUnusedParameters(this.binding);
      // check if the method could have been static
      if (!this.binding.isStatic() && (this.bits & ASTNode.CanBeStatic) != 0) {
        if(!this.binding.isOverriding() && !this.binding.isImplementing()) {
View Full Code Here

    FlowInfo flowInfo) {

    if (this.ignoreFurtherInvestigation)
      return;
    try {
      ExceptionHandlingFlowContext clinitContext =
        new ExceptionHandlingFlowContext(
          staticInitializerFlowContext.parent,
          this,
          Binding.NO_EXCEPTIONS,
          staticInitializerFlowContext,
          this.scope,
View Full Code Here

  }

  private boolean doesNotCompleteNormally() {
    try {
      return this.body.analyseCode(this.scope,
                   new ExceptionHandlingFlowContext(null, this, Binding.NO_EXCEPTIONS, null, this.scope, FlowInfo.DEAD_END),
                   UnconditionalFlowInfo.fakeInitializedFlowInfo(this.scope.outerMostMethodScope().analysisIndex, this.scope.referenceType().maxFieldCount)) == FlowInfo.DEAD_END;
    } catch (RuntimeException e) {
      this.scope.problemReporter().lambdaShapeComputationError(this);
      return this.valueCompatible;
    }
View Full Code Here

   
    if (this.ignoreFurtherInvestigation)
      return flowInfo;
   
    FlowInfo lambdaInfo = flowInfo.copy(); // what happens in vegas, stays in vegas ...
    ExceptionHandlingFlowContext methodContext =
        new ExceptionHandlingFlowContext(
            flowContext,
            this,
            this.binding.thrownExceptions,
            null,
            this.scope,
View Full Code Here

    FlowInfo flowInfo) {

    if (this.ignoreFurtherInvestigation)
      return;
    try {
      ExceptionHandlingFlowContext clinitContext =
        new ExceptionHandlingFlowContext(
          staticInitializerFlowContext.parent,
          this,
          Binding.NO_EXCEPTIONS,
          staticInitializerFlowContext,
          this.scope,
View Full Code Here

          if ((typeParameter.binding.modifiers  & ExtraCompilerModifiers.AccLocallyUsed) == 0) {
            this.scope.problemReporter().unusedTypeParameter(typeParameter);           
          }
        }
      }
      ExceptionHandlingFlowContext methodContext =
        new ExceptionHandlingFlowContext(
          flowContext,
          this,
          this.binding.thrownExceptions,
          null,
          this.scope,
          FlowInfo.DEAD_END);

      // nullity and mark as assigned
      if (classScope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_8)
        analyseArguments(flowInfo, this.arguments, this.binding);
      else
        analyseArguments18(flowInfo, this.arguments, this.binding);

      if (this.binding.declaringClass instanceof MemberTypeBinding && !this.binding.declaringClass.isStatic()) {
        // method of a non-static member type can't be static.
        this.bits &= ~ASTNode.CanBeStatic;
      }
      // propagate to statements
      if (this.statements != null) {
        boolean enableSyntacticNullAnalysisForFields = this.scope.compilerOptions().enableSyntacticNullAnalysisForFields;
        int complaintLevel = (flowInfo.reachMode() & FlowInfo.UNREACHABLE) == 0 ? Statement.NOT_COMPLAINED : Statement.COMPLAINED_FAKE_REACHABLE;
        for (int i = 0, count = this.statements.length; i < count; i++) {
          Statement stat = this.statements[i];
          if ((complaintLevel = stat.complainIfUnreachable(flowInfo, this.scope, complaintLevel, true)) < Statement.COMPLAINED_UNREACHABLE) {
            flowInfo = stat.analyseCode(this.scope, methodContext, flowInfo);
          }
          if (enableSyntacticNullAnalysisForFields) {
            methodContext.expireNullCheckedFieldInfo();
          }
        }
      } else {
        // method with empty body should not be flagged as static.
        this.bits &= ~ASTNode.CanBeStatic;
      }
      // check for missing returning path
      TypeBinding returnTypeBinding = this.binding.returnType;
      if ((returnTypeBinding == TypeBinding.VOID) || isAbstract()) {
        if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) {
          this.bits |= ASTNode.NeedFreeReturn;
        }
      } else {
        if (flowInfo != FlowInfo.DEAD_END) {
          this.scope.problemReporter().shouldReturn(returnTypeBinding, this);
        }
      }
      // check unreachable catch blocks
      methodContext.complainIfUnusedExceptionHandlers(this);
      // check unused parameters
      this.scope.checkUnusedParameters(this.binding);
      // check if the method could have been static
      if (!this.binding.isStatic() && (this.bits & ASTNode.CanBeStatic) != 0 && !this.isDefaultMethod()) {
        if(!this.binding.isOverriding() && !this.binding.isImplementing()) {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.flow.ExceptionHandlingFlowContext

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.