@@ -50,7 +50,7 @@ public class BuildArgParser extends Main { | |||
private static boolean LOADED_BUNDLE = false; | |||
static { | |||
Main.bundleName = BUNDLE_NAME; | |||
// Main.bundleName = BUNDLE_NAME; | |||
ResourceBundleFactory.getBundle(Locale.getDefault()); | |||
if (!LOADED_BUNDLE) { | |||
LOADED_BUNDLE = true; | |||
@@ -237,12 +237,12 @@ public class BuildArgParser extends Main { | |||
setDebugOptions(); | |||
buildConfig.getOptions().set(options); | |||
} catch (InvalidInputException iie) { | |||
} catch (IllegalArgumentException iae) { | |||
ISourceLocation location = null; | |||
if (buildConfig.getConfigFile() != null) { | |||
location = new SourceLocation(buildConfig.getConfigFile(), 0); | |||
} | |||
IMessage m = new Message(iie.getMessage(), IMessage.ERROR, null, location); | |||
IMessage m = new Message(iae.getMessage(), IMessage.ERROR, null, location); | |||
handler.handleMessage(m); | |||
} | |||
return buildConfig; |
@@ -108,7 +108,7 @@ public class AccessForInlineVisitor extends ASTVisitor { | |||
} | |||
public void endVisit(FieldReference ref, BlockScope scope) { | |||
ref.binding = getAccessibleField(ref.binding, ref.receiverType); | |||
ref.binding = getAccessibleField(ref.binding, ref.actualReceiverType); | |||
} | |||
public void endVisit(MessageSend send, BlockScope scope) { |
@@ -32,6 +32,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleTypeReference; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.CodeStream; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.Opcodes; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; | |||
@@ -81,7 +82,7 @@ public class AdviceDeclaration extends AjMethodDeclaration { | |||
l.add(new EclipseAttributeAdapter(makeAttribute())); | |||
addDeclarationStartLineAttribute(l, classFile); | |||
return classFile.generateMethodInfoAttribute(binding, false, l); | |||
return classFile.generateMethodInfoAttributes(binding, l); | |||
} | |||
private AjAttribute makeAttribute() { | |||
@@ -109,7 +110,7 @@ public class AdviceDeclaration extends AjMethodDeclaration { | |||
TypeBinding argTb = extraArgument.binding.type; | |||
TypeBinding expectedTb = upperScope.getJavaLangThrowable(); | |||
if (!argTb.isCompatibleWith(expectedTb)) { | |||
scope.problemReporter().typeMismatchError(argTb, expectedTb, extraArgument); | |||
scope.problemReporter().typeMismatchError(argTb, expectedTb, extraArgument,null); | |||
ignoreFurtherInvestigation = true; | |||
return; | |||
} | |||
@@ -190,7 +191,7 @@ public class AdviceDeclaration extends AjMethodDeclaration { | |||
classFile.generateMethodInfoHeader(binding); | |||
int methodAttributeOffset = classFile.contentsOffset; | |||
int attributeNumber = classFile.generateMethodInfoAttribute(binding, false, AstUtil.getAjSyntheticAttribute()); | |||
int attributeNumber = classFile.generateMethodInfoAttributes(binding, AstUtil.getAjSyntheticAttribute()); | |||
int codeAttributeOffset = classFile.contentsOffset; | |||
classFile.generateCodeAttributeHeader(); | |||
CodeStream codeStream = classFile.codeStream; | |||
@@ -219,7 +220,7 @@ public class AdviceDeclaration extends AjMethodDeclaration { | |||
codeStream.load(type, index); | |||
index += AstUtil.slotsNeeded(type); | |||
if (type.isBaseType()) { | |||
codeStream.invokestatic(AjTypeConstants.getConversionMethodToObject(classScope, type)); | |||
codeStream.invoke(Opcodes.OPC_invokestatic, AjTypeConstants.getConversionMethodToObject(classScope, type), null); | |||
} | |||
codeStream.aastore(); | |||
@@ -228,11 +229,11 @@ public class AdviceDeclaration extends AjMethodDeclaration { | |||
// call run | |||
ReferenceBinding closureType = (ReferenceBinding) binding.parameters[nargs - 1]; | |||
MethodBinding runMethod = closureType.getMethods("run".toCharArray())[0]; | |||
codeStream.invokevirtual(runMethod); | |||
codeStream.invoke(Opcodes.OPC_invokevirtual, runMethod, null); | |||
TypeBinding returnType = binding.returnType; | |||
if (returnType.isBaseType()) { | |||
codeStream.invokestatic(AjTypeConstants.getConversionMethodFromObject(classScope, returnType)); | |||
codeStream.invoke(Opcodes.OPC_invokestatic, AjTypeConstants.getConversionMethodFromObject(classScope, returnType), null); | |||
} else { | |||
codeStream.checkcast(returnType); | |||
} | |||
@@ -240,7 +241,7 @@ public class AdviceDeclaration extends AjMethodDeclaration { | |||
codeStream.recordPositionsFrom(0, 1); | |||
classFile.completeCodeAttribute(codeAttributeOffset); | |||
attributeNumber++; | |||
classFile.completeMethodInfo(methodAttributeOffset, attributeNumber); | |||
classFile.completeMethodInfo(binding,methodAttributeOffset, attributeNumber); | |||
} | |||
// override |
@@ -40,7 +40,7 @@ public class AjConstructorDeclaration extends ConstructorDeclaration { | |||
// add extra attributes into list then call 2-arg version of generateInfoAttributes... | |||
List extras = new ArrayList(); | |||
addDeclarationStartLineAttribute(extras,classFile); | |||
return classFile.generateMethodInfoAttribute(binding,false,extras); | |||
return classFile.generateMethodInfoAttributes(binding,extras); | |||
} | |||
protected void addDeclarationStartLineAttribute(List extraAttributeList, ClassFile classFile) { |
@@ -53,7 +53,7 @@ public class AjMethodDeclaration extends MethodDeclaration { | |||
if (addAjSynthetic) { | |||
extras.add(new EclipseAttributeAdapter(new AjAttribute.AjSynthetic())); | |||
} | |||
return classFile.generateMethodInfoAttribute(binding,false,extras); | |||
return classFile.generateMethodInfoAttributes(binding,extras); | |||
} | |||
protected int generateInfoAttributes(ClassFile classFile) { |
@@ -20,6 +20,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.BranchLabel; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.CodeStream; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.ExceptionLabel; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.Opcodes; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; | |||
@@ -57,11 +58,10 @@ public class AspectClinit extends Clinit { | |||
if (hasPre) { | |||
final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(classScope); | |||
codeStream.invokestatic(world.makeMethodBindingForCall( | |||
codeStream.invoke(Opcodes.OPC_invokestatic,world.makeMethodBindingForCall( | |||
AjcMemberMaker.ajcPreClinitMethod( | |||
world.fromBinding(classScope.referenceContext.binding) | |||
))); | |||
)),null); | |||
} | |||
super.generateSyntheticCode(classScope, codeStream); | |||
} | |||
@@ -73,11 +73,10 @@ public class AspectClinit extends Clinit { | |||
super.generatePostSyntheticCode(classScope, codeStream); | |||
if (hasPost) { | |||
final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(classScope); | |||
codeStream.invokestatic(world.makeMethodBindingForCall( | |||
codeStream.invoke(Opcodes.OPC_invokestatic,world.makeMethodBindingForCall( | |||
AjcMemberMaker.ajcPostClinitMethod( | |||
world.fromBinding(classScope.referenceContext.binding) | |||
))); | |||
)),null); | |||
} | |||
if (initFailureField != null) { | |||
@@ -91,7 +90,7 @@ public class AspectClinit extends Clinit { | |||
// CHECK THIS... | |||
codeStream.addVariable(new LocalVariableBinding("caughtException".toCharArray(),initFailureField.type,ClassFileConstants.AccPrivate,false)); | |||
codeStream.aload_0(); | |||
codeStream.putstatic(initFailureField); | |||
codeStream.fieldAccess(Opcodes.OPC_putstatic, initFailureField, null); | |||
endLabel.place(); | |||
} | |||
@@ -38,6 +38,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.BranchLabel; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.CodeStream; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.ExceptionLabel; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.Opcodes; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope; | |||
@@ -67,6 +68,8 @@ import org.aspectj.weaver.patterns.PerFromSuper; | |||
import org.aspectj.weaver.patterns.PerSingleton; | |||
import org.aspectj.weaver.patterns.TypePattern; | |||
import com.sun.org.apache.xpath.internal.compiler.OpCodes; | |||
/** | |||
* Represents an aspect declaration. | |||
* | |||
@@ -428,9 +431,9 @@ public class AspectDeclaration extends TypeDeclaration { | |||
List attrs = new ArrayList(); | |||
attrs.addAll(AstUtil.getAjSyntheticAttribute()); | |||
attrs.addAll(additionalAttributes); | |||
attributeNumber = classFile.generateMethodInfoAttribute(methodBinding, false, attrs); | |||
attributeNumber = classFile.generateMethodInfoAttributes(methodBinding, attrs); | |||
} else { | |||
attributeNumber = classFile.generateMethodInfoAttribute(methodBinding, false, AstUtil.getAjSyntheticAttribute()); | |||
attributeNumber = classFile.generateMethodInfoAttributes(methodBinding, AstUtil.getAjSyntheticAttribute()); | |||
} | |||
int codeAttributeOffset = classFile.contentsOffset; | |||
@@ -460,7 +463,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
} | |||
attributeNumber++; | |||
classFile.completeMethodInfo(methodAttributeOffset, attributeNumber); | |||
classFile.completeMethodInfo(methodBinding,methodAttributeOffset, attributeNumber); | |||
} | |||
private void generatePerCflowAspectOfMethod(ClassFile classFile) { | |||
@@ -468,8 +471,9 @@ public class AspectDeclaration extends TypeDeclaration { | |||
generateMethod(classFile, aspectOfMethod, new BodyGenerator() { | |||
public void generate(CodeStream codeStream) { | |||
// body starts here | |||
codeStream.getstatic(world.makeFieldBinding(AjcMemberMaker.perCflowField(typeX))); | |||
codeStream.invokevirtual(world.makeMethodBindingForCall(AjcMemberMaker.cflowStackPeekInstance())); | |||
codeStream.fieldAccess(Opcodes.OPC_getstatic,world.makeFieldBinding(AjcMemberMaker.perCflowField(typeX)),null); | |||
codeStream.invoke(Opcodes.OPC_invokevirtual,world.makeMethodBindingForCall(AjcMemberMaker.cflowStackPeekInstance()),null); | |||
codeStream.checkcast(binding); | |||
codeStream.areturn(); | |||
// body ends here | |||
@@ -483,8 +487,8 @@ public class AspectDeclaration extends TypeDeclaration { | |||
generateMethod(classFile, hasAspectMethod, new BodyGenerator() { | |||
public void generate(CodeStream codeStream) { | |||
// body starts here | |||
codeStream.getstatic(world.makeFieldBinding(AjcMemberMaker.perCflowField(typeX))); | |||
codeStream.invokevirtual(world.makeMethodBindingForCall(AjcMemberMaker.cflowStackIsValid())); | |||
codeStream.fieldAccess(Opcodes.OPC_getstatic,world.makeFieldBinding(AjcMemberMaker.perCflowField(typeX)),null); | |||
codeStream.invoke(Opcodes.OPC_invokevirtual,world.makeMethodBindingForCall(AjcMemberMaker.cflowStackIsValid()),null); | |||
codeStream.ireturn(); | |||
// body ends here | |||
} | |||
@@ -497,13 +501,13 @@ public class AspectDeclaration extends TypeDeclaration { | |||
new BodyGenerator() { | |||
public void generate(CodeStream codeStream) { | |||
// body starts here | |||
codeStream.getstatic(world.makeFieldBinding(AjcMemberMaker.perCflowField(typeX))); | |||
codeStream.fieldAccess(Opcodes.OPC_getstatic,world.makeFieldBinding(AjcMemberMaker.perCflowField(typeX)),null); | |||
codeStream.new_(binding); | |||
codeStream.dup(); | |||
codeStream.invokespecial(new MethodBinding(0, "<init>".toCharArray(), TypeBinding.VOID, new TypeBinding[0], | |||
new ReferenceBinding[0], binding)); | |||
codeStream.invoke(Opcodes.OPC_invokespecial,new MethodBinding(0, "<init>".toCharArray(), TypeBinding.VOID, new TypeBinding[0], | |||
new ReferenceBinding[0], binding),null); | |||
codeStream.invokevirtual(world.makeMethodBindingForCall(AjcMemberMaker.cflowStackPushInstance())); | |||
codeStream.invoke(Opcodes.OPC_invokevirtual, world.makeMethodBindingForCall(AjcMemberMaker.cflowStackPushInstance()), null); | |||
codeStream.return_(); | |||
// body ends here | |||
} | |||
@@ -519,8 +523,8 @@ public class AspectDeclaration extends TypeDeclaration { | |||
// body starts here | |||
codeStream.new_(world.makeTypeBinding(AjcMemberMaker.CFLOW_STACK_TYPE)); | |||
codeStream.dup(); | |||
codeStream.invokespecial(world.makeMethodBindingForCall(AjcMemberMaker.cflowStackInit())); | |||
codeStream.putstatic(world.makeFieldBinding(AjcMemberMaker.perCflowField(typeX))); | |||
codeStream.invoke(Opcodes.OPC_invokespecial,world.makeMethodBindingForCall(AjcMemberMaker.cflowStackInit()),null); | |||
codeStream.fieldAccess(Opcodes.OPC_putstatic,world.makeFieldBinding(AjcMemberMaker.perCflowField(typeX)),null); | |||
codeStream.return_(); | |||
// body ends here | |||
} | |||
@@ -558,7 +562,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
.makeTypeBinding(UnresolvedType.JL_EXCEPTION)); | |||
anythingGoesWrong.placeStart(); | |||
codeStream.aload_0(); | |||
codeStream.invokestatic(world.makeMethodBindingForCall(AjcMemberMaker.perTypeWithinGetInstance(typeX))); | |||
codeStream.invoke(Opcodes.OPC_invokestatic,world.makeMethodBindingForCall(AjcMemberMaker.perTypeWithinGetInstance(typeX)),null); | |||
codeStream.astore_1(); | |||
codeStream.aload_1(); | |||
codeStream.ifnonnull(instanceFound); | |||
@@ -568,7 +572,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
codeStream.ldc(typeX.getName()); | |||
codeStream.aconst_null(); | |||
codeStream.invokespecial(world.makeMethodBindingForCall(AjcMemberMaker.noAspectBoundExceptionInit2())); | |||
codeStream.invoke(Opcodes.OPC_invokespecial,world.makeMethodBindingForCall(AjcMemberMaker.noAspectBoundExceptionInit2()),null); | |||
codeStream.athrow(); | |||
instanceFound.place(); | |||
codeStream.aload_1(); | |||
@@ -583,7 +587,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
codeStream.dup(); | |||
// Run the simple ctor for NABE | |||
codeStream.invokespecial(world.makeMethodBindingForCall(AjcMemberMaker.noAspectBoundExceptionInit())); | |||
codeStream.invoke(Opcodes.OPC_invokespecial,world.makeMethodBindingForCall(AjcMemberMaker.noAspectBoundExceptionInit()),null); | |||
codeStream.athrow(); | |||
} | |||
}); | |||
@@ -601,7 +605,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
codeStream.ifeq(wrongType); | |||
codeStream.aload_0(); | |||
codeStream.checkcast(interfaceType); | |||
codeStream.invokeinterface(world.makeMethodBindingForCall(AjcMemberMaker.perObjectInterfaceGet(typeX))); | |||
codeStream.invoke(Opcodes.OPC_invokeinterface,world.makeMethodBindingForCall(AjcMemberMaker.perObjectInterfaceGet(typeX)),null); | |||
codeStream.dup(); | |||
codeStream.ifnull(popWrongType); | |||
@@ -613,7 +617,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
wrongType.place(); | |||
codeStream.new_(world.makeTypeBinding(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION)); | |||
codeStream.dup(); | |||
codeStream.invokespecial(world.makeMethodBindingForCall(AjcMemberMaker.noAspectBoundExceptionInit())); | |||
codeStream.invoke(Opcodes.OPC_invokespecial,world.makeMethodBindingForCall(AjcMemberMaker.noAspectBoundExceptionInit()),null); | |||
codeStream.athrow(); | |||
// body ends here | |||
} | |||
@@ -632,7 +636,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
codeStream.ifeq(wrongType); | |||
codeStream.aload_0(); | |||
codeStream.checkcast(interfaceType); | |||
codeStream.invokeinterface(world.makeMethodBindingForCall(AjcMemberMaker.perObjectInterfaceGet(typeX))); | |||
codeStream.invoke(Opcodes.OPC_invokeinterface,world.makeMethodBindingForCall(AjcMemberMaker.perObjectInterfaceGet(typeX)),null); | |||
codeStream.ifnull(wrongType); | |||
codeStream.iconst_1(); | |||
codeStream.ireturn(); | |||
@@ -655,7 +659,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
BranchLabel leave = new BranchLabel(codeStream); | |||
goneBang.placeStart(); | |||
codeStream.aload_0(); | |||
codeStream.invokestatic(world.makeMethodBinding(AjcMemberMaker.perTypeWithinGetInstance(typeX))); | |||
codeStream.invoke(Opcodes.OPC_invokestatic,world.makeMethodBinding(AjcMemberMaker.perTypeWithinGetInstance(typeX)),null); | |||
codeStream.ifnull(noInstanceExists); | |||
codeStream.iconst_1(); | |||
codeStream.goto_(leave); | |||
@@ -683,7 +687,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
codeStream.ifeq(wrongType); // XXX this case might call for screaming | |||
codeStream.aload_0(); | |||
codeStream.checkcast(interfaceType); | |||
codeStream.invokeinterface(world.makeMethodBindingForCall(AjcMemberMaker.perObjectInterfaceGet(typeX))); | |||
codeStream.invoke(Opcodes.OPC_invokeinterface,world.makeMethodBindingForCall(AjcMemberMaker.perObjectInterfaceGet(typeX)),null); | |||
// XXX should do a check for null here and throw a NoAspectBound | |||
codeStream.ifnonnull(wrongType); | |||
@@ -691,9 +695,9 @@ public class AspectDeclaration extends TypeDeclaration { | |||
codeStream.checkcast(interfaceType); | |||
codeStream.new_(binding); | |||
codeStream.dup(); | |||
codeStream.invokespecial(new MethodBinding(0, "<init>".toCharArray(), TypeBinding.VOID, new TypeBinding[0], | |||
new ReferenceBinding[0], binding)); | |||
codeStream.invokeinterface(world.makeMethodBindingForCall(AjcMemberMaker.perObjectInterfaceSet(typeX))); | |||
codeStream.invoke(Opcodes.OPC_invokespecial,new MethodBinding(0, "<init>".toCharArray(), TypeBinding.VOID, new TypeBinding[0], | |||
new ReferenceBinding[0], binding),null); | |||
codeStream.invoke(Opcodes.OPC_invokeinterface,world.makeMethodBindingForCall(AjcMemberMaker.perObjectInterfaceSet(typeX)),null); | |||
wrongType.place(); | |||
codeStream.return_(); | |||
@@ -715,7 +719,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
ExceptionLabel exc = new ExceptionLabel(codeStream, world.makeTypeBinding(UnresolvedType.JL_EXCEPTION)); | |||
exc.placeStart(); | |||
codeStream.aload_0(); | |||
codeStream.getfield(world.makeFieldBinding(AjcMemberMaker.perTypeWithinWithinTypeField(typeX, typeX))); | |||
codeStream.fieldAccess(Opcodes.OPC_getfield,world.makeFieldBinding(AjcMemberMaker.perTypeWithinWithinTypeField(typeX, typeX)),null); | |||
codeStream.areturn(); | |||
} | |||
}); | |||
@@ -731,19 +735,19 @@ public class AspectDeclaration extends TypeDeclaration { | |||
codeStream.aload_0(); | |||
codeStream.ldc(NameMangler.perTypeWithinLocalAspectOf(typeX)); | |||
codeStream.aconst_null(); | |||
codeStream.invokevirtual(new MethodBinding(0, "getDeclaredMethod".toCharArray(), | |||
codeStream.invoke(Opcodes.OPC_invokevirtual,new MethodBinding(0, "getDeclaredMethod".toCharArray(), | |||
world.makeTypeBinding(UnresolvedType.forSignature("Ljava/lang/reflect/Method;")), // return type | |||
new TypeBinding[] { world.makeTypeBinding(UnresolvedType.forSignature("Ljava/lang/String;")), | |||
world.makeTypeBinding(UnresolvedType.forSignature("[Ljava/lang/Class;")) }, | |||
new ReferenceBinding[0], (ReferenceBinding) world.makeTypeBinding(UnresolvedType.JL_CLASS))); | |||
new ReferenceBinding[0], (ReferenceBinding) world.makeTypeBinding(UnresolvedType.JL_CLASS)),null); | |||
codeStream.astore_1(); | |||
codeStream.aload_1(); | |||
codeStream.aconst_null(); | |||
codeStream.aconst_null(); | |||
codeStream.invokevirtual(new MethodBinding(0, "invoke".toCharArray(), world.makeTypeBinding(UnresolvedType.OBJECT), | |||
codeStream.invoke(Opcodes.OPC_invokevirtual,new MethodBinding(0, "invoke".toCharArray(), world.makeTypeBinding(UnresolvedType.OBJECT), | |||
new TypeBinding[] { world.makeTypeBinding(UnresolvedType.OBJECT), | |||
world.makeTypeBinding(UnresolvedType.forSignature("[Ljava/lang/Object;")) }, | |||
new ReferenceBinding[0], (ReferenceBinding) world.makeTypeBinding(UnresolvedType.JAVA_LANG_REFLECT_METHOD))); | |||
new ReferenceBinding[0], (ReferenceBinding) world.makeTypeBinding(UnresolvedType.JAVA_LANG_REFLECT_METHOD)),null); | |||
codeStream.checkcast(world.makeTypeBinding(typeX)); | |||
codeStream.astore_2(); | |||
codeStream.aload_2(); | |||
@@ -766,12 +770,12 @@ public class AspectDeclaration extends TypeDeclaration { | |||
codeStream.new_(world.makeTypeBinding(typeX)); | |||
codeStream.dup(); | |||
codeStream.invokespecial(new MethodBinding(0, "<init>".toCharArray(), TypeBinding.VOID, new TypeBinding[0], | |||
new ReferenceBinding[0], binding)); | |||
codeStream.invoke(Opcodes.OPC_invokespecial,new MethodBinding(0, "<init>".toCharArray(), TypeBinding.VOID, new TypeBinding[0], | |||
new ReferenceBinding[0], binding),null); | |||
codeStream.astore_1(); | |||
codeStream.aload_1(); | |||
codeStream.aload_0(); | |||
codeStream.putfield(world.makeFieldBinding(AjcMemberMaker.perTypeWithinWithinTypeField(typeX, typeX))); | |||
codeStream.fieldAccess(Opcodes.OPC_putfield,world.makeFieldBinding(AjcMemberMaker.perTypeWithinWithinTypeField(typeX, typeX)),null); | |||
codeStream.aload_1(); | |||
codeStream.areturn(); | |||
} | |||
@@ -810,17 +814,17 @@ public class AspectDeclaration extends TypeDeclaration { | |||
*/ | |||
// body starts here (see end of each line for what it is doing!) | |||
FieldBinding fb = world.makeFieldBinding(AjcMemberMaker.perSingletonField(typeX)); | |||
codeStream.getstatic(fb); // GETSTATIC | |||
codeStream.fieldAccess(Opcodes.OPC_getstatic, fb, null); | |||
BranchLabel isNonNull = new BranchLabel(codeStream); | |||
codeStream.ifnonnull(isNonNull); // IFNONNULL | |||
codeStream.new_(world.makeTypeBinding(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION)); // NEW | |||
codeStream.dup(); // DUP | |||
codeStream.ldc(typeX.getNameAsIdentifier()); // LDC | |||
codeStream.getstatic(initFailureField); // GETSTATIC | |||
codeStream.invokespecial(world.makeMethodBindingForCall(AjcMemberMaker.noAspectBoundExceptionInitWithCause())); // INVOKESPECIAL | |||
codeStream.fieldAccess(Opcodes.OPC_getstatic,initFailureField,null); | |||
codeStream.invoke(Opcodes.OPC_invokespecial,world.makeMethodBindingForCall(AjcMemberMaker.noAspectBoundExceptionInitWithCause()),null); // INVOKESPECIAL | |||
codeStream.athrow(); // ATHROW | |||
isNonNull.place(); | |||
codeStream.getstatic(fb); // GETSTATIC | |||
codeStream.fieldAccess(Opcodes.OPC_getstatic,fb,null); | |||
codeStream.areturn(); // ARETURN | |||
// body ends here | |||
} | |||
@@ -832,7 +836,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
generateMethod(classFile, hasAspectMethod, new BodyGenerator() { | |||
public void generate(CodeStream codeStream) { | |||
// body starts here | |||
codeStream.getstatic(world.makeFieldBinding(AjcMemberMaker.perSingletonField(typeX))); | |||
codeStream.fieldAccess(Opcodes.OPC_getstatic,world.makeFieldBinding(AjcMemberMaker.perSingletonField(typeX)),null); | |||
BranchLabel isNull = new BranchLabel(codeStream); | |||
codeStream.ifnull(isNull); | |||
codeStream.iconst_1(); | |||
@@ -853,10 +857,10 @@ public class AspectDeclaration extends TypeDeclaration { | |||
// body starts here | |||
codeStream.new_(binding); | |||
codeStream.dup(); | |||
codeStream.invokespecial(new MethodBinding(0, "<init>".toCharArray(), TypeBinding.VOID, new TypeBinding[0], | |||
new ReferenceBinding[0], binding)); | |||
codeStream.invoke(Opcodes.OPC_invokespecial,new MethodBinding(0, "<init>".toCharArray(), TypeBinding.VOID, new TypeBinding[0], | |||
new ReferenceBinding[0], binding),null); | |||
codeStream.putstatic(world.makeFieldBinding(AjcMemberMaker.perSingletonField(typeX))); | |||
codeStream.fieldAccess(Opcodes.OPC_putstatic, world.makeFieldBinding(AjcMemberMaker.perSingletonField(typeX)), null); | |||
codeStream.return_(); | |||
// body ends here | |||
} | |||
@@ -870,7 +874,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
// body starts here | |||
codeStream.aload_0(); | |||
AstUtil.generateParameterLoads(accessMethod.parameters, codeStream, 1); | |||
codeStream.invokespecial(factory.makeMethodBinding(method)); | |||
codeStream.invoke(Opcodes.OPC_invokespecial,factory.makeMethodBinding(method),null); | |||
AstUtil.generateReturn(accessMethod.returnType, codeStream); | |||
// body ends here | |||
} | |||
@@ -894,10 +898,10 @@ public class AspectDeclaration extends TypeDeclaration { | |||
public void generate(CodeStream codeStream) { | |||
// body starts here | |||
if (Modifier.isStatic(field.getModifiers())) { | |||
codeStream.getstatic(fieldBinding); | |||
codeStream.fieldAccess(Opcodes.OPC_getstatic,fieldBinding,null); | |||
} else { | |||
codeStream.aload_0(); | |||
codeStream.getfield(fieldBinding); | |||
codeStream.fieldAccess(Opcodes.OPC_getfield,fieldBinding,null); | |||
} | |||
AstUtil.generateReturn(accessField.reader.returnType, codeStream); | |||
@@ -911,11 +915,11 @@ public class AspectDeclaration extends TypeDeclaration { | |||
// body starts here | |||
if (Modifier.isStatic(field.getModifiers())) { | |||
codeStream.load(fieldBinding.type, 0); | |||
codeStream.putstatic(fieldBinding); | |||
codeStream.fieldAccess(Opcodes.OPC_putstatic,fieldBinding,null); | |||
} else { | |||
codeStream.aload_0(); | |||
codeStream.load(fieldBinding.type, 1); | |||
codeStream.putfield(fieldBinding); | |||
codeStream.fieldAccess(Opcodes.OPC_putfield,fieldBinding,null); | |||
} | |||
codeStream.return_(); | |||
@@ -934,9 +938,9 @@ public class AspectDeclaration extends TypeDeclaration { | |||
AstUtil.generateParameterLoads(accessMethod.parameters, codeStream); | |||
if (Modifier.isStatic(method.getModifiers())) { | |||
codeStream.invokestatic(factory.makeMethodBinding(method)); | |||
codeStream.invoke(Opcodes.OPC_invokestatic,factory.makeMethodBinding(method),null); | |||
} else { | |||
codeStream.invokevirtual(factory.makeMethodBinding(method)); | |||
codeStream.invoke(Opcodes.OPC_invokevirtual,factory.makeMethodBinding(method),null); | |||
} | |||
AstUtil.generateReturn(accessMethod.returnType, codeStream); | |||
@@ -1135,7 +1139,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
} | |||
// may be unresolved if the aspect type binding was a BinaryTypeBinding | |||
if (innerTypeBinding instanceof UnresolvedReferenceBinding) { | |||
innerTypeBinding = BinaryTypeBinding.resolveType(innerTypeBinding, world.getLookupEnvironment(), true); | |||
innerTypeBinding = (ReferenceBinding)BinaryTypeBinding.resolveType(innerTypeBinding, world.getLookupEnvironment(), true); | |||
} | |||
if (innerTypeBinding == null) { | |||
throw new IllegalStateException("Could not find inner type binding for '" + munger.getMemberTypeName() + "'"); |
@@ -116,7 +116,7 @@ public class AstUtil { | |||
public static SingleNameReference makeLocalVariableReference(LocalVariableBinding binding) { | |||
SingleNameReference ret = new SingleNameReference(binding.name, 0); | |||
ret.binding = binding; | |||
ret.codegenBinding = binding; | |||
// ret.codegenBinding = binding; | |||
ret.constant = Constant.NotAConstant; | |||
ret.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits | |||
ret.bits |= Binding.VARIABLE; | |||
@@ -126,7 +126,7 @@ public class AstUtil { | |||
public static SingleNameReference makeResolvedLocalVariableReference(LocalVariableBinding binding) { | |||
SingleNameReference ret = new SingleNameReference(binding.name, 0); | |||
ret.binding = binding; | |||
ret.codegenBinding = binding; | |||
// ret.codegenBinding = binding; | |||
ret.constant = Constant.NotAConstant; | |||
ret.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits | |||
ret.bits |= Binding.LOCAL; | |||
@@ -300,7 +300,7 @@ public class AstUtil { | |||
} | |||
public static void replaceMethodBinding(MessageSend send, MethodBinding newBinding) { | |||
send.binding = send.codegenBinding = newBinding; | |||
send.binding =/* send.codegenBinding =*/ newBinding; | |||
send.setActualReceiverType(newBinding.declaringClass); | |||
} |
@@ -251,7 +251,7 @@ public class AtAspectJAnnotationFactory { | |||
NormalAnnotation ann = new NormalAnnotation(annType,pos); | |||
Expression targetExpr = new StringLiteral(targetTypeName,pos,pos,1); | |||
Expression nameExpr = new StringLiteral(name,pos,pos,1); | |||
Expression modsExpr = new IntLiteral(Integer.toString(modifiers).toCharArray(),pos,pos); | |||
Expression modsExpr = IntLiteral.buildIntLiteral(Integer.toString(modifiers).toCharArray(),pos,pos); | |||
MemberValuePair[] mvps = new MemberValuePair[3]; | |||
mvps[0] = new MemberValuePair("targetType".toCharArray(),pos,pos,targetExpr); | |||
mvps[1] = new MemberValuePair("name".toCharArray(),pos,pos,nameExpr); |
@@ -38,7 +38,7 @@ public class IfMethodDeclaration extends AjMethodDeclaration { | |||
} | |||
protected int generateInfoAttributes(ClassFile classFile) { | |||
return classFile.generateMethodInfoAttribute(binding, false, AstUtil.getAjSyntheticAttribute()); | |||
return classFile.generateMethodInfoAttributes(binding, AstUtil.getAjSyntheticAttribute()); | |||
} | |||
public void resolveStatements() { |
@@ -324,7 +324,7 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration { | |||
} | |||
addDeclarationStartLineAttribute(l,classFile); | |||
return classFile.generateMethodInfoAttribute(binding, false, l); | |||
return classFile.generateMethodInfoAttributes(binding, l); | |||
} | |||
protected abstract Shadow.Kind getShadowKindForBody(); |
@@ -30,6 +30,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ReturnStatement; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Statement; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.CodeStream; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.Opcodes; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding; | |||
@@ -323,8 +324,7 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration { | |||
} | |||
classFile.generateMethodInfoHeader(binding); | |||
int methodAttributeOffset = classFile.contentsOffset; | |||
int attributeNumber = classFile.generateMethodInfoAttribute(binding, false, | |||
makeEffectiveSignatureAttribute(sig, isGetter ? Shadow.FieldGet : Shadow.FieldSet, false)); | |||
int attributeNumber = classFile.generateMethodInfoAttributes(binding, makeEffectiveSignatureAttribute(sig, isGetter ? Shadow.FieldGet : Shadow.FieldSet, false)); | |||
int codeAttributeOffset = classFile.contentsOffset; | |||
classFile.generateCodeAttributeHeader(); | |||
CodeStream codeStream = classFile.codeStream; | |||
@@ -377,18 +377,18 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration { | |||
classFile.completeCodeAttribute(codeAttributeOffset); | |||
attributeNumber++; | |||
classFile.completeMethodInfo(methodAttributeOffset, attributeNumber); | |||
classFile.completeMethodInfo(binding,methodAttributeOffset, attributeNumber); | |||
} | |||
private void generateInterfaceReadBody(MethodBinding binding, MethodBinding readMethod, CodeStream codeStream) { | |||
codeStream.aload_0(); | |||
codeStream.invokeinterface(readMethod); | |||
codeStream.invoke(Opcodes.OPC_invokeinterface,readMethod,null); | |||
} | |||
private void generateInterfaceWriteBody(MethodBinding binding, MethodBinding writeMethod, CodeStream codeStream) { | |||
codeStream.aload_0(); | |||
codeStream.load(writeMethod.parameters[0], 1); | |||
codeStream.invokeinterface(writeMethod); | |||
codeStream.invoke(Opcodes.OPC_invokeinterface, writeMethod, null); | |||
} | |||
private void generateClassReadBody(MethodBinding binding, FieldBinding field, CodeStream codeStream) { | |||
@@ -407,18 +407,18 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration { | |||
PrivilegedFieldBinding fBinding = (PrivilegedFieldBinding) handler.getPrivilegedAccessField(field, null); | |||
if (field.isStatic()) { | |||
codeStream.invokestatic(fBinding.reader); | |||
codeStream.invoke(Opcodes.OPC_invokestatic,fBinding.reader,null); | |||
} else { | |||
codeStream.aload_0(); | |||
codeStream.invokestatic(fBinding.reader); | |||
codeStream.invoke(Opcodes.OPC_invokestatic,fBinding.reader,null); | |||
} | |||
return; | |||
} | |||
if (field.isStatic()) { | |||
codeStream.getstatic(field); | |||
codeStream.fieldAccess(Opcodes.OPC_getstatic,field,null); | |||
} else { | |||
codeStream.aload_0(); | |||
codeStream.getfield(field); | |||
codeStream.fieldAccess(Opcodes.OPC_getfield,field,null); | |||
} | |||
} | |||
@@ -426,24 +426,23 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration { | |||
if (field.isPrivate() || !field.canBeSeenBy(binding.declaringClass.fPackage)) { | |||
PrivilegedFieldBinding fBinding = (PrivilegedFieldBinding) Scope.findPrivilegedHandler(binding.declaringClass) | |||
.getPrivilegedAccessField(field, null); | |||
if (field.isStatic()) { | |||
codeStream.load(field.type, 0); | |||
codeStream.invokestatic(fBinding.writer); | |||
codeStream.invoke(Opcodes.OPC_invokestatic,fBinding.writer,null); | |||
} else { | |||
codeStream.aload_0(); | |||
codeStream.load(field.type, 1); | |||
codeStream.invokestatic(fBinding.writer); | |||
codeStream.invoke(Opcodes.OPC_invokestatic,fBinding.writer,null); | |||
} | |||
return; | |||
} | |||
if (field.isStatic()) { | |||
codeStream.load(field.type, 0); | |||
codeStream.putstatic(field); | |||
codeStream.fieldAccess(Opcodes.OPC_putstatic,field,null); | |||
} else { | |||
codeStream.aload_0(); | |||
codeStream.load(field.type, 1); | |||
codeStream.putfield(field); | |||
codeStream.fieldAccess(Opcodes.OPC_putfield,field,null); | |||
} | |||
} | |||
@@ -24,6 +24,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclarat | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.CodeStream; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.Opcodes; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.flow.FlowInfo; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope; | |||
@@ -253,7 +254,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration { | |||
// the dispatch binding attributes will include the annotations from the 'binding'. | |||
// There is a chance that something else on the binding (e.g. throws clause) might | |||
// damage the attributes generated for the dispatch binding. | |||
int attributeNumber = classFile.generateMethodInfoAttribute(binding, false, makeEffectiveSignatureAttribute(signature, | |||
int attributeNumber = classFile.generateMethodInfoAttributes(binding, makeEffectiveSignatureAttribute(signature, | |||
Shadow.MethodCall, false)); | |||
int codeAttributeOffset = classFile.contentsOffset; | |||
classFile.generateCodeAttributeHeader(); | |||
@@ -291,12 +292,12 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration { | |||
} | |||
// TypeBinding type; | |||
if (methodBinding.isStatic()) | |||
codeStream.invokestatic(methodBinding); | |||
codeStream.invoke(Opcodes.OPC_invokestatic,methodBinding,null); | |||
else { | |||
if (methodBinding.declaringClass.isInterface()) { | |||
codeStream.invokeinterface(methodBinding); | |||
codeStream.invoke(Opcodes.OPC_invokeinterface, methodBinding, null); | |||
} else { | |||
codeStream.invokevirtual(methodBinding); | |||
codeStream.invoke(Opcodes.OPC_invokevirtual, methodBinding, null); | |||
} | |||
} | |||
AstUtil.generateReturn(dispatchBinding.returnType, codeStream); | |||
@@ -311,7 +312,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration { | |||
} | |||
classFile.completeCodeAttribute(codeAttributeOffset); | |||
attributeNumber++; | |||
classFile.completeMethodInfo(methodAttributeOffset, attributeNumber); | |||
classFile.completeMethodInfo(binding,methodAttributeOffset, attributeNumber); | |||
} | |||
protected Shadow.Kind getShadowKindForBody() { |
@@ -25,7 +25,7 @@ public class KnownFieldReference extends QualifiedNameReference { | |||
public KnownFieldReference(FieldBinding binding, int startPos,int endPos) { | |||
super(new char[][] {binding.name},new long[1], startPos, endPos); | |||
this.binding = this.codegenBinding = binding; | |||
this.binding = /*this.codegenBinding = */binding; | |||
this.constant = Constant.NotAConstant; | |||
this.actualReceiverType = binding.declaringClass; | |||
@@ -36,7 +36,7 @@ public class KnownFieldReference extends QualifiedNameReference { | |||
//XXX handle source locations | |||
public KnownFieldReference(FieldBinding binding, long pos) { | |||
super(new char[][] {binding.name},new long[1], 0, 0); | |||
this.binding = this.codegenBinding = binding; | |||
this.binding = /*this.codegenBinding = */binding; | |||
this.constant = Constant.NotAConstant; | |||
this.actualReceiverType = binding.declaringClass; | |||
@@ -9,8 +9,6 @@ | |||
* Contributors: | |||
* PARC initial implementation | |||
* ******************************************************************/ | |||
package org.aspectj.ajdt.internal.compiler.ast; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression; | |||
@@ -25,9 +23,10 @@ public class KnownMessageSend extends MessageSend { | |||
public KnownMessageSend(MethodBinding binding, Expression receiver, Expression[] arguments) { | |||
super(); | |||
this.binding = this.codegenBinding = binding; | |||
this.binding = binding; | |||
this.arguments = arguments; | |||
this.receiver = receiver; | |||
this.actualReceiverType = binding.declaringClass; | |||
this.selector = binding.selector; | |||
constant = Constant.NotAConstant; | |||
} | |||
@@ -40,6 +39,7 @@ public class KnownMessageSend extends MessageSend { | |||
BlockScope scope, | |||
TypeBinding[] argumentTypes) { | |||
// we've already resolved this | |||
} | |||
public String toStringExpression() { | |||
@@ -51,6 +51,7 @@ public class KnownMessageSend extends MessageSend { | |||
CodeStream codeStream, | |||
boolean valueRequired) { | |||
//System.out.println("about to generate: " +this + " args: " + Arrays.asList(arguments)); | |||
// this.actualReceiverType = this.receiver.resolveType(currentScope); | |||
super.generateCode(currentScope, codeStream, valueRequired); | |||
} | |||
@@ -46,7 +46,7 @@ public class Proceed extends MessageSend { | |||
this.selector = parent.selector; | |||
this.arguments = parent.arguments; | |||
this.binding = parent.binding; | |||
this.codegenBinding = parent.codegenBinding; | |||
//this.codegenBinding = parent.codegenBinding; | |||
this.syntheticAccessor = parent.syntheticAccessor; | |||
this.expectedType = parent.expectedType; | |||
@@ -72,7 +72,7 @@ public class Proceed extends MessageSend { | |||
} | |||
constant = Constant.NotAConstant; | |||
binding = codegenBinding = aroundDecl.proceedMethodBinding; | |||
binding =/* codegenBinding = */aroundDecl.proceedMethodBinding; | |||
this.actualReceiverType = binding.declaringClass; | |||
@@ -163,7 +163,7 @@ public class Proceed extends MessageSend { | |||
if (argType != null) { | |||
TypeBinding paramType = binding.parameters[i]; | |||
if (!argType.isCompatibleWith(paramType)) { | |||
scope.problemReporter().typeMismatchError(argType, paramType, arg); | |||
scope.problemReporter().typeMismatchError(argType, paramType, arg,null); | |||
} | |||
} | |||
} |
@@ -168,7 +168,7 @@ public class ProceedVisitor extends ASTVisitor { | |||
//System.err.println("replace static ref"); | |||
NameReference receiver = (NameReference) call.receiver; | |||
receiver.binding = thisJoinPointStaticPartDecLocal; //thisJoinPointStaticPartDec; | |||
receiver.codegenBinding = thisJoinPointStaticPartDecLocal; | |||
// receiver.codegenBinding = thisJoinPointStaticPartDecLocal; | |||
call.binding.declaringClass = | |||
(ReferenceBinding) thisJoinPointStaticPartDec.type; |
@@ -83,10 +83,10 @@ public class SuperFixerVisitor extends ASTVisitor { | |||
public void endVisit(MessageSend call, BlockScope scope) { | |||
// System.out.println("endVisit: " + call); | |||
// an error has already occurred | |||
if (call.codegenBinding == null) | |||
if (call.binding/*codegenBinding*/ == null) | |||
return; | |||
MethodBinding superBinding = call.codegenBinding; | |||
MethodBinding superBinding = call.binding/*codegenBinding*/; | |||
if (superBinding instanceof ProblemMethodBinding) { | |||
return; | |||
} |
@@ -188,7 +188,7 @@ public class ThisJoinPointVisitor extends ASTVisitor { | |||
// System.err.println("replace static ref: " + receiver + " is " + System.identityHashCode(receiver)); | |||
receiver.binding = thisJoinPointStaticPartDecLocal; // thisJoinPointStaticPartDec; | |||
receiver.codegenBinding = thisJoinPointStaticPartDecLocal; | |||
// receiver.codegenBinding = thisJoinPointStaticPartDecLocal; | |||
ReferenceBinding thisJoinPointStaticPartType = (ReferenceBinding) thisJoinPointStaticPartDec.type; | |||
@@ -1016,7 +1016,7 @@ public class EclipseFactory { | |||
// } else { | |||
// declaringElement = makeTypeBinding((UnresolvedType)tVar.getDeclaringElement()); | |||
// } | |||
tvBinding = new TypeVariableBinding(tv.getName().toCharArray(), declaringElement, tv.getRank()); | |||
tvBinding = new TypeVariableBinding(tv.getName().toCharArray(), declaringElement, tv.getRank(),this.lookupEnvironment); | |||
typeVariableToTypeBinding.put(tv.getName(), tvBinding); | |||
if (tv.getSuperclass() != null |
@@ -182,7 +182,7 @@ public class EclipseTypeMunger extends ConcreteTypeMunger { | |||
} | |||
// may be unresolved if the aspect type binding was a BinaryTypeBinding | |||
if (innerTypeBinding instanceof UnresolvedReferenceBinding) { | |||
innerTypeBinding = BinaryTypeBinding.resolveType(innerTypeBinding, world.getLookupEnvironment(), true); | |||
innerTypeBinding = (ReferenceBinding)BinaryTypeBinding.resolveType(innerTypeBinding, world.getLookupEnvironment(), true); | |||
} | |||
// rb = new InterTypeMemberClassBinding(world, munger, aspectType, aspectTypeBinding, onType, munger.getMemberTypeName(), | |||
// sourceType); |
@@ -102,8 +102,8 @@ public class HelperInterfaceBinding extends SourceTypeBinding { | |||
private void generateMethod(ClassFile classFile, MethodBinding binding) { | |||
classFile.generateMethodInfoHeader(binding); | |||
int methodAttributeOffset = classFile.contentsOffset; | |||
int attributeNumber = classFile.generateMethodInfoAttribute(binding); | |||
classFile.completeMethodInfo(methodAttributeOffset, attributeNumber); | |||
int attributeNumber = classFile.generateMethodInfoAttributes(binding); | |||
classFile.completeMethodInfo(binding,methodAttributeOffset, attributeNumber); | |||
} | |||
@@ -87,7 +87,7 @@ public class InterTypeScope extends ClassScope { | |||
int aliased = (aliases == null ? -1 : aliases.indexOf(variableName)); | |||
if (aliased != -1) { | |||
if (aliased > sourceType.typeVariables.length || sourceType.typeVariables.length == 0) { | |||
TypeVariableBinding tvb = new TypeVariableBinding("fake".toCharArray(), null, 0); | |||
TypeVariableBinding tvb = new TypeVariableBinding("fake".toCharArray(), null, 0,this.environment()); | |||
tvb.superclass = getJavaLangObject(); | |||
tvb.fPackage = new PackageBinding(environment()); | |||
return tvb; |
@@ -305,7 +305,9 @@ public class AjProblemReporter extends ProblemReporter { | |||
if (severity != ProblemSeverities.Ignore && DUMP_STACK) { | |||
Thread.dumpStack(); | |||
} | |||
super.handle(problemId, problemArguments, messageArguments, severity, problemStartPosition, problemEndPosition, | |||
super.handle(problemId, problemArguments, | |||
0, // no message elaboration | |||
messageArguments, severity, problemStartPosition, problemEndPosition, | |||
referenceContext, unitResult); | |||
} | |||
@@ -357,7 +359,7 @@ public class AjProblemReporter extends ProblemReporter { | |||
* Overrides the implementation in ProblemReporter and is ITD aware. To report a *real* problem with an ITD marked @override, | |||
* the other methodMustOverride() method is used. | |||
*/ | |||
public void methodMustOverride(AbstractMethodDeclaration method) { | |||
public void methodMustOverride(AbstractMethodDeclaration method, int complianceLevel) { | |||
// ignore ajc$ methods | |||
if (new String(method.selector).startsWith("ajc$")) | |||
@@ -389,7 +391,7 @@ public class AjProblemReporter extends ProblemReporter { | |||
supertypeToLookAt = supertypeToLookAt.getSuperclass(); | |||
} | |||
// report the error... | |||
super.methodMustOverride(method); | |||
super.methodMustOverride(method,complianceLevel); | |||
} | |||
private String typesAsString(boolean isVarargs, TypeBinding[] types, boolean makeShort) { | |||
@@ -668,12 +670,12 @@ public class AjProblemReporter extends ProblemReporter { | |||
} | |||
} | |||
public void duplicateMethodInType(SourceTypeBinding type, AbstractMethodDeclaration methodDecl) { | |||
public void duplicateMethodInType(SourceTypeBinding type, AbstractMethodDeclaration methodDecl, boolean equalParameters, int severity) { | |||
if (new String(methodDecl.selector).startsWith("ajc$interMethod")) { | |||
// this is an ITD clash and will be reported in another way by AspectJ (173602) | |||
return; | |||
} | |||
super.duplicateMethodInType(type, methodDecl); | |||
super.duplicateMethodInType(type, methodDecl, equalParameters, severity); | |||
} | |||
// pr246393 - if we are going to complain about privileged, we clearly don't know what is going on, so don't |
@@ -80,6 +80,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.batch.FileSystem; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.env.INameEnvironment; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.IrritantSet; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.problem.AbortCompilation; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; | |||
@@ -845,7 +846,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour | |||
bcelWorld.setXlazyTjp(buildConfig.isXlazyTjp()); | |||
bcelWorld.setXHasMemberSupportEnabled(buildConfig.isXHasMemberEnabled()); | |||
bcelWorld.setPinpointMode(buildConfig.isXdevPinpoint()); | |||
bcelWorld.setErrorAndWarningThreshold(buildConfig.getOptions().errorThreshold, buildConfig.getOptions().warningThreshold); | |||
bcelWorld.setErrorAndWarningThreshold(buildConfig.getOptions().errorThreshold.isSet(24), buildConfig.getOptions().warningThreshold.isSet(24)); | |||
BcelWeaver bcelWeaver = new BcelWeaver(bcelWorld); | |||
bcelWeaver.setCustomMungerFactory(customMungerFactory); | |||
state.setWorld(bcelWorld); |
@@ -16,6 +16,7 @@ import java.util.Map; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions; | |||
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.IrritantSet; | |||
import org.aspectj.weaver.Constants; | |||
/** | |||
@@ -49,16 +50,17 @@ public class AjCompilerOptions extends CompilerOptions { | |||
public static final String OPTION_GenerateJavaDocsInModel = "org.aspectj.ajdt.core.compiler.model.GenerateJavaDocsInModel"; | |||
public static final String OPTION_Emacssym = "org.aspectj.ajdt.core.compiler.model.Emacssym"; | |||
// constants for irritant levels | |||
public static final long InvalidAbsoluteTypeName = ASTNode.Bit47L; | |||
public static final long InvalidWildCardTypeName = ASTNode.Bit48L; | |||
public static final long UnresolvableMember = ASTNode.Bit49L; | |||
public static final long TypeNotExposedToWeaver = ASTNode.Bit50L; | |||
public static final long ShadowNotInStructure = ASTNode.Bit51L; | |||
public static final long UnmatchedSuperTypeInCall = ASTNode.Bit52L; | |||
public static final long CannotImplementLazyTJP = ASTNode.Bit53L; | |||
public static final long NeedSerialVersionUIDField = ASTNode.Bit54L; | |||
public static final long IncompatibleSerialVersion = ASTNode.Bit55L; | |||
public static final int InvalidAbsoluteTypeName = IrritantSet.GROUP2 | ASTNode.Bit8; | |||
public static final int InvalidWildCardTypeName = IrritantSet.GROUP2 | ASTNode.Bit9; | |||
public static final int UnresolvableMember = IrritantSet.GROUP2 | ASTNode.Bit10; | |||
public static final int TypeNotExposedToWeaver = IrritantSet.GROUP2 | ASTNode.Bit11; | |||
public static final int ShadowNotInStructure = IrritantSet.GROUP2 | ASTNode.Bit12; | |||
public static final int UnmatchedSuperTypeInCall = IrritantSet.GROUP2 | ASTNode.Bit13; | |||
public static final int CannotImplementLazyTJP = IrritantSet.GROUP2 | ASTNode.Bit14; | |||
public static final int NeedSerialVersionUIDField = IrritantSet.GROUP2 | ASTNode.Bit15; | |||
public static final int IncompatibleSerialVersion = IrritantSet.GROUP2 | ASTNode.Bit16; | |||
public boolean terminateAfterCompilation = false; | |||
public boolean xSerializableAspects = false; | |||
@@ -128,7 +130,7 @@ public class AjCompilerOptions extends CompilerOptions { | |||
*/ | |||
public Map getMap() { | |||
Map map = super.getMap(); | |||
// now add AspectJ additional options | |||
// now add AspectJ additional options | |||
map.put(OPTION_ReportInvalidAbsoluteTypeName, getSeverityString(InvalidAbsoluteTypeName)); | |||
map.put(OPTION_ReportInvalidWildcardTypeName, getSeverityString(InvalidWildCardTypeName)); | |||
map.put(OPTION_ReportUnresolvableMember, getSeverityString(UnresolvableMember)); | |||
@@ -290,8 +292,9 @@ public class AjCompilerOptions extends CompilerOptions { | |||
* Add these warnings to the default set... | |||
*/ | |||
private void setAspectJWarningDefaults() { | |||
super.warningThreshold = super.warningThreshold | InvalidAbsoluteTypeName | UnresolvableMember | TypeNotExposedToWeaver | |||
| UnmatchedSuperTypeInCall | CannotImplementLazyTJP | CompilerOptions.SwallowedExceptionInCatchBlock; | |||
super.warningThreshold = new IrritantSet(super.warningThreshold); | |||
super.warningThreshold.set(InvalidAbsoluteTypeName | UnresolvableMember | TypeNotExposedToWeaver | |||
| UnmatchedSuperTypeInCall | CannotImplementLazyTJP | CompilerOptions.SwallowedExceptionInCatchBlock); | |||
} | |||
/* |
@@ -1314,7 +1314,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
File sourceFile = new File(result.fileName()); | |||
CompilationResult cr = result.result(); | |||
references.put(sourceFile, new ReferenceCollection(cr.qualifiedReferences, cr.simpleNameReferences)); | |||
references.put(sourceFile, new ReferenceCollection(cr.qualifiedReferences, cr.simpleNameReferences,cr.rootReferences)); | |||
UnwovenClassFile[] unwovenClassFiles = result.unwovenClassFiles(); | |||
for (int i = 0; i < unwovenClassFiles.length; i++) { | |||
@@ -1936,7 +1936,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
existingCollection.addDependencies(typeNameDependencies); | |||
return true; | |||
} else { | |||
ReferenceCollection rc = new ReferenceCollection(null, null); | |||
ReferenceCollection rc = new ReferenceCollection(null, null, null); | |||
rc.addDependencies(typeNameDependencies); | |||
references.put(sourceFile, rc); | |||
return true; |
@@ -37,6 +37,10 @@ public class CompactTypeStructureRepresentation implements IBinaryType { | |||
char[] genericSignature; | |||
char[] superclassName; | |||
char[][] interfaces; | |||
char[] enclosingMethod; | |||
char[][][] missingTypeNames; | |||
// this is the extra state that enables us to be an IBinaryType | |||
char[] enclosingTypeName; | |||
@@ -50,6 +54,7 @@ public class CompactTypeStructureRepresentation implements IBinaryType { | |||
IBinaryMethod[] binMethods; | |||
IBinaryNestedType[] memberTypes; | |||
IBinaryAnnotation[] annotations; | |||
public CompactTypeStructureRepresentation(ClassFileReader cfr, boolean isAspect) { | |||
@@ -59,7 +64,9 @@ public class CompactTypeStructureRepresentation implements IBinaryType { | |||
this.isMember = cfr.isMember(); | |||
this.sourceFileName = cfr.sourceFileName(); | |||
this.fileName = cfr.getFileName(); | |||
this.missingTypeNames = cfr.getMissingTypeNames(); | |||
this.tagBits = cfr.getTagBits(); | |||
this.enclosingMethod = cfr.getEnclosingMethod(); | |||
this.isBinaryType = cfr.isBinaryType(); | |||
this.binFields = cfr.getFields(); | |||
if (binFields == null) { | |||
@@ -87,6 +94,10 @@ public class CompactTypeStructureRepresentation implements IBinaryType { | |||
} | |||
public char[][][] getMissingTypeNames() { | |||
return missingTypeNames; | |||
} | |||
public char[] getEnclosingTypeName() { | |||
return enclosingTypeName; | |||
} | |||
@@ -98,6 +109,10 @@ public class CompactTypeStructureRepresentation implements IBinaryType { | |||
public char[] getGenericSignature() { | |||
return genericSignature; | |||
} | |||
public char[] getEnclosingMethod() { | |||
return enclosingMethod; | |||
} | |||
public char[][] getInterfaceNames() { | |||
return interfaces; |
@@ -89,7 +89,7 @@ public class AjAST extends AST { | |||
ast.setDefaultNodeFlag(ASTNode.ORIGINAL); | |||
BindingResolver resolver = null; | |||
if (isResolved) { | |||
resolver = new DefaultBindingResolver(compilationUnitDeclaration.scope, workingCopy.owner, new DefaultBindingResolver.BindingTables(), false); | |||
resolver = new DefaultBindingResolver(compilationUnitDeclaration.scope, workingCopy.owner, new DefaultBindingResolver.BindingTables(), false,true); | |||
ast.setFlag(AST.RESOLVED_BINDINGS); | |||
} else { | |||
resolver = new BindingResolver(); |
@@ -2352,7 +2352,7 @@ public class AjASTConverter extends ASTConverter { | |||
} | |||
} | |||
} | |||
buildBodyDeclarations(typeDeclaration, typeDecl); | |||
buildBodyDeclarations(typeDeclaration, typeDecl,org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.kind(typeDeclaration.modifiers) == org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.INTERFACE_DECL); | |||
if (this.resolveBindings) { | |||
recordNodes(typeDecl, typeDeclaration); | |||
recordNodes(typeName, typeDeclaration); |
@@ -74,7 +74,7 @@ import org.aspectj.org.eclipse.jdt.core.dom.Type; | |||
import org.aspectj.org.eclipse.jdt.core.dom.TypeCategoryTypePattern; | |||
import org.aspectj.org.eclipse.jdt.core.dom.TypeDeclaration; | |||
import org.aspectj.org.eclipse.jdt.core.dom.TypePattern; | |||
import org.aspectj.org.eclipse.jdt.internal.core.SourceRange; | |||
import org.aspectj.org.eclipse.jdt.core.SourceRange; | |||
/** | |||
* For each AspectJ ASTNode there is a test for: |
@@ -21,7 +21,7 @@ import org.aspectj.org.eclipse.jdt.core.dom.ASTParser; | |||
import org.aspectj.org.eclipse.jdt.core.dom.AjAST; | |||
import org.aspectj.org.eclipse.jdt.core.dom.AjASTVisitor; | |||
import org.aspectj.org.eclipse.jdt.core.dom.CompilationUnit; | |||
import org.aspectj.org.eclipse.jdt.internal.core.SourceRange; | |||
import org.aspectj.org.eclipse.jdt.core.SourceRange; | |||
public abstract class AjASTTestCase extends TestCase { | |||