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

    https://github.com/apache/flink/pull/960#discussion_r36837638
  
    --- Diff: 
flink-java/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java 
---
    @@ -1328,24 +1329,29 @@ else if(typeHierarchy.size() <= 1) {
                List<Method> methods = getAllDeclaredMethods(clazz);
                for (Method method : methods) {
                        if (method.getName().equals("readObject") || 
method.getName().equals("writeObject")) {
    -                           LOG.info("Class "+clazz+" contains custom 
serialization methods we do not call.");
    +                           LOG.info(clazz+" contains custom serialization 
methods we do not call.");
                                return null;
                        }
                }
     
                // Try retrieving the default constructor, if it does not have 
one
                // we cannot use this because the serializer uses it.
    +           Constructor defaultConstructor = null;
                try {
    -                   clazz.getDeclaredConstructor();
    +                   defaultConstructor = clazz.getDeclaredConstructor();
                } catch (NoSuchMethodException e) {
                        if (clazz.isInterface() || 
Modifier.isAbstract(clazz.getModifiers())) {
    -                           LOG.info("Class " + clazz + " is abstract or an 
interface, having a concrete " +
    +                           LOG.info(clazz + " is abstract or an interface, 
having a concrete " +
                                                "type can increase 
performance.");
                        } else {
    -                           LOG.info("Class " + clazz + " must have a 
default constructor to be used as a POJO.");
    +                           LOG.info(clazz + " must have a default 
constructor to be used as a POJO.");
                                return null;
                        }
                }
    +           if(defaultConstructor != null && 
(defaultConstructor.getModifiers() & Modifier.PUBLIC) == 0) {
    --- End diff --
    
    `if(defaultConstructor != null && 
Modifier.isPublic(defaultConstructor.getModifiers())` seems to be more readable 
to me but your approach is fine too.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to