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

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration


  else
    this.tagBits |= TagBits.LocalTypeMask;
  this.enclosingCase = switchCase;
  this.sourceStart = scope.referenceContext.sourceStart;
  MethodScope methodScope = scope.enclosingMethodScope();
  AbstractMethodDeclaration declaration = methodScope.referenceMethod();
  if (declaration != null) {
    this.enclosingMethod = declaration.binding;
  }
}
View Full Code Here


    for (int i = 0, length = this.methods.length; i < length; i++) {
      MethodBinding method = resolvedMethods[i];
      if (method == null)
        continue;
      char[] selector = method.selector;
      AbstractMethodDeclaration methodDecl = null;
      nextSibling: for (int j = i + 1; j < length; j++) {
        MethodBinding method2 = resolvedMethods[j];
        if (method2 == null)
          continue nextSibling;
        if (!CharOperation.equals(selector, method2.selector))
          break nextSibling; // methods with same selector are contiguous

        if (complyTo15 && method.returnType != null && method2.returnType != null) {
          // 8.4.2, for collision to be detected between m1 and m2:
          // signature(m1) == signature(m2) i.e. same arity, same type parameter count, can be substituted
          // signature(m1) == erasure(signature(m2)) or erasure(signature(m1)) == signature(m2)
          TypeBinding[] params1 = method.parameters;
          TypeBinding[] params2 = method2.parameters;
          int pLength = params1.length;
          if (pLength != params2.length)
            continue nextSibling;

          TypeVariableBinding[] vars = method.typeVariables;
          TypeVariableBinding[] vars2 = method2.typeVariables;
          boolean equalTypeVars = vars == vars2;
          MethodBinding subMethod = method2;
          if (!equalTypeVars) {
            MethodBinding temp = method.computeSubstitutedMethod(method2, this.scope.environment());
            if (temp != null) {
              equalTypeVars = true;
              subMethod = temp;
            }
          }
          boolean equalParams = method.areParametersEqual(subMethod);
          if (equalParams && equalTypeVars) {
            // duplicates regardless of return types
          } else if (method.returnType.erasure() == subMethod.returnType.erasure() && (equalParams || method.areParameterErasuresEqual(method2))) {
            // name clash for sure if not duplicates, report as duplicates
          } else if (!equalTypeVars && vars != Binding.NO_TYPE_VARIABLES && vars2 != Binding.NO_TYPE_VARIABLES) {
            // type variables are different so we can distinguish between methods
            continue nextSibling;
          } else if (pLength > 0) {
            // check to see if the erasure of either method is equal to the other
            int index = pLength;
            for (; --index >= 0;) {
              if (params1[index] != params2[index].erasure())
                break;
              if (params1[index] == params2[index]) {
                TypeBinding type = params1[index].leafComponentType();
                if (type instanceof SourceTypeBinding && type.typeVariables() != Binding.NO_TYPE_VARIABLES) {
                  index = pLength; // handle comparing identical source types like X<T>... its erasure is itself BUT we need to answer false
                  break;
                }
              }
            }
            if (index >= 0 && index < pLength) {
              for (index = pLength; --index >= 0;)
                if (params1[index].erasure() != params2[index])
                  break;
            }
            if (index >= 0)
              continue nextSibling;
          }
        } else if (!method.areParametersEqual(method2)) { // prior to 1.5, parameter identity meant a collision case
          continue nextSibling;
        }
        boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));
        // report duplicate
        if (methodDecl == null) {
          methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special
          if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method
            if (isEnumSpecialMethod) {
              this.scope.problemReporter().duplicateEnumSpecialMethod(this, methodDecl);
            } else {
              this.scope.problemReporter().duplicateMethodInType(this, methodDecl);
            }
            methodDecl.binding = null;
            // do not alter original method array until resolution is over, due to reentrance (143259)
            if (resolvedMethods == this.methods) {
              System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
            }               
            resolvedMethods[i] = null;
            failed++;
          }
        }
        AbstractMethodDeclaration method2Decl = method2.sourceMethod();
        if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method
          if (isEnumSpecialMethod) {
            this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);
          } else {
            this.scope.problemReporter().duplicateMethodInType(this, method2Decl);
View Full Code Here

  if (isViewedAsDeprecated() && !method.isDeprecated())
    method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
  if (hasRestrictedAccess())
    method.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;

  AbstractMethodDeclaration methodDecl = method.sourceMethod();
  if (methodDecl == null) return null; // method could not be resolved in previous iteration

    methodDecl.ensureScopeSetup(); // AspectJ extension

  TypeParameter[] typeParameters = methodDecl.typeParameters();
  if (typeParameters != null) {
    methodDecl.scope.connectTypeVariables(typeParameters, true);
    // Perform deferred bound checks for type variables (only done after type variable hierarchy is connected)
    for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++)
      typeParameters[i].checkBounds(methodDecl.scope);
View Full Code Here

  MethodBinding originalMethod = this.original();
  if ((originalMethod.tagBits & TagBits.AnnotationResolved) == 0 && originalMethod.declaringClass instanceof SourceTypeBinding) {
    ClassScope scope = ((SourceTypeBinding) originalMethod.declaringClass).scope;
    if (scope != null) {
      TypeDeclaration typeDecl = scope.referenceContext;
      AbstractMethodDeclaration methodDecl = typeDecl.declarationOf(originalMethod);
      if (methodDecl != null)
        ASTNode.resolveAnnotations(methodDecl.scope, methodDecl.annotations, originalMethod);
    }
  }
  return originalMethod.tagBits;
View Full Code Here

    //The method has not been resolved nor has its class been resolved.
    //It can only be from a source type within compilation units to process.
    if (originalMethod.declaringClass instanceof SourceTypeBinding) {
      SourceTypeBinding sourceType = (SourceTypeBinding) originalMethod.declaringClass;
      if (sourceType.scope != null) {
        AbstractMethodDeclaration methodDeclaration = originalMethod.sourceMethod();
        if (methodDeclaration != null && methodDeclaration.isAnnotationMethod()) {
          methodDeclaration.resolve(sourceType.scope);
        }
      }
    }
    originalMethod.tagBits |= TagBits.DefaultValueResolved;
  }
