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.

GenericsLost4.java 762B

12345678910111213141516171819202122232425262728
  1. import java.util.*;
  2. import java.lang.reflect.*;
  3. // interface ITD
  4. aspect Foo {
  5. public List<String> IFace.getStrings() {
  6. return null;
  7. }
  8. }
  9. interface IFace {}
  10. class Goo implements IFace {}
  11. public class GenericsLost4 {
  12. public static void main(String[]argv) throws Exception {
  13. Method m = Goo.class.getDeclaredMethod("getStrings");
  14. Type t = m.getGenericReturnType();
  15. if (!t.toString().equals("java.util.List<java.lang.String>"))
  16. throw new RuntimeException("Incorrect signature. Signature is "+t);
  17. m = IFace.class.getDeclaredMethod("getStrings");
  18. t = m.getGenericReturnType();
  19. if (!t.toString().equals("java.util.List<java.lang.String>"))
  20. throw new RuntimeException("Incorrect signature. Signature is "+t);
  21. }
  22. }