aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2008-07-07 22:32:43 +0000
committeraclement <aclement>2008-07-07 22:32:43 +0000
commit13f83eba7cd6c3cdf9f97a527f3ed42f81bfd4ad (patch)
tree4c95b220faba6b636d8284841df97d01f044c502 /org.aspectj.ajdt.core
parentad03f314f66a7c49737f32fc23b4aea6bef3d8cf (diff)
downloadaspectj-13f83eba7cd6c3cdf9f97a527f3ed42f81bfd4ad.tar.gz
aspectj-13f83eba7cd6c3cdf9f97a527f3ed42f81bfd4ad.zip
238992: test and fix
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseAnnotationConvertor.java2
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java13
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java24
3 files changed, 34 insertions, 5 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseAnnotationConvertor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseAnnotationConvertor.java
index dac05522c..2a28a8535 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseAnnotationConvertor.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseAnnotationConvertor.java
@@ -138,7 +138,7 @@ public class EclipseAnnotationConvertor {
}
}
- private static AnnotationValue generateElementValueForConstantExpression(Expression defaultValue, TypeBinding defaultValueBinding) {
+ public static AnnotationValue generateElementValueForConstantExpression(Expression defaultValue, TypeBinding defaultValueBinding) {
if (defaultValueBinding != null) {
Constant c = defaultValue.constant;
if (c instanceof IntConstant) {
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
index c0eaaf4a5..0f885579c 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
@@ -16,14 +16,19 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AnnotationMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.FalseLiteral;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.IntLiteral;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TrueLiteral;
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.FieldBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
import org.aspectj.weaver.AnnotationX;
+import org.aspectj.weaver.BCException;
import org.aspectj.weaver.MemberKind;
import org.aspectj.weaver.ResolvedMemberImpl;
import org.aspectj.weaver.ResolvedType;
@@ -114,6 +119,14 @@ public class EclipseResolvedMember extends ResolvedMemberImpl {
sb.append(fb.name);
return sb.toString();
}
+ } else if (e instanceof TrueLiteral) {
+ return "true";
+ } else if (e instanceof FalseLiteral) {
+ return "false";
+ } else if (e instanceof IntLiteral) {
+ return Integer.toString(((IntConstant)e.constant).intValue());
+ } else {
+ throw new BCException("EclipseResolvedMember.getAnnotationDefaultValue() not implemented for value of type '"+e.getClass()+"' - raise an AspectJ bug !");
}
}
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
index d2d3cdcb0..ced21bd9c 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
@@ -35,6 +35,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
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.NameReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
@@ -161,7 +162,7 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
}
}
return false;
- }
+ }
/** Returns "" if there is a problem */
private String getPointcutStringFromAnnotationStylePointcut(AbstractMethodDeclaration amd) {
@@ -631,8 +632,10 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
annotationAJ.addNameValuePair(
new AnnotationNameValuePair(new String(singleMemberAnnotation.memberValuePairs()[0].name),av));
}
+ } else if (annotation instanceof MarkerAnnotation) {
+ return;
} else {
- // this is a marker annotation (no member value pairs)
+ // this is something else...
throw new MissingImplementationException(
"Please raise an AspectJ bug. AspectJ does not know how to convert this annotation ["+annotation+"]");
}
@@ -656,8 +659,12 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
}
} else {
if (constant != null && constant != Constant.NotAConstant) {
- throw new MissingImplementationException(
- "Please raise an AspectJ bug. AspectJ does not know how to convert this annotation value ["+defaultValue+"]");
+ AnnotationValue av = EclipseAnnotationConvertor.generateElementValueForConstantExpression(defaultValue,defaultValueBinding);
+ if (av==null) {
+ throw new MissingImplementationException(
+ "Please raise an AspectJ bug. AspectJ does not know how to convert this annotation value ["+defaultValue+"]");
+ }
+ return av;
// generateElementValue(attributeOffset, defaultValue, constant, memberValuePairReturnType.leafComponentType());
} else {
AnnotationValue av = generateElementValueForNonConstantExpression(defaultValue, defaultValueBinding);
@@ -708,6 +715,15 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
throw new MissingImplementationException(
"Please raise an AspectJ bug. AspectJ does not know how to convert this annotation value ["+defaultValue+"]");
}
+// } else if (defaultValue instanceof MagicLiteral) {
+// if (defaultValue instanceof FalseLiteral) {
+// new AnnotationValue
+// } else if (defaultValue instanceof TrueLiteral) {
+//
+// } else {
+// throw new MissingImplementationException(
+// "Please raise an AspectJ bug. AspectJ does not know how to convert this annotation value ["+defaultValue+"]");
+// }
} else {
// class type
throw new MissingImplementationException(