summaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2011-11-17 18:15:59 +0000
committeraclement <aclement>2011-11-17 18:15:59 +0000
commit49e0427bb885251ed491c5e243f2f5995149f57f (patch)
tree50787fae36793c56e9fc3636dca7a1e74a650081 /org.aspectj.ajdt.core
parent2a53b0a7b9655a7026527db21120f5724468c4c0 (diff)
downloadaspectj-49e0427bb885251ed491c5e243f2f5995149f57f.tar.gz
aspectj-49e0427bb885251ed491c5e243f2f5995149f57f.zip
363979
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java42
1 files changed, 31 insertions, 11 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 ab743177f..a7ebf448a 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
@@ -45,6 +45,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.StringLiteral;
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.BinaryTypeBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
@@ -56,6 +57,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TagBits;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.aspectj.weaver.AbstractReferenceTypeDelegate;
import org.aspectj.weaver.AnnotationAJ;
+import org.aspectj.weaver.AnnotationAnnotationValue;
import org.aspectj.weaver.AnnotationNameValuePair;
import org.aspectj.weaver.AnnotationTargetKind;
import org.aspectj.weaver.AnnotationValue;
@@ -673,7 +675,7 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
// long bs = (eclipseAnnotation.bits & TagBits.AnnotationRetentionMASK);
boolean isRuntimeVisible = (eclipseAnnotation.bits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationRuntimeRetention;
StandardAnnotation annotationAJ = new StandardAnnotation(annotationType, isRuntimeVisible);
- generateAnnotation(eclipseAnnotation, annotationAJ);
+ generateAnnotation(eclipseAnnotation, annotationAJ, w);
return annotationAJ;
}
@@ -689,7 +691,7 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
* @param annotation eclipse based annotation representation
* @param annotationAJ AspectJ based annotation representation
*/
- private void generateAnnotation(Annotation annotation, StandardAnnotation annotationAJ) {
+ private void generateAnnotation(Annotation annotation, StandardAnnotation annotationAJ, World w) {
if (annotation instanceof NormalAnnotation) {
NormalAnnotation normalAnnotation = (NormalAnnotation) annotation;
MemberValuePair[] memberValuePairs = normalAnnotation.memberValuePairs;
@@ -700,9 +702,22 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
MethodBinding methodBinding = memberValuePair.binding;
if (methodBinding == null) {
// is this just a marker annotation?
- throw new MissingImplementationException(
- "Please raise an AspectJ bug. AspectJ does not know how to convert this annotation [" + annotation
- + "]");
+ if (memberValuePair.value instanceof MarkerAnnotation) {
+ MarkerAnnotation eMarkerAnnotation = (MarkerAnnotation) memberValuePair.value;
+ AnnotationBinding eMarkerAnnotationBinding = eMarkerAnnotation.getCompilerAnnotation();
+ ReferenceBinding eAnnotationType = eMarkerAnnotationBinding.getAnnotationType();
+ ResolvedType ajAnnotationType = factory.fromTypeBindingToRTX(eAnnotationType);
+ boolean isRuntimeVisible = (eMarkerAnnotation.bits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationRuntimeRetention;
+ StandardAnnotation ajAnnotation = new StandardAnnotation(ajAnnotationType, isRuntimeVisible);
+ AnnotationValue av = new AnnotationAnnotationValue(ajAnnotation);
+ AnnotationNameValuePair anvp = new AnnotationNameValuePair(new String(memberValuePair.name), av);
+ annotationAJ.addNameValuePair(anvp);
+ } else {
+
+ throw new MissingImplementationException(
+ "Please raise an AspectJ bug. AspectJ does not know how to convert this annotation ["
+ + annotation + "]");
+ }
} else {
AnnotationValue av = generateElementValue(memberValuePair.value, methodBinding.returnType);
AnnotationNameValuePair anvp = new AnnotationNameValuePair(new String(memberValuePair.name), av);
@@ -793,12 +808,17 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
"Please raise an AspectJ bug. AspectJ does not know how to convert this annotation value [" + defaultValue
+ "]");
} else if (defaultValueBinding.isAnnotationType()) {
- throw new MissingImplementationException(
- "Please raise an AspectJ bug. AspectJ does not know how to convert this annotation value [" + defaultValue
- + "]");
- // contents[contentsOffset++] = (byte) '@';
- // generateAnnotation((Annotation) defaultValue,
- // attributeOffset);
+ if (defaultValue instanceof MarkerAnnotation) {
+ ResolvedType ajAnnotationType = factory.fromTypeBindingToRTX(defaultValueBinding);
+ StandardAnnotation ajAnnotation = new StandardAnnotation(ajAnnotationType,
+ ajAnnotationType.isAnnotationWithRuntimeRetention());
+ 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 ["
+ + defaultValue + "]");
+ }
} else if (defaultValueBinding.isArrayType()) {
// array type
if (defaultValue instanceof ArrayInitializer) {