Restore heuristic to compute inner class names in ClassifierResolutionContext
This commit restores the heuristic removed in 9df02b2366, but only
enables it in case the class wasn't found with the name mapped initially
according to the InnerClasses attribute values. This helps to support
class files which do not have the InnerClasses attribute for all nested
referenced classes, such as those generated by Groovy.
Note that in theory it's still possible for this code to behave
incorrectly, for example a reference to a class `C` nested in a
_top-level_ class named `A$B` will not be loaded by this code correctly.
This is a lower-priority issue and it will need to be fixed later.
#KT-27874 Fixed
This commit is contained in:
+2
-2
@@ -109,8 +109,8 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGroovyTraitsWithFields() {
|
||||
Project("groovyTraitsWithFields").build("build") {
|
||||
fun testGroovyInterop() {
|
||||
Project("groovyInterop").build("build") {
|
||||
assertSuccessful()
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
public class ClassWithReferenceToInner {
|
||||
public void f1(Thread.State state) {}
|
||||
|
||||
public void f2(Outer.Nested nested) {}
|
||||
}
|
||||
|
||||
class Outer {
|
||||
class Nested {}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun main(args: Array<String>) {
|
||||
System.out.println(MyTraitAccessor().myField)
|
||||
|
||||
System.out.println(ClassWithReferenceToInner().f1(null))
|
||||
System.out.println(ClassWithReferenceToInner().f2(null))
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
fun main(args: Array<String>) {
|
||||
System.out.println(MyTraitAccessor().myField)
|
||||
}
|
||||
Reference in New Issue
Block a user