Examples of MethodBinding


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

  If no visible constructor is discovered, an error binding is answered.
*/

public MethodBinding getConstructor(ReferenceBinding receiverType, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
  MethodBinding methodBinding = receiverType.getExactConstructor(argumentTypes);
  if (methodBinding != null) {
    if (canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this)) {
      return methodBinding;
    }
  }
  MethodBinding[] methods = receiverType.getMethods(TypeConstants.INIT);
  if (methods == Binding.NO_METHODS) {
    return new ProblemMethodBinding(TypeConstants.INIT, argumentTypes, ProblemReasons.NotFound);
  }
  MethodBinding[] compatible = new MethodBinding[methods.length];
  int compatibleIndex = 0;
  for (int i = 0, length = methods.length; i < length; i++) {
      MethodBinding compatibleMethod = computeCompatibleMethod(methods[i], argumentTypes, invocationSite);
    if (compatibleMethod != null)
      compatible[compatibleIndex++] = compatibleMethod;
  }
  if (compatibleIndex == 0)
    return new ProblemMethodBinding(TypeConstants.INIT, argumentTypes, ProblemReasons.NotFound); // need a more descriptive error... cannot convert from X to Y

  MethodBinding[] visible = new MethodBinding[compatibleIndex];
  int visibleIndex = 0;
  for (int i = 0; i < compatibleIndex; i++) {
    MethodBinding method = compatible[i];
    if (canBeSeenByForCodeSnippet(method, receiverType, invocationSite, this)) {
      visible[visibleIndex++] = method;
    }
  }
  if (visibleIndex == 1) {
View Full Code Here

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

  If no visible method is discovered, an error binding is answered.
*/

public MethodBinding getImplicitMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
  // retrieve an exact visible match (if possible)
  MethodBinding methodBinding = findExactMethod(receiverType, selector, argumentTypes, invocationSite);
  if (methodBinding == null)
    methodBinding = findMethod(receiverType, selector, argumentTypes, invocationSite);
  if (methodBinding != null) { // skip it if we did not find anything
    if (methodBinding.isValidBinding())
        if (!canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
        return new ProblemMethodBinding(methodBinding, selector, argumentTypes, ProblemReasons.NotVisible);
    return methodBinding;
  }
  return new ProblemMethodBinding(selector, argumentTypes, ProblemReasons.NotFound);
View Full Code Here

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

        // we cannot create problem methods for an interface. So we have to generate a clinit
        // which should contain all the problem
        classFile.addProblemClinit(problemsCopy);
        for (int i = 0, length = methodDecls.length; i < length; i++) {
          AbstractMethodDeclaration methodDecl = methodDecls[i];
          MethodBinding method = methodDecl.binding;
          if (method == null || method.isConstructor()) continue;
          classFile.addAbstractMethod(methodDecl, method);
        }   
      } else {
        for (int i = 0, length = methodDecls.length; i < length; i++) {
          AbstractMethodDeclaration methodDecl = methodDecls[i];
          MethodBinding method = methodDecl.binding;
          if (method == null) continue;
          if (method.isConstructor()) {
            classFile.addProblemConstructor(methodDecl, method, problemsCopy);
          } else {
            classFile.addProblemMethod(methodDecl, method, problemsCopy);
          }
        }
View Full Code Here

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

      contents[contentsOffset++] = (byte) (enclosingTypeIndex >> 8);
      contents[contentsOffset++] = (byte) enclosingTypeIndex;
      byte methodIndexByte1 = 0;
      byte methodIndexByte2 = 0;
      if (this.referenceBinding instanceof LocalTypeBinding) {
        MethodBinding methodBinding = ((LocalTypeBinding) this.referenceBinding).enclosingMethod;
        if (methodBinding != null) {
          int enclosingMethodIndex = constantPool.literalIndexForNameAndType(methodBinding.selector, methodBinding.signature(this));
          methodIndexByte1 = (byte) (enclosingMethodIndex >> 8);
          methodIndexByte2 = (byte) enclosingMethodIndex;
        }
      }
      contents[contentsOffset++] = methodIndexByte1;
View Full Code Here

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

            resizeContents(2);
          }
          final int elementNameIndex = constantPool.literalIndex(memberValuePair.name);
          contents[contentsOffset++] = (byte) (elementNameIndex >> 8);
          contents[contentsOffset++] = (byte) elementNameIndex;
          MethodBinding methodBinding = memberValuePair.binding;
          if (methodBinding == null) {
            contentsOffset = attributeOffset;
          } else {
            generateElementValue(memberValuePair.value, methodBinding.returnType, attributeOffset);
          }
        }
      } else {
        contents[contentsOffset++] = 0;
        contents[contentsOffset++] = 0;
      }
    } else if (annotation instanceof SingleMemberAnnotation) {
      SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation) annotation;
      // this is a single member annotation (one member value)
      contents[contentsOffset++] = 0;
      contents[contentsOffset++] = 1;
      if (contentsOffset + 2 >= this.contents.length) {
        resizeContents(2);
      }
      final int elementNameIndex = constantPool.literalIndex(VALUE);
      contents[contentsOffset++] = (byte) (elementNameIndex >> 8);
      contents[contentsOffset++] = (byte) elementNameIndex;
      MethodBinding methodBinding = singleMemberAnnotation.memberValuePairs()[0].binding;
      if (methodBinding == null) {
        contentsOffset = attributeOffset;
      } else {
        generateElementValue(singleMemberAnnotation.memberValue, methodBinding.returnType, attributeOffset);
      }
