Skip to content

Commit f9505c3

Browse files
christophstroblmp911de
authored andcommitted
Exclude synthetic constructors from AOT inspection.
Java8 bytecode may contain synthetic constructors that refer to anonymous classes which should not be inspected. Eg. the following construct results in bytecode as listed further down below. public enum Outer { INSTANCE { @OverRide public Inner getInnerType() { return Inner.STANDALONE; } }, public abstract Inner getInnerType(); } synthetic Outer(java.lang.String arg0, int arg1, Inner$1 arg2) See: #2744 Original pull request: #2746
1 parent 0e2fb7e commit f9505c3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/org/springframework/data/util/TypeCollector.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ Set<Type> visitConstructorsOfType(ResolvableType type) {
127127
}
128128
Set<Type> discoveredTypes = new LinkedHashSet<>();
129129
for (Constructor<?> constructor : type.toClass().getDeclaredConstructors()) {
130+
131+
if (constructor.isSynthetic()) {
132+
continue;
133+
}
130134
for (Class<?> signatureType : TypeUtils.resolveTypesInSignature(type.toClass(), constructor)) {
131135
if (typeFilter.test(signatureType)) {
132136
discoveredTypes.add(signatureType);

0 commit comments

Comments
 (0)