MCPcopy Create free account
hub / github.com/Ramos-dev/OSSTunnel / DynamicClassLoader

Class DynamicClassLoader

client/src/main/java/SennaLoader.java:174–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172
173
174 public static class DynamicClassLoader extends ClassLoader {
175
176 private Map<String, CompiledCode> customCompiledCode = new HashMap<>();
177
178 public DynamicClassLoader(ClassLoader parent) {
179 super(parent);
180 }
181
182 public void addCode(CompiledCode cc) {
183 customCompiledCode.put(cc.getName(), cc);
184 }
185
186 @Override
187 protected Class<?> findClass(String name) throws ClassNotFoundException {
188 CompiledCode cc = customCompiledCode.get(name);
189 if (cc == null) {
190 return super.findClass(name);
191 }
192 byte[] byteCode = cc.getByteCode();
193 return defineClass(name, byteCode, 0, byteCode.length);
194 }
195 }
196
197
198 public static class ExtendedStandardJavaFileManager extends

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected