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.

TwoTypes.java 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import java.io.Serializable;
  2. import java.lang.reflect.Field;
  3. import com.testware.ejb.common.*;
  4. // when in a package, AJ worked out:
  5. //Test SerialVersionUID is 8593816477552447372
  6. //ATest SerialVersionUID is -5439116922937363745
  7. // atest serialveruid: -5439116922937363745L
  8. // test serialveruid: 8593816477552447372L
  9. //ATest: static final long serialVersionUID = 9091955077097551023L;
  10. //Test: static final long serialVersionUID = 1583992244946994789L;
  11. //ATest SerialVersionUID is 9091955077097551023
  12. //Test SerialVersionUID is 1583992244946994789
  13. //
  14. aspect X {
  15. before(): staticinitialization(*Test) {}
  16. }
  17. public class TwoTypes implements Serializable {
  18. public static void main(String[] args) {
  19. try {
  20. Test c = (Test)Test.class.newInstance();
  21. Field f = Test.class.getDeclaredField("serialVersionUID");
  22. f.setAccessible(true);
  23. long l = f.getLong(c);
  24. System.err.println("Test SerialVersionUID is "+l);
  25. // ATest b = (ATest)ATest.class.newInstance();
  26. f = ATest.class.getDeclaredField("serialVersionUID");
  27. f.setAccessible(true);
  28. l = f.getLong(Test.class.getSuperclass());
  29. System.err.println("ATest SerialVersionUID is "+l);
  30. } catch (Exception e) {
  31. System.err.println("Problem: "+e.toString());
  32. e.printStackTrace();
  33. }
  34. }
  35. //
  36. // public int anInt;
  37. //
  38. // public static boolean aBoolean = false;
  39. //
  40. // public long foo = 376;
  41. //
  42. // public void m() {}
  43. // public int compareTo(Object o) { return 0;}
  44. // public String m2(boolean b,long l, String s) { return "";}
  45. //
  46. // public static transient short fo2 = 3;
  47. }