Skip to content

Commit 42ee944

Browse files
mp911deodrotbohm
authored andcommitted
DATACMNS-1400 - Do not consider bridge modifier in Kotlin default-method discovery.
We now no longer consider bridge modifiers when looking up Kotlin default methods. We previously included checks whether a synthetic default method is also a bridge method to take all specifics of synthetic methods into account. With Kotlin 1.3, the compiler no longer sets the bridge flag. This behavior change would previously prevent usage of the copy method with classes compiled with Kotlin 1.3. Default method discovery is still guesswork and Kotlin compiler reverse engineering as there is no documentation on how to look up this kind of methods. Further references: * https://youtrack.jetbrains.net/issue/KT-24415 - Remove bridge flag from default methods. * https://youtrack.jetbrains.net/issue/KT-27317 - No documented rules for discoverability of generated methods.
1 parent 3d6e3db commit 42ee944

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

src/main/java/org/springframework/data/mapping/model/KotlinCopyMethod.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ private static Optional<Method> findPublicCopyMethod(Method defaultKotlinMethod)
160160

161161
return Arrays.stream(type.getDeclaredMethods()).filter(it -> it.getName().equals("copy") //
162162
&& !it.isSynthetic() //
163-
&& !it.isBridge() //
164163
&& !Modifier.isStatic(it.getModifiers()) //
165164
&& it.getReturnType().equals(type) //
166165
&& it.getParameterCount() == constructorArguments.size()) //
@@ -212,7 +211,6 @@ private static Optional<Method> findSyntheticCopyMethod(Class<?> type) {
212211
&& Modifier.isStatic(it.getModifiers()) //
213212
&& it.getReturnType().equals(type))
214213
.filter(Method::isSynthetic) //
215-
.filter(Method::isBridge) //
216214
.findFirst();
217215
}
218216

0 commit comments

Comments
 (0)