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

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


    // boolean isExactTargetType) {

    SourceTypeBinding aspectTypeBinding = (SourceTypeBinding) world.makeTypeBinding(m.getAspectType());

    char[] mungerMemberTypeName = ("$" + munger.getMemberTypeName()).toCharArray();
    ReferenceBinding innerTypeBinding = null;
    for (ReferenceBinding innerType : aspectTypeBinding.memberTypes) {
      char[] compounded = CharOperation.concatWith(innerType.compoundName, '.');
      if (org.aspectj.org.eclipse.jdt.core.compiler.CharOperation.endsWith(compounded, mungerMemberTypeName)) {
        innerTypeBinding = innerType;
        break;
View Full Code Here


      codeStream.aastore();
    }

    // call run
    ReferenceBinding closureType = (ReferenceBinding) binding.parameters[nargs - 1];
    MethodBinding runMethod = closureType.getMethods("run".toCharArray())[0];
    codeStream.invokevirtual(runMethod);

    TypeBinding returnType = binding.returnType;
    if (returnType.isBaseType()) {
      codeStream.invokestatic(AjTypeConstants.getConversionMethodFromObject(classScope, returnType));
View Full Code Here

    if (field.isPrivate() || !field.canBeSeenBy(binding.declaringClass.fPackage)) {

      PrivilegedHandler handler = (PrivilegedHandler) Scope.findPrivilegedHandler(binding.declaringClass);
      if (handler == null) {
        // one is now required!
        ReferenceBinding typebinding = binding.declaringClass;
        if (typebinding instanceof ReferenceBinding) {
          SourceTypeBinding sourceBinding = (SourceTypeBinding) typebinding;
          handler = new PrivilegedHandler((AspectDeclaration) sourceBinding.scope.referenceContext);
          sourceBinding.privilegedHandler = handler;
        }
View Full Code Here

  /**
   * @see IMethodBinding#isDefaultConstructor()
   * @since 3.0
   */
  public boolean isDefaultConstructor() {
    final ReferenceBinding declaringClassBinding = this.binding.declaringClass;
    if (declaringClassBinding.isRawType()) {
      RawTypeBinding rawTypeBinding = (RawTypeBinding) declaringClassBinding;
      if (rawTypeBinding.genericType().isBinaryBinding()) {
        return false;
      }
      return (this.binding.modifiers & ExtraCompilerModifiers.AccIsDefaultConstructor) != 0;
    }
    if (declaringClassBinding.isBinaryBinding()) {
      return false;
    }
    return (this.binding.modifiers & ExtraCompilerModifiers.AccIsDefaultConstructor) != 0;
  }
View Full Code Here

    } else {
      // case of method not in the created AST, or a binary method
      org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding original = this.binding.original();
      String selector = original.isConstructor() ? declaringType.getElementName() : new String(original.selector);
      boolean isBinary = declaringType.isBinary();
      ReferenceBinding enclosingType = original.declaringClass.enclosingType();
      boolean isInnerBinaryTypeConstructor = isBinary && original.isConstructor() && enclosingType != null;
      TypeBinding[] parameters = original.parameters;
      int length = parameters == null ? 0 : parameters.length;
      int declaringIndex = isInnerBinaryTypeConstructor ? 1 : 0;
      String[] parameterSignatures = new String[declaringIndex + length];
      if (isInnerBinaryTypeConstructor)
        parameterSignatures[0] = new String(enclosingType.genericTypeSignature()).replace('/', '.');
      for (int i = 0;  i < length; i++) {
        parameterSignatures[declaringIndex + i] = new String(parameters[i].genericTypeSignature()).replace('/', '.');
      }
      IMethod result = declaringType.getMethod(selector, parameterSignatures);
      if (isBinary)
View Full Code Here

        EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(scope);
        MethodBinding realthing = world.makeMethodBinding(munger.getSignature(), munger.getTypeVariableAliases());

        boolean reportError = true;
        // Go up the hierarchy, looking for something we override
        ReferenceBinding supertype = onTypeBinding.superclass();
        while (supertype != null && reportError) {
          MethodBinding[] possibles = supertype.getMethods(declaredSelector);
          for (int i = 0; i < possibles.length; i++) {
            MethodBinding mb = possibles[i];

            boolean couldBeMatch = true;
            if (mb.parameters.length != realthing.parameters.length)
              couldBeMatch = false;
            else {
              for (int j = 0; j < mb.parameters.length && couldBeMatch; j++) {
                if (!mb.parameters[j].equals(realthing.parameters[j]))
                  couldBeMatch = false;
              }
            }
            // return types compatible? (allow for covariance)
            if (couldBeMatch && !returnType.resolvedType.isCompatibleWith(mb.returnType))
              couldBeMatch = false;
            if (couldBeMatch)
              reportError = false;
          }
          supertype = supertype.superclass(); // superclass of object is null
        }
        // If we couldn't find something we override, report the error
        if (reportError)
          ((AjProblemReporter) this.scope.problemReporter()).itdMethodMustOverride(this, realthing);
      }
View Full Code Here

    // for reported problems, we want the user to see the declared selector
    char[] realSelector = this.selector;
    this.selector = declaredSelector;

    final ReferenceBinding declaringClass = this.binding.declaringClass;
    if ((declaredModifiers & ExtraCompilerModifiers.AccAlternateModifierProblem) != 0)
      scope.problemReporter().duplicateModifierForMethod(onTypeBinding, this);

    // after this point, tests on the 16 bits reserved.
    int realModifiers = declaredModifiers & ExtraCompilerModifiers.AccJustFlag;

    // check for abnormal modifiers
    int unexpectedModifiers = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected
        | ClassFileConstants.AccAbstract | ClassFileConstants.AccStatic | ClassFileConstants.AccFinal
        | ClassFileConstants.AccSynchronized | ClassFileConstants.AccNative | ClassFileConstants.AccStrictfp);
    if ((realModifiers & unexpectedModifiers) != 0) {
      scope.problemReporter().illegalModifierForMethod(this);
      declaredModifiers &= ~ExtraCompilerModifiers.AccJustFlag | ~unexpectedModifiers;
    }

    // check for incompatible modifiers in the visibility bits, isolate the visibility bits
    int accessorBits = realModifiers
        & (ClassFileConstants.AccPublic | ClassFileConstants.AccProtected | ClassFileConstants.AccPrivate);
    if ((accessorBits & (accessorBits - 1)) != 0) {
      scope.problemReporter().illegalVisibilityModifierCombinationForMethod(onTypeBinding, this);

      // need to keep the less restrictive so disable Protected/Private as necessary
      if ((accessorBits & ClassFileConstants.AccPublic) != 0) {
        if ((accessorBits & ClassFileConstants.AccProtected) != 0)
          declaredModifiers &= ~ClassFileConstants.AccProtected;
        if ((accessorBits & ClassFileConstants.AccPrivate) != 0)
          declaredModifiers &= ~ClassFileConstants.AccPrivate;
      } else if ((accessorBits & ClassFileConstants.AccProtected) != 0 && (accessorBits & ClassFileConstants.AccPrivate) != 0) {
        declaredModifiers &= ~ClassFileConstants.AccPrivate;
      }
    }

    // check for modifiers incompatible with abstract modifier
    if ((declaredModifiers & ClassFileConstants.AccAbstract) != 0) {
      int incompatibleWithAbstract = ClassFileConstants.AccStatic | ClassFileConstants.AccFinal
          | ClassFileConstants.AccSynchronized | ClassFileConstants.AccNative | ClassFileConstants.AccStrictfp;
      if ((declaredModifiers & incompatibleWithAbstract) != 0)
        scope.problemReporter().illegalAbstractModifierCombinationForMethod(onTypeBinding, this);
      if (!onTypeBinding.isAbstract())
        scope.problemReporter().abstractMethodInAbstractClass((SourceTypeBinding) onTypeBinding, this);
    }

    /*
     * DISABLED for backward compatibility with javac (if enabled should also mark private methods as final) // methods from a
     * final class are final : 8.4.3.3 if (methodBinding.declaringClass.isFinal()) modifiers |= AccFinal;
     */
    // native methods cannot also be tagged as strictfp
    if ((declaredModifiers & ClassFileConstants.AccNative) != 0 && (declaredModifiers & ClassFileConstants.AccStrictfp) != 0)
      scope.problemReporter().nativeMethodsCannotBeStrictfp(onTypeBinding, this);

    // static members are only authorized in a static member or top level type
    if (((realModifiers & ClassFileConstants.AccStatic) != 0) && declaringClass.isNestedType() && !declaringClass.isStatic())
      scope.problemReporter().unexpectedStaticModifierForMethod(onTypeBinding, this);

    // restore the true selector now that any problems have been reported
    this.selector = realSelector;
  }
View Full Code Here

        // raw type
        this.typeBinding = this.environment.createRawType(this.genericType, (ReferenceBinding) this.typeBinding);
    } else {
      // parameterized top level type or parameterized member type with raw enclosing type
      this.genericType = (ReferenceBinding) this.typeBinding;
      ReferenceBinding enclosing = this.genericType.enclosingType();
      if (enclosing != null) enclosing = (ReferenceBinding) this.environment.convertToRawType(enclosing);
      this.typeBinding = this.environment.createParameterizedType(this.genericType, arguments, enclosing);
    }
  }
View Full Code Here

   */
  public CompilationUnitDeclaration getCompilationUnitDeclaration() {
    char[][] name = this.compoundName;
    if (name.length == 0) return null;
    if (this.environment == null) return null;
    ReferenceBinding binding = this.environment.getType(name);
    if (!(binding instanceof SourceTypeBinding)) {
      if (this.secondarySimpleName == null)
        return null;
      // case of a secondary type with no primary type (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=177115)
      int length = name.length;
View Full Code Here

  // this method depends on the fact that BinaryTypeBinding extends SourceTypeBinding
  private SourceTypeBinding makeSourceTypeBinding(ReferenceBinding onType) {
    if (onType instanceof SourceTypeBinding) return (SourceTypeBinding)onType;
    else if (onType instanceof ParameterizedTypeBinding) {
      ReferenceBinding rb = ((ParameterizedTypeBinding)onType).type;
      if (rb instanceof SourceTypeBinding) return (SourceTypeBinding)rb;
      else throw new BCException("In parameterized type "+onType+", can't handle reference binding "+rb);
    } else if (onType instanceof ProblemReferenceBinding) {
      return null;
    } else if (onType instanceof TypeVariableBinding) {
View Full Code Here

TOP

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

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.