Przeglądaj źródła

238992: test and fix

tags/V162DEV_M1
aclement 16 lat temu
rodzic
commit
13f83eba7c

+ 1
- 1
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseAnnotationConvertor.java Wyświetl plik

@@ -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) {

+ 13
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java Wyświetl plik

@@ -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 !");
}
}
}

+ 20
- 4
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java Wyświetl plik

@@ -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(

Ładowanie…
Anuluj
Zapisz