Package org.aspectj.ajdt.internal.compiler.lookup

Examples of org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory


    // AMC added concrete too. Needed because declare declarations concretize their
    // shadow mungers early.
    if (pointcut.state == Pointcut.RESOLVED || pointcut.state == Pointcut.CONCRETE)
      return true;

    EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(dec.scope);

    TypeBinding[] parameters = method.parameters;
    Argument[] arguments = dec.arguments;

    FormalBinding[] bindings = new FormalBinding[baseArgumentCount];
    for (int i = 0, len = baseArgumentCount; i < len; i++) {
      Argument arg = arguments[i];
      String name = new String(arg.name);
      UnresolvedType type = world.fromBinding(parameters[i]);
      // pr268710: allow for inner interfaces in a generic aspect
      if (parameters[i].isInterface() && parameters[i].isParameterizedType() && parameters[i].isMemberType()) {
        TypeVariableBinding[] tvs = parameters[i].typeVariables();
        if (tvs == null || tvs.length == 0) {
          type = type.getRawType();
View Full Code Here


      // return;
    }
    if (superBinding instanceof ParameterizedMethodBinding) {
      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;
      }
    } else if (depthCounter == 0) { // Allow case testSuperItds_pr198196_2/3

      char[] accessName;
      if (call.isSuperAccess() && !call.binding.isStatic()) {
        call.receiver = new ThisReference(call.receiver.sourceStart, call.receiver.sourceEnd);
        accessName = NameMangler.superDispatchMethod(factory.fromBinding(targetClass), new String(superBinding.selector))
            .toCharArray();
      } else if (call.receiver.isThis() && call.binding.isProtected() && !call.binding.isStatic()) {
        // XXX this is a hack that violates some binary compatibility rules
        ReferenceBinding superBindingDeclaringClass = superBinding.declaringClass;
        if (superBindingDeclaringClass.isParameterizedType()) {
          superBindingDeclaringClass = ((ParameterizedTypeBinding) superBindingDeclaringClass).type;
        }
        if (superBindingDeclaringClass.equals(targetClass)) {
          accessName = NameMangler.protectedDispatchMethod(factory.fromBinding(targetClass),
              new String(superBinding.selector)).toCharArray();
        } else {
          accessName = NameMangler.superDispatchMethod(factory.fromBinding(targetClass),
              new String(superBinding.selector)).toCharArray();
        }
      } else {
        return;
      }

      // ??? do we want these to be unique
      MethodBinding superAccessBinding = new MethodBinding(ClassFileConstants.AccPublic, accessName, superBinding.returnType,
          superBinding.parameters, superBinding.thrownExceptions, targetClass);

      AstUtil.replaceMethodBinding(call, superAccessBinding);
    } else {
      return;
    }
    ResolvedMember targetMember = null;
    if (superBinding.declaringClass.isParameterizedType()) { // pr206911
      targetMember = factory.makeResolvedMember(superBinding, ((ParameterizedTypeBinding) superBinding.declaringClass)
          .genericType());
    } else {
      targetMember = factory.makeResolvedMember(superBinding);
    }
    superMethodsCalled.add(targetMember);
  }
View Full Code Here

        getProblemFactory());

    forCompiler.problemReporter = pr;

    AjLookupEnvironment le = new AjLookupEnvironment(forCompiler, forCompiler.options, pr, environment);
    EclipseFactory factory = new EclipseFactory(le, this);
    le.factory = factory;
    pr.factory = factory;

    forCompiler.lookupEnvironment = le;
View Full Code Here

    // * an eclipse factory -- create from AjLookupEnvironment, need to hide AjBuildManager field
    AjProblemReporter pr = new AjProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(), forCompiler.options,
        new DefaultProblemFactory(Locale.getDefault()));
    forCompiler.problemReporter = pr;
    AjLookupEnvironment le = new AjLookupEnvironment(forCompiler, forCompiler.options, pr, nameEnvironment);
    EclipseFactory eFactory = new EclipseFactory(le, myBcelWorld, ajOptions.xSerializableAspects);
    le.factory = eFactory;
    forCompiler.lookupEnvironment = le;

    // AjBuildNotifier ajNotifier = (AjBuildNotifier) notifier;
    if (fileNameProvider == null)
