You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InstanceAsClassRefToConstant.java 917B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import org.aspectj.testing.Tester;
  2. import java.util.*;
  3. /** @testcase PR#909 instance as class reference to constant */
  4. public class InstanceAsClassRefToConstant {
  5. public static void main(String[] args) {
  6. throw new Error("XXX not set up to run");
  7. }
  8. }
  9. abstract class CWithLongConst {
  10. public static final long MAX = 1000000;
  11. }
  12. class A extends CWithLongConst {
  13. }
  14. class TestCase {
  15. public final static void main(String[] argv) {
  16. A aL = new A();
  17. // bad error
  18. // a) Sanity check:
  19. // stack size is -1 after stmt BreakStmt(label: null) (warning)
  20. for (long l=0; l<2000000; l+=100000) {
  21. if (l > aL.MAX) {
  22. break;
  23. }
  24. }
  25. // b) Sanity check: stack size is -1 after stmt ExprStmt() (warning)
  26. String[] stringsL = null;
  27. for (long k=0; (k<2000000) && (stringsL == null); k+=100000) {
  28. if (k > aL.MAX) {
  29. stringsL = new String[1];
  30. }
  31. }
  32. }
  33. }