aboutsummaryrefslogtreecommitdiffstats
path: root/tests/errors
diff options
context:
space:
mode:
authorwisberg <wisberg>2002-12-16 18:51:06 +0000
committerwisberg <wisberg>2002-12-16 18:51:06 +0000
commit144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch)
treeb12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/errors
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/errors')
-rw-r--r--tests/errors/AbstractAspectOf.java14
-rw-r--r--tests/errors/AccessingInstanceFieldsStatically.java42
-rw-r--r--tests/errors/AmbiguousFormal.java9
-rw-r--r--tests/errors/AmbiguousInterface.java14
-rw-r--r--tests/errors/AroundReturnType.java26
-rw-r--r--tests/errors/ArrayInitializerType.java3
-rw-r--r--tests/errors/AspectInheritance1.java20
-rw-r--r--tests/errors/AspectInheritance2.java39
-rw-r--r--tests/errors/AspectInheritance3.java32
-rw-r--r--tests/errors/AspectInheritance4.java25
-rw-r--r--tests/errors/AspectInterfaces.java9
-rw-r--r--tests/errors/AspectsCantHaveYesArgumentConstructors.java9
-rw-r--r--tests/errors/BadAround.java25
-rw-r--r--tests/errors/BadCCutSig.java10
-rw-r--r--tests/errors/BadCast.java12
-rw-r--r--tests/errors/BadConstructorName.java6
-rw-r--r--tests/errors/BadDesignator.java11
-rw-r--r--tests/errors/BadExpressionStatement.java6
-rw-r--r--tests/errors/BadExtension.java38
-rw-r--r--tests/errors/BadFormalsToCalls.java26
-rw-r--r--tests/errors/BadGetPCD.java7
-rw-r--r--tests/errors/BadIntroduction.java11
-rw-r--r--tests/errors/BadIntroductionDesignator.java11
-rw-r--r--tests/errors/BadNewArrayExprs.java51
-rw-r--r--tests/errors/BadPointcutName.java17
-rw-r--r--tests/errors/BadReferences.java25
-rw-r--r--tests/errors/BadStaticCast.java8
-rw-r--r--tests/errors/BadSynchronized.java8
-rw-r--r--tests/errors/BadTypeName.java18
-rw-r--r--tests/errors/BadValue.java13
-rw-r--r--tests/errors/BadVar.java12
-rw-r--r--tests/errors/BindingNullPointer.java17
-rw-r--r--tests/errors/BoundaryNums.java34
-rw-r--r--tests/errors/CantCallConstructorOnAspects.java12
-rw-r--r--tests/errors/CastInCast.java12
-rw-r--r--tests/errors/CircularDominates.java33
-rw-r--r--tests/errors/CircularExtends.java15
-rw-r--r--tests/errors/CircularExtendsAspect.java19
-rw-r--r--tests/errors/CircularPlusImplementsIntros.java20
-rw-r--r--tests/errors/ClassExtendingAspect.java22
-rw-r--r--tests/errors/ClosingBrace.java12
-rw-r--r--tests/errors/Colon.java13
-rw-r--r--tests/errors/Const.java21
-rw-r--r--tests/errors/ConstantOneOverZero.java4
-rw-r--r--tests/errors/DeclareError.java28
-rw-r--r--tests/errors/DominatesWithCommas.java11
-rw-r--r--tests/errors/DuplicatedNames.java9
-rw-r--r--tests/errors/ExplicitConstructorThrows.java24
-rw-r--r--tests/errors/ExtraClosingBrace.java10
-rw-r--r--tests/errors/FinalStatic.java14
-rw-r--r--tests/errors/FromJavac.java14
-rw-r--r--tests/errors/Goto.java16
-rw-r--r--tests/errors/ImportWithinClassBody.java13
-rw-r--r--tests/errors/InnerMembers.java20
-rw-r--r--tests/errors/InstanceofWithoutClass.java15
-rw-r--r--tests/errors/IntLiteral.java18
-rw-r--r--tests/errors/InterfaceArrayCast.java13
-rw-r--r--tests/errors/InterfaceCast.java15
-rw-r--r--tests/errors/InvalidReturn.java24
-rw-r--r--tests/errors/MethodsNotFound.java18
-rw-r--r--tests/errors/MismatchedParens.java17
-rw-r--r--tests/errors/MissingExposure.java15
-rw-r--r--tests/errors/MissingReturns.java22
-rw-r--r--tests/errors/Modifiers.java14
-rw-r--r--tests/errors/Modifiers1.java10
-rw-r--r--tests/errors/MultipleIntros.java32
-rw-r--r--tests/errors/NestedInterfaceTest.java5
-rw-r--r--tests/errors/New.java15
-rw-r--r--tests/errors/NoAspect.java14
-rw-r--r--tests/errors/NoFormalsCrosscut.java12
-rw-r--r--tests/errors/NoMethodName.java12
-rw-r--r--tests/errors/NoNew_PR398.java23
-rw-r--r--tests/errors/NoReturnStatement.java23
-rw-r--r--tests/errors/NoReturnStatementSimple.java6
-rw-r--r--tests/errors/NoReturnTypeInDesignator.java12
-rw-r--r--tests/errors/NoSource.java7
-rw-r--r--tests/errors/NotFound.java19
-rw-r--r--tests/errors/NullWithFormals.java39
-rw-r--r--tests/errors/OverloadedPointcuts.java6
-rw-r--r--tests/errors/PR320.java14
-rw-r--r--tests/errors/PR333.java7
-rw-r--r--tests/errors/PR348.java17
-rw-r--r--tests/errors/PR405.java16
-rw-r--r--tests/errors/PlusEqualsCantAssignToObject.java6
-rw-r--r--tests/errors/PointcutFormals.java27
-rw-r--r--tests/errors/ProceedArgsCE.java21
-rw-r--r--tests/errors/ProtectedFieldIntro.java15
-rw-r--r--tests/errors/ProtectedIntro.java15
-rw-r--r--tests/errors/RecursiveCCutSpecifier.java19
-rw-r--r--tests/errors/StaticAdviceOnAbstract.java20
-rw-r--r--tests/errors/StaticPointcutRefs.java10
-rw-r--r--tests/errors/StrayDot.java19
-rw-r--r--tests/errors/StraySlash.java23
-rw-r--r--tests/errors/SubAspectsCantExtendNonAbstractAspects.java15
-rw-r--r--tests/errors/Switch.java8
-rw-r--r--tests/errors/ThrowsClause.java14
-rw-r--r--tests/errors/TopLevelAfter.java9
-rw-r--r--tests/errors/TopLevelAround.java9
-rw-r--r--tests/errors/TopLevelBefore.java9
-rw-r--r--tests/errors/TwoDots.java17
-rw-r--r--tests/errors/TwoIntros.java17
-rw-r--r--tests/errors/TwoPublics.java10
-rw-r--r--tests/errors/UndeclaredThrows.java20
-rw-r--r--tests/errors/UndefinedPointCut_PR396.java10
-rw-r--r--tests/errors/WildcardForReturns.java21
-rw-r--r--tests/errors/protectedAccess/Main.java62
-rw-r--r--tests/errors/protectedAccess/p1/C1.java17
107 files changed, 1823 insertions, 0 deletions
diff --git a/tests/errors/AbstractAspectOf.java b/tests/errors/AbstractAspectOf.java
new file mode 100644
index 000000000..85cb14f99
--- /dev/null
+++ b/tests/errors/AbstractAspectOf.java
@@ -0,0 +1,14 @@
+import org.aspectj.testing.Tester;
+
+// PR#286 aspect of abstract class
+
+public class AbstractAspectOf { }
+
+abstract aspect AbstractAspect /*of eachobject(instanceof(AbstractError))*/ { }
+
+
+
+class C {
+ aspect InnerAspect {
+ }
+}
diff --git a/tests/errors/AccessingInstanceFieldsStatically.java b/tests/errors/AccessingInstanceFieldsStatically.java
new file mode 100644
index 000000000..11a090890
--- /dev/null
+++ b/tests/errors/AccessingInstanceFieldsStatically.java
@@ -0,0 +1,42 @@
+public class AccessingInstanceFieldsStatically {
+ public static void main(String[] args) {
+ new AccessingInstanceFieldsStatically().realMain(args);
+ }
+ public void realMain(String[] args) {
+ }
+}
+
+class T {
+ public void printIt() {}
+
+ public int getJ() { return -1; }
+
+ public static void m() {
+ Object o = this; //ERROR static reference to this
+ this.clay++; //ERROR static reference to instance field
+ clay++; //ERROR static reference to instance field
+ printIt(); //ERROR static reference to instance method
+ }
+
+ public T(int i, int j) {
+ clay = i;
+ }
+
+ public T() {
+ this(clay, //ERROR static reference to instance field
+ getJ()); //ERROR static reference to instance method
+ clay++;
+ getJ();
+ 1+1; //ERROR not a legal statement
+ }
+}
+
+aspect TAspect {
+ int T.clay = 0;
+ void around (T tt):
+ target(tt) && call(void printIt()) {
+ T.clay = 1; // ERROR static reference to instance field
+ T.getJ(); //ERROR static reference to instance method
+ }
+}
+
diff --git a/tests/errors/AmbiguousFormal.java b/tests/errors/AmbiguousFormal.java
new file mode 100644
index 000000000..d101c3daa
--- /dev/null
+++ b/tests/errors/AmbiguousFormal.java
@@ -0,0 +1,9 @@
+public class AmbiguousFormal {
+ public void m(int x, int y) {}
+}
+
+aspect A {
+ before(int n): execution(void *.m(.., n, ..)) {
+ System.out.println(n);
+ }
+}
diff --git a/tests/errors/AmbiguousInterface.java b/tests/errors/AmbiguousInterface.java
new file mode 100644
index 000000000..323b5f78d
--- /dev/null
+++ b/tests/errors/AmbiguousInterface.java
@@ -0,0 +1,14 @@
+public class AmbiguousInterface {
+ public static void main(String[] args) {
+ org.aspectj.testing.Tester.check(false, "shouldn't have compiled");
+ }
+}
+interface Outer {
+ interface Inner extends Outer {
+ interface Questionable {}
+ }
+ interface Questionable extends Inner {}
+}
+interface Another extends Outer, Outer.Questionable {
+ interface AnotherInner extends Questionable {}
+}
diff --git a/tests/errors/AroundReturnType.java b/tests/errors/AroundReturnType.java
new file mode 100644
index 000000000..ef0356c36
--- /dev/null
+++ b/tests/errors/AroundReturnType.java
@@ -0,0 +1,26 @@
+public class AroundReturnType {
+ public static void main(String[] args){
+ new AroundReturnType().go();
+ }
+
+ void go(){
+ System.out.println("... "+ s() );
+ }
+
+ static Integer s() {
+ return new Integer(1);
+ }
+}
+
+aspect A {
+ void around(): within(AroundReturnType) && call(Integer AroundReturnType.s()){
+ System.out.println("s - advice");
+ proceed();
+ }
+
+ Integer around(): within(AroundReturnType) && execution(* *(..)) {
+ proceed();
+ return new Integer(3);
+ }
+
+}
diff --git a/tests/errors/ArrayInitializerType.java b/tests/errors/ArrayInitializerType.java
new file mode 100644
index 000000000..c759bd953
--- /dev/null
+++ b/tests/errors/ArrayInitializerType.java
@@ -0,0 +1,3 @@
+class ArrayInitializerType {
+ int i[] = {3, "xxx"};
+}
diff --git a/tests/errors/AspectInheritance1.java b/tests/errors/AspectInheritance1.java
new file mode 100644
index 000000000..18413139f
--- /dev/null
+++ b/tests/errors/AspectInheritance1.java
@@ -0,0 +1,20 @@
+public class AspectInheritance1 {
+ public static void main(String[] args) {
+ }
+}
+
+
+abstract aspect Base {
+ abstract pointcut targets(int i, C c);
+
+ after(int i, C c): targets(i, c) {
+ //
+ }
+}
+
+aspect EmptyConcrete extends Base {
+ // this would match everything, but we declare it a syntax error
+ pointcut targets(int i, C c): ;
+}
+
+class C {}
diff --git a/tests/errors/AspectInheritance2.java b/tests/errors/AspectInheritance2.java
new file mode 100644
index 000000000..eb443ff2d
--- /dev/null
+++ b/tests/errors/AspectInheritance2.java
@@ -0,0 +1,39 @@
+public class AspectInheritance2 {
+ public static void main(String[] args) {
+ }
+}
+
+
+abstract aspect Base {
+ abstract pointcut targets(int i, C c);
+
+ after(int i, C c): targets(i, c) {
+ //
+ }
+}
+
+aspect FullConcrete extends Base {
+ pointcut targets(int i, SubC subc): //ERROR param types must match exactly
+ call(void SubC.m(double)) && target(subc) && args(i);
+}
+
+aspect ForgetfulConcrete extends Base { //ERROR must concretize abstracts
+}
+
+aspect ExplictAbstractConcrete extends Base {
+ pointcut targets(int i, C c);
+
+ abstract pointcut newTargets(); //ERROR no abstracts allowed in concrete
+}
+
+aspect PrivateConcrete extends Base {
+ private pointcut targets(int i, C c): //ERROR can't reduce visibility of decs
+ call(void C.m(int)) && target(c) && args(i);
+}
+
+
+class C {
+ public void m(int i) { }
+}
+
+class SubC extends C {}
diff --git a/tests/errors/AspectInheritance3.java b/tests/errors/AspectInheritance3.java
new file mode 100644
index 000000000..142de669c
--- /dev/null
+++ b/tests/errors/AspectInheritance3.java
@@ -0,0 +1,32 @@
+public class AspectInheritance3 {
+ public static void main(String[] args) {
+ }
+}
+
+
+abstract aspect Base {
+ abstract pointcut targets(int i, C c);
+
+ after(int i, C c): targets(i, c) {
+ //
+ }
+}
+aspect GoodConcrete extends Base {
+ pointcut targets(int i, C c);
+}
+
+// this aspect is illegal because concrete-concrete extension is illegal
+aspect DoubleConcrete extends GoodConcrete {
+}
+
+aspect OtherAspect {
+ // can't reference an abstract pointcut using a static reference
+ before(): Base.targets(int, C) { }
+}
+
+
+class C {
+ public void m(int i) { }
+}
+
+class SubC extends C {}
diff --git a/tests/errors/AspectInheritance4.java b/tests/errors/AspectInheritance4.java
new file mode 100644
index 000000000..c31aec153
--- /dev/null
+++ b/tests/errors/AspectInheritance4.java
@@ -0,0 +1,25 @@
+public class AspectInheritance4 {
+ public static void main(String[] args) {
+ }
+}
+
+
+abstract aspect Base {
+ abstract pointcut targets(int i, C c);
+
+ after(int i, C c): targets(i, c) {
+ //
+ }
+}
+
+aspect OtherAspect {
+ // can't reference an abstract pointcut using a static reference
+ before(): Base.targets(int, C) { }
+}
+
+
+class C {
+ public void m(int i) { }
+}
+
+class SubC extends C {}
diff --git a/tests/errors/AspectInterfaces.java b/tests/errors/AspectInterfaces.java
new file mode 100644
index 000000000..0bccb0593
--- /dev/null
+++ b/tests/errors/AspectInterfaces.java
@@ -0,0 +1,9 @@
+public class AspectInterfaces {
+}
+
+aspect SerAspect implements java.io.Serializable {} //ERR: can't implement Ser
+aspect CloneAspect implements Cloneable {} //ERR: can't implement Clone
+
+class C implements java.io.Serializable { }
+
+aspect Ser1Aspect extends C {} //ERR: can't extend a class that implements Ser
diff --git a/tests/errors/AspectsCantHaveYesArgumentConstructors.java b/tests/errors/AspectsCantHaveYesArgumentConstructors.java
new file mode 100644
index 000000000..9c3a029cd
--- /dev/null
+++ b/tests/errors/AspectsCantHaveYesArgumentConstructors.java
@@ -0,0 +1,9 @@
+public class AspectsCantHaveYesArgumentConstructors {
+ public static void main(String[] args) {
+ }
+}
+
+aspect A /*of eachobject(instanceof(CompileError2))*/ {
+ //ERROR: only zero argument constructors allowed in an aspect
+ public A(String s) {}
+}
diff --git a/tests/errors/BadAround.java b/tests/errors/BadAround.java
new file mode 100644
index 000000000..79e564557
--- /dev/null
+++ b/tests/errors/BadAround.java
@@ -0,0 +1,25 @@
+public class BadAround {
+
+}
+
+class C {
+ public String m(String s) { return "hi"; }
+ public int mi() { return 2; }
+}
+
+aspect A {
+ Object around(): call(String C.m(..)) {
+ return new Integer(2);
+ }
+ Object around(Object a): call(String C.m(..)) && args(a) {
+ return proceed(new Integer(2));
+ }
+
+ Object around(): call(int C.mi()) {
+ return "2";
+ }
+
+ int around(): call(String C.m(..)) { // ERR, return type mismatch
+ return 2;
+ }
+}
diff --git a/tests/errors/BadCCutSig.java b/tests/errors/BadCCutSig.java
new file mode 100644
index 000000000..96011cee9
--- /dev/null
+++ b/tests/errors/BadCCutSig.java
@@ -0,0 +1,10 @@
+package errors;
+
+aspect BadCCutSig {
+ int bar(int a, int b, int c) { return 0; }
+
+ pointcut cut(BadCCutSig b): target(b) && call(int bar(int, int, int));
+
+ before(BadCCutSig b): cut() { // SHOULD BE: cut(b)
+ }
+}
diff --git a/tests/errors/BadCast.java b/tests/errors/BadCast.java
new file mode 100644
index 000000000..7cd40466c
--- /dev/null
+++ b/tests/errors/BadCast.java
@@ -0,0 +1,12 @@
+import org.aspectj.testing.*;
+
+public class BadCast {
+ public static void main(String[] args) {
+ new BadCast().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ int i = )int) 13;
+ Tester.check(false, "shouldn't have compiled");
+ }
+}
diff --git a/tests/errors/BadConstructorName.java b/tests/errors/BadConstructorName.java
new file mode 100644
index 000000000..8a10aaf16
--- /dev/null
+++ b/tests/errors/BadConstructorName.java
@@ -0,0 +1,6 @@
+import org.aspectj.testing.Tester;
+
+class BadConstructorName {
+ public FooBar() {}
+}
+
diff --git a/tests/errors/BadDesignator.java b/tests/errors/BadDesignator.java
new file mode 100644
index 000000000..adaf95a2e
--- /dev/null
+++ b/tests/errors/BadDesignator.java
@@ -0,0 +1,11 @@
+import org.aspectj.testing.Tester;
+
+class BadDesignator {
+ pointcut cc(): BadDesignator && * void f();
+
+ BadDesignator() {}
+
+ void f() {}
+}
+
+
diff --git a/tests/errors/BadExpressionStatement.java b/tests/errors/BadExpressionStatement.java
new file mode 100644
index 000000000..95c505590
--- /dev/null
+++ b/tests/errors/BadExpressionStatement.java
@@ -0,0 +1,6 @@
+public class BadExpressionStatement {
+ public static void main(String[] args) {
+ System.out;
+ }
+}
+
diff --git a/tests/errors/BadExtension.java b/tests/errors/BadExtension.java
new file mode 100644
index 000000000..32bfe8e9c
--- /dev/null
+++ b/tests/errors/BadExtension.java
@@ -0,0 +1,38 @@
+public class BadExtension { }
+
+abstract class Super {
+ public final void finalPublic() {}
+
+ public void justPublic() {}
+ public int intPublic() {}
+
+ public abstract void abstractWithBody() {} //ERROR shouldn't have a body
+
+ public abstract void abstractPublic();
+
+ public static final void staticFinalPublic() {}
+}
+
+class Sub extends Super { //ERROR must implement abstractPublic
+ public void finalPublic() {} //ERROR can't override final
+ void justPublic() {} //ERROR can't override with weaker access
+ public void intPublic() {} //ERROR can't change the return type
+
+ public static void staticFinalPublic() {} //ERROR can't even override static finals
+}
+
+
+
+interface I1 {
+ void m();
+}
+
+interface I2 {
+ int m();
+}
+
+class C12 implements I1, I2 {
+ public void m() {} //ERROR incompatible return types with I2.m()
+}
+
+interface I12 extends I1, I2 {} //ERROR I1.m() and I2.m() are not compatible
diff --git a/tests/errors/BadFormalsToCalls.java b/tests/errors/BadFormalsToCalls.java
new file mode 100644
index 000000000..17559bbe0
--- /dev/null
+++ b/tests/errors/BadFormalsToCalls.java
@@ -0,0 +1,26 @@
+import org.aspectj.testing.Tester;
+public class BadFormalsToCalls {
+
+ static boolean noargsCalled = false;
+
+ public static void main(String[] args) {
+ new BadFormalsToCalls().go();
+ }
+
+ void go() {
+ new B().noargs();
+ Tester.check(noargsCalled, "noargs wasn't called");
+ }
+
+ class B {
+ public void noargs() {
+ }
+ }
+}
+
+aspect CallsNoArgsAspect {
+ pointcut noargs(BadFormalsToCalls.B b): call(void noargs());
+ void around(BadFormalsToCalls.B b): noargs(b) {
+ proceed(b);
+ }
+}
diff --git a/tests/errors/BadGetPCD.java b/tests/errors/BadGetPCD.java
new file mode 100644
index 000000000..d2c907f17
--- /dev/null
+++ b/tests/errors/BadGetPCD.java
@@ -0,0 +1,7 @@
+public abstract class BadGetPCD {
+}
+
+aspect A {
+ pointcut foo(): get(void i)[];
+}
+
diff --git a/tests/errors/BadIntroduction.java b/tests/errors/BadIntroduction.java
new file mode 100644
index 000000000..b4bdf5740
--- /dev/null
+++ b/tests/errors/BadIntroduction.java
@@ -0,0 +1,11 @@
+import org.aspectj.testing.Tester;
+
+public class BadIntroduction {
+ public static void main(String[] args) {
+ String s;
+ Tester.check(false, "the compiler should have given an error");
+ }
+}
+
+introduction (String) {
+}
diff --git a/tests/errors/BadIntroductionDesignator.java b/tests/errors/BadIntroductionDesignator.java
new file mode 100644
index 000000000..9b97d4aae
--- /dev/null
+++ b/tests/errors/BadIntroductionDesignator.java
@@ -0,0 +1,11 @@
+package errors;
+
+// PR#129
+
+public class BadIntroductionDesignator {
+ introduction (M||) {
+ public boolean m_foo;
+ }
+}
+
+class M {}
diff --git a/tests/errors/BadNewArrayExprs.java b/tests/errors/BadNewArrayExprs.java
new file mode 100644
index 000000000..138b89ca6
--- /dev/null
+++ b/tests/errors/BadNewArrayExprs.java
@@ -0,0 +1,51 @@
+class BadNewArrayExprs {
+ static Object o;
+ public static void main(String[] args) {
+ o = new Test[][3];
+ o = new Test[][];
+ o = new Test[];
+ o = new Test[3] { };
+ }
+}
+/*
+
+abstract class C {
+}
+class D extends C {
+}
+
+class M {}
+
+class X {
+ abstract void foo();
+}
+
+class Y extends X {
+
+ void foo(M m) {
+ new C().m(m);
+ }
+
+ static aspect XXX {
+ abstract private void C.m(M m);
+
+ private void D.m(M m) {
+ System.out.println("I'm in XXX " + m);
+ }
+ }
+}
+
+class Z extends X {
+ void foo(M m) {
+ new C().m(m);
+ }
+
+ static aspect XXX {
+ abstract private void C.m(M m);
+
+ private void D.m(M m) {
+ System.out.println("I'm in YYY " + m);
+ }
+ }
+}
+*/
diff --git a/tests/errors/BadPointcutName.java b/tests/errors/BadPointcutName.java
new file mode 100644
index 000000000..943f49554
--- /dev/null
+++ b/tests/errors/BadPointcutName.java
@@ -0,0 +1,17 @@
+
+import org.aspectj.testing.Tester;
+
+// PR#209
+
+public aspect BadPointcutName {
+ private static java.util.Vector v = new java.util.Vector();
+
+ public static void main(String[] args) { test(); }
+
+ public static void test() {
+ Tester.check(true, "");
+ }
+
+ /*static*/ after() returning (): noSuchCut() {}
+}
+
diff --git a/tests/errors/BadReferences.java b/tests/errors/BadReferences.java
new file mode 100644
index 000000000..0125a447b
--- /dev/null
+++ b/tests/errors/BadReferences.java
@@ -0,0 +1,25 @@
+aspect BadReferences {
+ public void main(String[] args) {
+ int x = C.x;
+
+ Object o = new C.Inner();
+ }
+}
+
+
+class C implements I1, I2 {
+}
+
+interface I1 {
+ public static int x = 1;
+
+ public static class Inner {
+ }
+}
+interface I2 {
+ public static int x = 2;
+
+ public static class Inner {
+ }
+}
+
diff --git a/tests/errors/BadStaticCast.java b/tests/errors/BadStaticCast.java
new file mode 100644
index 000000000..6fbe3b1e3
--- /dev/null
+++ b/tests/errors/BadStaticCast.java
@@ -0,0 +1,8 @@
+// Incorrect static casts to primitively foldable arguments should not
+// crash the compiler.
+public class BadStaticCast {
+ public static int foo() {
+ return 3 + (int)true;
+ }
+}
+
diff --git a/tests/errors/BadSynchronized.java b/tests/errors/BadSynchronized.java
new file mode 100644
index 000000000..3e3ee9311
--- /dev/null
+++ b/tests/errors/BadSynchronized.java
@@ -0,0 +1,8 @@
+public class BadSynchronized {
+ public void m() {
+ synchronized(2) {}
+ synchronized(false) {}
+ synchronized(null) {}
+ synchronized("");
+ }
+}
diff --git a/tests/errors/BadTypeName.java b/tests/errors/BadTypeName.java
new file mode 100644
index 000000000..3f8d2fcdd
--- /dev/null
+++ b/tests/errors/BadTypeName.java
@@ -0,0 +1,18 @@
+aspect BadTypeName {
+ static pointcut prints(Foo f): call(void System.out.println(..));
+
+ Foo x = null;
+
+ a.b.c.Foo y = null;
+
+ System.Inner i = null;
+
+ Object o = a.b.c.Foo.field;
+
+ Object o1 = C.privateField;
+}
+
+
+class C {
+ private int privateField;
+}
diff --git a/tests/errors/BadValue.java b/tests/errors/BadValue.java
new file mode 100644
index 000000000..08f6b063c
--- /dev/null
+++ b/tests/errors/BadValue.java
@@ -0,0 +1,13 @@
+import org.aspectj.testing.*;
+
+public class BadValue {
+ public static void main(String[] args) {
+ new BadValue().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ int i = ,;
+ //String s = ,;
+ Tester.check(false, "Shouldn't have compiled");
+ }
+}
diff --git a/tests/errors/BadVar.java b/tests/errors/BadVar.java
new file mode 100644
index 000000000..044ef93a5
--- /dev/null
+++ b/tests/errors/BadVar.java
@@ -0,0 +1,12 @@
+import org.aspectj.testing.*;
+
+public class BadVar {
+ public static void main(String[] args) {
+ new BadVar().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ int _ _ = 13;
+ Tester.check(false, "Shouldn't have compiled");
+ }
+}
diff --git a/tests/errors/BindingNullPointer.java b/tests/errors/BindingNullPointer.java
new file mode 100644
index 000000000..06ec48c6d
--- /dev/null
+++ b/tests/errors/BindingNullPointer.java
@@ -0,0 +1,17 @@
+import org.aspectj.testing.*;
+
+public class BindingNullPointer {
+ boolean ran = false;
+ final String s1 = new String("s1");
+ Runnable r1 = new Runnable() {
+ public void run() {String = s1; ran = true;}
+ };
+ void go() {
+ r1.run();
+ Tester.check(ran, "r1.run did not run");
+ }
+
+ public static void main(String[] args) {
+ new BindingNullPointer().go();
+ }
+}
diff --git a/tests/errors/BoundaryNums.java b/tests/errors/BoundaryNums.java
new file mode 100644
index 000000000..c5027d368
--- /dev/null
+++ b/tests/errors/BoundaryNums.java
@@ -0,0 +1,34 @@
+//Over-boundary base values cause compile-time errors
+public class BoundaryNums {
+ public static void main(String[] args) {
+ byte minByte = -129;
+ byte maxByte = 128;
+ byte minByteHex = -0x81;
+ byte maxByteHex = 0x80;
+
+ short minShort = -32769;
+ short maxShort = 32768;
+ short minShortHex = -0x8001;
+ short maxShortHex = 0x8000;
+
+ char maxChar = 65536;
+ char maxCharHex = 0x10000;
+ char maxCharChar = '\u10000';
+
+ int minInt = -2147483649;
+ int maxInt = 2147483648;
+ int minIntHex = -0x80000001;
+ int maxIntHex = 0x80000000;
+
+ long minLong = -9223372036854775810L;
+ long maxLong = 9223372036854775809L;
+ long minLongHex = -0x8000000000000001L;
+ long maxLongHex = 0x8000000000000000L;
+
+ float minPosFloat = 1.0e-46f;
+ float maxPosFloat = 1.0e+39f;
+
+ double minPosDouble = 1.0e-325;
+ double maxPosDouble = 1.0e+309;
+ }
+}
diff --git a/tests/errors/CantCallConstructorOnAspects.java b/tests/errors/CantCallConstructorOnAspects.java
new file mode 100644
index 000000000..02b5d260a
--- /dev/null
+++ b/tests/errors/CantCallConstructorOnAspects.java
@@ -0,0 +1,12 @@
+public class CantCallConstructorOnAspects {
+ public static void main(String[] args) {
+ //ERROR: can't call new on an aspect/of
+ A a = new A();
+ }
+}
+
+class C {
+}
+
+aspect A /*of eachobject(instanceof(C))*/ {
+}
diff --git a/tests/errors/CastInCast.java b/tests/errors/CastInCast.java
new file mode 100644
index 000000000..a8ae749b1
--- /dev/null
+++ b/tests/errors/CastInCast.java
@@ -0,0 +1,12 @@
+import org.aspectj.testing.*;
+
+public class CastInCast {
+ public static void main(String[] args) {
+ new CastInCast().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ int i = ((int) int) 13;
+ Tester.check(false, "Shouldn't have compiled");
+ }
+}
diff --git a/tests/errors/CircularDominates.java b/tests/errors/CircularDominates.java
new file mode 100644
index 000000000..3db4b691e
--- /dev/null
+++ b/tests/errors/CircularDominates.java
@@ -0,0 +1,33 @@
+import org.aspectj.testing.Tester;
+
+class C {
+ public void a() {
+ T.add("a");
+ }
+}
+
+aspect A1 { declare dominates: A1, A2;
+ pointcut cut(): target(C) && execution(void a());
+
+ before(): A1.cut() { T.add("A1"); }
+}
+
+aspect A2 { declare dominates: A2, A3;
+ before(): A1.cut() { T.add("A2"); }
+}
+
+aspect A3 { declare dominates: A3, A1;
+ before(): A1.cut() { T.add("A3"); }
+}
+
+
+class T {
+ private static StringBuffer order = new StringBuffer();
+ public static void add(String s) { order.append(s); order.append(':'); }
+ public static void reset() { order = new StringBuffer(); }
+
+ public static void checkAndReset(String expectedValue) {
+ Tester.checkEqual(order.toString(), expectedValue);
+ order.setLength(0);
+ }
+}
diff --git a/tests/errors/CircularExtends.java b/tests/errors/CircularExtends.java
new file mode 100644
index 000000000..9bd09bf6c
--- /dev/null
+++ b/tests/errors/CircularExtends.java
@@ -0,0 +1,15 @@
+import org.aspectj.testing.Tester;
+
+/**
+ * @errors 7
+ * @warnings
+ */
+public class CircularExtends extends CircularExtends {
+ public static void main(String[] args) {
+ new CircularExtends().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ Tester.check(false, "shouldn't have compiled");
+ }
+}
diff --git a/tests/errors/CircularExtendsAspect.java b/tests/errors/CircularExtendsAspect.java
new file mode 100644
index 000000000..fdeb7020f
--- /dev/null
+++ b/tests/errors/CircularExtendsAspect.java
@@ -0,0 +1,19 @@
+import org.aspectj.testing.Tester;
+
+/**
+ * @errors 18
+ * @warnings
+ */
+
+public class CircularExtendsAspect {
+ public static void main(String[] args) {
+ new CircularExtendsAspect().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ Tester.check(false, "shouldn't have compiled");
+ }
+}
+
+aspect Aspect extends Aspect {
+}
diff --git a/tests/errors/CircularPlusImplementsIntros.java b/tests/errors/CircularPlusImplementsIntros.java
new file mode 100644
index 000000000..a9dde722c
--- /dev/null
+++ b/tests/errors/CircularPlusImplementsIntros.java
@@ -0,0 +1,20 @@
+public class CircularPlusImplementsIntros {
+ public static void main(String[] args) {
+ org.aspectj.testing.Tester.check(false, "shouldn't have compiled!");
+ }
+}
+
+interface I {}
+interface J {}
+
+class C {
+ {
+ I i = new I() {};
+ J j = new J() {};
+ }
+}
+
+aspect A {
+ declare parents: I implements J;
+ declare parents: J implements I;
+}
diff --git a/tests/errors/ClassExtendingAspect.java b/tests/errors/ClassExtendingAspect.java
new file mode 100644
index 000000000..deced1ac1
--- /dev/null
+++ b/tests/errors/ClassExtendingAspect.java
@@ -0,0 +1,22 @@
+import org.aspectj.testing.*;
+
+public class ClassExtendingAspect {
+ public static void main(String[] args) {
+ new ClassExtendingAspect().go(args);
+ }
+
+ void go(String[] args) {
+ Extends e = new Extends();
+ Tester.check(false, "shouldn't have compiled!");
+ }
+
+}
+
+aspect Aspect {
+
+}
+
+class Extends extends Aspect {
+ pointcut p(): call(* *());
+}
+
diff --git a/tests/errors/ClosingBrace.java b/tests/errors/ClosingBrace.java
new file mode 100644
index 000000000..ad975bf5f
--- /dev/null
+++ b/tests/errors/ClosingBrace.java
@@ -0,0 +1,12 @@
+import org.aspectj.testing.*;
+
+public class ClosingBrace {
+ public static void main(String[] args) {
+ new ClosingBrace().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ Tester.check(false, "Shouldn't have compiled");
+ }
+ {
+
diff --git a/tests/errors/Colon.java b/tests/errors/Colon.java
new file mode 100644
index 000000000..ffa00b609
--- /dev/null
+++ b/tests/errors/Colon.java
@@ -0,0 +1,13 @@
+import org.aspectj.testing.*;
+
+public class Colon {
+ public static void main(String[] args) {
+ new Colon().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ int i = 13:
+ Tester.check(false, "Shouldn't have compiled");
+ }
+}
+
diff --git a/tests/errors/Const.java b/tests/errors/Const.java
new file mode 100644
index 000000000..103e4972b
--- /dev/null
+++ b/tests/errors/Const.java
@@ -0,0 +1,21 @@
+import org.aspectj.testing.*;
+
+public class Const {
+ public static void main(String[] args) {
+ new Const().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ int const = 2;
+ int i = const * 2;
+ Tester.check(false, "shouldn't have compiled");
+ }
+
+ public static void testme1() {
+ int i = const + 1;
+ }
+
+ public static void testme2() {
+ int j = Const.const + 1;
+ }
+}
diff --git a/tests/errors/ConstantOneOverZero.java b/tests/errors/ConstantOneOverZero.java
new file mode 100644
index 000000000..b9ac43198
--- /dev/null
+++ b/tests/errors/ConstantOneOverZero.java
@@ -0,0 +1,4 @@
+class ConstantOneOverZero {
+ int i = 1 / 0;
+ int j = 1 % 0;
+ }
diff --git a/tests/errors/DeclareError.java b/tests/errors/DeclareError.java
new file mode 100644
index 000000000..7ad6cd1e3
--- /dev/null
+++ b/tests/errors/DeclareError.java
@@ -0,0 +1,28 @@
+import org.aspectj.testing.Tester;
+
+public class DeclareError {
+ public static void main(String[] args) {
+ new C().bad();
+ }
+}
+
+class C {
+ public void m() {
+ new C().bad();
+ }
+
+ public void bad() { }
+}
+
+class D {
+ public void m() {
+ new C().bad();
+ }
+}
+
+
+aspect A {
+ declare error: call(void C.bad()) && !within(C):
+ "can only call bad from C";
+}
+
diff --git a/tests/errors/DominatesWithCommas.java b/tests/errors/DominatesWithCommas.java
new file mode 100644
index 000000000..14d17ae12
--- /dev/null
+++ b/tests/errors/DominatesWithCommas.java
@@ -0,0 +1,11 @@
+public class DominatesWithCommas {
+ public static void main(String[] args) {
+ new DominatesWithCommas().realMain(args);
+ }
+ public void realMain(String[] args) {
+ }
+}
+
+aspect A dominates B,C{}
+aspect B {}
+aspect C {}
diff --git a/tests/errors/DuplicatedNames.java b/tests/errors/DuplicatedNames.java
new file mode 100644
index 000000000..4e8cc2bdc
--- /dev/null
+++ b/tests/errors/DuplicatedNames.java
@@ -0,0 +1,9 @@
+public class DuplicatedNames { }
+
+interface DuplicatedNames { }
+
+class DuplicatedNames { }
+
+aspect DuplicatedNames { }
+
+aspect DuplicatedNames of eachJVM() { }
diff --git a/tests/errors/ExplicitConstructorThrows.java b/tests/errors/ExplicitConstructorThrows.java
new file mode 100644
index 000000000..09474f703
--- /dev/null
+++ b/tests/errors/ExplicitConstructorThrows.java
@@ -0,0 +1,24 @@
+import java.io.IOException;
+
+public class ExplicitConstructorThrows extends Base { //ERR: default constructor throws IOException
+}
+
+class Base {
+ Base() throws IOException { }
+}
+
+class Sub1 extends Base {
+ Sub1() {
+ super(); //ERR: throws IOException
+ }
+}
+
+class Sub2 extends Base {
+ Sub2(String s) {
+ this(); //ERR: throws IOException
+ }
+
+ Sub2() throws IOException {
+ super();
+ }
+}
diff --git a/tests/errors/ExtraClosingBrace.java b/tests/errors/ExtraClosingBrace.java
new file mode 100644
index 000000000..0a46739af
--- /dev/null
+++ b/tests/errors/ExtraClosingBrace.java
@@ -0,0 +1,10 @@
+package errors;
+
+//PR#219
+
+public aspect ExtraClosingBrace {
+ public void doIt() {
+
+ }}
+}
+}
diff --git a/tests/errors/FinalStatic.java b/tests/errors/FinalStatic.java
new file mode 100644
index 000000000..055e3ecd4
--- /dev/null
+++ b/tests/errors/FinalStatic.java
@@ -0,0 +1,14 @@
+import org.aspectj.testing.*;
+
+public class FinalStatic {
+ public static void main(String[] args) {
+ new FinalStatic().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ Tester.check(false, "Shouldn't have compiled");
+ }
+
+ final static int i = -1;
+ { i = 13; }
+}
diff --git a/tests/errors/FromJavac.java b/tests/errors/FromJavac.java
new file mode 100644
index 000000000..93f9eeb44
--- /dev/null
+++ b/tests/errors/FromJavac.java
@@ -0,0 +1,14 @@
+/**
+ * this class tries to contain an error that ajc will miss, and that will
+ * fall through to javac.
+ * this will need to be steadily updated as ajc catches more things
+ * the test is to be sure this isn't a silent error
+ */
+
+public class FromJavac {
+ public static void foo() {
+ int x;
+ int y = x;
+ }
+}
+
diff --git a/tests/errors/Goto.java b/tests/errors/Goto.java
new file mode 100644
index 000000000..a597eb789
--- /dev/null
+++ b/tests/errors/Goto.java
@@ -0,0 +1,16 @@
+import org.aspectj.testing.*;
+public class Goto {
+ public static void main(String[] args) {
+ int goto = 13;
+ Tester.check(false, "shouldn't have compiled");
+ }
+
+ public static void testme1() {
+ int i = goto + 1;
+ int j = Goto.goto + 1;
+ }
+
+ public static void testme2() {
+ int j = Goto.goto + 1;
+ }
+}
diff --git a/tests/errors/ImportWithinClassBody.java b/tests/errors/ImportWithinClassBody.java
new file mode 100644
index 000000000..24d1f45cd
--- /dev/null
+++ b/tests/errors/ImportWithinClassBody.java
@@ -0,0 +1,13 @@
+
+import org.aspectj.testing.Tester;
+
+// PR#218
+
+public class ImportWithinClassBody {
+
+ import java.util.Vector;
+
+ public static void test() {
+ Tester.check("".equals(""), "");
+ }
+}
diff --git a/tests/errors/InnerMembers.java b/tests/errors/InnerMembers.java
new file mode 100644
index 000000000..35bebb8ef
--- /dev/null
+++ b/tests/errors/InnerMembers.java
@@ -0,0 +1,20 @@
+public class InnerMembers {
+ static class StaticI {
+ static int x;
+ static String foo() { return "foo"; }
+ }
+ class Inner {
+ static final int CONST=10;
+ static final int NOT_CONST=new Integer(10).intValue(); //ERR: non-constant static in inner
+ static int x; //ERR: non-constant static in inner
+ static String foo() { return "foo"; }//ERR: non-constant static in inner
+ interface I {}//ERR: non-constant static in inner
+ }
+ public static void m() {
+ class Inner {
+ static final int CONST=10;
+ static int x; //ERR: non-constant static in inner
+ static String foo() { return "foo"; }//ERR: non-constant static in inner
+ }
+ }
+}
diff --git a/tests/errors/InstanceofWithoutClass.java b/tests/errors/InstanceofWithoutClass.java
new file mode 100644
index 000000000..cd9266e77
--- /dev/null
+++ b/tests/errors/InstanceofWithoutClass.java
@@ -0,0 +1,15 @@
+
+import org.aspectj.testing.Tester;
+
+// PR#271 instanceof used without a class
+
+public class InstanceofWithoutClass {
+
+ public static void main(String[] args){
+ new InstanceofWithoutClass().go();
+ }
+
+ void go() { }
+
+ pointcut t(): this() && call(void go());
+}
diff --git a/tests/errors/IntLiteral.java b/tests/errors/IntLiteral.java
new file mode 100644
index 000000000..bf12a6609
--- /dev/null
+++ b/tests/errors/IntLiteral.java
@@ -0,0 +1,18 @@
+import org.aspectj.testing.*;
+
+public class IntLiteral {
+ public static void main(String[] args) {
+ new IntLiteral().go();
+ org.aspectj.testing.Tester.check(goRan, "Method go did not run");
+ }
+
+ static boolean goRan = false;
+
+ void go() {
+ goRan = true;
+ }
+}
+
+aspect A {
+ pointcut p1(int i) : execution(* *(5));
+}
diff --git a/tests/errors/InterfaceArrayCast.java b/tests/errors/InterfaceArrayCast.java
new file mode 100644
index 000000000..0e4442582
--- /dev/null
+++ b/tests/errors/InterfaceArrayCast.java
@@ -0,0 +1,13 @@
+class A {}
+interface I {}
+
+public class InterfaceArrayCast {
+
+ public static void main(String[] args) {}
+
+ void foo(A[] as, I i) {
+ A[] as1 = (A[])i;
+ I i1 = (I)as;
+ }
+}
+
diff --git a/tests/errors/InterfaceCast.java b/tests/errors/InterfaceCast.java
new file mode 100644
index 000000000..769730496
--- /dev/null
+++ b/tests/errors/InterfaceCast.java
@@ -0,0 +1,15 @@
+/*
+ 73 addDirectSuperType(getSuperClassDec());
+ 74 for (Iterator i = getSuperInterfaceDecs().iterator(); i.hasNext(); ) {
+ 75 InterfaceDec superInterface = (InterfaceDec)i.next();
+ 76 addDirectSuperType(superInterface);
+ 77 }
+*/
+
+public class InterfaceCast {
+ public static void main(String[] args) {
+
+ }
+}
+class A implements B {}
+class B {}
diff --git a/tests/errors/InvalidReturn.java b/tests/errors/InvalidReturn.java
new file mode 100644
index 000000000..9ff3eb335
--- /dev/null
+++ b/tests/errors/InvalidReturn.java
@@ -0,0 +1,24 @@
+package errors;
+
+public class InvalidReturn {
+ public int doNothing() { return 0; }
+ public static void test() {}
+}
+
+aspect C {
+ pointcut iCut(): this(*) && call(int *(..));
+
+ before(): iCut() {
+ return -1;
+ }
+
+ after(): iCut() {
+ return 1;
+ }
+ after() returning (): iCut() {
+ return 1;
+ }
+ after() throwing (ArithmeticException e): iCut() {
+ return -1;
+ }
+}
diff --git a/tests/errors/MethodsNotFound.java b/tests/errors/MethodsNotFound.java
new file mode 100644
index 000000000..2a7547814
--- /dev/null
+++ b/tests/errors/MethodsNotFound.java
@@ -0,0 +1,18 @@
+
+public class MethodsNotFound {
+ public void foo() {
+ "a".bar();
+ }
+
+ public void foo(int x) {
+ new Ha().foo();
+ }
+
+ public void bar() {
+ new MethodsNotFound().foo("hi");
+ }
+}
+
+class Ha {
+ private void foo() {}
+}
diff --git a/tests/errors/MismatchedParens.java b/tests/errors/MismatchedParens.java
new file mode 100644
index 000000000..f39c9718e
--- /dev/null
+++ b/tests/errors/MismatchedParens.java
@@ -0,0 +1,17 @@
+
+import org.aspectj.testing.Tester;
+
+// PR#213
+
+public class MismatchedParens {
+
+ public static void main(String[] args) { test(); }
+
+ public static void test() {
+ org.aspectj.testing.Tester.check(true, "");
+ }
+}
+
+aspect A {
+ /*static*/ before(): foocut(
+}
diff --git a/tests/errors/MissingExposure.java b/tests/errors/MissingExposure.java
new file mode 100644
index 000000000..372845c3c
--- /dev/null
+++ b/tests/errors/MissingExposure.java
@@ -0,0 +1,15 @@
+public class MissingExposure {
+ public static void main(String[] args) {
+ C c = new C();
+ org.aspectj.testing.Tester.check(false, "shouldn't have compiled");
+ }
+}
+
+class C {
+ int _int = 13;
+}
+
+aspect Aspect {
+ pointcut crash(byte _new): set(int C._int) && args(int);
+ before(byte _new): crash(_new) {}
+}
diff --git a/tests/errors/MissingReturns.java b/tests/errors/MissingReturns.java
new file mode 100644
index 000000000..a5a9e2c5b
--- /dev/null
+++ b/tests/errors/MissingReturns.java
@@ -0,0 +1,22 @@
+
+import org.aspectj.testing.Tester;
+
+// PR#138, PR#139
+// error message could be more informatinve (PR#139)
+
+aspect MissingReturns {
+
+ int baz(int a) { return 1; }
+
+ void around(): this(MissingReturns) && call(int baz(int)) {
+ // SHOULD BE:
+ // static advice() returns int: MissingReturns && int baz(int) {
+ return proceed();
+ }
+
+ pointcut cut(): this(MissingReturns) && call(int baz(int));
+ void around(): cut() {
+ proceed();
+ return 2;
+ }
+}
diff --git a/tests/errors/Modifiers.java b/tests/errors/Modifiers.java
new file mode 100644
index 000000000..dd58dc8c8
--- /dev/null
+++ b/tests/errors/Modifiers.java
@@ -0,0 +1,14 @@
+public abstract class Modifiers {
+ public private void foo1() { }
+ public protected void foo2() { }
+ protected private void foo4() { }
+
+ abstract void foo6() { }
+ abstract static void foo7();
+ abstract synchronized void foo8();
+ abstract private void foo9();
+
+ abstract strictfp void foo10();
+
+ abstract static class A { }
+}
diff --git a/tests/errors/Modifiers1.java b/tests/errors/Modifiers1.java
new file mode 100644
index 000000000..192eba9cd
--- /dev/null
+++ b/tests/errors/Modifiers1.java
@@ -0,0 +1,10 @@
+public abstract class Modifiers1 {
+ private private void foo5() { }
+ public public void foo3() { }
+}
+
+private class C {}
+
+class D {
+ abstract static class A { }
+}
diff --git a/tests/errors/MultipleIntros.java b/tests/errors/MultipleIntros.java
new file mode 100644
index 000000000..1dc1f330d
--- /dev/null
+++ b/tests/errors/MultipleIntros.java
@@ -0,0 +1,32 @@
+public class MultipleIntros {
+ public static void main(String[] args) { new C().publicM(); }
+}
+
+class C {
+ private void privateM() {}
+ public void publicM() { System.out.println("from C"); }
+
+ private int privateF;
+ public int publicF;
+}
+
+
+aspect A {
+ private int C.privateF; // should be okay
+ public int C.publicF; //ERROR conflicts with existing field
+
+ private int C.privateFA;
+ private int C.privateFA; //ERROR conflicts with the above
+
+ private void C.privateM() {} // should be okay
+ public void C.publicM() { System.out.println("from A"); } //ERROR conflicts with existing method
+}
+
+aspect AO {
+ static aspect AI1 {
+ private int C.privateFA;
+ }
+ static aspect AI2 {
+ private int C.privateFA; //ERROR conflicts with field from AI1
+ }
+}
diff --git a/tests/errors/NestedInterfaceTest.java b/tests/errors/NestedInterfaceTest.java
new file mode 100644
index 000000000..b3aa83ff2
--- /dev/null
+++ b/tests/errors/NestedInterfaceTest.java
@@ -0,0 +1,5 @@
+class NestedInterfaceTest implements NestedInterfaceTest.Const {
+ interface Const {
+ int A = 42;
+ }
+}
diff --git a/tests/errors/New.java b/tests/errors/New.java
new file mode 100644
index 000000000..a2c23a069
--- /dev/null
+++ b/tests/errors/New.java
@@ -0,0 +1,15 @@
+public class New {
+ public static void main(String[] args) {
+ new New().go();
+ }
+
+ void go() {
+
+ }
+}
+
+aspect A {
+ pointcut p(): call(* *.new(..)) && this(*);
+ before(): p() {
+ }
+}
diff --git a/tests/errors/NoAspect.java b/tests/errors/NoAspect.java
new file mode 100644
index 000000000..c735fd27a
--- /dev/null
+++ b/tests/errors/NoAspect.java
@@ -0,0 +1,14 @@
+public class NoAspect {
+ public static void main(String[] args) {
+ new NoAspect().go();
+ }
+
+ void go() {
+ }
+}
+
+class A {
+ static pointcut p(): target(*) && call(* go(..));
+ before(): p() {
+ }
+}
diff --git a/tests/errors/NoFormalsCrosscut.java b/tests/errors/NoFormalsCrosscut.java
new file mode 100644
index 000000000..d37d80391
--- /dev/null
+++ b/tests/errors/NoFormalsCrosscut.java
@@ -0,0 +1,12 @@
+import org.aspectj.testing.Tester;
+
+aspect NoFormalsCrosscut {
+ public void foo() {}
+
+ pointcut xcut1(): * *(..);
+ pointcut xcut2(): NoFormalsCrosscut;
+ before(): xcut1 && xcut2() {
+ System.out.println("before");
+ }
+}
+
diff --git a/tests/errors/NoMethodName.java b/tests/errors/NoMethodName.java
new file mode 100644
index 000000000..c2eefd990
--- /dev/null
+++ b/tests/errors/NoMethodName.java
@@ -0,0 +1,12 @@
+import org.aspectj.testing.*;
+
+public class NoMethodName {
+ public static void main(String[] args) {
+ new NoMethodName().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ System.out.();
+ Tester.check(false, "Shouldn't have compiled");
+ }
+}
diff --git a/tests/errors/NoNew_PR398.java b/tests/errors/NoNew_PR398.java
new file mode 100644
index 000000000..d3603fc55
--- /dev/null
+++ b/tests/errors/NoNew_PR398.java
@@ -0,0 +1,23 @@
+import org.aspectj.testing.Tester;
+/**
+ * PR#398
+ */
+class NoNew {
+
+ public static void main(String[] args) {
+ try {
+ new NoNew().thrower();
+ } catch (Exception e) {
+ }
+ }
+ void thrower() throws Exception {
+ throw /*new*/ Exception("exception"); // missing new
+ }
+}
+
+aspect AspectTest of eachJVM() {
+
+ pointcut pc3(): executions(void thrower());
+ before(): pc3() {
+ }
+}
diff --git a/tests/errors/NoReturnStatement.java b/tests/errors/NoReturnStatement.java
new file mode 100644
index 000000000..b60d4fc46
--- /dev/null
+++ b/tests/errors/NoReturnStatement.java
@@ -0,0 +1,23 @@
+import org.aspectj.testing.Tester;
+
+// PR#280 return statement not present in around with returns
+
+public aspect NoReturnStatement {
+ public static void main(String[] args) { test(); }
+
+ public static void test() {
+ Tester.check(true, "passed");
+ }
+
+ public int m() { return 1; }
+
+ int around(C t): target(t) && call(int m()) {
+ int x = proceed(t);
+ // uncomment this to make code compile:
+ // return x;
+ }
+}
+
+class C {
+ public int m() { return 1; }
+}
diff --git a/tests/errors/NoReturnStatementSimple.java b/tests/errors/NoReturnStatementSimple.java
new file mode 100644
index 000000000..e6f7787c8
--- /dev/null
+++ b/tests/errors/NoReturnStatementSimple.java
@@ -0,0 +1,6 @@
+
+/** error falls to javac to detect - confirm detected in ajc */
+public class NoReturnStatementSimple {
+ static String noReturn() { } // compile error here detected by javac
+ public static void main(String[] args) { }
+}
diff --git a/tests/errors/NoReturnTypeInDesignator.java b/tests/errors/NoReturnTypeInDesignator.java
new file mode 100644
index 000000000..1549015aa
--- /dev/null
+++ b/tests/errors/NoReturnTypeInDesignator.java
@@ -0,0 +1,12 @@
+
+// PR#130
+
+public aspect NoReturnTypeInDesignator
+{
+ static after(): this(Point) && call(!static *(..)) {
+ System.out.println( "after" );
+ }
+
+}
+
+class Point {}
diff --git a/tests/errors/NoSource.java b/tests/errors/NoSource.java
new file mode 100644
index 000000000..31549fd77
--- /dev/null
+++ b/tests/errors/NoSource.java
@@ -0,0 +1,7 @@
+import org.aspectj.testing.Tester;
+
+class NoSource {
+ introduction String {
+ public void foo() {}
+ }
+}
diff --git a/tests/errors/NotFound.java b/tests/errors/NotFound.java
new file mode 100644
index 000000000..2960b29f1
--- /dev/null
+++ b/tests/errors/NotFound.java
@@ -0,0 +1,19 @@
+import foo.bar.Bax; //ERR: can't find type foo.bar.Bax
+import a.b.c.*; //ERR: can't find package a.b.c
+
+public class NotFound {
+ public static void main(String[] args) {
+ g(). //ERR: method g() not found
+ bar();
+
+ Mumble m = //ERR: type Mumble not found
+ new Mumble(); //ERR: type Mumble not found
+
+ m.go();
+
+ Mumble m2 = null; //ERR: type Mumble not found
+
+ CONST //ERR: CONST not found
+ .m(1);
+ }
+}
diff --git a/tests/errors/NullWithFormals.java b/tests/errors/NullWithFormals.java
new file mode 100644
index 000000000..1dc5cb229
--- /dev/null
+++ b/tests/errors/NullWithFormals.java
@@ -0,0 +1,39 @@
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+public class NullWithFormals {
+
+ public void realMain(String[] args) {
+ new InnerWindowAdapter().windowClosing(null);
+ }
+
+ static class InnerWindowAdapter extends WindowAdapter {
+ public void windowClosing(WindowEvent we) {
+ }
+ }
+
+ public static void main(String[] args) {
+ new NullWithFormals().realMain(args);
+ }
+}
+
+
+aspect AspectW {
+
+ pointcut pc0(WindowEvent we, String str) : instanceof(WindowAdapter) && executions(void windowClosing(we));
+ static before(WindowEvent we, String str): pc0(we, str) {
+ System.out.println(thisJoinPoint);
+ }
+
+ pointcut pc1(String str, WindowEvent we) : instanceof(WindowAdapter) && executions(void windowClosing(we));
+ static before(String str, WindowEvent we): pc1(str, we) {
+ System.out.println(thisJoinPoint);
+ }
+
+ pointcut pc2(WindowEvent we) : instanceof(WindowAdapter) && executions(void windowClosing(we));
+ static before(WindowEvent we): pc2(we) {
+ System.out.println(thisJoinPoint);
+ }
+
+}
diff --git a/tests/errors/OverloadedPointcuts.java b/tests/errors/OverloadedPointcuts.java
new file mode 100644
index 000000000..00d58785a
--- /dev/null
+++ b/tests/errors/OverloadedPointcuts.java
@@ -0,0 +1,6 @@
+//disallow defining more than one pointcut with the same name (PR#385)
+aspect OverloadedPointcuts {
+ static void foo(int i) {}
+ pointcut fooCut(): execution(void OverloadedPointcuts.foo(int));
+ pointcut fooCut(int i): execution(void OverloadedPointcuts.foo(int)) && args(i);
+}
diff --git a/tests/errors/PR320.java b/tests/errors/PR320.java
new file mode 100644
index 000000000..d0d2cb256
--- /dev/null
+++ b/tests/errors/PR320.java
@@ -0,0 +1,14 @@
+public class PR320 {
+ public static void main(String[] args) {
+ //org.aspectj.testing.Tester.check(false, "Shouldn't have compiled!");
+ org.aspectj.testing.Tester.check(true, "OK to compile by 08b1!");
+ }
+}
+class Product1 {}
+aspect Product1Aspect pertarget(target(Product1)){
+
+ pointcut instance(Product1 p): target(p);
+ before(Product1 p): instance(p) {
+ System.out.println("Im am instance of product1");
+ }
+}
diff --git a/tests/errors/PR333.java b/tests/errors/PR333.java
new file mode 100644
index 000000000..d7fc4beff
--- /dev/null
+++ b/tests/errors/PR333.java
@@ -0,0 +1,7 @@
+public class PR333 {
+ public static void main(String[] args) {
+ org.aspectj.testing.Tester.check(false, "Shouldn't have compiled");
+ }
+}
+class A implements B {}
+class B {}
diff --git a/tests/errors/PR348.java b/tests/errors/PR348.java
new file mode 100644
index 000000000..7d2c0c3b0
--- /dev/null
+++ b/tests/errors/PR348.java
@@ -0,0 +1,17 @@
+public class Mark {
+ public static void main(String[] args) {
+ new Mark().realMain(args);
+ }
+ public void realMain(String[] args) {
+ new Bug().go(null);
+ org.aspectj.testing.Tester.check(false, "shouldn't have compiled");
+ }
+}
+
+class Bug {
+ void go(String s){}
+}
+aspect A {
+ pointcut p1(String s, int y): calls (* *.go(s)) && within(*);
+ before(String y2, int y): p1(y2, int) {}
+}
diff --git a/tests/errors/PR405.java b/tests/errors/PR405.java
new file mode 100644
index 000000000..3c143e37e
--- /dev/null
+++ b/tests/errors/PR405.java
@@ -0,0 +1,16 @@
+import org.aspectj.testing.Tester;
+public class PR405 {
+ public static void main(String[] args) {
+ new PR405().realMain(args);
+ }
+ public void realMain(String[] args) {
+ Tester.check(false, "Shouldn't have compiled");
+ }
+
+ public PR405() {
+ }
+}
+
+class C {
+ int foo(){ return 1 }
+}
diff --git a/tests/errors/PlusEqualsCantAssignToObject.java b/tests/errors/PlusEqualsCantAssignToObject.java
new file mode 100644
index 000000000..c974cba87
--- /dev/null
+++ b/tests/errors/PlusEqualsCantAssignToObject.java
@@ -0,0 +1,6 @@
+class PlusEqualsCantAssignToObject {
+ public static void main(String[] args) {
+ Object o = "hello";
+ o += "bye";
+ }
+}
diff --git a/tests/errors/PointcutFormals.java b/tests/errors/PointcutFormals.java
new file mode 100644
index 000000000..1892513c9
--- /dev/null
+++ b/tests/errors/PointcutFormals.java
@@ -0,0 +1,27 @@
+import org.aspectj.testing.Tester;
+
+public class PointcutFormals {
+ public static void main(String[] args) {
+ new PointcutFormals().call(0);
+ Tester.check(false, "Shouldn't have compiled!");
+ }
+ void call(int i) {}
+}
+
+aspect Aspect {
+ int n;
+
+ pointcut calls_pc1 (int n): call(void *.call(n));
+ pointcut calls_pc2 (int n): call(void *.call(..));
+ pointcut calls_pc (): call(void *.call(n));
+ pointcut executions_pc(): execution(void *(n));
+
+ before(): calls_pc () { }
+ before(): executions_pc() { }
+
+ after(): calls_pc () { }
+ after(): executions_pc() { }
+
+ void around(): calls_pc () { }
+ void around(): executions_pc() { }
+}
diff --git a/tests/errors/ProceedArgsCE.java b/tests/errors/ProceedArgsCE.java
new file mode 100644
index 000000000..02224847d
--- /dev/null
+++ b/tests/errors/ProceedArgsCE.java
@@ -0,0 +1,21 @@
+public class ProceedArgsCE {
+ public static void main(String[] args){
+ new ProceedArgsCE().go();
+ }
+
+ void go() {
+ System.out.println("... ");
+ }
+}
+
+aspect A {
+ void around(Object o): this(o) {
+ proceed(); // CE
+ }
+ void around(Object o): this(o) {
+ proceed(2); // CE
+ }
+ void around(Object o): this(o) {
+ proceed("hi", 2); //CE
+ }
+}
diff --git a/tests/errors/ProtectedFieldIntro.java b/tests/errors/ProtectedFieldIntro.java
new file mode 100644
index 000000000..2d83b636e
--- /dev/null
+++ b/tests/errors/ProtectedFieldIntro.java
@@ -0,0 +1,15 @@
+public class ProtectedFieldIntro {
+ public static void main(String[] args) {
+ new ProtectedFieldIntro().realMain(args);
+ }
+ public void realMain(String[] args) {
+ org.aspectj.testing.Tester.check(false, "shouldn't have compiled");
+ }
+
+ public ProtectedFieldIntro() {
+ }
+}
+class C {}
+aspect A {
+ protected int C.i = 13; // can't do this
+}
diff --git a/tests/errors/ProtectedIntro.java b/tests/errors/ProtectedIntro.java
new file mode 100644
index 000000000..ea693ad36
--- /dev/null
+++ b/tests/errors/ProtectedIntro.java
@@ -0,0 +1,15 @@
+public class ProtectedIntro {
+ public static void main(String[] args) {
+ new ProtectedIntro().realMain(args);
+ }
+ public void realMain(String[] args) {
+ org.aspectj.testing.Tester.check(false, "shouldn't have compiled");
+ }
+
+ public ProtectedIntro() {
+ }
+}
+class C {}
+aspect A {
+ protected void C.foo() {}; // can't do this
+}
diff --git a/tests/errors/RecursiveCCutSpecifier.java b/tests/errors/RecursiveCCutSpecifier.java
new file mode 100644
index 000000000..049dca63a
--- /dev/null
+++ b/tests/errors/RecursiveCCutSpecifier.java
@@ -0,0 +1,19 @@
+package errors;
+
+import org.aspectj.testing.Tester;
+
+/**
+ * Test for: PR #95
+ */
+
+aspect RecursiveCCutSpecifier {
+ pointcut setFile(LocalFile f): receptions(* *(..)) || setFile(f) && instanceof(f);
+
+ /*static*/ before(LocalFile f): setFile(f) {
+ // nop
+ }
+}
+
+class LocalFile {
+ public LocalFile() {}
+}
diff --git a/tests/errors/StaticAdviceOnAbstract.java b/tests/errors/StaticAdviceOnAbstract.java
new file mode 100644
index 000000000..4975bd482
--- /dev/null
+++ b/tests/errors/StaticAdviceOnAbstract.java
@@ -0,0 +1,20 @@
+abstract aspect StaticAdviceOnAbstract {
+ abstract pointcut i();
+
+ pointcut j():
+ i()
+ && !this(StaticAdviceOnAbstract)
+ && call(new(..)) ;
+}
+
+aspect Concrete {
+ // static advice indirectly on an abstract pointcut
+ after() returning(Object o): StaticAdviceOnAbstract.j() {
+ System.out.println("we have"+o);
+ }
+
+ // a simple case of directly on abstract pointcut
+ after() returning(Object o): StaticAdviceOnAbstract.i() {
+ System.out.println("we have"+o);
+ }
+}
diff --git a/tests/errors/StaticPointcutRefs.java b/tests/errors/StaticPointcutRefs.java
new file mode 100644
index 000000000..3d8a75774
--- /dev/null
+++ b/tests/errors/StaticPointcutRefs.java
@@ -0,0 +1,10 @@
+public class StaticPointcutRefs {
+}
+
+abstract aspect A1 {
+ abstract pointcut ocut(); //: call(* *(..));
+
+ static aspect AI {
+ before(): ocut() {} //ERROR static reference to abstract PCD
+ }
+}
diff --git a/tests/errors/StrayDot.java b/tests/errors/StrayDot.java
new file mode 100644
index 000000000..d918b0957
--- /dev/null
+++ b/tests/errors/StrayDot.java
@@ -0,0 +1,19 @@
+import org.aspectj.testing.*;
+
+public class StrayDot {
+ public static void main(String[] args) {
+ new StrayDot().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ .int i = 13;
+ int. z = 13;
+ int .j = 13;
+ int k. = 13;
+ int l .= 13;
+ int m =. 13;
+ int n = .13;
+ Tester.check(false, "Shouldn't have compiled");
+ }
+}
+
diff --git a/tests/errors/StraySlash.java b/tests/errors/StraySlash.java
new file mode 100644
index 000000000..e5323326a
--- /dev/null
+++ b/tests/errors/StraySlash.java
@@ -0,0 +1,23 @@
+import org.aspectj.testing.*;
+
+public class StraySlash {
+ public static void main(String[] args) {
+ new StraySlash().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ \
+ /
+ &
+ *
+ (
+ )
+ @
+ #
+ $
+ %
+ ^
+ Tester.check(false, "Shouldn't have compiled");
+ }
+}
+
diff --git a/tests/errors/SubAspectsCantExtendNonAbstractAspects.java b/tests/errors/SubAspectsCantExtendNonAbstractAspects.java
new file mode 100644
index 000000000..e97e89fe8
--- /dev/null
+++ b/tests/errors/SubAspectsCantExtendNonAbstractAspects.java
@@ -0,0 +1,15 @@
+public class SubAspectsCantExtendNonAbstractAspects {
+ public static void main(String[] args) {
+ }
+}
+
+class C {}
+
+aspect A /*of eachobject(instanceof(C))*/ {
+ before(): call(* *(..)) {}
+}
+
+
+//ERROR: can't extend a concrete aspect
+aspect SubA extends A {
+}
diff --git a/tests/errors/Switch.java b/tests/errors/Switch.java
new file mode 100644
index 000000000..404db1d80
--- /dev/null
+++ b/tests/errors/Switch.java
@@ -0,0 +1,8 @@
+public class Switch {
+ public void m() {
+ switch(2) {
+ int j = 0;
+ case 1:
+ }
+ }
+}
diff --git a/tests/errors/ThrowsClause.java b/tests/errors/ThrowsClause.java
new file mode 100644
index 000000000..ca919b6e6
--- /dev/null
+++ b/tests/errors/ThrowsClause.java
@@ -0,0 +1,14 @@
+class C {
+ public void m() throws Integer { } //ERROR Integer is not a Throwable
+
+ public C() throws C { } //ERROR C is not a Throwable
+}
+
+
+class Sup {
+ public void m() {}
+}
+
+class Sub extends Sup {
+ public void m() throws Exception {}
+}
diff --git a/tests/errors/TopLevelAfter.java b/tests/errors/TopLevelAfter.java
new file mode 100644
index 000000000..7db612660
--- /dev/null
+++ b/tests/errors/TopLevelAfter.java
@@ -0,0 +1,9 @@
+import org.aspectj.testing.Tester;
+
+public class TopLevelAfter {
+ public static void main(String[] args) {
+ Tester.check(false, "should not have compiled");
+ }
+}
+
+after(): {}
diff --git a/tests/errors/TopLevelAround.java b/tests/errors/TopLevelAround.java
new file mode 100644
index 000000000..52beae80e
--- /dev/null
+++ b/tests/errors/TopLevelAround.java
@@ -0,0 +1,9 @@
+import org.aspectj.testing.Tester;
+
+public class TopLevelAround {
+ public static void main(String[] args) {
+ Tester.check(false, "should not have compiled");
+ }
+}
+
+around(): {} // CE 9
diff --git a/tests/errors/TopLevelBefore.java b/tests/errors/TopLevelBefore.java
new file mode 100644
index 000000000..4341e6941
--- /dev/null
+++ b/tests/errors/TopLevelBefore.java
@@ -0,0 +1,9 @@
+import org.aspectj.testing.Tester;
+
+public class TopLevelBefore {
+ public static void main(String[] args) {
+ Tester.check(false, "should not have compiled");
+ }
+}
+
+before(): {}
diff --git a/tests/errors/TwoDots.java b/tests/errors/TwoDots.java
new file mode 100644
index 000000000..e6589c508
--- /dev/null
+++ b/tests/errors/TwoDots.java
@@ -0,0 +1,17 @@
+import org.aspectj.testing.*;
+
+public class TwoDots {
+ public static void main(String[] args) {
+ new TwoDots().realMain(args);
+ }
+
+ public void realMain(String[] args) {
+ this..foo();
+ //this..i = 14;
+ Tester.check(false, "Shouldn't have compiled");
+ }
+
+ int i = 13;
+ void foo() {}
+}
+
diff --git a/tests/errors/TwoIntros.java b/tests/errors/TwoIntros.java
new file mode 100644
index 000000000..e9766ad5f
--- /dev/null
+++ b/tests/errors/TwoIntros.java
@@ -0,0 +1,17 @@
+import org.aspectj.testing.Tester;
+
+public class TwoIntros {
+ public static void main(String[] args) {
+ Tester.check(false, "shouldn't compile!");
+
+ }
+}
+
+class A {
+}
+
+aspect Aspect {
+ int A.i;
+
+ String A.i;
+}
diff --git a/tests/errors/TwoPublics.java b/tests/errors/TwoPublics.java
new file mode 100644
index 000000000..e31b8f477
--- /dev/null
+++ b/tests/errors/TwoPublics.java
@@ -0,0 +1,10 @@
+public class TwoPublics {
+ public static void main(String[] args) {
+ new TwoPublics().go();
+ }
+ void go() {
+ }
+}
+
+public aspect A {}
+public aspect B {}
diff --git a/tests/errors/UndeclaredThrows.java b/tests/errors/UndeclaredThrows.java
new file mode 100644
index 000000000..352341cf8
--- /dev/null
+++ b/tests/errors/UndeclaredThrows.java
@@ -0,0 +1,20 @@
+import java.io.*;
+
+public class UndeclaredThrows {
+
+}
+
+class C {
+ public void m() throws Exception {
+ }
+
+ public void m1() {
+ m();
+ }
+
+ public void m2() {
+ try {
+ m1();
+ } catch (IOException ioe) { }
+ }
+}
diff --git a/tests/errors/UndefinedPointCut_PR396.java b/tests/errors/UndefinedPointCut_PR396.java
new file mode 100644
index 000000000..786ffde24
--- /dev/null
+++ b/tests/errors/UndefinedPointCut_PR396.java
@@ -0,0 +1,10 @@
+class UndefinedPointCut_PR396 {
+ public static void main(String[] args) {
+ org.aspectj.testing.Tester.check(false, "Shouldn't have compiled");
+ }
+}
+
+aspect AspectTest { //of eachJVM() {
+ pointcut pc4(): callsto(pc2()); //pc2 is undefined
+ before(): pc4() {}
+}
diff --git a/tests/errors/WildcardForReturns.java b/tests/errors/WildcardForReturns.java
new file mode 100644
index 000000000..e330b474f
--- /dev/null
+++ b/tests/errors/WildcardForReturns.java
@@ -0,0 +1,21 @@
+
+import org.aspectj.testing.Tester;
+
+
+
+
+
+/** @testcase PR#280 wildcard used for returns clause */
+public class WildcardForReturns {
+ public static void main(String[] args) {
+ new WildcardForReturns().m();
+ }
+
+ public void m() { }
+
+ static aspect A {
+ * around (WildcardForReturns t): this(t) && call(* m()) { // CE 17
+ // bad test - return null; //return proceed(t);
+ }
+ }
+}
diff --git a/tests/errors/protectedAccess/Main.java b/tests/errors/protectedAccess/Main.java
new file mode 100644
index 000000000..39ba8307c
--- /dev/null
+++ b/tests/errors/protectedAccess/Main.java
@@ -0,0 +1,62 @@
+package protectedAccess;
+
+import org.aspectj.testing.Tester;
+import protectedAccess.p1.C1;
+
+public class Main {
+ public static void main(String[] args) {
+ SubC1 subc1 = new SubC1();
+ subc1.m(subc1, subc1);
+ }
+}
+
+class SubC1 extends C1 {
+ public void m(SubC1 subc1, C1 c1) {
+ Tester.checkEqual(this.s, "protected");
+ Tester.checkEqual(this.m(), "protected");
+
+ Tester.checkEqual(s, "protected");
+ Tester.checkEqual(m(), "protected");
+
+ Tester.checkEqual(subc1.s, "protected");
+ Tester.checkEqual(subc1.m(), "protected");
+
+ C1 c1a = new C1() { };
+
+ C1 c1b = new C1(); //ERROR: illegal protected access
+
+ Tester.checkEqual(c1.s, "protected"); //ERROR: illegal protected access
+ Tester.checkEqual(c1.m(), "protected"); //ERROR: illegal protected access
+
+ Tester.checkEqual(c1.m(), "protected"); //ERROR: illegal protected access
+ }
+
+ class SubI1 extends I1 {
+ public void m(SubC1 subc1, C1 c1, I1 i1) {
+ Tester.checkEqual(s, "protected");
+ Tester.checkEqual(m(), "protected"); //ERROR: method not found
+
+ Tester.checkEqual(SubC1.this.s, "protected");
+ Tester.checkEqual(SubC1.this.m(), "protected");
+
+ Tester.checkEqual(subc1.s, "protected");
+ Tester.checkEqual(subc1.m(), "protected");
+
+ Tester.checkEqual(c1.s, "protected"); //ERROR: illegal protected access
+ Tester.checkEqual(c1.m(), "protected"); //ERROR: illegal protected access
+
+ Tester.checkEqual(si, "ip");
+ Tester.checkEqual(mi(), "ip");
+
+ Tester.checkEqual(this.si, "ip");
+ Tester.checkEqual(this.mi(), "ip");
+
+ Tester.checkEqual(i1.si, "ip"); //ERROR: illegal protected access
+ Tester.checkEqual(i1.mi(), "ip"); //ERROR: illegal protected access
+ }
+ }
+
+ protected String mString(Object o) {
+ return o.toString();
+ }
+}
diff --git a/tests/errors/protectedAccess/p1/C1.java b/tests/errors/protectedAccess/p1/C1.java
new file mode 100644
index 000000000..976c8e7c6
--- /dev/null
+++ b/tests/errors/protectedAccess/p1/C1.java
@@ -0,0 +1,17 @@
+package protectedAccess.p1;
+
+
+public class C1 {
+ protected C1() { }
+
+ protected String s = "protected";
+
+ protected String m() { return "protected"; }
+
+ protected String mString(String s) { return s; }
+
+ protected static class I1 {
+ protected String si = "ip";
+ protected String mi() { return "ip"; }
+ }
+}