[ 
https://issues.apache.org/jira/browse/FLINK-8933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16475670#comment-16475670
 ] 

ASF GitHub Bot commented on FLINK-8933:
---------------------------------------

Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/6016#discussion_r188246129
  
    --- Diff: 
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/TupleSerializer.java
 ---
    @@ -59,7 +59,7 @@ public TupleSerializer(Class<T> tupleClass, 
TypeSerializer<?>[] fieldSerializers
        @Override
        public T createInstance() {
                try {
    -                   T t = tupleClass.newInstance();
    +                   T t = tupleClass.getDeclaredConstructor().newInstance();
    --- End diff --
    
    this change may have performance implications as noted in the mail thread 
linked in the jira.


> Avoid calling Class#newInstance
> -------------------------------
>
>                 Key: FLINK-8933
>                 URL: https://issues.apache.org/jira/browse/FLINK-8933
>             Project: Flink
>          Issue Type: Task
>            Reporter: Ted Yu
>            Assignee: vinoyang
>            Priority: Minor
>
> 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 
> wraps the checked exceptions in InvocationException.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to