< prev index next >

src/java.base/share/classes/java/lang/reflect/Proxy.java

Print this page

        

*** 687,703 **** ensureVisible(loader, type); } } /* ! * Returns all types referenced by all public method signatures of * the proxy interfaces */ private static Set<Class<?>> referencedTypes(ClassLoader loader, List<Class<?>> interfaces) { return interfaces.stream() .flatMap(intf -> Stream.of(intf.getMethods()) .flatMap(ProxyBuilder::methodRefTypes) .map(ProxyBuilder::getElementType) .filter(t -> !t.isPrimitive())) .collect(Collectors.toSet()); } --- 687,704 ---- ensureVisible(loader, type); } } /* ! * Returns all types referenced by all public non-static method signatures of * the proxy interfaces */ private static Set<Class<?>> referencedTypes(ClassLoader loader, List<Class<?>> interfaces) { return interfaces.stream() .flatMap(intf -> Stream.of(intf.getMethods()) + .filter(m -> !Modifier.isStatic(m.getModifiers())) .flatMap(ProxyBuilder::methodRefTypes) .map(ProxyBuilder::getElementType) .filter(t -> !t.isPrimitive())) .collect(Collectors.toSet()); }
*** 793,822 **** // all proxy interfaces are public and at least one in a non-exported package // map to dynamic proxy module and add reads edge and qualified exports, if necessary Module target = getDynamicModule(loader); ! // set up proxy class access to proxy interfaces and superinterfaces ! Deque<Class<?>> deque = new LinkedList<>(interfaces); ! Set<Class<?>> visited = new HashSet<>(); ! while (!deque.isEmpty()) { ! Class<?> c = deque.poll(); ! if (!visited.add(c)) { ! continue; ! } ensureAccess(target, c); - - // add all superinterfaces - for (Class<?> intf : c.getInterfaces()) { - deque.add(intf); } - } - - // set up proxy class access to types referenced in the method signature - refTypes.stream() - .filter(t -> !visited.contains(t)) - .forEach(t -> ensureAccess(target, t)); return target; } /* * Ensure the given module can access the given class. --- 794,810 ---- // all proxy interfaces are public and at least one in a non-exported package // map to dynamic proxy module and add reads edge and qualified exports, if necessary Module target = getDynamicModule(loader); ! // set up proxy class access to proxy interfaces and types ! // referenced in the method signature ! Set<Class<?>> types = new HashSet<>(interfaces); ! types.addAll(refTypes); ! for (Class<?> c : types) { ensureAccess(target, c); } return target; } /* * Ensure the given module can access the given class.
< prev index next >