Examples of EclipseFactory


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

    // annotations on the ITD declaration get put on this method
    generateDispatchMethod(classScope, classFile);
  }

  public void generateDispatchMethod(ClassScope classScope, ClassFile classFile) {
    EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(classScope);

    UnresolvedType aspectType = world.fromBinding(classScope.referenceContext.binding);
    ResolvedMember signature = munger.getSignature();

    ResolvedMember dispatchMember = AjcMemberMaker.interMethodDispatcher(signature, aspectType);
    MethodBinding dispatchBinding = world.makeMethodBinding(dispatchMember, munger.getTypeVariableAliases(), munger
        .getSignature().getDeclaringType());
    MethodBinding introducedMethod = world.makeMethodBinding(AjcMemberMaker.interMethod(signature, aspectType, onTypeBinding
        .isInterface()), munger.getTypeVariableAliases());

    classFile.generateMethodInfoHeader(dispatchBinding);
    int methodAttributeOffset = classFile.contentsOffset;
View Full Code Here

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

          return;
        }
      }

      // XXX this is where we should remove unavailable args if we're in a cflow
      EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(scope);
      ifPointcut.testMethod = new ResolvedMemberImpl(Member.METHOD, factory.fromBinding(binding.declaringClass),
          this.modifiers, ResolvedType.BOOLEAN, new String(this.selector), factory.fromBindings(this.binding.parameters));
    }
  }
View Full Code Here

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

      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 ) fileNameProvider = new OutputFileNameProvider(getProject());
View Full Code Here

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

   
    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

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

//        call.binding = m.postDispatchMethod;
//      }
//      return;
    }

      EclipseFactory factory = ((AjLookupEnvironment)method.scope.environment()).factory;

    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
      if (superBinding.declaringClass.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(ASTNode.AccPublic, accessName,
      superBinding.returnType, superBinding.parameters, superBinding.thrownExceptions,
      targetClass);
     
    AstUtil.replaceMethodBinding(call, superAccessBinding);
 
    ResolvedMember targetMember = factory.makeResolvedMember(superBinding);
    superMethodsCalled.add(targetMember);
  }
View Full Code Here

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]);
            bindings[i] = new FormalBinding(type, name, i, arg.sourceStart, arg.sourceEnd, "unknown");
        }
       
        EclipseScope scope = new EclipseScope(bindings, dec.scope);
View Full Code Here

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

    if (initFailureField != null) {
      handlerLabel = new ExceptionLabel(codeStream, classScope.getJavaLangThrowable());   
    }
   
    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

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

    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

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

        // XXX AMC we need to do this, but I'm not 100% comfortable as I don't
        // know why the return type is wrong in this case. Also, we don't seem to need
        // to do it for args...
        if (munger.getSignature().getReturnType().isRawType()) {
          if (!binding.returnType.isRawType()) {
        EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(scope);
            binding.returnType = world.makeTypeBinding(munger.getSignature().getReturnType());
          }
        }
       
        // check @Override annotation - based on MethodDeclaration.resolveStatements() @Override processing
    checkOverride: {
      if (this.binding == null) break checkOverride;
      if (this.scope.compilerOptions().sourceLevel < JDK1_5) break checkOverride;
      boolean hasOverrideAnnotation = (this.binding.tagBits & TagBits.AnnotationOverride) != 0;
     
      // Need to verify
      if (hasOverrideAnnotation) {
       
        // Work out the real method binding that we can use for comparison
        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) {
View Full Code Here

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

  }
 
 

  public EclipseTypeMunger build(ClassScope classScope) {
    EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(classScope);
   
    resolveOnType(classScope);
    if (ignoreFurtherInvestigation) return null;

    binding = classScope.referenceContext.binding.resolveTypesFor(binding);
    if (binding == null) {
      // if binding is null, we failed to find a type used in the method params, this error
      // has already been reported.
      this.ignoreFurtherInvestigation = true;
      //return null;
      throw new AbortCompilationUnit(compilationResult,null);
    }

    if (isTargetAnnotation(classScope,"method")) return null; // Error message output in isTargetAnnotation
    if (isTargetEnum(classScope,"method")) return null; // Error message output in isTargetEnum
   
    if (interTypeScope==null) return null; // We encountered a problem building the scope, don't continue - error already reported
   
    // This signature represents what we want consumers of the targetted type to 'see'
    // must use the factory method to build it since there may be typevariables from the binding
    // referred to in the parameters/returntype
    ResolvedMember sig = factory.makeResolvedMemberForITD(binding,onTypeBinding,interTypeScope.getRecoveryAliases());
    sig.resetName(new String(declaredSelector));
    int resetModifiers = declaredModifiers;
    if (binding.isVarargs())  resetModifiers = resetModifiers | Constants.ACC_VARARGS;
    sig.resetModifiers(resetModifiers);
    NewMethodTypeMunger myMunger = new NewMethodTypeMunger(sig, null, typeVariableAliases);
    setMunger(myMunger);
    ResolvedType aspectType = factory.fromEclipse(classScope.referenceContext.binding);
    ResolvedMember me =
      myMunger.getInterMethodBody(aspectType);
    this.selector = binding.selector = me.getName().toCharArray();
    return new EclipseTypeMunger(factory, myMunger, aspectType, this);
  }
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.