Package org.aspectj.weaver

Examples of org.aspectj.weaver.NewMemberClassTypeMunger


      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


  // }

  // very similar to code in EclipseTypeMunger
  private void mungeNewInnerClass(EclipseTypeMunger m, EclipseFactory world) {

    NewMemberClassTypeMunger munger = (NewMemberClassTypeMunger) m.getMunger();

    // private boolean mungeNewInnerClass(SourceTypeBinding sourceType, ResolvedType onType, NewMemberClassTypeMunger munger,
    // 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;
      }
    }
    // may be unresolved if the aspect type binding was a BinaryTypeBinding
    if (innerTypeBinding instanceof UnresolvedReferenceBinding) {
      innerTypeBinding = BinaryTypeBinding.resolveType(innerTypeBinding, world.getLookupEnvironment(), true);
    }
    if (innerTypeBinding == null) {
      throw new IllegalStateException("Could not find inner type binding for '" + munger.getMemberTypeName() + "'");
    }

    // TODO adjust modifier?
    // TODO deal with itd of it onto an interface

    SourceTypeBinding targetSourceTypeBinding = (SourceTypeBinding) world.makeTypeBinding(munger.getTargetType());

    // if it is a binary type binding it is likely to be something we ITD'd on before
    // TODO should probably avoid putting it onto BTBs at all (since already there)
    if (!(targetSourceTypeBinding instanceof BinaryTypeBinding)) {
      ReferenceBinding[] existingMemberTypes = targetSourceTypeBinding.memberTypes();
      for (int i = 0; i < existingMemberTypes.length; i++) {
        char[] compounded = CharOperation.concatWith(existingMemberTypes[i].compoundName, '.');
        if (CharOperation.endsWith(compounded, mungerMemberTypeName)) {
          scope.problemReporter().signalError(sourceStart(), sourceEnd(),
              "target type already declares a member type with the name '" + munger.getMemberTypeName() + "'");
          return;
        }
      }
    }
    /*
 
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.NewMemberClassTypeMunger

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.