I liked this idea. So we will have a new method overriding the Object method and just by that all the code will start using this new method, instead of the old deprecated one. This will be code change directly only in one place and indirectly call changed in many places.
If there is a proper base class in the object hierarchy of NB objects where we can add such method it will be easier. Otherwise this method can be a utility class utility method, but in that case it will still be a change of code in many places. with regards Tushar Tushar Joshi, Nagpur: http://www.tusharjoshi.com * MCSD_NET C#, SCJP, RHCE, ZCE, PMP, CSM, SAFe, PRINCE2 * Senior Architect @ Persistent Systems http://www.persistent.com * LinkedIn: http://www.linkedin.com/in/tusharvjoshi On Mon, Apr 1, 2019 at 1:14 AM Tim Boudreau <niftin...@gmail.com> wrote: > getDeclaredConstructor() will find non-public constructors - that is not a > 1:1 replacement. > > I wouldn't litter the codebase with code to do all the needed checks if you > replaced it - rather add a "<T> newInstance(Class<T>, ClassLoader)" method > somewhere. > > -Tim > > On Fri, Mar 29, 2019 at 3:44 PM Brad Walker <bwal...@musings.com> wrote: > > > I've been using/building Netbeans for the past few months.. > > > > I'm interested in helping w/ development. So I was thinking that I could > > fix some of the "low-hanging" issues that would be easy for me to > complete. > > This would also help me with learning the process. > > > > There are several places in the code where the following Java code > exists. > > Class<?> clz = Class.forName(cslLanguageClass, true, myClassLoader); > > Object o = clz.newInstance(); > > > > This causes the following error when compiling. > > > > [repeat] > > > > > /home/bwalker/src/netbeans-10.0-test/ide/csl.api/anttask/src/org/netbeans/modules/csl/CslJar.java:274: > > warning: [deprecation] newInstance() in Class has been deprecated > > [repeat] Object o = clz.newInstance(); > > > > I was thinking about fixing these to use the getDeclaredConstructor() > > method > > as that is the recommended solution. I've also looked over the > > documentation and it looks to be correct. > > > > There are many instances of this and before I take the effort to fix > them, > > I wanted to check with the dev team to see if that would be acceptable > and > > a good course of action. > > > > Any advice is appreciated. > > > > -brad w. > > > -- > http://timboudreau.com >