]> source.dussan.org Git - aspectj.git/commitdiff
275032: test and fix: itd of no-arg constructor should overwrite a generated default...
authoraclement <aclement>
Tue, 5 May 2009 23:41:20 +0000 (23:41 +0000)
committeraclement <aclement>
Tue, 5 May 2009 23:41:20 +0000 (23:41 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseAnnotationConvertor.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java

index 3aed8f22bd2fa9ef726f4e968a535c60de1d6428..d0088e16469bd4e10d8b5da28692fb423e5afd1e 100644 (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(
index 365373c5a18eb84cbda512e5882f757747ec5f18..463ecc5eba3075a42c43eff4947727c35e1eaff0 100644 (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);
+       }
+
 }