View Full Code Here

  // }
  // }
  // }

  private ResolvedMember getPointcutDeclaration(ReferencePointcut rp, MethodDeclaration declaration) {
    EclipseFactory factory = ((AjLookupEnvironment) declaration.scope.environment()).factory;
    World world = factory.getWorld();
    UnresolvedType onType = rp.onType;
    if (onType == null) {
      if (declaration.binding != null) {
        Member member = factory.makeResolvedMember(declaration.binding);
        onType = member.getDeclaringType();
      } else {
        return null;
      }
    }
View Full Code Here

  // ((IProgramElement)stack.peek()).addChild(peNode);
  // }
  protected void genBytecodeInfo(MethodDeclaration methodDeclaration, IProgramElement peNode) {
    if (methodDeclaration.binding != null) {
      try {
        EclipseFactory factory = ((AjLookupEnvironment) methodDeclaration.scope.environment()).factory;
        Member member = factory.makeResolvedMember(methodDeclaration.binding);
        peNode.setBytecodeName(member.getName());
        peNode.setBytecodeSignature(member.getSignature());
      } catch (BCException bce) { // bad type name
        bce.printStackTrace();
      } catch (NullPointerException npe) {
View Full Code Here

    // Fix to enable us to anchor things from ctor nodes
    if (constructorDeclaration.binding != null) {
      String memberName = "";
      String memberBytecodeSignature = "";
      try {
        EclipseFactory factory = ((AjLookupEnvironment) constructorDeclaration.scope.environment()).factory;
        Member member = factory.makeResolvedMember(constructorDeclaration.binding);
        memberName = member.getName();
        memberBytecodeSignature = member.getSignature();
      } catch (BCException bce) { // bad type name
        memberName = "<undefined>";
      } catch (NullPointerException npe) {
View Full Code Here

      // ((NestedTypeBinding) this.binding).compoundName = CharOperation.splitOn('.', "Basic$_".toCharArray());
    }
  }

  public EclipseTypeMunger build(ClassScope classScope) {
    EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(classScope);
    resolveOnType(classScope);
    ensureScopeSetup();

    if (ignoreFurtherInvestigation) {
      return null;
    }

    if (onTypeResolvedBinding.isInterface() || onTypeResolvedBinding.isEnum() || onTypeResolvedBinding.isAnnotationType()) {
      scope.problemReporter().signalError(
          sourceStart,
          sourceEnd,
          "Cannot declare new member type on '" + onType.toString()
              + "'. New member types can only be specified on classes (compiler limitation)");
      return null;
    }

    if (!Modifier.isStatic(modifiers)) {
      scope.problemReporter().signalError(sourceStart, sourceEnd,
          "Intertype declared member types can only be static (compiler limitation)");
      return null;
    }

    ResolvedType declaringType = world.fromBinding(onTypeResolvedBinding).resolve(world.getWorld());
    if (declaringType.isRawType() || declaringType.isParameterizedType()) {
      declaringType = declaringType.getGenericType();
    }

    if (interTypeScope == null) {
      return null; // We encountered a problem building the scope, don't continue - error already reported
    }

    // TODO [inner] use the interTypeScope.getRecoveryAliases
    // TODO [inner] should mark it in the aspect as unreachable - it is not to be considered part of the aspect
    newMemberClassTypeMunger = new NewMemberClassTypeMunger(declaringType, new String(this.name));
    newMemberClassTypeMunger.setSourceLocation(new EclipseSourceLocation(compilationResult, sourceStart, sourceEnd));
    ResolvedType aspectType = world.fromEclipse(classScope.referenceContext.binding);
    return new EclipseTypeMunger(world, newMemberClassTypeMunger, aspectType, null);
  }
View Full Code Here

      handlerLabel = new ExceptionLabel(codeStream, classScope.getJavaLangThrowable())
      handlerLabel.placeStart();
    }
   
    if (hasPre) {
      final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(classScope);

      codeStream.invokestatic(world.makeMethodBindingForCall(
        AjcMemberMaker.ajcPreClinitMethod(
          world.fromBinding(classScope.referenceContext.binding)
        )));
    }
    super.generateSyntheticCode(classScope, codeStream);
  }
View Full Code Here

    ClassScope classScope,
    CodeStream codeStream)
  {
    super.generatePostSyntheticCode(classScope, codeStream);
    if (hasPost) {
      final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(classScope);

      codeStream.invokestatic(world.makeMethodBindingForCall(
        AjcMemberMaker.ajcPostClinitMethod(
          world.fromBinding(classScope.referenceContext.binding)
        )));
    }
   
    if (initFailureField != null) {
      // Changes to this exception handling code may require changes to
View Full Code Here

TOP

Related Classes of org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory

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.