Report JvmStatic diagnostic on primary constructor properties

This commit is contained in:
Michael Bogdanov
2015-12-29 15:36:56 +03:00
parent bb63bcd520
commit ae4ca3b5bb
4 changed files with 22 additions and 1 deletions
@@ -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)
}
}
@@ -0,0 +1,3 @@
class A(<!JVM_STATIC_NOT_IN_OBJECT!>@JvmStatic val z: Int<!>) {
}
@@ -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");