Skip to content

Replaces all the occurrences of clazz.newInstance() #66

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

Merged
merged 1 commit into from
May 30, 2018

Conversation

gayanW
Copy link
Collaborator

@gayanW gayanW commented May 29, 2018

Replaces all the occurrences of

clazz.newInstance()

in jpf-core with

clazz.getDeclaredConstructor().newInstance()

From
http://cr.openjdk.java.net/~iris/se/10/latestSpec/api/java/lang/Class.html#newInstance()

Class.newInstance() method propagates any exception thrown by the
nullary constructor, including a checked exception. Use of this method
effectively bypasses the compile-time exception checking that would
otherwise be performed by the compiler. The Constructor.newInstance
method avoids this problem by wrapping any exception thrown by the
constructor in a (checked) InvocationTargetException.

Fixes: #61

Replaces all the occurrences of

    clazz.newInstance()

in jpf-core with

    clazz.getDeclaredConstructor().newInstance()

From
http://cr.openjdk.java.net/~iris/se/10/latestSpec/api/java/lang/Class.html#newInstance()

Class.newInstance() method propagates any exception thrown by the
nullary constructor, including a checked exception. Use of this method
effectively bypasses the compile-time exception checking that would
otherwise be performed by the compiler. The Constructor.newInstance
method avoids this problem by wrapping any exception thrown by the
constructor in a (checked) InvocationTargetException.
@cyrille-artho cyrille-artho merged commit 5b7f834 into javapathfinder:java-10 May 30, 2018
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.

2 participants