Change MISSING_CONSTRUCTOR_KEYWORD severity to error
And adjust testData
This commit is contained in:
@@ -158,7 +158,7 @@ public interface Errors {
|
||||
DiagnosticFactory0<JetNullableType> NULLABLE_SUPERTYPE = DiagnosticFactory0.create(ERROR, NULLABLE_TYPE);
|
||||
DiagnosticFactory0<JetTypeReference> DYNAMIC_SUPERTYPE = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<JetElement> MISSING_CONSTRUCTOR_KEYWORD = DiagnosticFactory0.create(WARNING);
|
||||
DiagnosticFactory0<JetElement> MISSING_CONSTRUCTOR_KEYWORD = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
// Secondary constructors
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Foo private(val param: String = "OK") {
|
||||
class Foo private constructor(val param: String = "OK") {
|
||||
companion object {
|
||||
val s = Foo()
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
var state: String = "Fail"
|
||||
|
||||
class A private(x: String = "OK") {
|
||||
class A private constructor(x: String = "OK") {
|
||||
init {
|
||||
state = x
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package someTest
|
||||
|
||||
public class Some private(val v: String) {
|
||||
public class Some private constructor(val v: String) {
|
||||
companion object {
|
||||
public fun init(v: String): Some {
|
||||
return Some(v)
|
||||
|
||||
@@ -12,7 +12,7 @@ data class A1(val prop1: String) {
|
||||
fun f(): String = "$prop1#$prop2#$prop3"
|
||||
}
|
||||
|
||||
data class A2 private () {
|
||||
data class A2 private constructor() {
|
||||
var prop1: String = ""
|
||||
var prop2: String = "const2"
|
||||
var prop3: String = ""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var sideEffects: String = ""
|
||||
|
||||
abstract class B protected(val arg: Int) {
|
||||
abstract class B protected constructor(val arg: Int) {
|
||||
val parentProp: String
|
||||
init {
|
||||
sideEffects += "zero#"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// This is crucial for some JVM frameworks like Quasar which rely on the bytecode being similar to the one generated by javac
|
||||
// See https://youtrack.jetbrains.com/issue/KT-6870
|
||||
|
||||
class PrivateConstructor private() {
|
||||
class PrivateConstructor private constructor() {
|
||||
class Nested { val a = PrivateConstructor() }
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
class Foo private(val a: Int = 1) {}
|
||||
class Foo private constructor(val a: Int = 1) {}
|
||||
|
||||
// CLASS: Foo
|
||||
// HAS_DEFAULT_CONSTRUCTOR: false
|
||||
|
||||
Vendored
+1
-1
@@ -1,3 +1,3 @@
|
||||
package test
|
||||
|
||||
class TestConstructor private(p: Int = 1)
|
||||
class TestConstructor private constructor(p: Int = 1)
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
package test
|
||||
|
||||
public class InternalConstructor internal()
|
||||
public class InternalConstructor internal constructor()
|
||||
|
||||
@@ -199,7 +199,7 @@ public class AnnotationGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testConstructor() throws NoSuchFieldException, NoSuchMethodException {
|
||||
loadText("class A @[Deprecated] () {}");
|
||||
loadText("class A @[Deprecated] constructor() {}");
|
||||
Class<?> aClass = generateClass("A");
|
||||
Constructor x = aClass.getDeclaredConstructor();
|
||||
Deprecated annotation = (Deprecated) x.getAnnotation(Deprecated.class);
|
||||
|
||||
Reference in New Issue
Block a user