Support line location information in KAPT for top level declarations

This CL fixes a bug in KAPT's MAP_DIAGNOSTIC_LOCATIONS flag where the
location mapping for top level elements didn't work.

I also needed to changes the Kapt3IntegrationTest to copy input files,
otherwise, it cannot map file paths since the mock project has no root
location.

Cleanup tmp folders in KAPT tests, update Kapt3IT test for new lines.

^KT-47934 Fixed
Test: KotlinKapt3IntegrationTests#testErrorLocationMapping
This commit is contained in:
Yigit Boyar
2021-07-30 17:05:28 -07:00
committed by Yahor Berdnikau
parent ec3a6e7f02
commit 95f990adab
11 changed files with 209 additions and 6 deletions
@@ -0,0 +1,45 @@
import java.lang.System;
@kotlin.Metadata()
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
public abstract @interface MyAnnotation {
}
////////////////////
import java.lang.System;
@kotlin.Metadata()
public final class Subject {
@org.jetbrains.annotations.NotNull()
private final java.lang.String field = "";
@org.jetbrains.annotations.NotNull()
private final java.lang.String annotationTrigger = "";
public Subject() {
super();
}
@org.jetbrains.annotations.NotNull()
public final java.lang.String getField() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final java.lang.String getAnnotationTrigger() {
return null;
}
@MyAnnotation()
@java.lang.Deprecated()
public static void getAnnotationTrigger$annotations() {
}
}
////////////////////
package error;
public final class NonExistentClass {
}
@@ -0,0 +1,11 @@
class Subject {
val field:String = ""
@MyAnnotation
val annotationTrigger: String = ""
}
internal annotation class MyAnnotation