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

Replaced Class#newInstance method with Constructor#newInstance method #14

Merged
merged 1 commit into from
Nov 6, 2017
Merged

Conversation

ghacupha
Copy link
Contributor

@ghacupha ghacupha commented Nov 6, 2017

The Class#newInstance method creates an instance but by-passes some checked exceptions (NoSuchMethod and InvocationTargetException) which could otherwise be caught by the compiler.
This PR also removes the method Field#isAccessible() and preemptively calls the Field#setAccessible(true) method since all fields created from Class#getDeclaredFields() have the accessible flag set to false.
The Class#newInstance method and the Field#isAccessible() are also deprecated in java 9

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 81.624% when pulling 8055200 on ghacupha:master into 940bb43 on ozlerhakan:master.

@ozlerhakan ozlerhakan merged commit 8055200 into ozlerhakan:master Nov 6, 2017
@ozlerhakan
Copy link
Owner

merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants