Browse Source

275032: test and fix: itd of no-arg constructor should overwrite a generated default constructor

tags/V1_6_5
aclement 15 years ago
parent
commit
a8c1caa33d

+ 3
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseAnnotationConvertor.java View File

@@ -15,6 +15,7 @@ import org.aspectj.apache.bcel.classfile.annotation.ElementValueGen;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
@@ -100,6 +101,8 @@ public class EclipseAnnotationConvertor {
annotationAJ.addNameValuePair(new AnnotationNameValuePair(new String(
singleMemberAnnotation.memberValuePairs()[0].name), av));
}
} else if (annotation instanceof MarkerAnnotation) {
MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
} else {
// this is a marker annotation (no member value pairs)
throw new MissingImplementationException(

+ 17
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java View File

@@ -26,6 +26,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.IntConstant;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
@@ -52,6 +53,7 @@ public class EclipseResolvedMember extends ResolvedMemberImpl {
private ResolvedType[] cachedAnnotationTypes;
private EclipseFactory eclipseFactory;

public EclipseResolvedMember(MethodBinding binding, MemberKind memberKind, ResolvedType realDeclaringType, int modifiers,
UnresolvedType rettype, String name, UnresolvedType[] paramtypes, UnresolvedType[] extypes,
EclipseFactory eclipseFactory) {
@@ -235,4 +237,19 @@ public class EclipseResolvedMember extends ResolvedMemberImpl {
return null;
}

/**
* Return true if this is the default constructor. The default constructor
* is the one generated if there isn't one in the source. Eclipse
* helpfully uses a bit to indicate the default constructor.
*
* @return true if this is the default constructor.
*/
public boolean isDefaultConstructor() {
if (!(realBinding instanceof MethodBinding)) {
return false;
}
MethodBinding mb = (MethodBinding) realBinding;
return mb.isConstructor() && ((mb.modifiers & ExtraCompilerModifiers.AccIsDefaultConstructor) != 0);
}

}

Loading…
Cancel
Save