Bug 62972 - Get rid of deprecated calls to Class#newInstance
Summary: Get rid of deprecated calls to Class#newInstance
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.0
Hardware: All All
: P2 enhancement (vote)
Target Milestone: JMETER_5.1
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-02 10:57 UTC by Felix Schumacher
Modified: 2018-12-18 22:28 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Schumacher 2018-12-02 10:57:41 UTC
Java 9 deprecated Class#newInstance. So let's try to get rid of those calls by replacing them with Class#getDeclaredConstructor#newInstance, which should be the equivalent logic.

The PR https://github.com/apache/jmeter/pull/435 gets rid of all but two occurrences. The two remaining ones would result in API changes.
Comment 1 Felix Schumacher 2018-12-02 11:45:08 UTC
Date: Sun Dec  2 11:00:28 2018
New Revision: 1847958

URL: http://svn.apache.org/viewvc?rev=1847958&view=rev
Log:
spacepolice

Modified:
    jmeter/trunk/test/src/org/apache/jorphan/exec/TestKeyToolUtils.java

Date: Sun Dec  2 11:04:09 2018
New Revision: 1847959

URL: http://svn.apache.org/viewvc?rev=1847959&view=rev
Log:
Use StringUtils.isNotBlank to make intent clearer

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java

Date: Sun Dec  2 11:05:50 2018
New Revision: 1847960

URL: http://svn.apache.org/viewvc?rev=1847960&view=rev
Log:
Replace deprecated newInstance calls

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
Date: Sun Dec  2 11:07:03 2018
New Revision: 1847961

URL: http://svn.apache.org/viewvc?rev=1847961&view=rev
Log:
Use log format strings

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java

Date: Sun Dec  2 11:09:06 2018
New Revision: 1847964

URL: http://svn.apache.org/viewvc?rev=1847964&view=rev
Log:
Replace calls to deprecated Class#newInstance

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionRouter.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/AddThinkTimeBetweenEachStep.java
    jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
    jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java

Date: Sun Dec  2 11:10:02 2018
New Revision: 1847965

URL: http://svn.apache.org/viewvc?rev=1847965&view=rev
Log:
Use log format strings

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java

Date: Sun Dec  2 11:11:31 2018
New Revision: 1847966

URL: http://svn.apache.org/viewvc?rev=1847966&view=rev
Log:
Simplify code

Newer java versions have changed the method signatures to varargs. Use those varargs.
Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java

Date: Sun Dec  2 11:12:48 2018
New Revision: 1847969

URL: http://svn.apache.org/viewvc?rev=1847969&view=rev
Log:
Use Java naming conventions for parameter names

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java

Date: Sun Dec  2 11:13:52 2018
New Revision: 1847972

URL: http://svn.apache.org/viewvc?rev=1847972&view=rev
Log:
Use StringUtils#isNotBlank to make intent clearer

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellInterpreter.java

Date: Sun Dec  2 11:14:49 2018
New Revision: 1847973

URL: http://svn.apache.org/viewvc?rev=1847973&view=rev
Log:
Replace calls to deprecated Class#newInstance

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListener.java

Date: Sun Dec  2 11:16:32 2018
New Revision: 1847974

URL: http://svn.apache.org/viewvc?rev=1847974&view=rev
Log:
Extract code to create BackendListenerClient from a classname

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java
Date: Sun Dec  2 11:17:25 2018
New Revision: 1847975

URL: http://svn.apache.org/viewvc?rev=1847975&view=rev
Log:
Extract code into private methods to make intent clearer

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java

Date: Sun Dec  2 11:18:35 2018
New Revision: 1847976

URL: http://svn.apache.org/viewvc?rev=1847976&view=rev
Log:
Use StringUtils.isNotBlank to make intent of code clearer

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/BackendListenerGui.java
Date: Sun Dec  2 11:19:45 2018
New Revision: 1847977

URL: http://svn.apache.org/viewvc?rev=1847977&view=rev
Log:
Replace calls to deprecated Class#newInstance method

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java
    jmeter/trunk/src/core/org/apache/jmeter/testelement/property/AbstractProperty.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java

Date: Sun Dec  2 11:20:26 2018
New Revision: 1847978

URL: http://svn.apache.org/viewvc?rev=1847978&view=rev
Log:
Use log format strings

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/BaseParser.java

Date: Sun Dec  2 11:21:32 2018
New Revision: 1847979

URL: http://svn.apache.org/viewvc?rev=1847979&view=rev
Log:
Replace calls to deprecated Class#newInstance method

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java
    jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassTools.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/SamplerCreatorFactory.java
    jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JavaSampler.java
    jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java
Date: Sun Dec  2 11:22:07 2018
New Revision: 1847980

URL: http://svn.apache.org/viewvc?rev=1847980&view=rev
Log:
Use log format strings

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java

Date: Sun Dec  2 11:23:44 2018
New Revision: 1847981

URL: http://svn.apache.org/viewvc?rev=1847981&view=rev
Log:
Replace calls to deprecated Class#newInstance method

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RequestPanel.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/graphite/GraphiteBackendListenerClient.java
    jmeter/trunk/src/core/org/apache/jmeter/NewDriver.java
    jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/GuiPackage.java
    jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java
    jmeter/trunk/src/core/org/apache/jmeter/save/converters/TestElementConverter.java
    jmeter/trunk/src/core/org/apache/jmeter/save/converters/TestElementPropertyConverter.java
    jmeter/trunk/src/core/org/apache/jmeter/testelement/property/CollectionProperty.java
    jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java

Date: Sun Dec  2 11:24:36 2018
New Revision: 1847982

URL: http://svn.apache.org/viewvc?rev=1847982&view=rev
Log:
Replace calls to deprecated Class#newInstance method

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java
    jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MapProperty.java
    jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java

Date: Sun Dec  2 11:25:42 2018
New Revision: 1847984

URL: http://svn.apache.org/viewvc?rev=1847984&view=rev
Log:
With varargs there is no need for an extra array

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/BeanShellServer.java

Date: Sun Dec  2 11:27:21 2018
New Revision: 1847985

URL: http://svn.apache.org/viewvc?rev=1847985&view=rev
Log:
Replace calls to deprecated method Class#newInstance

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java
    jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java

Date: Sun Dec  2 11:28:12 2018
New Revision: 1847986

URL: http://svn.apache.org/viewvc?rev=1847986&view=rev
Log:
With varargs there is no need for the arrays

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java

Date: Sun Dec  2 11:33:14 2018
New Revision: 1847987

URL: http://svn.apache.org/viewvc?rev=1847987&view=rev
Log:
Simplify code that tries to find the correct constructor

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/PowerTableModel.java

Date: Sun Dec  2 11:34:38 2018
New Revision: 1847989

URL: http://svn.apache.org/viewvc?rev=1847989&view=rev
Log:
Replace calls to deprecated method Class#newInstance

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
    jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java
    jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java
    jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TestBeanGUI.java
    jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java

Date: Sun Dec  2 11:35:31 2018
New Revision: 1847990

URL: http://svn.apache.org/viewvc?rev=1847990&view=rev
Log:
Adapt test case to new method of constructing instances

Part of #435 and Bugzilla Id: 62972

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java

Date: Sun Dec  2 11:39:02 2018
New Revision: 1847991

URL: http://svn.apache.org/viewvc?rev=1847991&view=rev
Log:
Add changelog entry.

Closes #435
Bugzilla Id: 62972

Modified:
    jmeter/trunk/xdocs/changes.xml