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.

123456789101112131415161718192021222324252627282930313233343536373839
  1. import java.util.HashSet;
  2. import java.util.Set;
  3. aspect ReturnTypeTest {
  4. private interface Test {
  5. Object getId();
  6. int hashCode();
  7. }
  8. public int Test.hashCode() {
  9. System.out.println("in Test.hashCode()");
  10. return getId().hashCode();
  11. }
  12. declare parents : ReturnTypeTester implements Test;
  13. }
  14. class ReturnTypeTester {
  15. static Set<ReturnTypeTester> set = new HashSet<ReturnTypeTester>();
  16. static {
  17. ReturnTypeTester tester = new ReturnTypeTester();
  18. set.add(tester);
  19. }
  20. public String getId() {
  21. return "id";
  22. }
  23. }
  24. public class pr105479part2 {
  25. public static void main(String[] args) {
  26. ReturnTypeTester rtt = new ReturnTypeTester();
  27. rtt.hashCode();
  28. System.out.println(rtt.getId());
  29. if (rtt.hashCode() != "id".hashCode()) throw new RuntimeException("dispatch failure");
  30. }
  31. }