@Test(expected = UnsupportedOperationException.class) public void testModifyThrowsException() throws Exception { JavaModule.Dispatcher.Disabled.INSTANCE.modify(mock(Instrumentation.class), mock(Object.class), Collections.emptySet(), Collections.<String, Set<Object>>emptyMap(), Collections.<String, Set<Object>>emptyMap(), Collections.<Class<?>>emptySet(), Collections.<Class<?>, List<Class<?>>>emptyMap()); }
public void modify(Instrumentation instrumentation, Set<JavaModule> reads, Map<String, Set<JavaModule>> exports, Map<String, Set<JavaModule>> opens, Set<Class<?>> uses, Map<Class<?>, List<Class<?>>> provides) { Set<Object> unwrappedReads = new HashSet<Object>(); for (JavaModule read : reads) { unwrappedReads.add(read.unwrap()); } Map<String, Set<Object>> unwrappedExports = new HashMap<String, Set<Object>>(); for (Map.Entry<String, Set<JavaModule>> entry : exports.entrySet()) { Set<Object> modules = new HashSet<Object>(); for (JavaModule module : entry.getValue()) { modules.add(module.unwrap()); } unwrappedExports.put(entry.getKey(), modules); } Map<String, Set<Object>> unwrappedOpens = new HashMap<String, Set<Object>>(); for (Map.Entry<String, Set<JavaModule>> entry : opens.entrySet()) { Set<Object> modules = new HashSet<Object>(); for (JavaModule module : entry.getValue()) { modules.add(module.unwrap()); } unwrappedOpens.put(entry.getKey(), modules); } DISPATCHER.modify(instrumentation, module, unwrappedReads, unwrappedExports, unwrappedOpens, uses, provides); }
JavaModule implements NamedElement.WithOptionalName, AnnotationSource { public void modify(Instrumentation instrumentation, Set<JavaModule> reads, Map<String, Set<JavaModule>> exports, Map<String, Set<JavaModule>> opens, Set<Class<?>> uses, Map<Class<?>, List<Class<?>>> provides) { Set<Object> unwrappedReads = new HashSet<Object>(); for (JavaModule read : reads) { unwrappedReads.add(read.unwrap()); } Map<String, Set<Object>> unwrappedExports = new HashMap<String, Set<Object>>(); for (Map.Entry<String, Set<JavaModule>> entry : exports.entrySet()) { Set<Object> modules = new HashSet<Object>(); for (JavaModule module : entry.getValue()) { modules.add(module.unwrap()); } unwrappedExports.put(entry.getKey(), modules); } Map<String, Set<Object>> unwrappedOpens = new HashMap<String, Set<Object>>(); for (Map.Entry<String, Set<JavaModule>> entry : opens.entrySet()) { Set<Object> modules = new HashSet<Object>(); for (JavaModule module : entry.getValue()) { modules.add(module.unwrap()); } unwrappedOpens.put(entry.getKey(), modules); } DISPATCHER.modify(instrumentation, module, unwrappedReads, unwrappedExports, unwrappedOpens, uses, provides); } }
JavaModule implements NamedElement.WithOptionalName, AnnotationSource { public void modify(Instrumentation instrumentation, Set<JavaModule> reads, Map<String, Set<JavaModule>> exports, Map<String, Set<JavaModule>> opens, Set<Class<?>> uses, Map<Class<?>, List<Class<?>>> provides) { Set<Object> unwrappedReads = new HashSet<Object>(); for (JavaModule read : reads) { unwrappedReads.add(read.unwrap()); } Map<String, Set<Object>> unwrappedExports = new HashMap<String, Set<Object>>(); for (Map.Entry<String, Set<JavaModule>> entry : exports.entrySet()) { Set<Object> modules = new HashSet<Object>(); for (JavaModule module : entry.getValue()) { modules.add(module.unwrap()); } unwrappedExports.put(entry.getKey(), modules); } Map<String, Set<Object>> unwrappedOpens = new HashMap<String, Set<Object>>(); for (Map.Entry<String, Set<JavaModule>> entry : opens.entrySet()) { Set<Object> modules = new HashSet<Object>(); for (JavaModule module : entry.getValue()) { modules.add(module.unwrap()); } unwrappedOpens.put(entry.getKey(), modules); } DISPATCHER.modify(instrumentation, module, unwrappedReads, unwrappedExports, unwrappedOpens, uses, provides); } protected  JavaModule(AnnotatedElement module); }
JavaModule implements NamedElement.WithOptionalName, AnnotationSource { public void modify(Instrumentation instrumentation, Set<JavaModule> reads, Map<String, Set<JavaModule>> exports, Map<String, Set<JavaModule>> opens, Set<Class<?>> uses, Map<Class<?>, List<Class<?>>> provides) { Set<Object> unwrappedReads = new HashSet<Object>(); for (JavaModule read : reads) { unwrappedReads.add(read.unwrap()); } Map<String, Set<Object>> unwrappedExports = new HashMap<String, Set<Object>>(); for (Map.Entry<String, Set<JavaModule>> entry : exports.entrySet()) { Set<Object> modules = new HashSet<Object>(); for (JavaModule module : entry.getValue()) { modules.add(module.unwrap()); } unwrappedExports.put(entry.getKey(), modules); } Map<String, Set<Object>> unwrappedOpens = new HashMap<String, Set<Object>>(); for (Map.Entry<String, Set<JavaModule>> entry : opens.entrySet()) { Set<Object> modules = new HashSet<Object>(); for (JavaModule module : entry.getValue()) { modules.add(module.unwrap()); } unwrappedOpens.put(entry.getKey(), modules); } DISPATCHER.modify(instrumentation, module, unwrappedReads, unwrappedExports, unwrappedOpens, uses, provides); } protected  JavaModule(AnnotatedElement module); static JavaModule ofType(Class<?> type); static JavaModule of(Object module); static boolean isSupported(); boolean isNamed(); String getActualName(); InputStream getResourceAsStream(String name); ClassLoader getClassLoader(); Object unwrap(); boolean canRead(JavaModule module); boolean isExported(PackageDescription packageDescription, JavaModule module); boolean isOpened(PackageDescription packageDescription, JavaModule module); AnnotationList getDeclaredAnnotations(); void modify(Instrumentation instrumentation,
                       Set<JavaModule> reads,
                       Map<String, Set<JavaModule>> exports,
                       Map<String, Set<JavaModule>> opens,
                       Set<Class<?>> uses,
                       Map<Class<?>, List<Class<?>>> provides); @Override int hashCode(); @Override boolean equals(Object other); @Override String toString(); }
