[
https://issues.apache.org/jira/browse/GORA-536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16473664#comment-16473664
]
ASF GitHub Bot commented on GORA-536:
-------------------------------------
Github user carlosrmng commented on the issue:
https://github.com/apache/gora/pull/133
Hi @lewismc
I found multiple classes and interfaces that define their own newInstance()
method which are not directly affected by the issue. I used my IDE's 'find
usages' feature to search for all the Class#newInstance() references within the
code, so hopefully I didn't miss anything.
Some examples:
-
[javax.xml.parsers.DocumentBuilderFactory#newInstance()](https://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#newInstance())
-
[org.apache.gora.persistency.Persistent#newInstance()](https://github.com/apache/gora/blob/dc70b14b542830cee434329cabee1b801ad51254/gora-core/src/main/java/org/apache/gora/persistency/Persistent.java#L115)
-
[org.apache.gora.goraci.generated.CINode#newInstance()](https://github.com/apache/gora/blob/dc70b14b542830cee434329cabee1b801ad51254/gora-goraci/src/main/java/org/apache/gora/goraci/generated/CINode.java#L342)
> 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)