View Full Code Here

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

      TypeDeclaration currentDeclaration = this.referenceBinding.scope.referenceContext;
      int typeDeclarationSourceStart = currentDeclaration.sourceStart();
      int typeDeclarationSourceEnd = currentDeclaration.sourceEnd();
      for (int i = 0, max = methodDeclarations.length; i < max; i++) {
        MethodDeclaration methodDeclaration = methodDeclarations[i];
        MethodBinding methodBinding = methodDeclaration.binding;
         String readableName = new String(methodBinding.readableName());
         CategorizedProblem[] problems = compilationResult.problems;
         int problemsCount = compilationResult.problemCount;
        for (int j = 0; j < problemsCount; j++) {
          CategorizedProblem problem = problems[j];
          if (problem != null
View Full Code Here

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

    if (defaultValue == null) return false;
    return defaultValue.equals(value2);
  }

  public boolean isDeprecated() {
    MethodBinding methodBinding = this.internalPair.getMethodBinding();
    return methodBinding == null ? false : methodBinding.isDeprecated();
  }
View Full Code Here

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

      MemberValuePair[] memberValuePairs = normalAnnotation.memberValuePairs;
      if (memberValuePairs != null) {
        int memberValuePairsLength = memberValuePairs.length;
        for (int i = 0; i < memberValuePairsLength; i++) {
          MemberValuePair memberValuePair = memberValuePairs[i];
          MethodBinding methodBinding = memberValuePair.binding;
          if (methodBinding == null) {
            // is this just a marker annotation?
            throw new MissingImplementationException(
                "Please raise an AspectJ bug.  AspectJ does not know how to convert this annotation [" + annotation
                    + "]");
          } else {
            AnnotationValue av = generateElementValue(memberValuePair.value, methodBinding.returnType);
            AnnotationNameValuePair anvp = new AnnotationNameValuePair(new String(memberValuePair.name), av);
            annotationAJ.addNameValuePair(anvp);
          }
        }
      }
    } else if (annotation instanceof SingleMemberAnnotation) {
      // this is a single member annotation (one member value)
      SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation) annotation;
      MethodBinding methodBinding = singleMemberAnnotation.memberValuePairs()[0].binding;
      if (methodBinding == null) {
        throw new MissingImplementationException(
            "Please raise an AspectJ bug.  AspectJ does not know how to convert this annotation [" + annotation + "]");
      } else {
        AnnotationValue av = generateElementValue(singleMemberAnnotation.memberValue, methodBinding.returnType);
View Full Code Here

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

      return;

    if (send.isSuperAccess() && !send.binding.isStatic()) {
      send.receiver = new ThisReference(send.sourceStart, send.sourceEnd);
      // send.arguments = AstUtil.insert(new ThisReference(send.sourceStart, send.sourceEnd), send.arguments);
      MethodBinding superAccessBinding = getSuperAccessMethod(send.binding);
      AstUtil.replaceMethodBinding(send, superAccessBinding);
    } else if (!isPublic(send.binding)) {
      send.syntheticAccessor = getAccessibleMethod(send.binding, send.actualReceiverType);
    }
View Full Code Here

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

      // runtime this will be satisfied by the super).
      m = world.makeResolvedMember(binding, receiverType);
    }
    if (inAspect.accessForInline.containsKey(m))
      return (MethodBinding) inAspect.accessForInline.get(m);
    MethodBinding ret = world.makeMethodBinding(AjcMemberMaker.inlineAccessMethodForMethod(inAspect.typeX, m));
    inAspect.accessForInline.put(m, ret);
    return ret;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.