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

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


      }
      if (this.indexOfFirstFieldBinding == 1) { // was an implicit reference to the first field binding
        ReferenceBinding declaringClass = lastFieldBinding.declaringClass;
        // check if accessing enum static field in initializer         
        if (declaringClass.isEnum()) {
          MethodScope methodScope = currentScope.methodScope();
          SourceTypeBinding sourceType = methodScope.enclosingSourceType();
          if (lastFieldBinding.isStatic()
              && (sourceType == declaringClass || sourceType.superclass == declaringClass) // enum constant body
              && lastFieldBinding.constant() == Constant.NotAConstant
              && !methodScope.isStatic
              && methodScope.isInsideInitializerOrConstructor()) {
            currentScope.problemReporter().enumStaticFieldUsedDuringInitialization(lastFieldBinding, this);
          }
        }       
      }
      // check if final blank field
View Full Code Here


      if (this.indexOfFirstFieldBinding == 1) { // was an implicit reference to the first field binding
        FieldBinding fieldBinding = (FieldBinding) this.binding;
        ReferenceBinding declaringClass = fieldBinding.declaringClass;
        // check if accessing enum static field in initializer         
        if (declaringClass.isEnum()) {
          MethodScope methodScope = currentScope.methodScope();
          SourceTypeBinding sourceType = methodScope.enclosingSourceType();
          if (fieldBinding.isStatic()
              && (sourceType == declaringClass || sourceType.superclass == declaringClass) // enum constant body
              && fieldBinding.constant() == Constant.NotAConstant
              && !methodScope.isStatic
              && methodScope.isInsideInitializerOrConstructor()) {
            currentScope.problemReporter().enumStaticFieldUsedDuringInitialization(fieldBinding, this);
          }
        }       
        // check if reading a final blank field
        if (fieldBinding.isBlankFinal()
View Full Code Here

/**
* Check and/or redirect the field access to the delegate receiver if any
*/
public TypeBinding checkFieldAccess(BlockScope scope) {
  FieldBinding fieldBinding = (FieldBinding) this.binding;
  MethodScope methodScope = scope.methodScope();
  // check for forward references
  if (this.indexOfFirstFieldBinding == 1
      && methodScope.enclosingSourceType() == fieldBinding.original().declaringClass
      && methodScope.lastVisibleFieldID >= 0
      && fieldBinding.id >= methodScope.lastVisibleFieldID
      && (!fieldBinding.isStatic() || methodScope.isStatic)) {
    scope.problemReporter().forwardReference(this, 0, methodScope.enclosingSourceType());
  }
  this.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits
  this.bits |= Binding.FIELD;
  return getOtherFieldBindings(scope);
}
View Full Code Here

          this.bits |= Binding.LOCAL;
          return this.resolvedType = getOtherFieldBindings(scope);
        }
        if (this.binding instanceof FieldBinding) {
          FieldBinding fieldBinding = (FieldBinding) this.binding;
          MethodScope methodScope = scope.methodScope();
          // check for forward references
          if (this.indexOfFirstFieldBinding == 1
              && methodScope.enclosingSourceType() == fieldBinding.original().declaringClass
              && methodScope.lastVisibleFieldID >= 0
              && fieldBinding.id >= methodScope.lastVisibleFieldID
              && (!fieldBinding.isStatic() || methodScope.isStatic)) {
            scope.problemReporter().forwardReference(this, 0, methodScope.enclosingSourceType());
          }
          if (!fieldBinding.isStatic()
              && this.indexOfFirstFieldBinding == 1
              && scope.compilerOptions().getSeverity(CompilerOptions.UnqualifiedFieldAccess) != ProblemSeverities.Ignore) {
            scope.problemReporter().unqualifiedFieldAccess(this, fieldBinding);
View Full Code Here

          knownScopes.put(scope, newElement);
        }
        break;
      case Scope.METHOD_SCOPE :
        IType parentType = (IType) createElement(scope.parent, elementPosition, unit, existingElements, knownScopes);
        MethodScope methodScope = (MethodScope) scope;
        if (methodScope.isInsideInitializer()) {
          // inside field or initializer, must find proper one
          TypeDeclaration type = methodScope.referenceType();
          int occurenceCount = 1;
          for (int i = 0, length = type.fields.length; i < length; i++) {
            FieldDeclaration field = type.fields[i];
            if (field.declarationSourceStart < elementPosition && field.declarationSourceEnd > elementPosition) {
              switch (field.getKind()) {
                case AbstractVariableDeclaration.FIELD :
                case AbstractVariableDeclaration.ENUM_CONSTANT :
                  newElement = parentType.getField(new String(field.name));
                  break;
                case AbstractVariableDeclaration.INITIALIZER :
                  newElement = parentType.getInitializer(occurenceCount);
                  break;
              }
              break;
            } else if (field.getKind() == AbstractVariableDeclaration.INITIALIZER) {
              occurenceCount++;
            }
          }
        } else {
          // method element
          AbstractMethodDeclaration method = methodScope.referenceMethod();
          newElement = parentType.getMethod(new String(method.selector), Util.typeParameterSignatures(method));
          if (newElement != null) {
            knownScopes.put(scope, newElement);
          }
        }
View Full Code Here

  private AdviceDeclaration findEnclosingAround(Scope scope) {
    if (scope == null) return null;
       
    if (scope instanceof MethodScope) {
      MethodScope methodScope = (MethodScope)scope;
      ReferenceContext context = methodScope.referenceContext;
      if (context instanceof AdviceDeclaration) {
        AdviceDeclaration adviceDecl = (AdviceDeclaration)context;
        if (adviceDecl.kind == AdviceKind.Around) {
          // pr 53981 only match "bare" calls to proceed
View Full Code Here

    pre.arguments = AstUtil.copyArguments(this.arguments);

    // XXX should do exceptions

    pre.scope = new MethodScope(scope, pre, true);
    // ??? do we need to do anything with scope???

    // Use the factory to build a semi-correct resolvedmember - then patch it up with
    // reset calls. This is SAFE
    ResolvedMemberImpl preIntroducedConstructorRM = world.makeResolvedMember(binding);
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;
   
    // 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);
    }

    // resolve it
    ReferenceBinding rb = (ReferenceBinding)ot.getTypeBindingPublic(scope.parent);

    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

  private AdviceDeclaration findEnclosingAround(Scope scope) {
    if (scope == null) return null;
       
    if (scope instanceof MethodScope) {
      MethodScope methodScope = (MethodScope)scope;
      ReferenceContext context = methodScope.referenceContext;
      if (context instanceof AdviceDeclaration) {
        AdviceDeclaration adviceDecl = (AdviceDeclaration)context;
        if (adviceDecl.kind == AdviceKind.Around) {
          // pr 53981 only match "bare" calls to proceed
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.