Report JvmStatic diagnostic on primary constructor properties
This commit is contained in:
+4
-1
@@ -58,7 +58,10 @@ public class PlatformStaticAnnotationChecker : DeclarationChecker {
|
||||
bindingContext: BindingContext
|
||||
) {
|
||||
if (descriptor.hasJvmStaticAnnotation()) {
|
||||
if (declaration is KtNamedFunction || declaration is KtProperty || declaration is KtPropertyAccessor) {
|
||||
if (declaration is KtNamedFunction ||
|
||||
declaration is KtProperty ||
|
||||
declaration is KtPropertyAccessor ||
|
||||
declaration is KtParameter) {
|
||||
checkDeclaration(declaration, descriptor, diagnosticHolder)
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
class A(<!JVM_STATIC_NOT_IN_OBJECT!>@JvmStatic val z: Int<!>) {
|
||||
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
package
|
||||
|
||||
public final class A {
|
||||
public constructor A(/*0*/ z: kotlin.Int)
|
||||
@kotlin.jvm.JvmStatic() public final val z: 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
|
||||
}
|
||||
@@ -501,6 +501,12 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/annotations/platformStatic"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("constructorProperty.kt")
|
||||
public void testConstructorProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/platformStatic/constructorProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("constructors.kt")
|
||||
public void testConstructors() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/platformStatic/constructors.kt");
|
||||
|
||||
Reference in New Issue
Block a user