add DEBUG flag save of loaded entity as proxy
Signed-off-by: Scott Marlow <smarlow@redhat.com>
This commit is contained in:
parent
744d3ea644
commit
ab549a4828
|
@ -128,8 +128,15 @@ public final class ByteBuddyState {
|
|||
* @return The loaded generated class.
|
||||
*/
|
||||
public Class<?> load(Class<?> referenceClass, Function<ByteBuddy, DynamicType.Builder<?>> makeClassFunction) {
|
||||
return make( makeClassFunction.apply( byteBuddy ) )
|
||||
.load( referenceClass.getClassLoader(), resolveClassLoadingStrategy( referenceClass ) )
|
||||
Unloaded<?> result = make( makeClassFunction.apply( byteBuddy ) );
|
||||
if (DEBUG) {
|
||||
try {
|
||||
result.saveIn(new File(System.getProperty("java.io.tmpdir") + "/bytebuddy/"));
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Unable to save generated class %1$s", result.getTypeDescription().getName(), e);
|
||||
}
|
||||
}
|
||||
return result.load( referenceClass.getClassLoader(), resolveClassLoadingStrategy( referenceClass ) )
|
||||
.getLoaded();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue