From 5a74f9d2cc82ea9137a3d8f5e13a55c038c61754 Mon Sep 17 00:00:00 2001 From: QuantumMaid Developer Date: Thu, 9 Apr 2020 06:47:05 +0200 Subject: [PATCH] bug #5 --- .idea/.gitignore | 2 ++ .idea/.name | 1 + .idea/encodings.xml | 1 + CHANGELOG.md | 9 +++++---- README.md | 6 +++++- pom.xml | 2 +- .../reflectmaid/resolver/ResolvedConstructor.java | 1 + .../quantummaid/reflectmaid/resolver/ResolvedField.java | 1 + .../quantummaid/reflectmaid/resolver/ResolvedMethod.java | 1 + .../reflectmaid/resolver/ResolvedParameter.java | 4 ++-- 10 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/.name diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..15741f4 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +reflectmaid-parent \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml index b26911b..fade66b 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 05fc449..f53c26a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] - +## [0.1.4](https://search.maven.org/artifact/de.quantummaid.reflectmaid/reflectmaid-parent/0.1.4/jar) - 2020-04-09 ### Added -- Apache2 badge (Issue [#1](https://github.com/quantummaid/reflectmaid/issues/1). -- Other badges. \ No newline at end of file +- Apache2 badge ([#1](https://github.com/quantummaid/reflectmaid/issues/1)). +- Other badges. +### Changed +- Fixed bug [#5](https://github.com/quantummaid/reflectmaid/issues/5). \ No newline at end of file diff --git a/README.md b/README.md index 486bf59..3f40685 100644 --- a/README.md +++ b/README.md @@ -21,4 +21,8 @@ support generic types (see [Type Erasure](https://docs.oracle.com/javase/tutoria To work around the aforementioned limitation, QuantumMaid offers the `GenericClass` type. Whenever a configuration method takes a parameter of type `java.lang.Class`, there will be an overloaded variant -of that configuration method that accepts a `GenericType` parameter instead of the `java.lang.Class` parameter. \ No newline at end of file +of that configuration method that accepts a `GenericType` parameter instead of the `java.lang.Class` parameter. + +## Synthetic methods, constructors and fields +[Synthetic methods, constructors and fields](https://www.baeldung.com/java-synthetic) are ignored by ReflectMaid. +This is recommended [to support tools like JaCoCo](https://www.jacoco.org/jacoco/trunk/doc/faq.html). \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4e7c20c..d92b9de 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ de.quantummaid.reflectmaid reflectmaid-parent - 0.1.3 + 0.1.4 35fe547b725ca8e71b0d13c8c21894df diff --git a/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedConstructor.java b/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedConstructor.java index d88168e..efb0cdf 100644 --- a/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedConstructor.java +++ b/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedConstructor.java @@ -45,6 +45,7 @@ public final class ResolvedConstructor { public static List resolveConstructors(final ClassType fullType) { return stream(fullType.assignableType().getDeclaredConstructors()) + .filter(constructor -> !constructor.isSynthetic()) .map(constructor -> resolveConstructor(constructor, fullType)) .collect(toList()); } diff --git a/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedField.java b/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedField.java index 77d33d7..e0faa7a 100644 --- a/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedField.java +++ b/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedField.java @@ -50,6 +50,7 @@ public final class ResolvedField { public static List resolvedFields(final ClassType fullType) { final Class type = fullType.assignableType(); return stream(type.getDeclaredFields()) + .filter(field -> !field.isSynthetic()) .map(field -> { final ResolvedType resolved = resolveType(field.getGenericType(), fullType); return resolvedField(field.getName(), resolved, field); diff --git a/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedMethod.java b/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedMethod.java index e10d20b..9b2c106 100644 --- a/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedMethod.java +++ b/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedMethod.java @@ -57,6 +57,7 @@ public static List resolveMethodsWithResolvableTypeVariables(fin final Class type = fullType.assignableType(); final Method[] declaredMethods = type.getDeclaredMethods(); return stream(declaredMethods) + .filter(method -> !method.isSynthetic()) .map(method -> { try { return of(resolveMethod(method, fullType)); diff --git a/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedParameter.java b/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedParameter.java index 3471d8d..c6366fb 100644 --- a/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedParameter.java +++ b/src/main/java/de/quantummaid/reflectmaid/resolver/ResolvedParameter.java @@ -52,8 +52,8 @@ public static List resolveParameters(final Executable executa .collect(toList()); } - public static ResolvedParameter resolveParameter(final ClassType declaringType, - final Parameter parameter) { + private static ResolvedParameter resolveParameter(final ClassType declaringType, + final Parameter parameter) { NotNullValidator.validateNotNull(declaringType, "declaringType"); NotNullValidator.validateNotNull(parameter, "parameter");