[NoArg] Reorganize module structure of NoArg plugin

This commit is contained in:
Dmitriy Novozhilov
2022-05-17 17:05:31 +03:00
committed by teamcity
parent 0f757c300a
commit 8fc4962213
53 changed files with 88 additions and 33 deletions
+31
View File
@@ -0,0 +1,31 @@
// WITH_STDLIB
// INVOKE_INITIALIZERS
annotation class NoArg
class Simple(val a: String)
@NoArg
class Test(val a: String) {
val x = 5
val y = Simple("Hello, world!")
val z by lazy { "TEST" }
}
fun box(): String {
val test = Test::class.java.newInstance()
if (test.x != 5) {
return "Bad 5"
}
if (test.y == null || test.y.a != "Hello, world!") {
return "Bad Hello, world!"
}
if (test.z != "TEST") {
return "Bad TEST"
}
return "OK"
}
@@ -0,0 +1,25 @@
// WITH_STDLIB
annotation class NoArg
class Simple(val a: String)
@NoArg
class Test(val a: String) {
val x = 5
val y: Simple? = Simple("Hello, world!")
}
fun box(): String {
val test = Test::class.java.newInstance()
if (test.x != 0) {
return "Bad 5"
}
if (test.y != null) {
return "Bad Hello, world!"
}
return "OK"
}
+45
View File
@@ -0,0 +1,45 @@
// WITH_STDLIB
annotation class NoArg
sealed class Test {
abstract val test: String
@NoArg
data class Test1(override val test: String) : Test()
@NoArg
data class Test2(override val test: String) : Test()
}
fun box(): String {
Test::class.java.declaredConstructors.forEach { it.isAccessible = true }
Test.Test1::class.java.declaredConstructors.forEach { it.isAccessible = true }
val instance = Test.Test1::class.java.newInstance() // Error
Demo.Foo::class.java.newInstance()
Demo.Free::class.java.newInstance()
A.Free::class.java.newInstance()
return "OK"
}
@NoArg
sealed class Demo(val name : String) {
@NoArg
class Free(name: String)
@NoArg
class Foo(name: String) : Demo(name)
@NoArg
class Bar(name: String) : Demo(name)
}
@NoArg
abstract class A(val name: String) {
@NoArg
class Free(name: String) : A(name)
}
+14
View File
@@ -0,0 +1,14 @@
// WITH_STDLIB
annotation class NoArg
@NoArg
class Foo(val s1: String) {
val s2: String = ""
val l: List<String> = listOf()
}
fun box(): String {
val instance = Foo::class.java.newInstance()
return "OK"
}
+22
View File
@@ -0,0 +1,22 @@
// WITH_STDLIB
annotation class NoArg
@NoArg
class AuthenticationConfiguration(tokenExpiresIn: Long) {
var tokenExpiryDate: String?
init {
tokenExpiryDate = tokenExpiresIn.toString()
}
}
fun box(): String {
val instance = AuthenticationConfiguration::class.java.newInstance()
if (instance.tokenExpiryDate != null) {
return "Initializer invoked"
}
return "OK"
}
+20
View File
@@ -0,0 +1,20 @@
// WITH_STDLIB
// INVOKE_INITIALIZERS
annotation class NoArg
@NoArg
class Test(val a: String) {
val lc = run {
class Local(val result: String)
Local("OK").result
}
val obj = object { val result = "OK" }.result
}
fun box(): String {
val t = Test::class.java.newInstance()
if (t.lc != "OK") return "Fail 1"
return t.obj
}
+14
View File
@@ -0,0 +1,14 @@
// WITH_STDLIB
annotation class NoArg
class Outer {
@NoArg
class Nested(val a: String)
}
fun box(): String {
Outer.Nested::class.java.newInstance()
return "OK"
}
@@ -0,0 +1,14 @@
// WITH_STDLIB
annotation class NoArg
@NoArg
sealed class MappedSuperClass
@NoArg
class ConcreteClass(val x: String) : MappedSuperClass()
fun box(): String {
ConcreteClass::class.java.getConstructor().newInstance()
return "OK"
}
+11
View File
@@ -0,0 +1,11 @@
// WITH_STDLIB
annotation class NoArg
@NoArg
class Test(val a: String)
fun box(): String {
Test::class.java.newInstance()
return "OK"
}
+22
View File
@@ -0,0 +1,22 @@
// WITH_STDLIB
annotation class NoArg
open class Base1
open class Base2(val a: Int = 1)
open class Base3(val a: Int) {
@JvmOverloads constructor(a: Long = 1L) : this(a.toInt())
}
@NoArg class Test1(val b: String) : Base1()
@NoArg class Test2(val b: String) : Base2()
@NoArg class Test3(val b: String) : Base3()
fun box(): String {
val test1 = Test1::class.java.newInstance()
val test2 = Test2::class.java.newInstance()
if (test2.a != 1) return "fail@test2: ${test2.a}"
val test3 = Test3::class.java.newInstance()
if (test3.a != 1) return "fail@test3: ${test3.a}"
return "OK"
}
@@ -0,0 +1,19 @@
@NoArg
annotation class NoArg
@NoArg
interface Intf
@NoArg
enum class Colors { RED, WHITE }
@NoArg
object Obj
class MyClass(a: Int) {
@NoArg
fun someFun() {}
@field:NoArg @get:NoArg @set:NoArg
var abc: String = ""
}
@@ -0,0 +1,44 @@
@NoArg
@kotlin.Metadata
public final enum class Colors {
// source: 'annoOnNotClass.kt'
private synthetic final static field $VALUES: Colors[]
public final enum static field RED: Colors
public final enum static field WHITE: Colors
static method <clinit>(): void
private method <init>(p0: java.lang.String, p1: int): void
public static method valueOf(p0: java.lang.String): Colors
public static method values(): Colors[]
}
@NoArg
@kotlin.Metadata
public interface Intf {
// source: 'annoOnNotClass.kt'
}
@kotlin.Metadata
public final class MyClass {
// source: 'annoOnNotClass.kt'
private @NoArg @org.jetbrains.annotations.NotNull field abc: java.lang.String
public method <init>(p0: int): void
public final @NoArg @org.jetbrains.annotations.NotNull method getAbc(): java.lang.String
public final @NoArg method setAbc(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
public final @NoArg method someFun(): void
}
@NoArg
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class NoArg {
// source: 'annoOnNotClass.kt'
}
@NoArg
@kotlin.Metadata
public final class Obj {
// source: 'annoOnNotClass.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: Obj
static method <clinit>(): void
private method <init>(): void
}
@@ -0,0 +1,45 @@
@NoArg
@kotlin.Metadata
public final enum class Colors {
// source: 'annoOnNotClass.kt'
private synthetic final static field $VALUES: Colors[]
public final enum static field RED: Colors
public final enum static field WHITE: Colors
private synthetic final static method $values(): Colors[]
static method <clinit>(): void
private method <init>(p0: java.lang.String, p1: int): void
public static method valueOf(p0: java.lang.String): Colors
public static method values(): Colors[]
}
@NoArg
@kotlin.Metadata
public interface Intf {
// source: 'annoOnNotClass.kt'
}
@kotlin.Metadata
public final class MyClass {
// source: 'annoOnNotClass.kt'
private @NoArg @org.jetbrains.annotations.NotNull field abc: java.lang.String
public method <init>(p0: int): void
public final @NoArg @org.jetbrains.annotations.NotNull method getAbc(): java.lang.String
public final @NoArg method setAbc(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
public final @NoArg method someFun(): void
}
@NoArg
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class NoArg {
// source: 'annoOnNotClass.kt'
}
@NoArg
@kotlin.Metadata
public final class Obj {
// source: 'annoOnNotClass.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: Obj
static method <clinit>(): void
private method <init>(): void
}
@@ -0,0 +1,10 @@
annotation class NoArg
@NoArg
class Internal internal constructor(z: Boolean)
@NoArg
abstract class Protected protected constructor(c: Char)
@NoArg
class Private private constructor(ia: IntArray)
@@ -0,0 +1,29 @@
@NoArg
@kotlin.Metadata
public final class Internal {
// source: 'constructorVisibility.kt'
public method <init>(): void
public method <init>(p0: boolean): void
}
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class NoArg {
// source: 'constructorVisibility.kt'
}
@NoArg
@kotlin.Metadata
public final class Private {
// source: 'constructorVisibility.kt'
public method <init>(): void
private method <init>(p0: int[]): void
}
@NoArg
@kotlin.Metadata
public abstract class Protected {
// source: 'constructorVisibility.kt'
public method <init>(): void
protected method <init>(p0: char): void
}
@@ -0,0 +1,19 @@
annotation class NoArg
@NoArg
annotation class MetaAnno
@NoArg
interface BaseIntf
@NoArg
class Test(a: String = "", i: Int = 2)
class Test2 : BaseIntf {
constructor(a: String = "", b: Long = 0L) {}
}
@MetaAnno
class Test3(a: String) {
constructor() : this("") {}
}
@@ -0,0 +1,43 @@
@NoArg
@kotlin.Metadata
public interface BaseIntf {
// source: 'defaultParameters.kt'
}
@NoArg
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class MetaAnno {
// source: 'defaultParameters.kt'
}
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class NoArg {
// source: 'defaultParameters.kt'
}
@NoArg
@kotlin.Metadata
public final class Test {
// source: 'defaultParameters.kt'
public method <init>(): void
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String, p1: int): void
public synthetic method <init>(p0: java.lang.String, p1: int, p2: int, p3: kotlin.jvm.internal.DefaultConstructorMarker): void
}
@kotlin.Metadata
public final class Test2 {
// source: 'defaultParameters.kt'
public method <init>(): void
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String, p1: long): void
public synthetic method <init>(p0: java.lang.String, p1: long, p2: int, p3: kotlin.jvm.internal.DefaultConstructorMarker): void
}
@MetaAnno
@kotlin.Metadata
public final class Test3 {
// source: 'defaultParameters.kt'
public method <init>(): void
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
}
+10
View File
@@ -0,0 +1,10 @@
annotation class NoArg
@NoArg
annotation class MyAnno
@MyAnno
interface Base
@MyAnno
class Test(a: String) : Base
+26
View File
@@ -0,0 +1,26 @@
@MyAnno
@kotlin.Metadata
public interface Base {
// source: 'inherited.kt'
}
@NoArg
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class MyAnno {
// source: 'inherited.kt'
}
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class NoArg {
// source: 'inherited.kt'
}
@MyAnno
@kotlin.Metadata
public final class Test {
// source: 'inherited.kt'
public method <init>(): void
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
}
+6
View File
@@ -0,0 +1,6 @@
annotation class NoArg
class Outer {
@NoArg
class Nested(a: Long)
}
+21
View File
@@ -0,0 +1,21 @@
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class NoArg {
// source: 'nestedClass.kt'
}
@NoArg
@kotlin.Metadata
public final class Outer$Nested {
// source: 'nestedClass.kt'
public method <init>(): void
public method <init>(p0: long): void
public final inner class Outer$Nested
}
@kotlin.Metadata
public final class Outer {
// source: 'nestedClass.kt'
public method <init>(): void
public final inner class Outer$Nested
}
+3
View File
@@ -0,0 +1,3 @@
annotation class NoArg
class Test(a: String)
+11
View File
@@ -0,0 +1,11 @@
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class NoArg {
// source: 'noNoArg.kt'
}
@kotlin.Metadata
public final class Test {
// source: 'noNoArg.kt'
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
}
@@ -0,0 +1,5 @@
annotation class NoArg
annotation class NoArg2
@NoArg @NoArg2
class Test(a: String)
+20
View File
@@ -0,0 +1,20 @@
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class NoArg {
// source: 'severalNoArg.kt'
}
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class NoArg2 {
// source: 'severalNoArg.kt'
}
@NoArg
@NoArg2
@kotlin.Metadata
public final class Test {
// source: 'severalNoArg.kt'
public method <init>(): void
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
}
+4
View File
@@ -0,0 +1,4 @@
annotation class NoArg
@NoArg
class Test(a: String)
+13
View File
@@ -0,0 +1,13 @@
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class NoArg {
// source: 'simple.kt'
}
@NoArg
@kotlin.Metadata
public final class Test {
// source: 'simple.kt'
public method <init>(): void
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
}
+13
View File
@@ -0,0 +1,13 @@
annotation class NoArg
@NoArg
interface BaseIntf
open class Test1(a: String) : BaseIntf
class Test12(b: Int) : Test1("")
@NoArg
abstract class BaseClass
class MyClass(a: String) : BaseClass()
+39
View File
@@ -0,0 +1,39 @@
@NoArg
@kotlin.Metadata
public abstract class BaseClass {
// source: 'superTypes.kt'
public method <init>(): void
}
@NoArg
@kotlin.Metadata
public interface BaseIntf {
// source: 'superTypes.kt'
}
@kotlin.Metadata
public final class MyClass {
// source: 'superTypes.kt'
public method <init>(): void
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
}
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class NoArg {
// source: 'superTypes.kt'
}
@kotlin.Metadata
public class Test1 {
// source: 'superTypes.kt'
public method <init>(): void
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
}
@kotlin.Metadata
public final class Test12 {
// source: 'superTypes.kt'
public method <init>(): void
public method <init>(p0: int): void
}
+14
View File
@@ -0,0 +1,14 @@
annotation class NoArg
class Outer {
@NoArg
inner class <!NOARG_ON_INNER_CLASS!>Inner<!>(val b: Any)
}
fun local() {
@NoArg
class <!NOARG_ON_LOCAL_CLASS!>Local<!>(val l: Any) {
@NoArg
inner class <!NOARG_ON_INNER_CLASS!>InnerLocal<!>(val x: Any)
}
}
+25
View File
@@ -0,0 +1,25 @@
package
public fun local(): kotlin.Unit
public final annotation class NoArg : kotlin.Annotation {
public constructor NoArg()
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 Outer {
public constructor Outer()
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
@NoArg public final inner class Inner {
public constructor Inner(/*0*/ b: kotlin.Any)
public final val b: kotlin.Any
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
}
}
@@ -0,0 +1,6 @@
annotation class NoArg
open class Base(val s: String)
@NoArg
class <!NO_NOARG_CONSTRUCTOR_IN_SUPERCLASS!>Derived<!>(s: String) : Base(s)
@@ -0,0 +1,24 @@
package
public open class Base {
public constructor Base(/*0*/ s: kotlin.String)
public final val s: 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
}
@NoArg public final class Derived : Base {
public constructor Derived(/*0*/ s: kotlin.String)
public final override /*1*/ /*fake_override*/ val s: 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 annotation class NoArg : kotlin.Annotation {
public constructor NoArg()
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
}