Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,14 @@ private static Object newInstance(Class<?> cls) {
} catch (Throwable t) {
try {
Constructor<?>[] constructors = cls.getDeclaredConstructors();
if (constructors != null && constructors.length == 0) {
/**
* From Javadoc java.lang.Class#getDeclaredConstructors
* This method returns an array of Constructor objects reflecting all the constructors
* declared by the class represented by this Class object.
* This method returns an array of length 0,
* if this Class object represents an interface, a primitive type, an array class, or void.
*/
if (constructors.length == 0) {
Comment thread
ralf0131 marked this conversation as resolved.
throw new RuntimeException("Illegal constructor: " + cls.getName());
}
Constructor<?> constructor = constructors[0];
Expand Down