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.

GenericConfigurableBugTest.java 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package test;
  2. import junit.framework.TestCase;
  3. /**
  4. * Test case to illustrate problem with SPR-4587.
  5. *
  6. * @author Ramnivas Laddad
  7. *
  8. */
  9. public class GenericConfigurableBugTest {
  10. public static void main(String[] argv) {
  11. RegularClass regular = new RegularClass();
  12. GenericParameterClass generic = new GenericParameterClass();
  13. if (!(regular instanceof ConfigurableObject))
  14. throw new RuntimeException("regular not instanceof ConfigurableObject");
  15. if (!(generic instanceof ConfigurableObject))
  16. throw new RuntimeException("generic not instanceof ConfigurableObject");
  17. if (TestAspect.aspectOf().count!=4)
  18. throw new RuntimeException("Count should be 4 but is "+TestAspect.aspectOf().count);
  19. }
  20. }
  21. aspect TestAspect {
  22. int count = 0;
  23. after() : initialization(ConfigurableObject+.new(..)) {
  24. System.out.println(thisJoinPoint);
  25. count++;
  26. }
  27. declare parents: @Configurable * implements ConfigurableObject;
  28. }
  29. interface ConfigurableObject {
  30. }
  31. @interface Configurable {
  32. }
  33. @Configurable
  34. class RegularClass {
  35. }
  36. @Configurable
  37. class GenericParameterClass<T> {
  38. }