View Full Code Here

  buffer.getChars(0, nameLength, signature, 0);     
 
  return signature;
}
public final int sourceEnd() {
  AbstractMethodDeclaration method = sourceMethod();
  if (method == null) {
    if (this.declaringClass instanceof SourceTypeBinding)
      return ((SourceTypeBinding) this.declaringClass).sourceEnd();
    return 0;
  }
View Full Code Here

    if (this == methods[i].binding)
      return methods[i];
  return null;   
}
public final int sourceStart() {
  AbstractMethodDeclaration method = sourceMethod();
  if (method == null) {
    if (this.declaringClass instanceof SourceTypeBinding)
      return ((SourceTypeBinding) this.declaringClass).sourceStart();
    return 0;
  }
View Full Code Here

        } else {
          // we can create a new FieldDeclaration
          typeDecl.bodyDeclarations().add(convertToFieldDeclaration(fieldDeclaration));
        }
      } else if(node instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration) {
        AbstractMethodDeclaration nextMethodDeclaration = (AbstractMethodDeclaration) node;
        if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) {
          typeDecl.bodyDeclarations().add(convert(nextMethodDeclaration));
        }
      } else if(node instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) {
        org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) node;
        ASTNode nextMemberDeclarationNode = convert(nextMemberDeclaration);
View Full Code Here

        } else {
          return typeDecl.initializerScope;
        }
      }
    }
    AbstractMethodDeclaration abstractMethodDeclaration = (AbstractMethodDeclaration) this.ast.getBindingResolver().getCorrespondingNode(currentNode);
    return abstractMethodDeclaration.scope;
  }
View Full Code Here

   
    binding.methods()// the important side-effect of this call is to make sure bindings are completed
    AbstractMethodDeclaration[] methods = declaration.methods;
    if (methods != null) {
      for (int i=0, len=methods.length; i < len; i++) {
        AbstractMethodDeclaration amd = methods[i];
        if (amd == null || amd.ignoreFurtherInvestigation) continue;
        if (amd instanceof PointcutDeclaration) {
          PointcutDeclaration d = (PointcutDeclaration)amd;
          ResolvedPointcutDefinition df = d.makeResolvedPointcutDefinition(factory);
          declaredPointcuts.add(df);
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration

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.