import org.aspectj.ajdt.internal.compiler.ast.Proceed;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.ajdt.internal.compiler.lookup.InterTypeMethodBinding;
+import org.aspectj.ajdt.internal.compiler.lookup.PrivilegedFieldBinding;
import org.aspectj.bridge.context.CompilationAndWeavingContext;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.core.compiler.IProblem;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
super.unusedPrivateMethod(methodDecl);
}
+ public void caseExpressionMustBeConstant(Expression expression) {
+ if (expression instanceof QualifiedNameReference) {
+ QualifiedNameReference qnr = (QualifiedNameReference)expression;
+ if (qnr.otherBindings!=null && qnr.otherBindings.length>0 && qnr.otherBindings[0] instanceof PrivilegedFieldBinding) {
+ super.signalError(expression.sourceStart,expression.sourceEnd,"Fields accessible due to an aspect being privileged can not be used in switch statements");
+ referenceContext.tagAsHavingErrors();
+ return;
+ }
+ }
+ super.caseExpressionMustBeConstant(expression);
+ }
+
public void unusedArgument(LocalDeclaration localDecl) {
// don't warn if this is an aj synthetic arg
String argType = new String(localDecl.type.resolvedType.signature());
public void testGenericITDsAndAbstractMethodError_pr102357() { runTest("generic itds and abstract method error");}
*/
+ public void testPrivilegeProblem_pr87525() { runTest("privilege problem with switch");}
public void testGenericAspects_pr115237() { runTest("aspectOf and generic aspects");}
public void testClassFormatError_pr114436() { runTest("ClassFormatError binary weaving perthis");}
public void testParserException_pr115788() { runTest("parser exception");}
<compile files="Pr113368.aj"/>
<run class="Pr113368"/>
</ajc-test>
+
+ <ajc-test dir="bugs150/pr87525" pr="87525" title="privilege problem with switch">
+ <compile files="A.java,B.java">
+ <message kind="error" line="5" text="Fields accessible due to an aspect being privileged can not be used in switch statements"/>
+ </compile>
+ </ajc-test>
<ajc-test dir="java5/reflection" title="pointcut parsing with ajc compiled pointcut references">
<compile files="PointcutLibrary.aj,ReflectOnAjcCompiledPointcuts.java" options="-1.5"></compile>