Warn about annotations that targets non-existing accessors
#KT-15453 In Progress
This commit is contained in:
+90
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.resolve.jvm.checkers
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.MemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.KotlinRetention
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.diagnostics.reportDiagnosticOnce
|
||||
import org.jetbrains.kotlin.psi.KtAnnotationEntry
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtParameter
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.annotations.hasJvmStaticAnnotation
|
||||
import org.jetbrains.kotlin.resolve.checkers.DeclarationChecker
|
||||
import org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.getAnnotationRetention
|
||||
import org.jetbrains.kotlin.resolve.jvm.annotations.hasJvmFieldAnnotation
|
||||
|
||||
class JvmAnnotationsTargetNonExistentAccessorChecker : DeclarationChecker {
|
||||
companion object {
|
||||
private val getterUselessTargets = setOf(PROPERTY_GETTER)
|
||||
private val setterUselessTargets = setOf(PROPERTY_SETTER, SETTER_PARAMETER)
|
||||
}
|
||||
|
||||
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
|
||||
if (descriptor !is MemberDescriptor) return
|
||||
if (declaration !is KtParameter && declaration !is KtProperty) return
|
||||
|
||||
if (!Visibilities.isPrivate(descriptor.visibility) && !isSpecialStaticProperty(descriptor)) return
|
||||
|
||||
val hasGetterWithBody = declaration is KtProperty && declaration.getter?.hasBody() == true
|
||||
val hasSetterWithBody = declaration is KtProperty && declaration.setter?.hasBody() == true
|
||||
|
||||
if (hasGetterWithBody && hasSetterWithBody) return
|
||||
if (declaration is KtProperty && declaration.hasDelegate()) return
|
||||
|
||||
val declarationName = declaration.name ?: descriptor.name.asString()
|
||||
|
||||
for (annotation in declaration.annotationEntries) {
|
||||
val psiTarget = annotation.useSiteTarget ?: continue
|
||||
val useSiteTarget = psiTarget.getAnnotationUseSiteTarget()
|
||||
if (!hasGetterWithBody && useSiteTarget in getterUselessTargets ||
|
||||
!hasSetterWithBody && useSiteTarget in setterUselessTargets
|
||||
) {
|
||||
reportOnAnnotationWithNonSourceRetention(annotation, declarationName, context)
|
||||
}
|
||||
}
|
||||
|
||||
if (declaration is KtProperty) {
|
||||
if (!hasGetterWithBody) {
|
||||
declaration.getter?.annotationEntries?.forEach {
|
||||
reportOnAnnotationWithNonSourceRetention(it, declarationName, context)
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasSetterWithBody) {
|
||||
declaration.setter?.annotationEntries?.forEach {
|
||||
reportOnAnnotationWithNonSourceRetention(it, declarationName, context)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun reportOnAnnotationWithNonSourceRetention(
|
||||
entry: KtAnnotationEntry,
|
||||
declarationName: String,
|
||||
context: DeclarationCheckerContext
|
||||
) {
|
||||
val annotationDescriptor = context.trace[BindingContext.ANNOTATION, entry] ?: return
|
||||
if (annotationDescriptor.annotationClass?.getAnnotationRetention() == KotlinRetention.SOURCE) return
|
||||
|
||||
context.trace.reportDiagnosticOnce(Errors.ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR.on(entry, declarationName))
|
||||
}
|
||||
|
||||
private fun isSpecialStaticProperty(descriptor: MemberDescriptor): Boolean {
|
||||
return descriptor.hasJvmStaticAnnotation() ||
|
||||
descriptor.hasJvmFieldAnnotation() ||
|
||||
(descriptor is VariableDescriptor && descriptor.isConst)
|
||||
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -45,7 +45,8 @@ object JvmPlatformConfigurator : PlatformConfigurator(
|
||||
TypeParameterBoundIsNotArrayChecker(),
|
||||
JvmSyntheticApplicabilityChecker(),
|
||||
StrictfpApplicabilityChecker(),
|
||||
ExpectedActualDeclarationChecker
|
||||
ExpectedActualDeclarationChecker,
|
||||
JvmAnnotationsTargetNonExistentAccessorChecker()
|
||||
),
|
||||
|
||||
additionalCallCheckers = listOf(
|
||||
|
||||
@@ -250,6 +250,8 @@ public interface Errors {
|
||||
DiagnosticFactory1<KtAnnotationEntry, FqName> USE_EXPERIMENTAL_ARGUMENT_IS_NOT_MARKER = DiagnosticFactory1.create(WARNING);
|
||||
DiagnosticFactory1<KtAnnotationEntry, String> EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
DiagnosticFactory1<KtAnnotationEntry, String> ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR = DiagnosticFactory1.create(WARNING);
|
||||
|
||||
// Const
|
||||
DiagnosticFactory0<PsiElement> CONST_VAL_NOT_TOP_LEVEL_OR_OBJECT = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> CONST_VAL_WITH_GETTER = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
+2
@@ -154,6 +154,8 @@ public class DefaultErrorMessages {
|
||||
MAP.put(USE_EXPERIMENTAL_ARGUMENT_IS_NOT_MARKER, "Annotation ''{0}'' is not an experimental API marker, therefore its usage in @UseExperimental is ignored", TO_STRING);
|
||||
MAP.put(EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET, "Experimental annotation cannot be used on the following code elements: {0}. Please remove these targets", STRING);
|
||||
|
||||
MAP.put(ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR, "An accessor will not be generated for ''{0}'' so the annotation effectively has a ''SOURCE'' retention", STRING);
|
||||
|
||||
MAP.put(REDUNDANT_MODIFIER, "Modifier ''{0}'' is redundant because ''{1}'' is present", TO_STRING, TO_STRING);
|
||||
MAP.put(REDUNDANT_OPEN_IN_INTERFACE, "Modifier 'open' is redundant for abstract interface members");
|
||||
MAP.put(REDUNDANT_MODIFIER_IN_GETTER, "Visibility modifiers are redundant in getter");
|
||||
|
||||
+191
@@ -0,0 +1,191 @@
|
||||
// WITH_REFLECT
|
||||
// IGNORE_BACKEND: JVM_IR, JS_IR, JS
|
||||
|
||||
// Please make sure that this test is consistent with the diagnostic test "annotationsTargetingNonExistentAccessor.kt"
|
||||
|
||||
// FILE: Temporary.java
|
||||
|
||||
// see https://youtrack.jetbrains.com/issue/KT-25499
|
||||
|
||||
class Temporary {
|
||||
public static void checkX2FromStaticsHasAnnotations() {
|
||||
try {
|
||||
if (Statics.Companion.getClass().getDeclaredMethod("getX2").getAnnotations().length == 0) {
|
||||
throw new RuntimeException("there are no annotations");
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
import kotlin.reflect.KAnnotatedElement
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
annotation class Ann
|
||||
annotation class AnnRepeat
|
||||
|
||||
fun check(element: KAnnotatedElement, annotationExists: Boolean) {
|
||||
require(element.annotations.isNotEmpty() == annotationExists) { "Fail: $element" }
|
||||
}
|
||||
|
||||
class PrivateProperties(
|
||||
@get:Ann private val y0: Int,
|
||||
@get:Ann private vararg val y1: String
|
||||
) {
|
||||
@get:Ann
|
||||
private val x1 = ""
|
||||
|
||||
@set:Ann
|
||||
private var x2 = ""
|
||||
|
||||
@setparam:Ann
|
||||
private var x3 = ""
|
||||
|
||||
@setparam:[Ann AnnRepeat]
|
||||
private var x4 = ""
|
||||
|
||||
@get:Ann
|
||||
internal val x5 = ""
|
||||
|
||||
@get:Ann
|
||||
protected val x6 = ""
|
||||
|
||||
@get:Ann
|
||||
private val x7: String = ""
|
||||
@AnnRepeat get
|
||||
|
||||
@get:Ann
|
||||
@set:Ann
|
||||
private var x8: String = ""
|
||||
get() { return "" }
|
||||
|
||||
@get:Ann
|
||||
@set:Ann
|
||||
private var x9: String = ""
|
||||
get() { return "" }
|
||||
set(f) { field = f }
|
||||
|
||||
fun test() {
|
||||
check(::y0.getter, annotationExists = false)
|
||||
check(::y1.getter, annotationExists = false)
|
||||
check(::x1.getter, annotationExists = false)
|
||||
check(::x2.setter, annotationExists = false)
|
||||
check(::x3.setter.parameters.first(), annotationExists = false)
|
||||
check(::x4.setter.parameters.first(), annotationExists = false)
|
||||
|
||||
check(::x5.getter, annotationExists = true)
|
||||
check(::x6.getter, annotationExists = true)
|
||||
|
||||
check(::x7.getter, annotationExists = false)
|
||||
|
||||
check(::x8.getter, annotationExists = true)
|
||||
check(::x8.setter, annotationExists = false)
|
||||
|
||||
check(::x9.getter, annotationExists = true)
|
||||
check(::x9.setter, annotationExists = true)
|
||||
}
|
||||
}
|
||||
|
||||
private class EffetivelyPrivate private constructor(
|
||||
@get:Ann val x0: Int,
|
||||
@get:Ann protected val x1: Int,
|
||||
@get:Ann internal val x2: Int
|
||||
) {
|
||||
companion object {
|
||||
fun test() {
|
||||
EffetivelyPrivate(0, 0, 0).test()
|
||||
}
|
||||
}
|
||||
|
||||
private class Nested {
|
||||
@get:Ann
|
||||
val fofo = 0
|
||||
}
|
||||
|
||||
fun test() {
|
||||
check(::x0.getter, annotationExists = true)
|
||||
check(::x1.getter, annotationExists = true)
|
||||
check(::x2.getter, annotationExists = true)
|
||||
|
||||
check(Nested::fofo.getter, annotationExists = true)
|
||||
}
|
||||
}
|
||||
|
||||
class Statics {
|
||||
@get:Ann
|
||||
lateinit var y0: String
|
||||
|
||||
@get:Ann
|
||||
private lateinit var y1: String
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
@get:Ann
|
||||
val x0 = ""
|
||||
|
||||
@get:Ann
|
||||
const val x1 = ""
|
||||
|
||||
@JvmStatic
|
||||
@AnnRepeat
|
||||
@get:Ann
|
||||
@set:Ann
|
||||
@setparam:Ann
|
||||
var x2 = ""
|
||||
|
||||
@JvmStatic
|
||||
@get:Ann
|
||||
private val x3 = ""
|
||||
|
||||
@get:Ann
|
||||
val x4 = ""
|
||||
}
|
||||
|
||||
fun test() {
|
||||
check(::y0.getter, annotationExists = true)
|
||||
check(::y1.getter, annotationExists = false)
|
||||
|
||||
check(::x0.getter, annotationExists = false)
|
||||
check(::x1.getter, annotationExists = false)
|
||||
|
||||
check(::x2.getter, annotationExists = false) // https://youtrack.jetbrains.com/issue/KT-25499
|
||||
check(::x2.setter, annotationExists = false)
|
||||
check(::x2.setter.parameters.first(), annotationExists = false)
|
||||
|
||||
check(::x3.getter, annotationExists = false)
|
||||
|
||||
check(::x4.getter, annotationExists = true)
|
||||
}
|
||||
}
|
||||
|
||||
class Delegate {
|
||||
@get:Ann
|
||||
@set:Ann
|
||||
@setparam:Ann
|
||||
private var delegate by CustomDelegate()
|
||||
|
||||
fun test() {
|
||||
check(::delegate.getter, annotationExists = true)
|
||||
check(::delegate.setter, annotationExists = true)
|
||||
check(::delegate.setter.parameters.first(), annotationExists = false) // https://youtrack.jetbrains.com/issue/KT-25500
|
||||
}
|
||||
|
||||
class CustomDelegate {
|
||||
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
|
||||
operator fun setValue(delegate: Delegate, property: KProperty<*>, s: String) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
PrivateProperties(0, "").test()
|
||||
EffetivelyPrivate.test()
|
||||
Statics().test()
|
||||
Temporary.checkX2FromStaticsHasAnnotations()
|
||||
Delegate().test()
|
||||
return "OK"
|
||||
}
|
||||
compiler/testData/diagnostics/testsWithStdLib/annotations/annotationsTargetingNonExistentAccessor.kt
Vendored
+116
@@ -0,0 +1,116 @@
|
||||
// Please make sure that this test is consistent with the blackbox test "annotationsOnNonExistentAccessors.kt"
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
annotation class Ann
|
||||
annotation class AnnRepeat
|
||||
|
||||
class Foo(
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@get:Ann<!> private val y0: Int,
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@get:Ann<!> private vararg val y1: String
|
||||
) {
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@get:Ann<!>
|
||||
private val x1 = ""
|
||||
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@set:Ann<!>
|
||||
private var x2 = ""
|
||||
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@setparam:Ann<!>
|
||||
private var x3 = ""
|
||||
|
||||
@setparam:[<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>Ann<!> <!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>AnnRepeat<!>]
|
||||
private var x4 = ""
|
||||
|
||||
@get:Ann
|
||||
internal val x5 = ""
|
||||
|
||||
@get:Ann
|
||||
protected val x6 = ""
|
||||
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@get:Ann<!>
|
||||
private val x7: String = ""
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@AnnRepeat<!> get
|
||||
|
||||
@get:Ann
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@set:Ann<!>
|
||||
private var x8: String = ""
|
||||
get() { return "" }
|
||||
|
||||
@get:Ann
|
||||
@set:Ann
|
||||
private var x9: String = ""
|
||||
get() { return "" }
|
||||
set(f) { field = f }
|
||||
}
|
||||
|
||||
private class EffetivelyPrivate private constructor(
|
||||
@get:Ann val x0: Int,
|
||||
@get:Ann protected val x1: Int,
|
||||
@get:Ann internal val x2: Int
|
||||
) {
|
||||
private class Nested {
|
||||
@get:Ann
|
||||
val fofo = 0
|
||||
}
|
||||
}
|
||||
|
||||
class PrivateToThis<in I> {
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@get:Ann<!>
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@set:Ann<!>
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@setparam:Ann<!>
|
||||
private var x0: I = TODO()
|
||||
}
|
||||
|
||||
class Statics {
|
||||
@get:Ann
|
||||
lateinit var y0: String
|
||||
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@get:Ann<!>
|
||||
private lateinit var y1: String
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@get:Ann<!>
|
||||
val x0 = ""
|
||||
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@get:Ann<!>
|
||||
const val x1 = ""
|
||||
|
||||
@JvmStatic
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@get:Ann<!>
|
||||
val x2 = ""
|
||||
|
||||
@JvmStatic
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@get:Ann<!>
|
||||
private val x3 = ""
|
||||
}
|
||||
}
|
||||
|
||||
private class Other(@param:Ann private val param: Int) {
|
||||
@property:Ann
|
||||
@field:Ann
|
||||
private val other = ""
|
||||
|
||||
private fun @receiver:Ann Int.receiver() {}
|
||||
|
||||
@delegate:Ann
|
||||
@get:Ann
|
||||
private val delegate by CustomDelegate()
|
||||
}
|
||||
|
||||
class CustomDelegate {
|
||||
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
|
||||
}
|
||||
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class SourceAnn
|
||||
|
||||
class WithSource {
|
||||
@get:SourceAnn
|
||||
@set:SourceAnn
|
||||
@setparam:SourceAnn
|
||||
private var x0 = ""
|
||||
|
||||
private val x1 = ""
|
||||
@SourceAnn get
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
package
|
||||
|
||||
public final annotation class Ann : kotlin.Annotation {
|
||||
public constructor Ann()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final annotation class AnnRepeat : kotlin.Annotation {
|
||||
public constructor AnnRepeat()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class CustomDelegate {
|
||||
public constructor CustomDelegate()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
private final class EffetivelyPrivate {
|
||||
private constructor EffetivelyPrivate(/*0*/ x0: kotlin.Int, /*1*/ x1: kotlin.Int, /*2*/ x2: kotlin.Int)
|
||||
public final val x0: kotlin.Int
|
||||
protected final val x1: kotlin.Int
|
||||
internal final val x2: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
private final class Nested {
|
||||
public constructor Nested()
|
||||
public final val fofo: kotlin.Int = 0
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public final class Foo {
|
||||
public constructor Foo(/*0*/ y0: kotlin.Int, /*1*/ vararg y1: kotlin.String /*kotlin.Array<out kotlin.String>*/)
|
||||
private final val x1: kotlin.String = ""
|
||||
private final var x2: kotlin.String
|
||||
@setparam:Ann private final var x3: kotlin.String
|
||||
@setparam:Ann @setparam:AnnRepeat private final var x4: kotlin.String
|
||||
internal final val x5: kotlin.String = ""
|
||||
protected final val x6: kotlin.String = ""
|
||||
private final val x7: kotlin.String = ""
|
||||
private final var x8: kotlin.String
|
||||
private final var x9: kotlin.String
|
||||
private final val y0: kotlin.Int
|
||||
private final val y1: kotlin.Array<out kotlin.String>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
private final class Other {
|
||||
public constructor Other(/*0*/ @param:Ann param: kotlin.Int)
|
||||
@delegate:Ann private final val delegate: kotlin.String
|
||||
@property:Ann @field:Ann private final val other: kotlin.String = ""
|
||||
private final val param: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
private final fun @receiver:Ann kotlin.Int.receiver(): kotlin.Unit
|
||||
}
|
||||
|
||||
public final class PrivateToThis</*0*/ in I> {
|
||||
public constructor PrivateToThis</*0*/ in I>()
|
||||
@setparam:Ann private/*private to this*/ final var x0: I
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) public final annotation class SourceAnn : kotlin.Annotation {
|
||||
public constructor SourceAnn()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Statics {
|
||||
public constructor Statics()
|
||||
public final lateinit var y0: kotlin.String
|
||||
private final lateinit var y1: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
@kotlin.jvm.JvmField public final val x0: kotlin.String = ""
|
||||
public const final val x1: kotlin.String = ""
|
||||
@kotlin.jvm.JvmStatic public final val x2: kotlin.String = ""
|
||||
@kotlin.jvm.JvmStatic private final val x3: kotlin.String = ""
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public final class WithSource {
|
||||
public constructor WithSource()
|
||||
@setparam:SourceAnn private final var x0: kotlin.String
|
||||
private final val x1: kotlin.String = ""
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+2
-2
@@ -37,11 +37,11 @@ abstract class C : I{
|
||||
|
||||
<!INAPPLICABLE_JVM_FIELD!>@JvmField<!>
|
||||
val explicitDefaultAnnotatedGetter: String = ""
|
||||
@DemoAnnotation get
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@DemoAnnotation<!> get
|
||||
|
||||
<!INAPPLICABLE_JVM_FIELD!>@JvmField<!>
|
||||
var explicitDefaultAnnotatedSetter: String = ""
|
||||
@DemoAnnotation set
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@DemoAnnotation<!> set
|
||||
|
||||
<!INAPPLICABLE_JVM_FIELD!>@JvmField<!>
|
||||
var customSetter: String = ""
|
||||
|
||||
Vendored
+1
-1
@@ -45,7 +45,7 @@ interface B {
|
||||
<!JVM_STATIC_NOT_IN_OBJECT_OR_CLASS_COMPANION!>@JvmStatic get<!>
|
||||
|
||||
private var foo8 = 1
|
||||
<!JVM_STATIC_NOT_IN_OBJECT_OR_CLASS_COMPANION!>@JvmStatic <!SETTER_VISIBILITY_INCONSISTENT_WITH_PROPERTY_VISIBILITY!>public<!> set<!>
|
||||
<!JVM_STATIC_NOT_IN_OBJECT_OR_CLASS_COMPANION!><!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@JvmStatic<!> <!SETTER_VISIBILITY_INCONSISTENT_WITH_PROPERTY_VISIBILITY!>public<!> set<!>
|
||||
|
||||
public var foo9 = 1
|
||||
<!JVM_STATIC_NOT_IN_OBJECT_OR_CLASS_COMPANION!>@JvmStatic private set<!>
|
||||
|
||||
Vendored
+1
-1
@@ -45,7 +45,7 @@ interface B {
|
||||
<!JVM_STATIC_IN_INTERFACE_1_6!>@JvmStatic get<!>
|
||||
|
||||
private var foo8 = 1
|
||||
<!JVM_STATIC_IN_INTERFACE_1_6!>@JvmStatic <!SETTER_VISIBILITY_INCONSISTENT_WITH_PROPERTY_VISIBILITY!>public<!> set<!>
|
||||
<!JVM_STATIC_IN_INTERFACE_1_6!><!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@JvmStatic<!> <!SETTER_VISIBILITY_INCONSISTENT_WITH_PROPERTY_VISIBILITY!>public<!> set<!>
|
||||
|
||||
public var foo9 = 1
|
||||
<!JVM_STATIC_ON_NON_PUBLIC_MEMBER, JVM_STATIC_IN_INTERFACE_1_6!>@JvmStatic private set<!>
|
||||
|
||||
Vendored
+1
-1
@@ -46,7 +46,7 @@ interface B {
|
||||
@JvmStatic get
|
||||
|
||||
private var foo8 = 1
|
||||
@JvmStatic <!SETTER_VISIBILITY_INCONSISTENT_WITH_PROPERTY_VISIBILITY!>public<!> set
|
||||
<!ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR!>@JvmStatic<!> <!SETTER_VISIBILITY_INCONSISTENT_WITH_PROPERTY_VISIBILITY!>public<!> set
|
||||
|
||||
public var foo9 = 1
|
||||
<!JVM_STATIC_ON_NON_PUBLIC_MEMBER!>@JvmStatic private set<!>
|
||||
|
||||
Generated
+5
@@ -66,6 +66,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsOnNonExistentAccessors.kt")
|
||||
public void testAnnotationsOnNonExistentAccessors() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnNonExistentAccessors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsOnTypeAliases.kt")
|
||||
public void testAnnotationsOnTypeAliases() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnTypeAliases.kt");
|
||||
|
||||
+5
@@ -161,6 +161,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/annotations"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsTargetingNonExistentAccessor.kt")
|
||||
public void testAnnotationsTargetingNonExistentAccessor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/annotationsTargetingNonExistentAccessor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassObjectAnnotatedWithItsKClass.kt")
|
||||
public void testClassObjectAnnotatedWithItsKClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/ClassObjectAnnotatedWithItsKClass.kt");
|
||||
|
||||
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
Generated
+5
@@ -161,6 +161,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/annotations"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsTargetingNonExistentAccessor.kt")
|
||||
public void testAnnotationsTargetingNonExistentAccessor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/annotationsTargetingNonExistentAccessor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassObjectAnnotatedWithItsKClass.kt")
|
||||
public void testClassObjectAnnotatedWithItsKClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/ClassObjectAnnotatedWithItsKClass.kt");
|
||||
|
||||
+5
@@ -66,6 +66,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsOnNonExistentAccessors.kt")
|
||||
public void testAnnotationsOnNonExistentAccessors() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnNonExistentAccessors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsOnTypeAliases.kt")
|
||||
public void testAnnotationsOnTypeAliases() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnTypeAliases.kt");
|
||||
|
||||
+5
@@ -71,6 +71,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsOnNonExistentAccessors.kt")
|
||||
public void testAnnotationsOnNonExistentAccessors() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnNonExistentAccessors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsOnTypeAliases.kt")
|
||||
public void testAnnotationsOnTypeAliases() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnTypeAliases.kt");
|
||||
|
||||
+5
@@ -66,6 +66,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsOnNonExistentAccessors.kt")
|
||||
public void testAnnotationsOnNonExistentAccessors() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnNonExistentAccessors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsOnTypeAliases.kt")
|
||||
public void testAnnotationsOnTypeAliases() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnTypeAliases.kt");
|
||||
|
||||
+5
@@ -66,6 +66,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnDefault.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsOnNonExistentAccessors.kt")
|
||||
public void testAnnotationsOnNonExistentAccessors() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnNonExistentAccessors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsOnTypeAliases.kt")
|
||||
public void testAnnotationsOnTypeAliases() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/annotations/annotationsOnTypeAliases.kt");
|
||||
|
||||
Reference in New Issue
Block a user