| 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 |
nothing calls this directly
no outgoing calls
no test coverage detected