49 50 interface KM extends K<String>, M{} //generic substitution 51 52 interface N extends H {String m();} //covariant return 53 54 private static void assertTrue(boolean b) { 55 if(!b) 56 throw new AssertionError(); 57 } 58 59 private Set<String> setOfStringObject() { 60 Set<String> s = new HashSet<>(); 61 s.add("java.lang.String"); 62 s.add("java.lang.Object"); 63 return s; 64 } 65 66 private static Set<String> allowedMethods() { 67 Set<String> s = new HashSet<>(); 68 s.add("m"); 69 if (Boolean.getBoolean("jdk.internal.lambda.disableEagerInitialization")) { 70 s.add("get$Lambda"); 71 } 72 return s; 73 } 74 75 private static boolean matchingMethodNames(Method[] methods) { 76 Set<String> methodNames = new HashSet<>(); 77 for (Method m : methods) { 78 methodNames.add(m.getName()); 79 } 80 return methodNames.equals(allowedMethods()); 81 } 82 83 private void test1() 84 { 85 L la = s -> { }; 86 la.m("hi"); 87 Class<? extends L> c1 = la.getClass(); 88 Method[] methods = c1.getDeclaredMethods(); 89 assertTrue(matchingMethodNames(methods)); 90 Set<String> types = setOfStringObject(); 91 for(Method m : methods) { | 49 50 interface KM extends K<String>, M{} //generic substitution 51 52 interface N extends H {String m();} //covariant return 53 54 private static void assertTrue(boolean b) { 55 if(!b) 56 throw new AssertionError(); 57 } 58 59 private Set<String> setOfStringObject() { 60 Set<String> s = new HashSet<>(); 61 s.add("java.lang.String"); 62 s.add("java.lang.Object"); 63 return s; 64 } 65 66 private static Set<String> allowedMethods() { 67 Set<String> s = new HashSet<>(); 68 s.add("m"); 69 return s; 70 } 71 72 private static boolean matchingMethodNames(Method[] methods) { 73 Set<String> methodNames = new HashSet<>(); 74 for (Method m : methods) { 75 methodNames.add(m.getName()); 76 } 77 return methodNames.equals(allowedMethods()); 78 } 79 80 private void test1() 81 { 82 L la = s -> { }; 83 la.m("hi"); 84 Class<? extends L> c1 = la.getClass(); 85 Method[] methods = c1.getDeclaredMethods(); 86 assertTrue(matchingMethodNames(methods)); 87 Set<String> types = setOfStringObject(); 88 for(Method m : methods) { |