Skip to content

Commit

Permalink
Kotlin#163 file annotations should be copied to `ClassBinarySignature…
Browse files Browse the repository at this point in the history
…`: add reproducer
  • Loading branch information
dovchinnikov committed Jan 8, 2024
1 parent 24cdd4e commit 3b0e6f3
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/test/kotlin/cases/marker/HiddenByJavaAnnotation.java
@@ -0,0 +1,8 @@
package cases.marker;

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

@Target(ElementType.TYPE)
public @interface HiddenByJavaAnnotation {
}
5 changes: 5 additions & 0 deletions src/test/kotlin/cases/marker/javaFileAnnotation.kt
@@ -0,0 +1,5 @@
@file:HiddenByJavaAnnotation

package cases.marker

class ClassInAFileAnnotatedByHiddenJava
5 changes: 5 additions & 0 deletions src/test/kotlin/cases/marker/ktFileAnnotation.kt
@@ -0,0 +1,5 @@
@file:HiddenByKtAnnotation

package cases.marker

class ClassInAFileAnnotatedByHiddenKt
3 changes: 3 additions & 0 deletions src/test/kotlin/cases/marker/marker.kt
Expand Up @@ -8,6 +8,9 @@ annotation class HiddenProperty

annotation class HiddenMethod

@Target(AnnotationTarget.FILE)
annotation class HiddenByKtAnnotation

public class Foo {
// HiddenField will be on the field
@HiddenField
Expand Down
6 changes: 6 additions & 0 deletions src/test/kotlin/cases/marker/marker.txt
Expand Up @@ -2,6 +2,12 @@ public final class cases/marker/Foo {
public fun <init> ()V
}

public abstract interface annotation class cases/marker/HiddenByJavaAnnotation : java/lang/annotation/Annotation {
}

public abstract interface annotation class cases/marker/HiddenByKtAnnotation : java/lang/annotation/Annotation {
}

public abstract interface annotation class cases/marker/HiddenField : java/lang/annotation/Annotation {
}

Expand Down
13 changes: 12 additions & 1 deletion src/test/kotlin/tests/CasesPublicAPITest.kt
Expand Up @@ -41,7 +41,18 @@ class CasesPublicAPITest {

@Test fun localClasses() { snapshotAPIAndCompare(testName.methodName) }

@Test fun marker() { snapshotAPIAndCompare(testName.methodName, setOf("cases/marker/HiddenField", "cases/marker/HiddenProperty", "cases/marker/HiddenMethod")) }
@Test
fun marker() {
snapshotAPIAndCompare(
testName.methodName, setOf(
"cases/marker/HiddenField",
"cases/marker/HiddenProperty",
"cases/marker/HiddenMethod",
"cases/marker/HiddenByJavaAnnotation",
"cases/marker/HiddenByKtAnnotation",
)
)
}

@Test fun nestedClasses() { snapshotAPIAndCompare(testName.methodName) }

Expand Down

0 comments on commit 3b0e6f3

Please sign in to comment.