Kapt: Disable location mapping by default, allow to enable it manually
This commit is contained in:
+26
@@ -301,6 +301,32 @@ open class Kapt3IT : Kapt3BaseIT() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testLocationMapping() {
|
||||
val project = Project("locationMapping", GRADLE_VERSION, directoryPrefix = "kapt2")
|
||||
|
||||
project.build("build") {
|
||||
assertFailed()
|
||||
|
||||
assertContains("Test.java:9: error: GenError element")
|
||||
assertContains("Test.java:17: error: GenError element")
|
||||
}
|
||||
|
||||
project.projectDir.getFileByName("build.gradle").modify {
|
||||
it.replace("mapDiagnosticLocations = false", "mapDiagnosticLocations = true")
|
||||
}
|
||||
|
||||
project.build("build") {
|
||||
assertFailed()
|
||||
|
||||
assertNotContains("Test.java:9: error: GenError element")
|
||||
assertNotContains("Test.java:17: error: GenError element")
|
||||
|
||||
assertContains("test.kt:3: error: GenError element")
|
||||
assertContains("test.kt:7: error: GenError element")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testChangesInLocalAnnotationProcessor() {
|
||||
val project = Project("localAnnotationProcessor", GRADLE_VERSION, directoryPrefix = "kapt2")
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: "kotlin"
|
||||
apply plugin: "kotlin-kapt"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
compile "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version"
|
||||
kapt "org.jetbrains.kotlin:annotation-processor-example:$kotlin_version"
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
||||
|
||||
kapt {
|
||||
mapDiagnosticLocations = false
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package example
|
||||
|
||||
class Test {
|
||||
@field:example.GenError
|
||||
val a: String
|
||||
|
||||
fun b(@example.GenError a: Boolean) {}
|
||||
}
|
||||
Reference in New Issue
Block a user