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.

ArrayInc1CE.java 1.2KB

1234567891011121314151617181920212223242526272829
  1. /**
  2. * @testcase PR#715 PUREJAVA incrementing objects, arrays
  3. */
  4. public class ArrayIncCE {
  5. private static int[] IRA = new int[]{0,1,2};
  6. private static Object OBJECT = new Object();
  7. static int[] getIRA() { return IRA; }
  8. static Object getObject() { return null; }
  9. public void testObjectIncrementingCE() {
  10. int i = 0;
  11. Object object = new Object();
  12. String[] sra = new String[]{""};
  13. //++getIRA(); // CE prefix ++ not applied to int[]
  14. //++getObject(); // CE prefix ++ not applied to Object
  15. //getIRA()++; // CE postfix ++ not applied to int[]
  16. //getObject()++; // CE postfix ++ not applied to Object
  17. IRA += 1; // CE + not applied to int[], int
  18. //getIRA() += 1; // CE + not applied to int[], int
  19. object += 1; // CE + not applied to Object, int
  20. //getObject() += 1; // CE + not applied to Object, int
  21. i = +IRA; // CE unary + not applied to int[]
  22. i = +getIRA(); // CE unary + not applied to int[]
  23. sra += "bad concat"; // CE string + not applied to String[], String
  24. //"1" += sra[0]; // CE no literal on lhs
  25. }
  26. }