aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/protectedStatic
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/new/protectedStatic
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/new/protectedStatic')
-rw-r--r--tests/new/protectedStatic/SubClass.java32
-rw-r--r--tests/new/protectedStatic/pack/SuperClass.java19
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/new/protectedStatic/SubClass.java b/tests/new/protectedStatic/SubClass.java
new file mode 100644
index 000000000..d2caf89eb
--- /dev/null
+++ b/tests/new/protectedStatic/SubClass.java
@@ -0,0 +1,32 @@
+import pack.SuperClass;
+import org.aspectj.testing.Tester;
+
+/** @testcase PR#585 PUREJAVA subclass unable to access protected static methods using type-qualified references */
+public class SubClass extends SuperClass {
+ private static int i;
+ static {
+ while (i<6) {
+ Tester.expectEvent(label() + SuperClass.SUPERCLASS);
+ }
+ i = 0;
+ }
+ static void register(Object o) {
+ Tester.event(""+o);
+ }
+
+ public static String label() { return "label() " + i++; }
+ public static void main(String[] args) {
+ Object o = protectedStaticObject;
+ register(""+protectedStatic(label() + o));
+ register(""+SuperClass.protectedStatic(label() + o));
+ register(""+pack.SuperClass.protectedStatic(label() + o));
+ new SubClass().run();
+ Tester.checkAllEvents();
+ }
+ public void run() {
+ Object o = protectedObject;
+ register(label() + protectedObject);
+ register(""+protectedMethod(label()+o));
+ register(""+this.protectedMethod(label()+o));
+ }
+}
diff --git a/tests/new/protectedStatic/pack/SuperClass.java b/tests/new/protectedStatic/pack/SuperClass.java
new file mode 100644
index 000000000..ac301a3ee
--- /dev/null
+++ b/tests/new/protectedStatic/pack/SuperClass.java
@@ -0,0 +1,19 @@
+
+package pack;
+
+public class SuperClass {
+ public static final String SUPERCLASS = "SuperClass";
+ private static String superClass() { return SUPERCLASS; }
+
+ /** @testcase PR#585 subclass access to protected static field */
+ protected static Object protectedStaticObject = superClass();
+ /** @testcase PR#585 subclass access to protected static method */
+ protected static Object protectedStatic(String s) { return s; }
+
+ /** @testcase PR#585 subclass access to protected field */
+ protected Object protectedObject = superClass();
+ /** @testcase PR#585 subclass access to protected method */
+ protected Object protectedMethod(String s) { return s; }
+
+ public String toString() { return superClass(); }
+}