htynkn commented on a change in pull request #1575: [dubbo-1521]add java 9 in travis yml URL: https://github.com/apache/incubator-dubbo/pull/1575#discussion_r180294062
########## File path: dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ReflectUtils.java ########## @@ -910,6 +910,9 @@ private static Object getEmptyObject(Class<?> returnType, Map<Class<?>, Object> while (cls != null && cls != Object.class) { Field[] fields = cls.getDeclaredFields(); for (Field field : fields) { + if (field.isSynthetic()) { Review comment: @lovepoem @beiwei30 please refer to jacoco faq http://www.jacoco.org/jacoco/trunk/doc/faq.html <img width="1337" alt="screen shot 2018-04-10 at 12 15 57 pm" src="https://user-images.githubusercontent.com/659135/38535943-f615402a-3cb8-11e8-8dd1-6734ca9ca9ac.png"> We need this change to skip $jacocoData, otherwise test will fail. Also skip synthetic field in reflection is also a good practice. Refer to those two links: + https://docs.oracle.com/javase/tutorial/reflect/member/fieldModifiers.html + https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.8 According to the JVM Spec: "A class member that does not appear in the source code must be marked using a Synthetic attribute." Also, "The Synthetic attribute was introduced in JDK release 1.1 to support nested classes and interfaces." ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services