aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2011-11-17 20:00:18 +0000
committeraclement <aclement>2011-11-17 20:00:18 +0000
commit6e0ff8f48b26623ef111aaf4fab2e9ca27353a3d (patch)
tree870bc14bb8833c91e7671930ee9b38222dc33fcd /org.aspectj.ajdt.core
parent74e9c7af2b24e2d658f4677a1d8d7f02e9b0a087 (diff)
downloadaspectj-6e0ff8f48b26623ef111aaf4fab2e9ca27353a3d.tar.gz
aspectj-6e0ff8f48b26623ef111aaf4fab2e9ca27353a3d.zip
363979
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java59
1 files changed, 58 insertions, 1 deletions
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 a7ebf448a..e254922bd 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
@@ -34,6 +34,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.Literal;
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;
@@ -46,6 +47,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeParameter;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.Constant;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
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.ExtraCompilerModifiers;
@@ -712,8 +714,42 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
AnnotationValue av = new AnnotationAnnotationValue(ajAnnotation);
AnnotationNameValuePair anvp = new AnnotationNameValuePair(new String(memberValuePair.name), av);
annotationAJ.addNameValuePair(anvp);
+ // } else if (memberValuePair.value instanceof NormalAnnotation) {
+ // NormalAnnotation eNormalAnnotation = (NormalAnnotation) memberValuePair.value;
+ // AnnotationBinding eMarkerAnnotationBinding = eNormalAnnotation.getCompilerAnnotation();
+ // ReferenceBinding eAnnotationType = eMarkerAnnotationBinding.getAnnotationType();
+ // ResolvedType ajAnnotationType = factory.fromTypeBindingToRTX(eAnnotationType);
+ // boolean isRuntimeVisible = (eNormalAnnotation.bits & TagBits.AnnotationRetentionMASK) ==
+ // TagBits.AnnotationRuntimeRetention;
+ // StandardAnnotation ajAnnotation = new StandardAnnotation(ajAnnotationType, isRuntimeVisible);
+ // MemberValuePair[] pairs = eNormalAnnotation.memberValuePairs;
+ // if (pairs != null) {
+ // for (int p = 0; p < pairs.length; p++) {
+ // MemberValuePair pair = pairs[p];
+ // throw new IllegalStateException("nyi");
+ //
+ // }
+ // }
+ // AnnotationValue av = new AnnotationAnnotationValue(ajAnnotation);
+ // AnnotationNameValuePair anvp = new AnnotationNameValuePair(new String(memberValuePair.name), av);
+ // annotationAJ.addNameValuePair(anvp);
+ } else if (memberValuePair.value instanceof Literal) {
+ AnnotationValue av = generateElementValue(memberValuePair.value,
+ ((Literal) memberValuePair.value).resolvedType);
+ AnnotationNameValuePair anvp = new AnnotationNameValuePair(new String(memberValuePair.name), av);
+ annotationAJ.addNameValuePair(anvp);
+ } else if (memberValuePair.value instanceof ArrayInitializer) {
+ ArrayInitializer arrayInitializer = (ArrayInitializer) memberValuePair.value;
+ Expression[] expressions = arrayInitializer.expressions;
+ AnnotationValue[] arrayValues = new AnnotationValue[expressions.length];
+ for (int e = 0; e < expressions.length; e++) {
+ arrayValues[e] = generateElementValue(expressions[e],
+ ((ArrayBinding) arrayInitializer.resolvedType).leafComponentType);
+ }
+ AnnotationValue array = new ArrayAnnotationValue(arrayValues);
+ AnnotationNameValuePair anvp = new AnnotationNameValuePair(new String(memberValuePair.name), array);
+ annotationAJ.addNameValuePair(anvp);
} else {
-
throw new MissingImplementationException(
"Please raise an AspectJ bug. AspectJ does not know how to convert this annotation ["
+ annotation + "]");
@@ -814,6 +850,27 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
ajAnnotationType.isAnnotationWithRuntimeRetention());
AnnotationValue av = new AnnotationAnnotationValue(ajAnnotation);
return av;
+ } else if (defaultValue instanceof NormalAnnotation) {
+ NormalAnnotation normalAnnotation = (NormalAnnotation) defaultValue;
+ ResolvedType ajAnnotationType = factory.fromTypeBindingToRTX(defaultValueBinding);
+ StandardAnnotation ajAnnotation = new StandardAnnotation(ajAnnotationType,
+ ajAnnotationType.isAnnotationWithRuntimeRetention());
+ MemberValuePair[] pairs = normalAnnotation.memberValuePairs;
+ if (pairs != null) {
+ for (int p = 0; p < pairs.length; p++) {
+ MemberValuePair pair = pairs[p];
+ Expression valueEx = pair.value;
+ AnnotationValue pairValue = null;
+ if (valueEx instanceof Literal) {
+ pairValue = generateElementValue(valueEx, ((Literal) valueEx).resolvedType);
+ } else {
+ pairValue = generateElementValue(pair.value, pair.binding.returnType);
+ }
+ ajAnnotation.addNameValuePair(new AnnotationNameValuePair(new String(pair.name), pairValue));
+ }
+ }
+ AnnotationValue av = new AnnotationAnnotationValue(ajAnnotation);
+ return av;
} else {
throw new MissingImplementationException(
"Please raise an AspectJ bug. AspectJ does not know how to convert this annotation value ["