[KAPT] Suppress resolve error in annotation procssing
#KT-33223
This commit is contained in:
@@ -210,6 +210,7 @@ class KaptJavaLog(
|
|||||||
"compiler.err.already.defined",
|
"compiler.err.already.defined",
|
||||||
"compiler.err.annotation.type.not.applicable",
|
"compiler.err.annotation.type.not.applicable",
|
||||||
"compiler.err.doesnt.exist",
|
"compiler.err.doesnt.exist",
|
||||||
|
"compiler.err.cant.resolve.location",
|
||||||
"compiler.err.duplicate.annotation.missing.container",
|
"compiler.err.duplicate.annotation.missing.container",
|
||||||
"compiler.err.not.def.access.package.cant.access",
|
"compiler.err.not.def.access.package.cant.access",
|
||||||
"compiler.err.package.not.visible",
|
"compiler.err.package.not.visible",
|
||||||
|
|||||||
+5
@@ -49,6 +49,11 @@ public class KaptToolIntegrationTestGenerated extends AbstractKaptToolIntegratio
|
|||||||
runTest("plugins/kapt3/kapt3-cli/testData/integration/kotlinFileGeneration/");
|
runTest("plugins/kapt3/kapt3-cli/testData/integration/kotlinFileGeneration/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kotlinFileGenerationCorrectErrorTypes")
|
||||||
|
public void testKotlinFileGenerationCorrectErrorTypes() throws Exception {
|
||||||
|
runTest("plugins/kapt3/kapt3-cli/testData/integration/kotlinFileGenerationCorrectErrorTypes/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kotlinFileGenerationDefaultOutput")
|
@TestMetadata("kotlinFileGenerationDefaultOutput")
|
||||||
public void testKotlinFileGenerationDefaultOutput() throws Exception {
|
public void testKotlinFileGenerationDefaultOutput() throws Exception {
|
||||||
runTest("plugins/kapt3/kapt3-cli/testData/integration/kotlinFileGenerationDefaultOutput/");
|
runTest("plugins/kapt3/kapt3-cli/testData/integration/kotlinFileGenerationDefaultOutput/");
|
||||||
|
|||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
import apt.Anno
|
||||||
|
import generated.Test as TestGenerated
|
||||||
|
import generated.Property
|
||||||
|
|
||||||
|
@Anno
|
||||||
|
class Test {
|
||||||
|
|
||||||
|
@field:Anno
|
||||||
|
val property: String = ""
|
||||||
|
|
||||||
|
@Anno
|
||||||
|
fun function() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Usage {
|
||||||
|
fun test(): TestGenerated
|
||||||
|
fun test1(): generated.Function
|
||||||
|
fun test2(): Property
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
println("Generated class: " + TestGenerated::class.java.name)
|
||||||
|
}
|
||||||
Vendored
+37
@@ -0,0 +1,37 @@
|
|||||||
|
# copy
|
||||||
|
../kotlinFileGeneration/ap
|
||||||
|
ap
|
||||||
|
|
||||||
|
# mkdir
|
||||||
|
output/ap
|
||||||
|
output/stubs
|
||||||
|
output/classes
|
||||||
|
output/sources
|
||||||
|
output/kotlin-sources
|
||||||
|
|
||||||
|
# kotlinc
|
||||||
|
-cp %KOTLIN_STDLIB%
|
||||||
|
-d output/ap
|
||||||
|
ap/Processor.kt
|
||||||
|
|
||||||
|
# copy
|
||||||
|
../kotlinFileGeneration/ap/META-INF/services/javax.annotation.processing.Processor
|
||||||
|
output/ap/META-INF/services/javax.annotation.processing.Processor
|
||||||
|
|
||||||
|
# kapt
|
||||||
|
-Kapt-stubs=output/stubs
|
||||||
|
-Kapt-classes=output/classes
|
||||||
|
-Kapt-sources=output/sources
|
||||||
|
-Kapt-classpath=output/ap
|
||||||
|
-Kapt-option:kapt.kotlin.generated=output/kotlin-sources
|
||||||
|
-Kapt-correct-error-types=true
|
||||||
|
-d output/classes
|
||||||
|
-cp output/ap:%KOTLIN_STDLIB%
|
||||||
|
Test.kt
|
||||||
|
|
||||||
|
# java
|
||||||
|
-cp output/classes:output/ap:%KOTLIN_STDLIB%
|
||||||
|
test.TestKt
|
||||||
|
|
||||||
|
# after
|
||||||
|
Generated class: generated.Test
|
||||||
@@ -28,13 +28,5 @@ class ErrorInDeclarations {
|
|||||||
annotation class Anno(val a: KClass<Any>)
|
annotation class Anno(val a: KClass<Any>)
|
||||||
|
|
||||||
// EXPECTED_ERROR(kotlin:11:1) cannot find symbol
|
// EXPECTED_ERROR(kotlin:11:1) cannot find symbol
|
||||||
// EXPECTED_ERROR(kotlin:12:1) cannot find symbol
|
|
||||||
// EXPECTED_ERROR(kotlin:16:5) cannot find symbol
|
|
||||||
// EXPECTED_ERROR(kotlin:17:5) cannot find symbol
|
|
||||||
// EXPECTED_ERROR(kotlin:20:5) cannot find symbol
|
|
||||||
// EXPECTED_ERROR(kotlin:22:5) cannot find symbol
|
|
||||||
// EXPECTED_ERROR(kotlin:25:5) cannot find symbol
|
|
||||||
// EXPECTED_ERROR(kotlin:6:1) cannot find symbol
|
// EXPECTED_ERROR(kotlin:6:1) cannot find symbol
|
||||||
// EXPECTED_ERROR(kotlin:9:34) cannot find symbol
|
// EXPECTED_ERROR(kotlin:12:1) cannot find symbol
|
||||||
// EXPECTED_ERROR(kotlin:9:50) cannot find symbol
|
|
||||||
// EXPECTED_ERROR(kotlin:9:62) cannot find symbol
|
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ enum class Color {
|
|||||||
@Anno(Color.`WHI-TE`)
|
@Anno(Color.`WHI-TE`)
|
||||||
annotation class Anno(val color: Color)
|
annotation class Anno(val color: Color)
|
||||||
|
|
||||||
// EXPECTED_ERROR(kotlin:5:1) cannot find symbol
|
// EXPECTED_ERROR(kotlin:5:1) an enum annotation value must be an enum constant
|
||||||
// EXPECTED_ERROR(other:-1:-1) 'WHI-TE' is an invalid Java enum value name
|
// EXPECTED_ERROR(other:-1:-1) 'WHI-TE' is an invalid Java enum value name
|
||||||
|
|||||||
@@ -10,5 +10,4 @@ class Foo(private val string: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// EXPECTED_ERROR(kotlin:9:9) cannot find symbol
|
// EXPECTED_ERROR(other:-1:-1) Can't generate a stub for 'Foo$Bar$Bar'.
|
||||||
// EXPECTED_ERROR(other:-1:-1) Can't generate a stub for 'Foo$Bar$Bar'.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user