Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8264138: Replace uses of Class.newInstance #491



Copy link

@aghaisas aghaisas commented May 10, 2021

This PR replaces Class.newInstance() deprecated method with Contructor.newinstance().


  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed




Using git

Checkout this PR locally:
$ git fetch pull/491/head:pull/491
$ git checkout pull/491

Update a local copy of the PR:
$ git checkout pull/491
$ git pull pull/491/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 491

View PR using the GUI difftool:
$ git pr show -t 491

Using diff file

Download this PR as a diff file:

Copy link

@bridgekeeper bridgekeeper bot commented May 10, 2021

👋 Welcome back aghaisas! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label May 10, 2021
Copy link

@mlbridge mlbridge bot commented May 10, 2021


Copy link
Collaborator Author

@aghaisas aghaisas commented May 12, 2021

Found and replaced deprecated Class.newInstance() instances in apps and unit tests.

@kevinrushforth kevinrushforth self-requested a review May 12, 2021
Copy link

@kevinrushforth kevinrushforth left a comment

I left a couple comments (in tests), where the replacement code isn't equivalent.

throw constructLoadException(exception);
value = type.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw constructLoadException(e);
Copy link

@kevinrushforth kevinrushforth May 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't quite equivalent, since it will now wrap a RuntimeException in a LoadException, but I think that's OK in this case.

Copy link

@openjdk openjdk bot commented May 13, 2021

@aghaisas This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file for details.

After integration, the commit message for the final commit will be:

8264138: Replace uses of Class.newInstance

Reviewed-by: kcr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 5 new commits pushed to the master branch:

  • 389e8c0: 8266968: Ignore
  • e40b0b8: 8266811: Openjfx controls test build broken (Eclipse)
  • c7833f1: 8266757: Add entry for to gradle/verification-metadata.xml
  • 3ac6bf0: 8266919: Gradle verification fails on windows x86
  • eb913cb: 8189354: Change.getRemoved() list contains incorrect selected items when a TreeItem is collapsed

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label May 13, 2021
Copy link
Collaborator Author

@aghaisas aghaisas commented May 18, 2021


@openjdk openjdk bot closed this May 18, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels May 18, 2021
Copy link

@openjdk openjdk bot commented May 18, 2021

@aghaisas Since your change was applied there have been 13 commits pushed to the master branch:

  • 93de584: 8266966: Wrong CSS properties are applied to other nodes after fix for JDK-8204568
  • c511789: 8266860: [macos] Incorrect duration reported for HLS live streams
  • d2d145d: 8266643: Intermittent failure of HonorDeveloperSettingsTest unit test
  • 9c97d9b: 8267121: Illegal access to private "size" field of ArrayList from build.gradle
  • f236a7d: 8266539: [TreeView]: Change.getRemoved() contains null item when deselecting a TreeItem
  • 285a0b6: 8264770: BidirectionalBinding should use InvalidationListener to prevent boxing
  • 8ca7815: 8267160: Monocle mouse never get ENTERED state
  • 9e8c617: 8266516: One label typo in the properties for bi-directional text
  • 389e8c0: 8266968: Ignore
  • e40b0b8: 8266811: Openjfx controls test build broken (Eclipse)
  • ... and 3 more:

Your commit was automatically rebased without conflicts.

Pushed as commit 4619cdd.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@aghaisas aghaisas deleted the replace_deprecated_newInstance branch Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants