summaryrefslogtreecommitdiffstats
path: root/tests/bugs/InstanceAsClassRefToConstant.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs/InstanceAsClassRefToConstant.java')
-rw-r--r--tests/bugs/InstanceAsClassRefToConstant.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/bugs/InstanceAsClassRefToConstant.java b/tests/bugs/InstanceAsClassRefToConstant.java
new file mode 100644
index 000000000..6e615ae97
--- /dev/null
+++ b/tests/bugs/InstanceAsClassRefToConstant.java
@@ -0,0 +1,40 @@
+
+import org.aspectj.testing.Tester;
+import java.util.*;
+
+/** @testcase PR#909 instance as class reference to constant */
+public class InstanceAsClassRefToConstant {
+ public static void main(String[] args) {
+ throw new Error("XXX not set up to run");
+ }
+}
+
+abstract class CWithLongConst {
+ public static final long MAX = 1000000;
+}
+
+class A extends CWithLongConst {
+}
+
+class TestCase {
+ public final static void main(String[] argv) {
+ A aL = new A();
+
+ // bad error
+ // a) Sanity check:
+ // stack size is -1 after stmt BreakStmt(label: null) (warning)
+ for (long l=0; l<2000000; l+=100000) {
+ if (l > aL.MAX) {
+ break;
+ }
+ }
+
+ // b) Sanity check: stack size is -1 after stmt ExprStmt() (warning)
+ String[] stringsL = null;
+ for (long k=0; (k<2000000) && (stringsL == null); k+=100000) {
+ if (k > aL.MAX) {
+ stringsL = new String[1];
+ }
+ }
+ }
+}