> On Nov 2, 2016, at 5:51 PM, joe darcy <[email protected]> wrote: > > : > The getConstructor call only returns *public* constructors while newInstance > can call non-public constructors too, subject to the appropriate security > checks. > > > Therefore, using "getDeclaredConstructor()" is a better replacement since it > should be able to find and call non-public constructors when that is > permissible. The patch for this is: > > --- a/src/java.base/share/classes/java/lang/Class.java Wed Nov 02 16:24:43 > 2016 -0700 > +++ b/src/java.base/share/classes/java/lang/Class.java Wed Nov 02 17:36:25 > 2016 -0700 > @@ -485,7 +485,7 @@ > * can be replaced by > * > * <pre>{@code > - * clazz.getConstructor().newInstance() > + * clazz.getDeclaredConstructor().newInstance() > * }</pre> > * > * The latter sequence of calls is inferred to be able to throw >
+1 Mandy
