// }
// 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;
}
}
}
/*