You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by FSchumacher <gi...@git.apache.org> on 2018/11/11 21:33:00 UTC
[GitHub] jmeter pull request #431: Class#newInstance deprecation with Java 9
GitHub user FSchumacher opened a pull request:
https://github.com/apache/jmeter/pull/431
Class#newInstance deprecation with Java 9
## Description
Change invocation of Class#newInstance to Class#getConstructor#newInstance
And do some cleanup using StringUtils.isNotBlank
## Motivation and Context
Java 9 deprecates Class#newInstance, so this will get rid of the deprecation warnings
## How Has This Been Tested?
ran tests
## Screenshots (if appropriate):
## Types of changes
<!--- What types of changes does your code introduce? Delete as appropriate -->
- Bug fix (non-breaking change which fixes an issue)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [x] My code follows the [code style][style-guide] of this project.
[style-guide]: https://wiki.apache.org/jmeter/CodeStyleGuidelines
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/FSchumacher/jmeter newinstance-deprecation
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/jmeter/pull/431.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #431
----
commit 3d8aa9c075770a669c9e8eb441e2d30d211b8fa9
Author: Felix Schumacher <fe...@...>
Date: 2018-11-11T21:16:06Z
Class#newInstance will be deprecated with Java 9
commit 224c7f41ff0c282baef55e6c5658a543aa4ee308
Author: Felix Schumacher <fe...@...>
Date: 2018-11-11T21:18:22Z
Get rid of deprecation warning of Class#newInstance
commit 9807e46ecc40bbb655fc847f429467bc3657d366
Author: Felix Schumacher <fe...@...>
Date: 2018-11-11T21:23:16Z
Get rid of deprecation warning for Class#newInstance
commit b36e2202d48b427d1dca7ecf62ccc23f9ae24f48
Author: Felix Schumacher <fe...@...>
Date: 2018-11-11T21:27:22Z
Get rid of deprecation warnings for Class#newInstance
----
---
[GitHub] jmeter issue #431: Class#newInstance deprecation with Java 9
Posted by codecov-io <gi...@git.apache.org>.
Github user codecov-io commented on the issue:
https://github.com/apache/jmeter/pull/431
# [Codecov](https://codecov.io/gh/apache/jmeter/pull/431?src=pr&el=h1) Report
> Merging [#431](https://codecov.io/gh/apache/jmeter/pull/431?src=pr&el=desc) into [trunk](https://codecov.io/gh/apache/jmeter/commit/95361b101ad7fdfc5073e12ad667b82c85c2d7f5?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `4.16%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/jmeter/pull/431/graphs/tree.svg?width=650&token=6Q7CI1wFSh&height=150&src=pr)](https://codecov.io/gh/apache/jmeter/pull/431?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## trunk #431 +/- ##
===========================================
+ Coverage 58.59% 58.6% +<.01%
- Complexity 10633 10635 +2
===========================================
Files 1196 1196
Lines 76040 76039 -1
Branches 7357 7356 -1
===========================================
+ Hits 44558 44564 +6
+ Misses 28974 28969 -5
+ Partials 2508 2506 -2
```
| [Impacted Files](https://codecov.io/gh/apache/jmeter/pull/431?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...ore/org/apache/jmeter/gui/action/ActionRouter.java](https://codecov.io/gh/apache/jmeter/pull/431/diff?src=pr&el=tree#diff-c3JjL2NvcmUvb3JnL2FwYWNoZS9qbWV0ZXIvZ3VpL2FjdGlvbi9BY3Rpb25Sb3V0ZXIuamF2YQ==) | `6.61% <0%> (ø)` | `3 <0> (ø)` | :arrow_down: |
| [...jmeter/gui/action/AddThinkTimeBetweenEachStep.java](https://codecov.io/gh/apache/jmeter/pull/431/diff?src=pr&el=tree#diff-c3JjL2NvcmUvb3JnL2FwYWNoZS9qbWV0ZXIvZ3VpL2FjdGlvbi9BZGRUaGlua1RpbWVCZXR3ZWVuRWFjaFN0ZXAuamF2YQ==) | `0% <0%> (ø)` | `0 <0> (ø)` | :arrow_down: |
| [...jmeter/protocol/http/sampler/AccessLogSampler.java](https://codecov.io/gh/apache/jmeter/pull/431/diff?src=pr&el=tree#diff-c3JjL3Byb3RvY29sL2h0dHAvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvaHR0cC9zYW1wbGVyL0FjY2Vzc0xvZ1NhbXBsZXIuamF2YQ==) | `7.69% <0%> (+0.07%)` | `3 <0> (ø)` | :arrow_down: |
| [test/src/org/apache/jorphan/test/AllTests.java](https://codecov.io/gh/apache/jmeter/pull/431/diff?src=pr&el=tree#diff-dGVzdC9zcmMvb3JnL2FwYWNoZS9qb3JwaGFuL3Rlc3QvQWxsVGVzdHMuamF2YQ==) | `81.25% <50%> (ø)` | `17 <0> (ø)` | :arrow_down: |
| [...re/org/apache/jmeter/engine/DistributedRunner.java](https://codecov.io/gh/apache/jmeter/pull/431/diff?src=pr&el=tree#diff-c3JjL2NvcmUvb3JnL2FwYWNoZS9qbWV0ZXIvZW5naW5lL0Rpc3RyaWJ1dGVkUnVubmVyLmphdmE=) | `85.71% <0%> (+3.36%)` | `32% <0%> (+1%)` | :arrow_up: |
| [...s/org/apache/jmeter/timers/PoissonRandomTimer.java](https://codecov.io/gh/apache/jmeter/pull/431/diff?src=pr&el=tree#diff-c3JjL2NvbXBvbmVudHMvb3JnL2FwYWNoZS9qbWV0ZXIvdGltZXJzL1BvaXNzb25SYW5kb21UaW1lci5qYXZh) | `78.37% <0%> (+5.4%)` | `10% <0%> (+1%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/jmeter/pull/431?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/jmeter/pull/431?src=pr&el=footer). Last update [95361b1...b36e220](https://codecov.io/gh/apache/jmeter/pull/431?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
---
[GitHub] jmeter issue #431: Class#newInstance deprecation with Java 9
Posted by FSchumacher <gi...@git.apache.org>.
Github user FSchumacher commented on the issue:
https://github.com/apache/jmeter/pull/431
> According to https://docs.oracle.com/javase/9/docs/api/java/lang/Class.html
> It should be replaced by
> ` clazz.getDeclaredConstructor().newInstance()`
> see also https://stackoverflow.com/questions/53257073/java-9-replace-class-newinstance
Thanks for the info, I read the same article before I started and then made such a mess :) I prepared a new pull request #435 and will close this one.
---
[GitHub] jmeter pull request #431: Class#newInstance deprecation with Java 9
Posted by FSchumacher <gi...@git.apache.org>.
Github user FSchumacher closed the pull request at:
https://github.com/apache/jmeter/pull/431
---
[GitHub] jmeter issue #431: Class#newInstance deprecation with Java 9
Posted by FSchumacher <gi...@git.apache.org>.
Github user FSchumacher commented on the issue:
https://github.com/apache/jmeter/pull/431
Well, I don't know, if we can generalize it, but it is surely the first hits, only. There will be more, when I have slept a bit.
---
[GitHub] jmeter issue #431: Class#newInstance deprecation with Java 9
Posted by pmouawad <gi...@git.apache.org>.
Github user pmouawad commented on the issue:
https://github.com/apache/jmeter/pull/431
Hello Felix,
I guess this is a first step before generalization ?
As I see other places in code where newInstance() is used.
Regards
---
[GitHub] jmeter issue #431: Class#newInstance deprecation with Java 9
Posted by jmetertea <gi...@git.apache.org>.
Github user jmetertea commented on the issue:
https://github.com/apache/jmeter/pull/431
According to https://docs.oracle.com/javase/9/docs/api/java/lang/Class.html
It should be replaced by
` clazz.getDeclaredConstructor().newInstance()`
But for generalizing, see https://stackoverflow.com/questions/53257073/java-9-replace-class-newinstance
---