Skip to content

fix(123): @TestOnly should be allowed for ElementType.PACKAGE #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/commonMain/kotlin/org/jetbrains/annotations/TestOnly.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ package org.jetbrains.annotations
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.CONSTRUCTOR,
AnnotationTarget.FIELD,
AnnotationTarget.CLASS
AnnotationTarget.CLASS,
AnnotationTarget.FILE
)
@kotlin.jvm.ImplicitlyActualizedByJvmDeclaration
expect annotation class TestOnly()
expect annotation class TestOnly()
13 changes: 9 additions & 4 deletions src/jvmMain/java/org/jetbrains/annotations/TestOnly.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
*/
package org.jetbrains.annotations;

import java.lang.annotation.*;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* A member or type annotated with TestOnly claims that it should be used from testing code only.
Expand All @@ -29,6 +33,7 @@
* proper API which can be used in production as well as in tests.
*/
@Documented
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE})
public @interface TestOnly { }
@Retention( RetentionPolicy.CLASS )
@Target( { ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE, ElementType.PACKAGE } )
public @interface TestOnly {
}
5 changes: 3 additions & 2 deletions src/nonJvmMain/kotlin/org/jetbrains/annotations/TestOnly.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ package org.jetbrains.annotations
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.CONSTRUCTOR,
AnnotationTarget.FIELD,
AnnotationTarget.CLASS
AnnotationTarget.CLASS,
AnnotationTarget.FILE
)
actual annotation class TestOnly
actual annotation class TestOnly