AnnotationTarget.PACKAGE was dropped
This commit is contained in:
@@ -187,7 +187,6 @@ public abstract class AnnotationCodegen {
|
|||||||
new EnumMap<KotlinTarget, ElementType>(KotlinTarget.class);
|
new EnumMap<KotlinTarget, ElementType>(KotlinTarget.class);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
annotationTargetMap.put(KotlinTarget.PACKAGE, ElementType.PACKAGE);
|
|
||||||
annotationTargetMap.put(KotlinTarget.CLASSIFIER, ElementType.TYPE);
|
annotationTargetMap.put(KotlinTarget.CLASSIFIER, ElementType.TYPE);
|
||||||
annotationTargetMap.put(KotlinTarget.ANNOTATION_CLASS, ElementType.ANNOTATION_TYPE);
|
annotationTargetMap.put(KotlinTarget.ANNOTATION_CLASS, ElementType.ANNOTATION_TYPE);
|
||||||
annotationTargetMap.put(KotlinTarget.CONSTRUCTOR, ElementType.CONSTRUCTOR);
|
annotationTargetMap.put(KotlinTarget.CONSTRUCTOR, ElementType.CONSTRUCTOR);
|
||||||
|
|||||||
@@ -165,7 +165,6 @@ public class AnnotationChecker(private val additionalCheckers: Iterable<Addition
|
|||||||
TargetLists.T_TOP_LEVEL_FUNCTION
|
TargetLists.T_TOP_LEVEL_FUNCTION
|
||||||
}
|
}
|
||||||
is JetPropertyAccessor -> if (annotated.isGetter) TargetLists.T_PROPERTY_GETTER else TargetLists.T_PROPERTY_SETTER
|
is JetPropertyAccessor -> if (annotated.isGetter) TargetLists.T_PROPERTY_GETTER else TargetLists.T_PROPERTY_SETTER
|
||||||
is JetPackageDirective -> TargetLists.T_PACKAGE
|
|
||||||
is JetTypeReference -> TargetLists.T_TYPE_REFERENCE
|
is JetTypeReference -> TargetLists.T_TYPE_REFERENCE
|
||||||
is JetFile -> TargetLists.T_FILE
|
is JetFile -> TargetLists.T_FILE
|
||||||
is JetTypeParameter -> TargetLists.T_TYPE_PARAMETER
|
is JetTypeParameter -> TargetLists.T_TYPE_PARAMETER
|
||||||
@@ -205,7 +204,6 @@ public class AnnotationChecker(private val additionalCheckers: Iterable<Addition
|
|||||||
}
|
}
|
||||||
|
|
||||||
val T_FILE = targetList(FILE)
|
val T_FILE = targetList(FILE)
|
||||||
val T_PACKAGE = targetList(PACKAGE)
|
|
||||||
|
|
||||||
val T_CONSTRUCTOR = targetList(CONSTRUCTOR)
|
val T_CONSTRUCTOR = targetList(CONSTRUCTOR)
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ public object ModifierCheckerCore {
|
|||||||
val actualParents: List<KotlinTarget> = when (parentDescriptor) {
|
val actualParents: List<KotlinTarget> = when (parentDescriptor) {
|
||||||
is ClassDescriptor -> KotlinTarget.classActualTargets(parentDescriptor)
|
is ClassDescriptor -> KotlinTarget.classActualTargets(parentDescriptor)
|
||||||
is FunctionDescriptor -> listOf(FUNCTION)
|
is FunctionDescriptor -> listOf(FUNCTION)
|
||||||
else -> listOf(PACKAGE)
|
else -> listOf(FILE)
|
||||||
}
|
}
|
||||||
val possibleParents = possibleParentTargetMap[modifier] ?: return true
|
val possibleParents = possibleParentTargetMap[modifier] ?: return true
|
||||||
if (possibleParents == KotlinTarget.ALL_TARGET_SET) return true
|
if (possibleParents == KotlinTarget.ALL_TARGET_SET) return true
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
@pck package test;
|
|
||||||
|
|
||||||
@pck class My {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
package-info.java:3:1:compiler.err.annotation.type.not.applicable
|
|
||||||
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
package test
|
|
||||||
|
|
||||||
target(AnnotationTarget.PACKAGE)
|
|
||||||
annotation class pck
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package test
|
|
||||||
|
|
||||||
test.pck() public/*package*/ interface `package-info` {
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlin.annotation.target(allowedTargets = {AnnotationTarget.PACKAGE}) kotlin.annotation.annotation() internal final class pck : kotlin.Annotation {
|
|
||||||
public constructor pck()
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<!UNRESOLVED_REFERENCE!>myAnnotation<!> <!WRONG_MODIFIER_TARGET!>public<!> package illegal_modifiers
|
<!UNRESOLVED_REFERENCE, WRONG_ANNOTATION_TARGET!>myAnnotation<!> <!WRONG_MODIFIER_TARGET!>public<!> package illegal_modifiers
|
||||||
|
|
||||||
abstract class A() {
|
abstract class A() {
|
||||||
<!INCOMPATIBLE_MODIFIERS!>abstract<!> <!INCOMPATIBLE_MODIFIERS!>final<!> fun f()
|
<!INCOMPATIBLE_MODIFIERS!>abstract<!> <!INCOMPATIBLE_MODIFIERS!>final<!> fun f()
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public open class AnnotationTargets {
|
|||||||
public constructor multiple()
|
public constructor multiple()
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin.annotation.target(allowedTargets = {AnnotationTarget.PACKAGE}) public final class packag : kotlin.Annotation {
|
kotlin.annotation.target(allowedTargets = {}) public final class packag : kotlin.Annotation {
|
||||||
public constructor packag()
|
public constructor packag()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-6
@@ -622,12 +622,6 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("package-info.kt")
|
|
||||||
public void testPackage_info() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/package-info.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("parameter.kt")
|
@TestMetadata("parameter.kt")
|
||||||
public void testParameter() throws Exception {
|
public void testParameter() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/parameter.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/parameter.kt");
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ package kotlin.annotation
|
|||||||
* Contains the list of code elements which are the possible annotation targets
|
* Contains the list of code elements which are the possible annotation targets
|
||||||
*/
|
*/
|
||||||
public enum class AnnotationTarget {
|
public enum class AnnotationTarget {
|
||||||
/** Package directive */
|
|
||||||
PACKAGE,
|
|
||||||
/** Class, interface or object, annotation class is also included */
|
/** Class, interface or object, annotation class is also included */
|
||||||
CLASSIFIER,
|
CLASSIFIER,
|
||||||
/** Annotation class only */
|
/** Annotation class only */
|
||||||
|
|||||||
+1
-1
@@ -175,7 +175,7 @@ class JavaTargetAnnotationDescriptor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
public object JavaAnnotationTargetMapper {
|
public object JavaAnnotationTargetMapper {
|
||||||
private val targetNameLists = mapOf("PACKAGE" to EnumSet.of(KotlinTarget.PACKAGE),
|
private val targetNameLists = mapOf("PACKAGE" to EnumSet.noneOf(KotlinTarget::class.java),
|
||||||
"TYPE" to EnumSet.of(KotlinTarget.CLASSIFIER),
|
"TYPE" to EnumSet.of(KotlinTarget.CLASSIFIER),
|
||||||
"ANNOTATION_TYPE" to EnumSet.of(KotlinTarget.ANNOTATION_CLASS),
|
"ANNOTATION_TYPE" to EnumSet.of(KotlinTarget.ANNOTATION_CLASS),
|
||||||
"TYPE_PARAMETER" to EnumSet.of(KotlinTarget.TYPE_PARAMETER),
|
"TYPE_PARAMETER" to EnumSet.of(KotlinTarget.TYPE_PARAMETER),
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import java.util.*
|
|||||||
// NOTE: this enum must have the same entries with kotlin.annotation.AnnotationTarget,
|
// NOTE: this enum must have the same entries with kotlin.annotation.AnnotationTarget,
|
||||||
// and may also have some additional entries
|
// and may also have some additional entries
|
||||||
public enum class KotlinTarget(val description: String, val isDefault: Boolean = true) {
|
public enum class KotlinTarget(val description: String, val isDefault: Boolean = true) {
|
||||||
PACKAGE("package"),
|
|
||||||
CLASSIFIER("classifier"), // includes CLASS, OBJECT, INTERFACE, *_CLASS but not ENUM_ENTRY
|
CLASSIFIER("classifier"), // includes CLASS, OBJECT, INTERFACE, *_CLASS but not ENUM_ENTRY
|
||||||
ANNOTATION_CLASS("annotation class"),
|
ANNOTATION_CLASS("annotation class"),
|
||||||
TYPE_PARAMETER("type parameter", false),
|
TYPE_PARAMETER("type parameter", false),
|
||||||
|
|||||||
Reference in New Issue
Block a user