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

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


  System.arraycopy(this.isReached, 0, this.isNeeded, 0, cacheSize);
  this.initsOnReturn = FlowInfo.DEAD_END; 
}

public void complainIfUnusedExceptionHandlers(AbstractMethodDeclaration method) {
  MethodScope scope = method.scope;
  // can optionally skip overriding methods
  if ((method.binding.modifiers & (ExtraCompilerModifiers.AccOverriding | ExtraCompilerModifiers.AccImplementing)) != 0
          && !scope.compilerOptions().reportUnusedDeclaredThrownExceptionWhenOverriding) {
      return;
  }
     
  // report errors for unreachable exception handlers
  for (int i = 0, count = this.handledExceptions.length; i < count; i++) {
    int index = this.indexes.get(this.handledExceptions[i]);
    int cacheIndex = index / ExceptionHandlingFlowContext.BitCacheSize;
    int bitMask = 1 << (index % ExceptionHandlingFlowContext.BitCacheSize);
    if ((this.isReached[cacheIndex] & bitMask) == 0) {
      scope.problemReporter().unusedDeclaredThrownException(
        this.handledExceptions[index],
        method,
        method.thrownExceptions[index]);
    }
  }
View Full Code Here


      case Scope.COMPILATION_UNIT_SCOPE:
      case Scope.CLASS_SCOPE:
        specifiedTags = CLASS_TAGS;
        break;
      case Scope.METHOD_SCOPE:
        MethodScope methodScope = (MethodScope) scope;
        if (methodScope.referenceMethod() == null) {
          if (methodScope.initializedField == null) {
            specifiedTags = PACKAGE_TAGS;
          } else {
            specifiedTags = FIELD_TAGS;
          }
View Full Code Here

  public TypeBinding resolveType(BlockScope scope) {
 
    // implicit this
    this.constant = Constant.NotAConstant;
    TypeBinding snippetType = null;
    MethodScope methodScope = scope.methodScope();
    if (!this.isImplicit && !checkAccess(methodScope)) {
      return null;
    }
    snippetType = scope.enclosingSourceType();
   
    this.delegateThis = scope.getField(snippetType, DELEGATE_THIS, this);
    if (this.delegateThis == null || !this.delegateThis.isValidBinding()) {
      // should not happen
      // if this happen we should report illegal access to this in a static context
      methodScope.problemReporter().errorThisSuperInStatic(this);
      return null;
    }
    return this.resolvedType = this.delegateThis.type;
  }
View Full Code Here

    this.scribe.space();
    /*
     * Print the method return type
     */ 
    final TypeReference returnType = annotationTypeMemberDeclaration.returnType;
    final MethodScope annotationTypeMemberDeclarationScope = annotationTypeMemberDeclaration.scope;
   
    if (returnType != null) {
      returnType.traverse(this, annotationTypeMemberDeclarationScope);
    }
    /*
 
View Full Code Here

   
    /*
     * Print the method return type
     */ 
    final TypeReference returnType = methodDeclaration.returnType;
    final MethodScope methodDeclarationScope = methodDeclaration.scope;
   
    if (returnType != null) {
      returnType.traverse(this, methodDeclarationScope);
    }
    /*
 
View Full Code Here

   * by the ITD can be resolved.  For example, if type variables are referred to in the ontype for the ITD,
   * they have to be resolved against the ontype, not the aspect containing the ITD.
   */
  public void ensureScopeSetup() {
    if (scopeSetup) return; // don't do it again
    MethodScope scope = this.scope;
   
    TypeReference ot = onType;
    ReferenceBinding rb = null;
   
    if (ot instanceof ParameterizedQualifiedTypeReference) { // pr132349
      ParameterizedQualifiedTypeReference pref = (ParameterizedQualifiedTypeReference) ot;
      if (pref.typeArguments!=null && pref.typeArguments.length!=0) {
        boolean usingNonTypeVariableInITD = false;
        // Check if any of them are not type variables
        for (int i = 0; i < pref.typeArguments.length; i++) {
          TypeReference[] refs = pref.typeArguments[i];
          for (int j = 0; refs!=null && j < refs.length; j++) {
            TypeBinding tb = refs[j].getTypeBindingPublic(scope.parent);
            if (!tb.isTypeVariable() && !(tb instanceof ProblemReferenceBinding)) {
              usingNonTypeVariableInITD = true;
            }
           
          }
        }
        if (usingNonTypeVariableInITD) {
          scope.problemReporter().signalError(sourceStart,sourceEnd,
            "Cannot make inter-type declarations on parameterized types");
          // to prevent disgusting cascading errors after this problem - lets null out what leads to them (pr105038)
          this.arguments=null;
          this.returnType=new SingleTypeReference(TypeReference.VOID,0L);
         
          this.ignoreFurtherInvestigation=true;
          ReferenceBinding closestMatch = null;
          rb = new ProblemReferenceBinding(ot.getParameterizedTypeName(),closestMatch,0);   
          onType=null;
        }
      }
   
    }

    // Work out the real base type
    if (ot instanceof ParameterizedSingleTypeReference) {
      ParameterizedSingleTypeReference pref = (ParameterizedSingleTypeReference) ot;
      long pos = (((long)pref.sourceStart) << 32) | pref.sourceEnd;
      ot = new SingleTypeReference(pref.token,pos);
    } else if (ot instanceof ParameterizedQualifiedTypeReference) {
      ParameterizedQualifiedTypeReference pref = (ParameterizedQualifiedTypeReference) ot;
      long pos = (((long)pref.sourceStart) << 32) | pref.sourceEnd;
      ot = new QualifiedTypeReference(pref.tokens,new long[]{pos});//SingleTypeReference(pref.Quatoken,pos);
    }
   
    // resolve it
    if (rb==null) {
      rb = (ReferenceBinding)ot.getTypeBindingPublic(scope.parent);
    }
   
    // pr203646 - if we have ended up with the raw type, get back to the underlying generic one.
    if (rb.isRawType() && rb.isMemberType()) {
      // if the real target type used a type variable alias then we can do this OK, but need to switch things around, we want the generic type
      rb = ((RawTypeBinding)rb).type;
    }
   
    if (rb instanceof TypeVariableBinding) {
      scope.problemReporter().signalError(sourceStart,sourceEnd,
            "Cannot make inter-type declarations on type variables, use an interface and declare parents");
      // to prevent disgusting cascading errors after this problem - lets null out what leads to them (pr105038)
      this.arguments=null;
      this.returnType=new SingleTypeReference(TypeReference.VOID,0L);
     
View Full Code Here

      superBinding = ((ParameterizedMethodBinding) superBinding).original();
    }
    EclipseFactory factory = ((AjLookupEnvironment) method.scope.environment()).factory;
    if (depthCounter != 0 && targetClass.isInterface()) {// pr198196 - when calling MarkerInterface.super.XXX()
      if (call.isSuperAccess() && !call.binding.isStatic()) {
        MethodScope currentMethodScope = scope.methodScope();
        SourceTypeBinding sourceType = currentMethodScope.enclosingSourceType();
        FieldBinding field = sourceType.addSyntheticFieldForInnerclass(targetClass);
        call.receiver = new KnownFieldReference(field, call.receiver.sourceStart, call.receiver.sourceEnd);
      } else {
        return;
      }
View Full Code Here

    codeStream.reset(this, classFile);
    TypeDeclaration declaringType = classScope.referenceContext;

    // initialize local positions - including initializer scope.
    MethodScope staticInitializerScope = declaringType.staticInitializerScope;
    staticInitializerScope.computeLocalVariablePositions(0, codeStream);

    // 1.4 feature
    // This has to be done before any other initialization
    // AspectJ Extension - move logic to helper method
    // was:
View Full Code Here

    return output;
  }

  public void resolve(ClassScope classScope) {

    this.scope = new MethodScope(classScope, classScope.referenceContext, true);
  }
View Full Code Here

      if (visitor.visit(this, this.scope)) {
        if (this.types != null && isPackageInfo()) {
                // resolve synthetic type declaration
          final TypeDeclaration syntheticTypeDeclaration = types[0];
          // resolve javadoc package if any
          final MethodScope methodScope = syntheticTypeDeclaration.staticInitializerScope;
          if (this.javadoc != null) {
            this.javadoc.traverse(visitor, methodScope);
          }
          if (this.currentPackage != null) {
            final Annotation[] annotations = this.currentPackage.annotations;
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodScope

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.