mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-28 13:45:22 +01:00
Add some debug information to a OutOfMemory exception.
This commit is contained in:
parent
dd3cd6c768
commit
02d0a9afd5
@ -25,6 +25,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.reflect.StructureModifier;
|
import com.comphenix.protocol.reflect.StructureModifier;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.primitives.Primitives;
|
import com.google.common.primitives.Primitives;
|
||||||
@ -206,6 +207,11 @@ public final class StructureCompiler {
|
|||||||
return (StructureModifier<TField>) compiledClass.getConstructor(
|
return (StructureModifier<TField>) compiledClass.getConstructor(
|
||||||
StructureModifier.class, StructureCompiler.class).
|
StructureModifier.class, StructureCompiler.class).
|
||||||
newInstance(source, this);
|
newInstance(source, this);
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
// Print the number of generated classes by the current instances
|
||||||
|
ProtocolLibrary.getErrorReporter().reportWarning(
|
||||||
|
this, "May have generated too many classes (count: " + compiledCache.size() + ")");
|
||||||
|
throw e;
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
throw new IllegalStateException("Used invalid parameters in instance creation", e);
|
throw new IllegalStateException("Used invalid parameters in instance creation", e);
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user