add DEBUG flag save of loaded entity as proxy
Signed-off-by: Scott Marlow <smarlow@redhat.com>
This commit is contained in:
parent
b3b62ad685
commit
7b9c14d8a1
|
@ -128,9 +128,18 @@ public final class ByteBuddyState {
|
||||||
* @return The loaded generated class.
|
* @return The loaded generated class.
|
||||||
*/
|
*/
|
||||||
public Class<?> load(Class<?> referenceClass, Function<ByteBuddy, DynamicType.Builder<?>> makeClassFunction) {
|
public Class<?> load(Class<?> referenceClass, Function<ByteBuddy, DynamicType.Builder<?>> makeClassFunction) {
|
||||||
return make( makeClassFunction.apply( byteBuddy ) )
|
Unloaded<?> result =
|
||||||
.load( referenceClass.getClassLoader(), resolveClassLoadingStrategy( referenceClass ) )
|
make( makeClassFunction.apply( byteBuddy ) );
|
||||||
.getLoaded();
|
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