From 07f3694a5c85ff5ee8c556817c0d2ea3504f26f7 Mon Sep 17 00:00:00 2001 From: Chas Honton Date: Wed, 11 Oct 2017 08:50:01 -0700 Subject: [PATCH] revert LANG-1354; java7 has synthetic fields on Integer, jacoco does not yet work with java9 --- .travis.yml | 2 +- .../org/apache/commons/lang3/reflect/FieldUtils.java | 12 +++--------- .../resources/{profile.jacoco => profile.cobertura} | 0 3 files changed, 4 insertions(+), 10 deletions(-) rename src/site/resources/{profile.jacoco => profile.cobertura} (100%) diff --git a/.travis.yml b/.travis.yml index 6e09a29e7..497753789 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,4 +25,4 @@ script: - mvn after_success: - - mvn clean test jacoco:report coveralls:report -Ptravis-jacoco + - mvn clean cobertura:cobertura coveralls:report -Ptravis-cobertura diff --git a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java index c42cd3285..c4ccccab7 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java @@ -24,6 +24,7 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -186,7 +187,6 @@ public class FieldUtils { /** * Gets all fields of the given class and its parents (if any). - * Does not return any synthetic fields. * * @param cls * the {@link Class} to query @@ -202,7 +202,6 @@ public class FieldUtils { /** * Gets all fields of the given class and its parents (if any). - * Does not return any synthetic fields. * * @param cls * the {@link Class} to query @@ -216,11 +215,8 @@ public class FieldUtils { final List allFields = new ArrayList<>(); Class currentClass = cls; while (currentClass != null) { - for(final Field declaredField : currentClass.getDeclaredFields()) { - if(!declaredField.isSynthetic()) { - allFields.add(declaredField); - } - } + final Field[] declaredFields = currentClass.getDeclaredFields(); + Collections.addAll(allFields, declaredFields); currentClass = currentClass.getSuperclass(); } return allFields; @@ -228,8 +224,6 @@ public class FieldUtils { /** * Gets all fields of the given class and its parents (if any) that are annotated with the given annotation. - * Does not return any synthetic fields. - * * @param cls * the {@link Class} to query * @param annotationCls diff --git a/src/site/resources/profile.jacoco b/src/site/resources/profile.cobertura similarity index 100% rename from src/site/resources/profile.jacoco rename to src/site/resources/profile.cobertura