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.
This commit is contained in:
committed by
Oliver Gierke
parent
3d6e3dbcc0
commit
42ee9448d9
@@ -160,7 +160,6 @@ class KotlinCopyMethod {
|
||||
|
||||
return Arrays.stream(type.getDeclaredMethods()).filter(it -> it.getName().equals("copy") //
|
||||
&& !it.isSynthetic() //
|
||||
&& !it.isBridge() //
|
||||
&& !Modifier.isStatic(it.getModifiers()) //
|
||||
&& it.getReturnType().equals(type) //
|
||||
&& it.getParameterCount() == constructorArguments.size()) //
|
||||
@@ -212,7 +211,6 @@ class KotlinCopyMethod {
|
||||
&& Modifier.isStatic(it.getModifiers()) //
|
||||
&& it.getReturnType().equals(type))
|
||||
.filter(Method::isSynthetic) //
|
||||
.filter(Method::isBridge) //
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user