Community
Participate
Working Groups
One user on the Spring forum posted an aspect that used a 'static final' string as pointcut expression. The compiler crashes for such an aspect. I think either accepting it (since such a string is a compile-time constant) or issuing a proper error message will be appropriate resolution. package bug; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; @Aspect public class StaticFinalStringInPointcutAspect { static final String pcExpression = "within(*)"; @Pointcut(pcExpression) public void pointcutThatUsesStaticFinalStringAsExpression() {} } java.lang.ClassCastException at org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.getPointcutStringFromAnnotationStylePointcut(EclipseSourceType.java:169) at org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.makeResolvedPointcutDefinition(EclipseSourceType.java:266) at org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.fillDeclaredMembers(EclipseSourceType.java:232) at org.aspectj.ajdt.internal.compiler.looku ... rg.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleNameReference cannot be cast to org.aspectj.org.eclipse.jdt.internal.compiler.ast.StringLiteral
i think this could work...
raising p so I will look at this soon.
fixed. Had to allow for something other than fixed constants for the values. Changes were in: EclipseSourceType.getPointcutStringFromAnnotationStylePointcut() ValidateAtAspectJAnnotationsVisitor.getStringLiteralFor()