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.

X.java 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. abstract class FooBase<A> { }
  2. // Existence of this line causes the exception
  3. abstract class Foo <CC extends Resource, DD extends DataInterface<CC>> extends FooBase<DD> { }
  4. interface DataInterface<CC> {
  5. public CC getContent(); // ERR
  6. }
  7. interface Marker<CC> extends DataInterface<CC> { }
  8. interface Resource { }
  9. aspect DataAspect {
  10. // Intertype declaration onto Marker that shares the variable
  11. public C Marker<C>.getContent() { // ERR
  12. return null;
  13. }
  14. }
  15. /*
  16. X.java:7 [error] can't override CC DataInterface<CC>.getContent() with CC Marker.getContent() return types don't match
  17. public CC getContent();
  18. ^^^^^^^^^
  19. X.java:16 [error] can't override CC DataInterface<CC>.getContent() with CC Marker.getContent() return types don't match
  20. public C Marker<C>.getContent() {
  21. ^^^^^^^^^
  22. 1. Two errors because both source locations reported (stupid code)
  23. when failing:
  24. parent: CC DataInterface<CC>.getContent()
  25. child : CC Marker.getContent()
  26. Both return types are type variable reference types (different ones though)
  27. parent: TypeVar CC extends Resource
  28. child : CC
  29. So parent discovered the wrong type variable (the wrong CC).
  30. parent is a ResolvedMemberImpl
  31. it is considered an 'existingmember' of the type DataInterface<CC>
  32. */