Converter:
Preserve white spaces for top members (classes, package statements, comments)
This commit is contained in:
committed by
Pavel V. Talanov
parent
098a80a2af
commit
d69c61c972
@@ -58,7 +58,7 @@ public class Converter(val project: Project, val settings: ConverterSettings) {
|
||||
return kElement?.toKotlin() ?: ""
|
||||
}
|
||||
|
||||
public fun convertTopElement(element: PsiElement?): Node? = when(element) {
|
||||
public fun convertTopElement(element: PsiElement?): Element? = when(element) {
|
||||
is PsiJavaFile -> convertFile(element)
|
||||
is PsiClass -> convertClass(element)
|
||||
is PsiMethod -> convertMethod(element)
|
||||
@@ -68,18 +68,14 @@ public class Converter(val project: Project, val settings: ConverterSettings) {
|
||||
is PsiComment -> Comment(element.getText()!!)
|
||||
is PsiImportList -> convertImportList(element)
|
||||
is PsiImportStatementBase -> convertImport(element)
|
||||
is PsiPackageStatement -> PackageStatement(quoteKeywords(element.getPackageName() ?: ""))
|
||||
is PsiWhiteSpace -> WhiteSpace(element.getText()!!)
|
||||
else -> null
|
||||
}
|
||||
|
||||
public fun convertFile(javaFile: PsiJavaFile): File {
|
||||
val body = ArrayList<Node>()
|
||||
for (element in javaFile.getChildren()) {
|
||||
val node = convertTopElement(element)
|
||||
if (node != null) {
|
||||
body.add(node)
|
||||
}
|
||||
}
|
||||
return File(quoteKeywords(javaFile.getPackageName()), body, createMainFunction(javaFile))
|
||||
val fileMembers = FileMemberList(javaFile.getChildren() .map { convertTopElement(it) } .filterNotNull())
|
||||
return File(fileMembers, createMainFunction(javaFile))
|
||||
}
|
||||
|
||||
public fun convertAnonymousClass(anonymousClass: PsiAnonymousClass): AnonymousClass {
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
|
||||
package org.jetbrains.jet.j2k.ast
|
||||
|
||||
public class File(val packageName: String,
|
||||
val body: List<Node>,
|
||||
val mainFunction: String) : Node {
|
||||
class FileMemberList(elements: List<Element>): WhiteSpaceSeparatedElementList(elements, WhiteSpace.NewLine, false)
|
||||
|
||||
class PackageStatement(val packageName: String): Element {
|
||||
override fun toKotlin(): String = "package " + packageName
|
||||
}
|
||||
|
||||
public class File(val body: FileMemberList,
|
||||
val mainFunction: String) : Element {
|
||||
|
||||
override fun toKotlin(): String {
|
||||
val common = body.filterNot { it is Element && it.isEmpty() }.toKotlin("\n") + mainFunction
|
||||
if (packageName.isEmpty()) {
|
||||
return common
|
||||
}
|
||||
|
||||
return "package " + packageName + "\n" + common
|
||||
return body.toKotlin() + mainFunction
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.jet.util.QualifiedNamesUtil
|
||||
import org.jetbrains.jet.lang.resolve.java.mapping.JavaToKotlinClassMap
|
||||
|
||||
|
||||
public class Import(val name: String) : Node {
|
||||
public class Import(val name: String) : Element {
|
||||
public override fun toKotlin() = "import " + name
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,8 @@ public fun Expression.withPrefix(prefix: String): String = if (isEmpty()) "" els
|
||||
|
||||
open class WhiteSpaceSeparatedElementList(
|
||||
val elements: List<Element>,
|
||||
val minimalWhiteSpace: WhiteSpace
|
||||
val minimalWhiteSpace: WhiteSpace,
|
||||
val ensureSurroundedByWhiteSpace: Boolean = true
|
||||
) {
|
||||
val nonEmptyElements = elements.filterNot { it.isEmpty() }
|
||||
|
||||
@@ -62,6 +63,9 @@ open class WhiteSpaceSeparatedElementList(
|
||||
}
|
||||
|
||||
private fun List<Element>.surroundWithWhiteSpaces(): List<Element> {
|
||||
if (!ensureSurroundedByWhiteSpace) {
|
||||
return this
|
||||
}
|
||||
val result = ArrayList<Element>()
|
||||
result.add(minimalWhiteSpace)
|
||||
result.addAll(this)
|
||||
|
||||
@@ -4,10 +4,12 @@ class Foo() {
|
||||
fun execute() {
|
||||
}
|
||||
}
|
||||
|
||||
class Bar() {
|
||||
var fooNotNull: Foo = Foo()
|
||||
var fooNullable: Foo = null
|
||||
}
|
||||
|
||||
class Test() {
|
||||
public fun test(barNotNull: Bar, barNullable: Bar) {
|
||||
barNotNull.fooNotNull.execute()
|
||||
|
||||
@@ -20,4 +20,4 @@ class Test {
|
||||
barNullable.fooNotNull.execute();
|
||||
barNullable.fooNullable.execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,12 @@ open class Foo() {
|
||||
open fun execute() {
|
||||
}
|
||||
}
|
||||
|
||||
open class Bar() {
|
||||
var fooNotNull: Foo = Foo()
|
||||
var fooNullable: Foo? = null
|
||||
}
|
||||
|
||||
open class Test() {
|
||||
public open fun test(barNotNull: Bar, barNullable: Bar?) {
|
||||
barNotNull.fooNotNull.execute()
|
||||
|
||||
@@ -7,4 +7,4 @@ class Foo {
|
||||
int foo = 0;
|
||||
foo = o2.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ class Library() {
|
||||
val ourOut: java.io.PrintStream = 0
|
||||
}
|
||||
}
|
||||
|
||||
class User() {
|
||||
fun main() {
|
||||
Library.ourOut.print()
|
||||
|
||||
@@ -3,6 +3,7 @@ open class Library() {
|
||||
val ourOut: java.io.PrintStream? = null
|
||||
}
|
||||
}
|
||||
|
||||
open class User() {
|
||||
open fun main() {
|
||||
Library.ourOut?.print()
|
||||
|
||||
@@ -8,6 +8,7 @@ class Library() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class User() {
|
||||
fun main() {
|
||||
Library.call()
|
||||
|
||||
@@ -8,6 +8,7 @@ open class Library() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class User() {
|
||||
open fun main() {
|
||||
Library.call()
|
||||
|
||||
@@ -6,6 +6,7 @@ class Library() {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
class User() {
|
||||
fun main() {
|
||||
val lib = Library()
|
||||
|
||||
@@ -6,6 +6,7 @@ open class Library() {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
open class User() {
|
||||
open fun main() {
|
||||
var lib: Library? = Library()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Library() {
|
||||
public val myString: String = 0
|
||||
}
|
||||
|
||||
class User() {
|
||||
fun main() {
|
||||
Library.myString.isEmpty()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
open class Library() {
|
||||
public val myString: String? = null
|
||||
}
|
||||
|
||||
open class User() {
|
||||
open fun main() {
|
||||
Library.myString?.isEmpty()
|
||||
|
||||
@@ -7,6 +7,7 @@ public class Short() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
class object {
|
||||
public fun test() {
|
||||
|
||||
@@ -7,6 +7,7 @@ public open class Short() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class Test() {
|
||||
class object {
|
||||
public open fun test() {
|
||||
|
||||
@@ -14,6 +14,7 @@ class Test() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class User() {
|
||||
fun main() {
|
||||
val m = HashMap(1)
|
||||
|
||||
@@ -14,6 +14,7 @@ open class Test() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class User() {
|
||||
open fun main() {
|
||||
var m: HashMap<Any?, Any?>? = HashMap(1)
|
||||
|
||||
@@ -12,6 +12,7 @@ class C(arg1: Int, arg2: Int, arg3: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class User() {
|
||||
class object {
|
||||
public fun main() {
|
||||
|
||||
@@ -12,6 +12,7 @@ open class C(arg1: Int, arg2: Int, arg3: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public open class User() {
|
||||
class object {
|
||||
public open fun main() {
|
||||
|
||||
@@ -26,6 +26,7 @@ class C(arg1: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class User() {
|
||||
class object {
|
||||
public fun main() {
|
||||
|
||||
@@ -26,6 +26,7 @@ open class C(arg1: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public open class User() {
|
||||
class object {
|
||||
public open fun main() {
|
||||
|
||||
@@ -24,6 +24,7 @@ class Customer(first: String, last: String) {
|
||||
doSmthAfter()
|
||||
}
|
||||
}
|
||||
|
||||
class CustomerBuilder() {
|
||||
public var _firstName: String = "Homer"
|
||||
public var _lastName: String = "Simpson"
|
||||
@@ -42,6 +43,7 @@ class CustomerBuilder() {
|
||||
return Customer(_firstName, _lastName)
|
||||
}
|
||||
}
|
||||
|
||||
public class User() {
|
||||
class object {
|
||||
public fun main() {
|
||||
|
||||
@@ -24,6 +24,7 @@ open class Customer(first: String?, last: String?) {
|
||||
doSmthAfter()
|
||||
}
|
||||
}
|
||||
|
||||
open class CustomerBuilder() {
|
||||
public var _firstName: String? = "Homer"
|
||||
public var _lastName: String? = "Simpson"
|
||||
@@ -42,6 +43,7 @@ open class CustomerBuilder() {
|
||||
return Customer(_firstName, _lastName)
|
||||
}
|
||||
}
|
||||
|
||||
public open class User() {
|
||||
class object {
|
||||
public open fun main() {
|
||||
|
||||
@@ -32,6 +32,7 @@ public class Identifier<T>(_myName: T, _myHasDollar: Boolean) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class User() {
|
||||
class object {
|
||||
public fun main() {
|
||||
|
||||
@@ -32,6 +32,7 @@ public open class Identifier<T>(_myName: T?, _myHasDollar: Boolean) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public open class User() {
|
||||
class object {
|
||||
public open fun main() {
|
||||
|
||||
@@ -32,6 +32,7 @@ public class Identifier(_myName: String, _myHasDollar: Boolean) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class User() {
|
||||
class object {
|
||||
public fun main() {
|
||||
|
||||
@@ -32,6 +32,7 @@ public open class Identifier(_myName: String?, _myHasDollar: Boolean) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public open class User() {
|
||||
class object {
|
||||
public open fun main() {
|
||||
|
||||
@@ -37,6 +37,7 @@ public class Test(_myName: String, _a: Boolean, _b: Double, _c: Float, _d: Long,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class User() {
|
||||
class object {
|
||||
public fun main() {
|
||||
|
||||
@@ -37,6 +37,7 @@ public open class Test(_myName: String?, _a: Boolean, _b: Double, _c: Float, _d:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public open class User() {
|
||||
class object {
|
||||
public open fun main() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Base() {
|
||||
private var myFirst: String = 0
|
||||
}
|
||||
|
||||
class Child() : Base() {
|
||||
private var mySecond: String = 0
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
open class Base() {
|
||||
private var myFirst: String? = null
|
||||
}
|
||||
|
||||
open class Child() : Base() {
|
||||
private var mySecond: String? = null
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
class C() {
|
||||
private var f: Foo = 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
open class C() {
|
||||
private var f: Foo? = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ class Test() : Base() {
|
||||
super.finalize()
|
||||
}
|
||||
}
|
||||
|
||||
class Base() {
|
||||
public fun hashCode(): Int {
|
||||
return System.identityHashCode(this)
|
||||
|
||||
@@ -21,6 +21,7 @@ open class Test() : Base() {
|
||||
super.finalize()
|
||||
}
|
||||
}
|
||||
|
||||
open class Base() {
|
||||
public open fun hashCode(): Int {
|
||||
return System.identityHashCode(this)
|
||||
|
||||
@@ -2,10 +2,12 @@ class A() {
|
||||
fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
class B() : A() {
|
||||
override fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
class C() : B() {
|
||||
override fun foo() {
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@ open class A() {
|
||||
open fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
open class B() : A() {
|
||||
override fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
open class C() : B() {
|
||||
override fun foo() {
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
class `$$$$$`() {
|
||||
}
|
||||
|
||||
class `$`() {
|
||||
}
|
||||
|
||||
class `$$`(`$$$$`: `$$$$$`) : `$`() {
|
||||
val `$$$`: `$$$$$`
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
open class `$$$$$`() {
|
||||
}
|
||||
|
||||
open class `$`() {
|
||||
}
|
||||
|
||||
open class `$$`(`$$$$`: `$$$$$`?) : `$`() {
|
||||
val `$$$`: `$$$$$`?
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@ package test;
|
||||
|
||||
import as.type.val.var.fun.is.in.object.when.trait.This;
|
||||
|
||||
class Test {}
|
||||
class Test {}
|
||||
@@ -1,5 +1,6 @@
|
||||
class Base<T>(name: T) {
|
||||
}
|
||||
|
||||
class One<T, K>(name: T, second: K) : Base<T>(name) {
|
||||
private var mySecond: K = 0
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
open class Base<T>(name: T?) {
|
||||
}
|
||||
|
||||
open class One<T, K>(name: T?, second: K?) : Base<T?>(name) {
|
||||
private var mySecond: K? = null
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Base(name: String) {
|
||||
}
|
||||
|
||||
class One(name: String, second: String) : Base(name) {
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
open class Base(name: String?) {
|
||||
}
|
||||
|
||||
open class One(name: String?, second: String?) : Base(name) {
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
class Base() {
|
||||
}
|
||||
|
||||
class One() : Base() {
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
open class Base() {
|
||||
}
|
||||
|
||||
open class One() : Base() {
|
||||
}
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
class Base(name: String) {
|
||||
}
|
||||
|
||||
class One(name: String, second: String) : Base(name) {
|
||||
private var mySecond: String = 0
|
||||
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
open class Base(name: String?) {
|
||||
}
|
||||
|
||||
open class One(name: String?, second: String?) : Base(name) {
|
||||
private var mySecond: String? = null
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@ class Test {
|
||||
public static int foo(String[] args) {
|
||||
return args.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,14 @@
|
||||
// This is an end-of-line comment
|
||||
|
||||
/*
|
||||
This is a block comment
|
||||
*/
|
||||
|
||||
|
||||
/*doc comment of class*/
|
||||
//one line comment of class
|
||||
//another one
|
||||
/*another doc*/
|
||||
class C() {
|
||||
// This is a class comment
|
||||
|
||||
@@ -56,4 +63,4 @@ class C() {
|
||||
|
||||
/*two*/ /*comments*//*line*/
|
||||
var z: Int = 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,10 @@ This is a block comment
|
||||
*/
|
||||
|
||||
|
||||
/*doc comment of class*/
|
||||
//one line comment of class
|
||||
//another one
|
||||
/*another doc*/
|
||||
class C {
|
||||
// This is a class comment
|
||||
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
// This is an end-of-line comment
|
||||
|
||||
/*
|
||||
This is a block comment
|
||||
*/
|
||||
|
||||
|
||||
/*doc comment of class*/
|
||||
//one line comment of class
|
||||
//another one
|
||||
/*another doc*/
|
||||
open class C() {
|
||||
// This is a class comment
|
||||
|
||||
@@ -56,4 +63,4 @@ open class C() {
|
||||
|
||||
/*two*/ /*comments*//*line*/
|
||||
var z: Int = 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import java.util.HashMap
|
||||
|
||||
class G<T : String>(t: T) {
|
||||
}
|
||||
|
||||
public class Java() {
|
||||
fun test() {
|
||||
val m = HashMap()
|
||||
|
||||
@@ -2,6 +2,7 @@ import java.util.HashMap
|
||||
|
||||
open class G<T : String?>(t: T?) {
|
||||
}
|
||||
|
||||
public open class Java() {
|
||||
open fun test() {
|
||||
var m: HashMap<Any?, Any?>? = HashMap()
|
||||
|
||||
@@ -32,6 +32,7 @@ public class Identifier<T>(_myName: T, _myHasDollar: Boolean) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class User() {
|
||||
class object {
|
||||
public fun main(args: Array<String>) {
|
||||
|
||||
@@ -32,6 +32,7 @@ public open class Identifier<T>(_myName: T?, _myHasDollar: Boolean) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public open class User() {
|
||||
class object {
|
||||
public open fun main(args: Array<String?>?) {
|
||||
|
||||
@@ -13,6 +13,7 @@ class Base() {
|
||||
return getJavaClass<Base>.getName() + '@' + Integer.toHexString(hashCode())
|
||||
}
|
||||
}
|
||||
|
||||
class Child() : Base() {
|
||||
override fun hashCode(): Int {
|
||||
return super.hashCode()
|
||||
|
||||
@@ -33,4 +33,4 @@ class Child extends Base {
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ open class Base() {
|
||||
return getJavaClass<Base>.getName() + '@' + Integer.toHexString(hashCode())
|
||||
}
|
||||
}
|
||||
|
||||
open class Child() : Base() {
|
||||
override fun hashCode(): Int {
|
||||
return super.hashCode()
|
||||
|
||||
@@ -3,13 +3,16 @@ package demo
|
||||
class Container() {
|
||||
var myString: String = "1"
|
||||
}
|
||||
|
||||
class One() {
|
||||
class object {
|
||||
var myContainer: Container = Container()
|
||||
}
|
||||
}
|
||||
|
||||
class StringContainer(s: String) {
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun putString(s: String) {
|
||||
}
|
||||
|
||||
@@ -3,13 +3,16 @@ package demo
|
||||
open class Container() {
|
||||
var myString: String? = "1"
|
||||
}
|
||||
|
||||
open class One() {
|
||||
class object {
|
||||
var myContainer: Container? = Container()
|
||||
}
|
||||
}
|
||||
|
||||
open class StringContainer(s: String?) {
|
||||
}
|
||||
|
||||
open class Test() {
|
||||
open fun putString(s: String?) {
|
||||
}
|
||||
|
||||
@@ -3,13 +3,16 @@ package demo
|
||||
class Container() {
|
||||
var myInt: Int = 1
|
||||
}
|
||||
|
||||
class One() {
|
||||
class object {
|
||||
var myContainer: Container = Container()
|
||||
}
|
||||
}
|
||||
|
||||
class IntContainer(i: Int) {
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun putInt(i: Int) {
|
||||
}
|
||||
|
||||
@@ -3,13 +3,16 @@ package demo
|
||||
open class Container() {
|
||||
var myInt: Int = 1
|
||||
}
|
||||
|
||||
open class One() {
|
||||
class object {
|
||||
var myContainer: Container? = Container()
|
||||
}
|
||||
}
|
||||
|
||||
open class IntContainer(i: Int) {
|
||||
}
|
||||
|
||||
open class Test() {
|
||||
open fun putInt(i: Int) {
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package demo
|
||||
class Container() {
|
||||
var myInt: Int = 1
|
||||
}
|
||||
|
||||
class One() {
|
||||
class object {
|
||||
var myContainer: Container = Container()
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
var b: Byte = One.myContainer.myInt.toByte()
|
||||
}
|
||||
@@ -3,11 +3,13 @@ package demo
|
||||
open class Container() {
|
||||
var myInt: Int = 1
|
||||
}
|
||||
|
||||
open class One() {
|
||||
class object {
|
||||
var myContainer: Container? = Container()
|
||||
}
|
||||
}
|
||||
|
||||
open class Test() {
|
||||
var b: Byte = One.myContainer?.myInt!!.toByte()
|
||||
}
|
||||
@@ -3,11 +3,13 @@ package demo
|
||||
class Container() {
|
||||
var myInt: Int = 1
|
||||
}
|
||||
|
||||
class One() {
|
||||
class object {
|
||||
var myContainer: Container = Container()
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
val b = One.myContainer.myInt.toByte()
|
||||
|
||||
@@ -3,11 +3,13 @@ package demo
|
||||
open class Container() {
|
||||
var myInt: Int = 1
|
||||
}
|
||||
|
||||
open class One() {
|
||||
class object {
|
||||
var myContainer: Container? = Container()
|
||||
}
|
||||
}
|
||||
|
||||
open class Test() {
|
||||
open fun test() {
|
||||
var b: Byte = One.myContainer?.myInt!!.toByte()
|
||||
|
||||
@@ -3,11 +3,13 @@ package demo
|
||||
class Container() {
|
||||
var myBoolean: Boolean = true
|
||||
}
|
||||
|
||||
class One() {
|
||||
class object {
|
||||
var myContainer: Container = Container()
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun test() {
|
||||
if (One.myContainer.myBoolean)
|
||||
|
||||
@@ -3,11 +3,13 @@ package demo
|
||||
open class Container() {
|
||||
var myBoolean: Boolean = true
|
||||
}
|
||||
|
||||
open class One() {
|
||||
class object {
|
||||
var myContainer: Container? = Container()
|
||||
}
|
||||
}
|
||||
|
||||
open class Test() {
|
||||
open fun test() {
|
||||
if (One.myContainer?.myBoolean!!)
|
||||
|
||||
@@ -13,6 +13,8 @@ public class Language(code: String) : Serializable {
|
||||
this.code = code
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Base() {
|
||||
fun test() {
|
||||
}
|
||||
@@ -20,10 +22,11 @@ class Base() {
|
||||
return "BASE"
|
||||
}
|
||||
}
|
||||
|
||||
class Child() : Base() {
|
||||
override fun test() {
|
||||
}
|
||||
override fun toString(): String {
|
||||
return "Child"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ public open class Language(code: String?) : Serializable {
|
||||
this.code = code
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open class Base() {
|
||||
open fun test() {
|
||||
}
|
||||
@@ -20,10 +22,11 @@ open class Base() {
|
||||
return "BASE"
|
||||
}
|
||||
}
|
||||
|
||||
open class Child() : Base() {
|
||||
override fun test() {
|
||||
}
|
||||
override fun toString(): String? {
|
||||
return "Child"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ abstract class MyCalendar() : Calendar() {
|
||||
public fun foo() {
|
||||
val i = Calendar.ALL_STYLES
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ abstract class MyCalendar() : Calendar() {
|
||||
public open fun foo() {
|
||||
var i: Int = Calendar.ALL_STYLES
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ class Test() : java.lang.Iterable<String> {
|
||||
return j
|
||||
}
|
||||
}
|
||||
|
||||
class FullTest() : java.lang.Iterable<String> {
|
||||
override fun iterator(): java.util.Iterator<String> {
|
||||
return null
|
||||
|
||||
@@ -10,6 +10,7 @@ open class Test() : java.lang.Iterable<String?> {
|
||||
return j
|
||||
}
|
||||
}
|
||||
|
||||
open class FullTest() : java.lang.Iterable<String?> {
|
||||
override fun iterator(): java.util.Iterator<String?>? {
|
||||
return null
|
||||
|
||||
@@ -4,6 +4,7 @@ class Map() {
|
||||
fun <K, V> put(k: K, v: V) {
|
||||
}
|
||||
}
|
||||
|
||||
class U() {
|
||||
fun test() {
|
||||
val m = Map()
|
||||
|
||||
@@ -4,6 +4,7 @@ open class Map() {
|
||||
open fun <K, V> put(k: K?, v: V?) {
|
||||
}
|
||||
}
|
||||
|
||||
open class U() {
|
||||
open fun test() {
|
||||
var m: Map? = Map()
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.test
|
||||
|
||||
class Library() {
|
||||
}
|
||||
|
||||
class User() {
|
||||
fun main() {
|
||||
val lib = Library()
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.test
|
||||
|
||||
open class Library() {
|
||||
}
|
||||
|
||||
open class User() {
|
||||
open fun main() {
|
||||
var lib: Library? = Library()
|
||||
|
||||
@@ -4,6 +4,7 @@ class OuterClass() {
|
||||
class InnerClass() {
|
||||
}
|
||||
}
|
||||
|
||||
class User() {
|
||||
fun main() {
|
||||
val outerObject = OuterClass()
|
||||
|
||||
@@ -4,6 +4,7 @@ open class OuterClass() {
|
||||
open class InnerClass() {
|
||||
}
|
||||
}
|
||||
|
||||
open class User() {
|
||||
open fun main() {
|
||||
var outerObject: OuterClass? = OuterClass()
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.LinkedList
|
||||
|
||||
class Member() {
|
||||
}
|
||||
|
||||
class User() {
|
||||
fun main() {
|
||||
val members = LinkedList<Member>()
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.LinkedList
|
||||
|
||||
open class Member() {
|
||||
}
|
||||
|
||||
open class User() {
|
||||
open fun main() {
|
||||
var members: MutableList<Member?>? = LinkedList<Member?>()
|
||||
|
||||
@@ -6,6 +6,7 @@ class Foo() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class User() {
|
||||
fun main() {
|
||||
val boo = Foo.Bar()
|
||||
|
||||
@@ -6,6 +6,7 @@ open class Foo() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class User() {
|
||||
open fun main() {
|
||||
var boo: Foo.Bar? = Foo.Bar()
|
||||
|
||||
@@ -4,6 +4,7 @@ class WindowAdapter() {
|
||||
public fun windowClosing() {
|
||||
}
|
||||
}
|
||||
|
||||
public class Client() : Frame() {
|
||||
{
|
||||
val a = object : WindowAdapter() {
|
||||
|
||||
@@ -4,6 +4,7 @@ open class WindowAdapter() {
|
||||
public open fun windowClosing() {
|
||||
}
|
||||
}
|
||||
|
||||
public class Client() : Frame() {
|
||||
{
|
||||
var a: WindowAdapter? = object : WindowAdapter() {
|
||||
|
||||
@@ -9,4 +9,4 @@ class Test {
|
||||
HashMap rawMap = new HashMap<String, Integer>();
|
||||
HashMap superRawMap = new HashMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ class Collection<E>(e: E) {
|
||||
System.out.println(e)
|
||||
}
|
||||
}
|
||||
|
||||
class Test() {
|
||||
fun main() {
|
||||
val raw1 = Collection(1)
|
||||
|
||||
@@ -5,6 +5,7 @@ open class Collection<E>(e: E?) {
|
||||
System.out?.println(e)
|
||||
}
|
||||
}
|
||||
|
||||
open class Test() {
|
||||
open fun main() {
|
||||
var raw1: Collection<*>? = Collection(1)
|
||||
|
||||
@@ -4,6 +4,7 @@ class TestT() {
|
||||
fun <T> getT() {
|
||||
}
|
||||
}
|
||||
|
||||
class U() {
|
||||
fun main() {
|
||||
val t = TestT()
|
||||
|
||||
@@ -4,6 +4,7 @@ open class TestT() {
|
||||
open fun <T> getT() {
|
||||
}
|
||||
}
|
||||
|
||||
open class U() {
|
||||
open fun main() {
|
||||
var t: TestT? = TestT()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Base() {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
class A() : Base() {
|
||||
class C() {
|
||||
fun test() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
open class Base() {
|
||||
open fun foo()
|
||||
}
|
||||
|
||||
open class A() : Base() {
|
||||
open class C() {
|
||||
open fun test() {
|
||||
|
||||
@@ -3,6 +3,7 @@ class B(i: Int) {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
class A() : B(10) {
|
||||
|
||||
override fun call(): Int {
|
||||
|
||||
@@ -3,6 +3,7 @@ open class B(i: Int) {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
open class A() : B(10) {
|
||||
|
||||
override fun call(): Int {
|
||||
|
||||
@@ -2,6 +2,7 @@ class Base() {
|
||||
fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
class A() : Base() {
|
||||
class C() {
|
||||
fun test() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user