JavaModule implements NamedElement.WithOptionalName, AnnotationSource { public void modify(Instrumentation instrumentation, Set<JavaModule> reads, Map<String, Set<JavaModule>> exports, Map<String, Set<JavaModule>> opens, Set<Class<?>> uses, Map<Class<?>, List<Class<?>>> provides) { Set<Object> unwrappedReads = new HashSet<Object>(); for (JavaModule read : reads) { unwrappedReads.add(read.unwrap()); } Map<String, Set<Object>> unwrappedExports = new HashMap<String, Set<Object>>(); for (Map.Entry<String, Set<JavaModule>> entry : exports.entrySet()) { Set<Object> modules = new HashSet<Object>(); for (JavaModule module : entry.getValue()) { modules.add(module.unwrap()); } unwrappedExports.put(entry.getKey(), modules); } Map<String, Set<Object>> unwrappedOpens = new HashMap<String, Set<Object>>(); for (Map.Entry<String, Set<JavaModule>> entry : opens.entrySet()) { Set<Object> modules = new HashSet<Object>(); for (JavaModule module : entry.getValue()) { modules.add(module.unwrap()); } unwrappedOpens.put(entry.getKey(), modules); } DISPATCHER.modify(instrumentation, module, unwrappedReads, unwrappedExports, unwrappedOpens, uses, provides); } protected  JavaModule(AnnotatedElement module); static JavaModule ofType(Class<?> type); static JavaModule of(Object module); static boolean isSupported(); boolean isNamed(); String getActualName(); InputStream getResourceAsStream(String name); ClassLoader getClassLoader(); Object unwrap(); boolean canRead(JavaModule module); boolean isExported(PackageDescription packageDescription, JavaModule module); boolean isOpened(PackageDescription packageDescription, JavaModule module); AnnotationList getDeclaredAnnotations(); void modify(Instrumentation instrumentation,
                       Set<JavaModule> reads,
                       Map<String, Set<JavaModule>> exports,
                       Map<String, Set<JavaModule>> opens,
                       Set<Class<?>> uses,
                       Map<Class<?>, List<Class<?>>> provides); @Override int hashCode(); @Override boolean equals(Object other); @Override String toString(); static final JavaModule UNSUPPORTED; }