You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gora.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/05/13 03:26:00 UTC
[jira] [Commented] (GORA-536) Avoid calling Class#newInstance
[ https://issues.apache.org/jira/browse/GORA-536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16473340#comment-16473340 ]
ASF GitHub Bot commented on GORA-536:
-------------------------------------
GitHub user carlosrmng opened a pull request:
https://github.com/apache/gora/pull/133
GORA-536: Avoid calling Class#newInstance
When using reflexion use `getDeclaredConstructor().newInstance()` instead of `Class::newInstance` because it may throw undeclared checked exceptions.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/carlosrmng/gora GORA-536
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/gora/pull/133.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 #133
----
commit aed2e299762d632eb00da18f6815f6fffd8d75bd
Author: Carlos Rodrigo Muñoz <ca...@...>
Date: 2018-05-13T02:50:32Z
When using reflexion use getDeclaredConstructor().newInstance() instead of Class::newInstance because it may throw undeclared checked exceptions.
commit 0896daf8bae1899694305ffc7e3f9b02de5d770c
Author: Carlos Rodrigo Muñoz <ca...@...>
Date: 2018-05-13T03:25:01Z
remove unused imports
----
> Avoid calling Class#newInstance
> -------------------------------
>
> Key: GORA-536
> URL: https://issues.apache.org/jira/browse/GORA-536
> Project: Apache Gora
> Issue Type: Task
> Reporter: Ted Yu
> Priority: Minor
> Fix For: 0.9
>
>
> Class::newInstance is deprecated starting in Java 9 - https://bugs.openjdk.java.net/browse/JDK-6850612 - because it may throw undeclared checked exceptions.
> The suggested replacement is {{getDeclaredConstructor().newInstance()}}, which will wrap the checked exceptions in InvocationException.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)