Created
October 18, 2021 19:55
-
-
Save HarrisonMc555/a700b51f99d854e1287091477c602d75 to your computer and use it in GitHub Desktop.
Patch to improve error message for failing to instantiate constructor for abstract class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/jdk/internal/reflect/ReflectionFactory.java b/jdk/internal/reflect/ReflectionFactory.java | |
--- a/jdk/internal/reflect/ReflectionFactory.java | |
+++ b/jdk/internal/reflect/ReflectionFactory.java | |
@@ -225,7 +225,8 @@ | |
Class<?> declaringClass = c.getDeclaringClass(); | |
if (Modifier.isAbstract(declaringClass.getModifiers())) { | |
- return new InstantiationExceptionConstructorAccessorImpl(null); | |
+ return new InstantiationExceptionConstructorAccessorImpl | |
+ ("Can not instantiate abstract class"); | |
} | |
if (declaringClass == Class.class) { | |
return new InstantiationExceptionConstructorAccessorImpl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment