Converter:

Functions are final by default in plugin mode
This commit is contained in:
Pavel V. Talanov
2013-11-19 16:52:57 +04:00
parent bf4e27b152
commit d98d8cfa7f
88 changed files with 168 additions and 162 deletions
+6 -6
View File
@@ -207,7 +207,7 @@ public class Converter(val project: Project, val settings: ConverterSettings) {
}
}
}
members.add(Constructor(Identifier.EMPTY_IDENTIFIER, arrayListOf(), Collections.emptySet<Modifier>(),
members.add(Constructor(this, Identifier.EMPTY_IDENTIFIER, arrayListOf(), Collections.emptySet<Modifier>(),
ClassType(name, Collections.emptyList<Element>(), false, this),
Collections.emptyList<Element>(),
ParameterList(createParametersFromFields(finalOrWithEmptyInitializer)),
@@ -295,12 +295,11 @@ public class Converter(val project: Project, val settings: ConverterSettings) {
}
if (method.isConstructor()) {
val isPrimary: Boolean = isConstructorPrimary(method)
return Constructor(identifier, docComments, modifiers, returnType, typeParameters, params,
Block(removeEmpty(body.statements), false), isPrimary)
return Constructor(this, identifier, docComments, modifiers, returnType, typeParameters, params,
Block(removeEmpty(body.statements), false), isConstructorPrimary(method))
}
return Function(identifier, docComments, modifiers, returnType, typeParameters, params, body)
return Function(this, identifier, docComments, modifiers, returnType, typeParameters, params, body)
}
private fun createFunctionParameters(method: PsiMethod): ParameterList {
@@ -342,6 +341,7 @@ public class Converter(val project: Project, val settings: ConverterSettings) {
return false
}
public fun blockToBlock(block: PsiCodeBlock?, notEmpty: Boolean): Block {
if (block == null)
return Block.EMPTY_BLOCK
@@ -611,7 +611,7 @@ public class Converter(val project: Project, val settings: ConverterSettings) {
private fun isNotOpenMethod(method: PsiMethod): Boolean {
val parent = method.getParent()
if (parent is PsiClass) {
val parentModifierList: PsiModifierList? = parent.getModifierList()
val parentModifierList = parent.getModifierList()
if ((parentModifierList != null && parentModifierList.hasExplicitModifier(PsiModifier.FINAL)) || parent.isEnum()) {
return true
}
+1 -1
View File
@@ -80,7 +80,7 @@ public open class Class(val converter: Converter,
val constructorTypeParameters = ArrayList<Element>()
constructorTypeParameters.addAll(typeParameters)
constructorTypeParameters.addAll(f.typeParameters)
return Function(Identifier("init"), arrayList(), modifiers,
return Function(converter, Identifier("init"), arrayList(), modifiers,
ClassType(name, constructorTypeParameters, false, converter),
constructorTypeParameters, f.params, block)
}
@@ -17,21 +17,24 @@
package org.jetbrains.jet.j2k.ast
import org.jetbrains.jet.j2k.ast.types.Type
import org.jetbrains.jet.j2k.Converter
public open class Constructor(identifier: Identifier,
public class Constructor(converter: Converter,
identifier: Identifier,
docComments: List<Node>,
modifiers: Set<Modifier>,
`type`: Type,
typeParameters: List<Element>,
params: Element,
block: Block,
val isPrimary: Boolean) : Function(identifier, docComments, modifiers, `type`, typeParameters, params, block) {
val isPrimary: Boolean) : Function(converter, identifier, docComments, modifiers,
`type`, typeParameters, params, block) {
public open fun primarySignatureToKotlin(): String {
public fun primarySignatureToKotlin(): String {
return "(" + params.toKotlin() + ")"
}
public open fun primaryBodyToKotlin(): String {
public fun primaryBodyToKotlin(): String {
return block!!.toKotlin()
}
}
@@ -19,8 +19,10 @@ package org.jetbrains.jet.j2k.ast
import org.jetbrains.jet.j2k.ast.types.Type
import java.util.ArrayList
import org.jetbrains.jet.j2k.ast.types.isUnit
import org.jetbrains.jet.j2k.Converter
public open class Function(val name: Identifier,
public open class Function(val converter: Converter,
val name: Identifier,
val docComments: List<Node>,
modifiers: Set<Modifier>,
val `type`: Type,
@@ -61,10 +63,11 @@ public open class Function(val name: Identifier,
modifierList.add(Modifier.OVERRIDE)
}
if (!modifiers.contains(Modifier.ABSTRACT) &&
!modifiers.contains(Modifier.OVERRIDE) &&
!modifiers.contains(Modifier.FINAL) &&
!modifiers.contains(Modifier.PRIVATE)) {
if (converter.settings.openByDefault &&
!modifiers.contains(Modifier.ABSTRACT) &&
!modifiers.contains(Modifier.OVERRIDE) &&
!modifiers.contains(Modifier.FINAL) &&
!modifiers.contains(Modifier.PRIVATE)) {
modifierList.add(Modifier.OPEN)
}
@@ -1,13 +1,13 @@
package test
public class Test(str : String) {
var myStr : String = "String2"
public open fun sout(str : String) {
public fun sout(str : String) {
System.out.println(str)
}
public open fun dummy(str : String) : String {
public fun dummy(str : String) : String {
return str
}
public open fun test() {
public fun test() {
sout("String")
val test = "String2"
sout(test)
@@ -1,6 +1,6 @@
package test
class Foo() {
open fun execute() {
fun execute() {
}
}
class Bar() {
@@ -8,7 +8,7 @@ var fooNotNull : Foo = Foo()
var fooNullable : Foo = null
}
class Test() {
public open fun test(barNotNull : Bar, barNullable : Bar) {
public fun test(barNotNull : Bar, barNullable : Bar) {
barNotNull.fooNotNull.execute()
barNotNull.fooNullable.execute()
barNullable.fooNotNull.execute()
@@ -1,6 +1,6 @@
import java.util.BitSet
class Foo() {
open fun foo(o : BitSet) {
fun foo(o : BitSet) {
val o2 = o
val foo = 0
foo = o2.size()
@@ -1,6 +1,6 @@
import java.util.ArrayList
class Boxing() {
open fun test() {
fun test() {
val i = 0
val n = 0.0.toFloat()
i = 1
@@ -1,6 +1,6 @@
package demo
class Test() {
open fun test() {
fun test() {
val i = Integer.valueOf(100)
val s = 3
val ss = java.lang.Short.valueOf(s)
@@ -4,7 +4,7 @@ val ourOut : java.io.PrintStream = 0
}
}
class User() {
open fun main() {
fun main() {
Library.ourOut.print()
}
}
@@ -1,14 +1,14 @@
class Library() {
class object {
open fun call() {
fun call() {
}
open fun getString() : String {
fun getString() : String {
return ""
}
}
}
class User() {
open fun main() {
fun main() {
Library.call()
Library.getString().isEmpty()
}
@@ -1,12 +1,12 @@
class Library() {
open fun call() {
fun call() {
}
open fun getString() : String {
fun getString() : String {
return ""
}
}
class User() {
open fun main() {
fun main() {
val lib = Library()
lib.call()
lib.getString().isEmpty()
@@ -2,7 +2,7 @@ class Library() {
public val myString : String = 0
}
class User() {
open fun main() {
fun main() {
Library.myString.isEmpty()
}
}
@@ -1,14 +1,14 @@
package test
public class Short() {
class object {
public open fun valueOf(value : String) : Short {
public fun valueOf(value : String) : Short {
return Short()
}
}
}
class Test() {
class object {
public open fun test() {
public fun test() {
test.Short.valueOf("1")
test.Short.valueOf("1")
java.lang.Short.valueOf("1")
@@ -1,6 +1,6 @@
abstract class A() {
abstract fun callme()
open fun callmetoo() {
fun callmetoo() {
print("This is a concrete method.")
}
}
@@ -1,9 +1,9 @@
abstract class Shape() {
public var color : String = 0
public open fun setColor(c : String) {
public fun setColor(c : String) {
color = c
}
public open fun getColor() : String {
public fun getColor() : String {
return color
}
public abstract fun area() : Double
+3 -3
View File
@@ -2,18 +2,18 @@ package demo
import java.util.HashMap
class Test() {
class object {
open fun init() : Test {
fun init() : Test {
val __ = Test()
return __
}
open fun init(s : String) : Test {
fun init(s : String) : Test {
val __ = Test()
return __
}
}
}
class User() {
open fun main() {
fun main() {
val m = HashMap(1)
val m2 = HashMap(10)
val t1 = Test.init()
@@ -1,10 +1,10 @@
class C(arg1 : Int, arg2 : Int, arg3 : Int) {
class object {
open fun init(arg1 : Int, arg2 : Int) : C {
fun init(arg1 : Int, arg2 : Int) : C {
val __ = C(arg1, arg2, 0)
return __
}
open fun init(arg1 : Int) : C {
fun init(arg1 : Int) : C {
val __ = C(arg1, 0, 0)
return __
}
@@ -12,7 +12,7 @@ return __
}
public class User() {
class object {
public open fun main() {
public fun main() {
val c1 = C(100, 100, 100)
val c2 = C.init(100, 100)
val c3 = C.init(100)
@@ -8,13 +8,13 @@ myArg2 = 0
myArg3 = 0
}
class object {
open fun init(arg1 : Int, arg2 : Int, arg3 : Int) : C {
fun init(arg1 : Int, arg2 : Int, arg3 : Int) : C {
val __ = C(arg1)
__.myArg2 = arg2
__.myArg3 = arg3
return __
}
open fun init(arg1 : Int, arg2 : Int) : C {
fun init(arg1 : Int, arg2 : Int) : C {
val __ = C(arg1)
__.myArg2 = arg2
__.myArg3 = 0
@@ -24,7 +24,7 @@ return __
}
public class User() {
class object {
public open fun main() {
public fun main() {
val c1 = C.init(100, 100, 100)
val c2 = C.init(100, 100)
val c3 = C(100)
@@ -2,10 +2,10 @@ package org.test.customer
class Customer(first : String, last : String) {
public val _firstName : String
public val _lastName : String
public open fun getFirstName() : String {
public fun getFirstName() : String {
return _firstName
}
public open fun getLastName() : String {
public fun getLastName() : String {
return _lastName
}
private fun doSmthBefore() {
@@ -22,21 +22,21 @@ doSmthAfter()
class CustomerBuilder() {
public var _firstName : String = "Homer"
public var _lastName : String = "Simpson"
public open fun WithFirstName(firstName : String) : CustomerBuilder {
public fun WithFirstName(firstName : String) : CustomerBuilder {
_firstName = firstName
return this
}
public open fun WithLastName(lastName : String) : CustomerBuilder {
public fun WithLastName(lastName : String) : CustomerBuilder {
_lastName = lastName
return this
}
public open fun Build() : Customer {
public fun Build() : Customer {
return Customer(_firstName, _lastName)
}
}
public class User() {
class object {
public open fun main() {
public fun main() {
val customer = CustomerBuilder().WithFirstName("Homer").WithLastName("Simpson").Build()
System.out.println(customer.getFirstName())
System.out.println(customer.getLastName())
@@ -2,7 +2,7 @@ public class Identifier<T>(_myName : T, _myHasDollar : Boolean) {
private val myName : T
private var myHasDollar : Boolean = false
private var myNullable : Boolean = true
public open fun getName() : T {
public fun getName() : T {
return myName
}
{
@@ -10,16 +10,16 @@ myName = _myName
myHasDollar = _myHasDollar
}
class object {
public open fun init<T>(name : T) : Identifier<T> {
public fun init<T>(name : T) : Identifier<T> {
val __ = Identifier(name, false)
return __
}
public open fun init<T>(name : T, isNullable : Boolean) : Identifier<T> {
public fun init<T>(name : T, isNullable : Boolean) : Identifier<T> {
val __ = Identifier(name, false)
__.myNullable = isNullable
return __
}
public open fun init<T>(name : T, hasDollar : Boolean, isNullable : Boolean) : Identifier<T> {
public fun init<T>(name : T, hasDollar : Boolean, isNullable : Boolean) : Identifier<T> {
val __ = Identifier(name, hasDollar)
__.myNullable = isNullable
return __
@@ -28,7 +28,7 @@ return __
}
public class User() {
class object {
public open fun main() {
public fun main() {
val i1 = Identifier.init<String>("name", false, true)
val i2 = Identifier.init<String>("name", false)
val i3 = Identifier.init<String>("name")
@@ -2,7 +2,7 @@ public class Identifier(_myName : String, _myHasDollar : Boolean) {
private val myName : String
private var myHasDollar : Boolean = false
private var myNullable : Boolean = true
public open fun getName() : String {
public fun getName() : String {
return myName
}
{
@@ -10,16 +10,16 @@ myName = _myName
myHasDollar = _myHasDollar
}
class object {
public open fun init(name : String) : Identifier {
public fun init(name : String) : Identifier {
val __ = Identifier(name, false)
return __
}
public open fun init(name : String, isNullable : Boolean) : Identifier {
public fun init(name : String, isNullable : Boolean) : Identifier {
val __ = Identifier(name, false)
__.myNullable = isNullable
return __
}
public open fun init(name : String, hasDollar : Boolean, isNullable : Boolean) : Identifier {
public fun init(name : String, hasDollar : Boolean, isNullable : Boolean) : Identifier {
val __ = Identifier(name, hasDollar)
__.myNullable = isNullable
return __
@@ -28,7 +28,7 @@ return __
}
public class User() {
class object {
public open fun main() {
public fun main() {
val i1 = Identifier.init("name", false, true)
val i2 = Identifier.init("name", false)
val i3 = Identifier.init("name")
@@ -18,22 +18,22 @@ f = _f
g = _g
}
class object {
public open fun init() : Test {
public fun init() : Test {
val __ = Test(0, false, 0.toDouble(), 0.toFloat(), 0, 0, 0, ' ')
return __
}
public open fun init(name : String) : Test {
public fun init(name : String) : Test {
val __ = Test(foo(name), false, 0.toDouble(), 0.toFloat(), 0, 0, 0, ' ')
return __
}
open fun foo(n : String) : String {
fun foo(n : String) : String {
return ""
}
}
}
public class User() {
class object {
public open fun main() {
public fun main() {
val t = Test.init("name")
}
}
@@ -17,19 +17,19 @@ super.finalize()
}
}
class Base() {
public open fun hashCode() : Int {
public fun hashCode() : Int {
return System.identityHashCode(this)
}
public open fun equals(o : Any) : Boolean {
public fun equals(o : Any) : Boolean {
return this.identityEquals(o)
}
protected open fun clone() : Any {
protected fun clone() : Any {
return super.clone()
}
public open fun toString() : String {
public fun toString() : String {
return getJavaClass<Base>.getName() + '@' + Integer.toHexString(hashCode())
}
protected open fun finalize() {
protected fun finalize() {
super.finalize()
}
}
@@ -1,5 +1,5 @@
class A() {
open fun a() {
fun a() {
}
}
class B() : A() {
@@ -1,5 +1,5 @@
class A() {
open fun foo() {
fun foo() {
}
}
class B() : A() {
@@ -1,18 +1,18 @@
package test
class Test() {
public open fun hashCode() : Int {
public fun hashCode() : Int {
return System.identityHashCode(this)
}
public open fun equals(o : Any) : Boolean {
public fun equals(o : Any) : Boolean {
return this.identityEquals(o)
}
protected open fun clone() : Any {
protected fun clone() : Any {
return super.clone()
}
public open fun toString() : String {
public fun toString() : String {
return getJavaClass<Test>.getName() + '@' + Integer.toHexString(hashCode())
}
protected open fun finalize() {
protected fun finalize() {
super.finalize()
}
}
@@ -1,6 +1,6 @@
package demo
class Test() {
open fun test(vararg var args : Any) {
fun test(vararg var args : Any) {
args = array<Int>(1, 2, 3)
}
}
@@ -1,6 +1,6 @@
package demo
class Test() {
open fun test(var i : Int) : Int {
fun test(var i : Int) : Int {
i = 10
return i + 20
}
@@ -4,7 +4,7 @@ class `$`() {
}
class `$$`(`$$$$` : `$$$$$`) : `$`() {
val `$$$` : `$$$$$`
public open fun `$$$$$$`() : `$$$$$` {
public fun `$$$$$$`() : `$$$$$` {
return `$$$`
}
{
@@ -1,6 +1,6 @@
class Test() {
class object {
public open fun foo(args : Array<String>) : Int {
public fun foo(args : Array<String>) : Int {
return args.size
}
}
@@ -11,7 +11,7 @@ private var i : Int = 0
/**
* This is a function doc comment.
*/
public open fun foo() {
public fun foo() {
/* This is a function comment */
}
}
+2 -2
View File
@@ -2,11 +2,11 @@ import java.util.HashMap
class G<T : String>(t : T) {
}
public class Java() {
open fun test() {
fun test() {
val m = HashMap()
m.put(1, 1)
}
open fun test2() {
fun test2() {
val m = HashMap()
val g = G("")
val g2 = G<String>("")
+1 -1
View File
@@ -1,7 +1,7 @@
package demo
class Test() {
class object {
open fun subListRangeCheck(fromIndex : Int, toIndex : Int, size : Int) {
fun subListRangeCheck(fromIndex : Int, toIndex : Int, size : Int) {
if (fromIndex < 0)
throw IndexOutOfBoundsException("fromIndex = " + fromIndex)
if (toIndex > size)
@@ -1,8 +1,8 @@
package demo
class Test() {
open fun putInt(i : Int) {
fun putInt(i : Int) {
}
open fun test() {
fun test() {
val b = 10
putInt(b.toInt())
val b2 = 10
@@ -1,8 +1,8 @@
package demo
class Test() {
open fun putInt(i : Int) {
fun putInt(i : Int) {
}
open fun test() {
fun test() {
val i = 10
putInt(i)
}
+2 -2
View File
@@ -1,8 +1,8 @@
package demo
class Test() {
open fun putInt(i : Int) {
fun putInt(i : Int) {
}
open fun test() {
fun test() {
val b = 10
putInt(b.toInt())
}
+5 -5
View File
@@ -2,7 +2,7 @@ public class Identifier<T>(_myName : T, _myHasDollar : Boolean) {
private val myName : T
private var myHasDollar : Boolean = false
private var myNullable : Boolean = true
public open fun getName() : T {
public fun getName() : T {
return myName
}
{
@@ -10,16 +10,16 @@ myName = _myName
myHasDollar = _myHasDollar
}
class object {
public open fun init<T>(name : T) : Identifier<T> {
public fun init<T>(name : T) : Identifier<T> {
val __ = Identifier(name, false)
return __
}
public open fun init<T>(name : T, isNullable : Boolean) : Identifier<T> {
public fun init<T>(name : T, isNullable : Boolean) : Identifier<T> {
val __ = Identifier(name, false)
__.myNullable = isNullable
return __
}
public open fun init<T>(name : T, hasDollar : Boolean, isNullable : Boolean) : Identifier<T> {
public fun init<T>(name : T, hasDollar : Boolean, isNullable : Boolean) : Identifier<T> {
val __ = Identifier(name, hasDollar)
__.myNullable = isNullable
return __
@@ -28,7 +28,7 @@ return __
}
public class User() {
class object {
public open fun main(args : Array<String>) {
public fun main(args : Array<String>) {
val i1 = Identifier.init<String>("name", false, true)
val i2 = Identifier.init<String>("name", false)
val i3 = Identifier.init<String>("name")
+3 -3
View File
@@ -1,12 +1,12 @@
package test
class Base() {
public open fun hashCode() : Int {
public fun hashCode() : Int {
return System.identityHashCode(this)
}
public open fun equals(o : Any) : Boolean {
public fun equals(o : Any) : Boolean {
return this.identityEquals(o)
}
public open fun toString() : String {
public fun toString() : String {
return getJavaClass<Base>.getName() + '@' + Integer.toHexString(hashCode())
}
}
@@ -1,6 +1,6 @@
package demo
class Test(i : Int) {
open fun test() {
fun test() {
val i = 10
Test(i)
}
+1 -1
View File
@@ -1,6 +1,6 @@
package demo
class Test(i : Int) {
open fun test() {
fun test() {
val b = 10
Test(b.toInt())
}
@@ -1,9 +1,9 @@
package demo
class Test() {
open fun getInteger(i : Int) : Int {
fun getInteger(i : Int) : Int {
return i
}
open fun test() {
fun test() {
val i = getInteger(10)!!
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
class Test() {
open fun getInt() : Int {
fun getInt() : Int {
val b = 10
return b.toInt()
}
@@ -10,9 +10,9 @@ var myContainer : Container = Container()
class StringContainer(s : String) {
}
class Test() {
open fun putString(s : String) {
fun putString(s : String) {
}
open fun test() {
fun test() {
putString(One.myContainer.myString)
StringContainer(One.myContainer.myString)
}
+2 -2
View File
@@ -10,9 +10,9 @@ var myContainer : Container = Container()
class IntContainer(i : Int) {
}
class Test() {
open fun putInt(i : Int) {
fun putInt(i : Int) {
}
open fun test() {
fun test() {
putInt(One.myContainer.myInt)
IntContainer(One.myContainer.myInt)
}
@@ -1,6 +1,6 @@
class Test() {
class object {
public open fun toFileSystemSafeName(name : String) : String {
public fun toFileSystemSafeName(name : String) : String {
val size = name.length()
return name
}
+1 -1
View File
@@ -8,7 +8,7 @@ var myContainer : Container = Container()
}
}
class Test() {
open fun test() {
fun test() {
val b = One.myContainer.myInt.toByte()
}
}
@@ -5,7 +5,7 @@ import java.io.File
*/
public class Test() {
class object {
public open fun isDir(parent : File) : Boolean {
public fun isDir(parent : File) : Boolean {
if (parent == null || !parent.exists())
{
return false
+1 -1
View File
@@ -8,7 +8,7 @@ var myContainer : Container = Container()
}
}
class Test() {
open fun test() {
fun test() {
if (One.myContainer.myBoolean)
System.out.println("Ok")
val s = (if (One.myContainer.myBoolean)
+1 -1
View File
@@ -1,5 +1,5 @@
class Test() {
open fun test() {
fun test() {
val res = true
res = res and false
res = res or false
+2 -2
View File
@@ -10,9 +10,9 @@ this.code = code
}
}
class Base() {
open fun test() {
fun test() {
}
open fun toString() : String {
fun toString() : String {
return "BASE"
}
}
+1 -1
View File
@@ -2,7 +2,7 @@ package com.voltvoodoo.saplo4j.model
import java.io.Serializable
public class Language(code : String) : Serializable {
protected var code : String = 0
public open fun equals(other : Language) : Boolean {
public fun equals(other : Language) : Boolean {
return other.toString().equals(this.toString())
}
{
+1 -1
View File
@@ -1,6 +1,6 @@
package demo
class Test() {
open fun test() : String {
fun test() : String {
val s1 = ""
val s2 = ""
val s3 = ""
+1 -1
View File
@@ -1,7 +1,7 @@
package demo
class Program() {
class object {
public open fun main(args : Array<String>) {
public fun main(args : Array<String>) {
System.out.println("Halo!")
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
class Test() {
class object {
public open fun getInt(i : Int) : Int {
public fun getInt(i : Int) : Int {
when (i) {
0 -> {
return 0
+1 -1
View File
@@ -1,6 +1,6 @@
package demo
class Test() {
open fun test() {
fun test() {
for (i in 0..10 - 1) {
System.out.println(i)
}
@@ -1,6 +1,6 @@
import java.util.Calendar
abstract class MyCalendar() : Calendar() {
public open fun foo() {
public fun foo() {
val i = Calendar.ALL_STYLES
}
}
@@ -3,7 +3,7 @@ class Test() : java.lang.Iterable<String> {
public override fun iterator() : java.util.Iterator<String> {
return null
}
public open fun push(i : java.util.Iterator<String>) : java.util.Iterator<String> {
public fun push(i : java.util.Iterator<String>) : java.util.Iterator<String> {
val j = i
return j
}
@@ -12,7 +12,7 @@ class FullTest() : java.lang.Iterable<String> {
public override fun iterator() : java.util.Iterator<String> {
return null
}
public open fun push(i : java.util.Iterator<String>) : java.util.Iterator<String> {
public fun push(i : java.util.Iterator<String>) : java.util.Iterator<String> {
val j = i
return j
}
+1 -1
View File
@@ -1,6 +1,6 @@
import java.util.*
public class ForEach() {
public open fun test() {
public fun test() {
val xs = ArrayList<Any>()
val ys = LinkedList<Any>()
for (x in xs)
+1 -1
View File
@@ -1,6 +1,6 @@
import java.util.*
public class Lists() {
public open fun test() {
public fun test() {
val xs = ArrayList<Any>()
val ys = LinkedList<Any>()
val zs = ArrayList<Any>()
@@ -1,5 +1,5 @@
class Test() {
open fun test() {
fun test() {
val c1 = 'c'
val c2 = 'C'
}
@@ -1,6 +1,6 @@
package demo
class Test() {
open fun test() {
fun test() {
val name = "$$$$"
name = name.replaceAll("\\$[0-9]+", "\\$")
val c = '$'
@@ -1,5 +1,5 @@
class Test() {
open fun test() {
fun test() {
val l1 = 10
val d1 = 10.0
val f1 = 10.0.toFloat()
@@ -7,7 +7,7 @@ val l2 = 10
val d2 = 10.0
val f2 = 10.0.toFloat()
}
open fun testBoxed() {
fun testBoxed() {
val l1 = 10
val d1 = 10.0
val f1 = 10.0.toFloat()
@@ -1,5 +1,5 @@
class Test() {
open fun test() {
fun test() {
val i1 = 33
val i2 = 51
}
@@ -1,5 +1,5 @@
class Test() {
open fun test() {
fun test() {
val i1 = 37
val i2 = 26
}
@@ -1,5 +1,5 @@
class Test() {
open fun test() {
fun test() {
val t1 = true
val t2 = true
val f1 = false
@@ -1,10 +1,10 @@
package demo
class Map() {
open fun put<K, V>(k : K, v : V) {
fun put<K, V>(k : K, v : V) {
}
}
class U() {
open fun test() {
fun test() {
val m = Map()
m.put<String, Int>("10", 10)
}
@@ -1,6 +1,6 @@
package test
class User() {
open fun main() {
fun main() {
val list = java.util.LinkedList()
}
}
@@ -1,6 +1,6 @@
package test
class User() {
open fun main() {
fun main() {
val list = java.util.LinkedList()
}
}
@@ -1,6 +1,6 @@
import java.util.LinkedList
class User() {
open fun main() {
fun main() {
val list = LinkedList<String>()
}
}
@@ -2,7 +2,7 @@ package org.test
class Library() {
}
class User() {
open fun main() {
fun main() {
val lib = Library()
}
}
@@ -4,7 +4,7 @@ class InnerClass() {
}
}
class User() {
open fun main() {
fun main() {
val outerObject = OuterClass()
val innerObject = outerObject.InnerClass()
}
@@ -3,7 +3,7 @@ import java.util.LinkedList
class Member() {
}
class User() {
open fun main() {
fun main() {
val members = LinkedList<Member>()
members.add(Member())
}
@@ -6,7 +6,7 @@ class Bar() {
}
}
class User() {
open fun main() {
fun main() {
val boo = Foo.Bar()
}
}
@@ -1,6 +1,6 @@
package demo
class WindowAdapter() {
public open fun windowClosing() {
public fun windowClosing() {
}
}
public class Client() : Frame() {
@@ -1,7 +1,7 @@
package demo
import java.util.HashMap
class Test() {
open fun main() {
fun main() {
val commonMap = HashMap<String, Int>()
val rawMap = HashMap<String, Int>()
val superRawMap = HashMap()
@@ -5,7 +5,7 @@ System.out.println(e)
}
}
class Test() {
open fun main() {
fun main() {
val raw1 = Collection(1)
val raw2 = Collection<Int>(1)
val raw3 = Collection<String>("1")
@@ -1,7 +1,7 @@
package demo
import java.util.LinkedList
class Test() {
open fun main() {
fun main() {
val common = LinkedList<String>()
val raw = LinkedList<String>()
val superRaw = LinkedList()
@@ -1,10 +1,10 @@
package demo
class TestT() {
open fun getT<T>() {
fun getT<T>() {
}
}
class U() {
open fun main() {
fun main() {
val t = TestT()
t.getT<String>()
t.getT<Int>()
@@ -1,9 +1,9 @@
class Base() {
open fun foo()
fun foo()
}
class A() : Base() {
class C() {
open fun test() {
fun test() {
super@A.foo()
}
}
@@ -1,5 +1,5 @@
class B(i : Int) {
open fun call() : Int {
fun call() : Int {
return 1
}
}
@@ -1,10 +1,10 @@
package demo
public class SwitchDemo() {
class object {
public open fun print(o : Any) {
public fun print(o : Any) {
System.out.println(o)
}
public open fun test(i : Int) {
public fun test(i : Int) {
val monthString = "<empty>"
when (i) {
1 -> {
@@ -80,7 +80,7 @@ monthString = "Invalid month"
}
System.out.println(monthString)
}
public open fun main(args : Array<String>) {
public fun main(args : Array<String>) {
for (i in 1..12) test(i)
}
}
@@ -1,6 +1,6 @@
public class NonDefault() {
class object {
public open fun main(args : Array<String>) {
public fun main(args : Array<String>) {
val value = 3
val valueString = ""
when (value) {
@@ -1,7 +1,7 @@
package switch_demo
public class SwitchDemo() {
class object {
public open fun main(args : Array<String>) {
public fun main(args : Array<String>) {
val month = 8
val monthString : String
when (month) {
+1 -1
View File
@@ -1,7 +1,7 @@
package switch_demo
public class SwitchDemo() {
class object {
public open fun main(args : Array<String>) {
public fun main(args : Array<String>) {
val month = 8
val monthString : String
when (month) {
@@ -1,6 +1,6 @@
public class NonDefault() {
class object {
public open fun main(args : Array<String>) {
public fun main(args : Array<String>) {
val value = 3
val valueString = ""
when (value) {
@@ -1,10 +1,10 @@
class Base() {
open fun foo() {
fun foo() {
}
}
class A() : Base() {
class C() {
open fun test() {
fun test() {
this@A.foo()
}
}
@@ -1,4 +1,4 @@
trait INode {
open fun getTag() : Tag
open fun toKotlin() : String
fun getTag() : Tag
fun toKotlin() : String
}