Class<?> defineClassInternal(final String className, byte[] bytes, int off, int len, final ProtectionDomain protectionDomain) { if (transformer != null) { return defineClassInternal(className, ByteBuffer.wrap(bytes, off, len), protectionDomain); } final long start = Metrics.getCurrentCPUTime(); final Class<?> defined = defineClass(className, bytes, off, len, protectionDomain); module.getModuleLoader().addClassLoadTime(Metrics.getCurrentCPUTime() - start); return defined; }
private Class<?> doDefineOrLoadClass(final String className, final byte[] bytes, final ByteBuffer byteBuffer, ProtectionDomain protectionDomain) { try { final Class<?> definedClass = bytes != null ? defineClass(className, bytes, 0, bytes.length, protectionDomain) : defineClass(className, byteBuffer, protectionDomain); module.getModuleLoader().incClassCount(); return definedClass; } catch (LinkageError e) { final Class<?> loadedClass = findLoadedClass(className); if (loadedClass != null) { module.getModuleLoader().incRaceCount(); return loadedClass; } throw e; } }
Class<?> defineClassInternal(final String className, ByteBuffer byteBuffer, final ProtectionDomain protectionDomain) { if (transformer != null) { int pos = byteBuffer.position(); int lim = byteBuffer.limit(); ByteBuffer transformed; try { transformed = transformer.transform(this, className.replace('.', '/'), protectionDomain, byteBuffer); } catch (Exception e) { ClassFormatError error = new ClassFormatError(e.getMessage()); error.initCause(e); throw error; } if (transformed != null) { byteBuffer = transformed; } else { byteBuffer.position(0); byteBuffer.limit(lim); byteBuffer.position(pos); } } final long start = Metrics.getCurrentCPUTime(); final Class<?> defined = defineClass(className, byteBuffer, protectionDomain); module.getModuleLoader().addClassLoadTime(Metrics.getCurrentCPUTime() - start); return defined; }
private Class<?> doDefineOrLoadClass(final String className, final byte[] bytes, int off, int len, ProtectionDomain protectionDomain) { try { final Class<?> definedClass = defineClass(className, bytes, off, len, protectionDomain); module.getModuleLoader().incClassCount(); return definedClass; } catch (LinkageError e) { final Class<?> loadedClass = findLoadedClass(className); if (loadedClass != null) { module.getModuleLoader().incRaceCount(); return loadedClass; } throw e; } }
throw new ClassNotFoundException("Failed to preDefine class: " + className, th); final Class<?> clazz = defineClass(className, classSpec, resourceLoader); try { postDefine(classSpec, clazz);
throw new ClassNotFoundException("Failed to preDefine class: " + className, th); final Class<?> clazz = defineClass(className, classSpec, resourceLoader); try { postDefine(classSpec, clazz);