J2K: do not produce redundant "internal" words for members in an internal class

This commit is contained in:
Valentin Kipyatkov
2015-09-16 21:50:01 +03:00
parent 367b32c309
commit 0cc2158ec1
260 changed files with 459 additions and 448 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
import java.io.File
internal fun foo(file: File): List<String> {
fun foo(file: File): List<String> {
return emptyList()
}
@@ -1,3 +1,3 @@
internal fun foo(p: Dependency): Double {
fun foo(p: Dependency): Double {
return p.getInt().toDouble() // explicit conversion to Double must be added on conversion (if type Dependency) is correctly resolved
}
@@ -1,10 +1,10 @@
class A {
internal fun foo() {
fun foo() {
}
internal fun bar() {
fun bar() {
}
@@ -1,3 +1,3 @@
package to
internal fun foo(p: Int)
fun foo(p: Int)
@@ -19,16 +19,12 @@ package org.jetbrains.kotlin.j2k
import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi.*
import org.jetbrains.kotlin.j2k.ast.*
import org.jetbrains.kotlin.j2k.ast.Class
import org.jetbrains.kotlin.j2k.usageProcessing.AccessorToPropertyProcessing
import org.jetbrains.kotlin.j2k.usageProcessing.MethodIntoObjectProcessing
import org.jetbrains.kotlin.j2k.usageProcessing.ToObjectWithOnlyMethodsProcessing
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.kotlin.name.SpecialNames
import java.util.ArrayList
import java.util.HashMap
import java.util.HashSet
import java.util.LinkedHashMap
import java.util.*
class FieldCorrectionInfo(val name: String, val access: Modifier?, val setterAccess: Modifier?) {
val identifier = Identifier(name).assignNoPrototype()
@@ -189,11 +185,11 @@ class ClassBodyConverter(private val psiClass: PsiClass,
membersToRemove.add(setterInfo.method)
}
val getterAccess = converter.convertModifiers(getterInfo.method).accessModifier()
val getterAccess = converter.convertModifiers(getterInfo.method, isOpenClass).accessModifier()
val setterAccess = if (setterInfo != null)
converter.convertModifiers(setterInfo.method).accessModifier()
converter.convertModifiers(setterInfo.method, isOpenClass).accessModifier()
else
converter.convertModifiers(field).accessModifier()
converter.convertModifiers(field, false).accessModifier()
//TODO: check that setter access is not bigger
fieldCorrections[field] = FieldCorrectionInfo(propertyName, getterAccess, setterAccess)
@@ -71,7 +71,7 @@ class CodeConverter(
!variable.hasWriteAccesses(converter.referenceSearcher, variable.getContainingMethod())
return LocalVariable(variable.declarationIdentifier(),
converter.convertAnnotations(variable),
converter.convertModifiers(variable),
converter.convertModifiers(variable, false),
converter.variableTypeToDeclare(variable, settings.specifyLocalVariableTypeByDefault, isVal),
convertExpression(variable.getInitializer(), variable.getType()),
isVal).assignPrototype(variable)
@@ -19,10 +19,7 @@ package org.jetbrains.kotlin.j2k
import com.intellij.psi.*
import com.intellij.psi.util.PsiUtil
import org.jetbrains.kotlin.j2k.ast.*
import org.jetbrains.kotlin.j2k.ast.Annotation
import java.util.ArrayList
import java.util.HashMap
import java.util.HashSet
import java.util.*
class ConstructorConverter(
private val psiClass: PsiClass,
@@ -208,7 +205,7 @@ class ConstructorConverter(
val accessModifiers = if (fieldCorrection != null)
Modifiers(listOf()).with(fieldCorrection.access).assignNoPrototype()
else
converter.convertModifiers(field).filter { it in ACCESS_MODIFIERS }
converter.convertModifiers(field, false).filter { it in ACCESS_MODIFIERS }
FunctionParameter(name,
type,
if (field.isVal(converter.referenceSearcher)) FunctionParameter.VarValModifier.Val else FunctionParameter.VarValModifier.Var,
+33 -15
View File
@@ -162,7 +162,7 @@ class Converter private constructor(
}
val annotations = convertAnnotations(psiClass)
var modifiers = convertModifiers(psiClass)
var modifiers = convertModifiers(psiClass, false)
val typeParameters = convertTypeParameterList(psiClass.getTypeParameterList())
val extendsTypes = convertToNotNullableTypes(psiClass.getExtendsListTypes())
val implementsTypes = convertToNotNullableTypes(psiClass.getImplementsListTypes())
@@ -282,7 +282,7 @@ class Converter private constructor(
return Class(psiClass.declarationIdentifier(),
convertAnnotations(psiClass),
convertModifiers(psiClass).with(Modifier.ANNOTATION).without(Modifier.ABSTRACT),
convertModifiers(psiClass, false).with(Modifier.ANNOTATION).without(Modifier.ABSTRACT),
TypeParameterList.Empty,
listOf(),
null,
@@ -292,13 +292,14 @@ class Converter private constructor(
public fun convertInitializer(initializer: PsiClassInitializer): Initializer {
return Initializer(deferredElement { codeConverter -> codeConverter.convertBlock(initializer.getBody()) },
convertModifiers(initializer)).assignPrototype(initializer)
convertModifiers(initializer, false)).assignPrototype(initializer)
}
public fun convertField(field: PsiField, correction: FieldCorrectionInfo?): Member {
val annotations = convertAnnotations(field)
var modifiers = convertModifiers(field)
var modifiers = convertModifiers(field, false)
if (correction != null) {
modifiers = modifiers.without(modifiers.accessModifier()).with(correction.access)
}
@@ -362,10 +363,7 @@ class Converter private constructor(
val annotations = convertAnnotations(method) + convertThrows(method)
var modifiers = convertModifiers(method)
if (needOpenModifier(method, isInOpenClass, modifiers)) {
modifiers = modifiers.with(Modifier.OPEN)
}
var modifiers = convertModifiers(method, isInOpenClass)
val statementsToInsert = ArrayList<Statement>()
for (parameter in method.getParameterList().getParameters()) {
@@ -392,11 +390,6 @@ class Converter private constructor(
constructorConverter.convertConstructor(method, annotations, modifiers, membersToRemove!!, postProcessBody)
}
else {
val isOverride = isOverride(method)
if (isOverride) {
modifiers = modifiers.with(Modifier.OVERRIDE)
}
val containingClass = method.getContainingClass()
if (settings.openByDefault) {
@@ -555,9 +548,34 @@ class Converter private constructor(
return Identifier(identifier.getText()!!).assignPrototype(identifier)
}
public fun convertModifiers(owner: PsiModifierListOwner): Modifiers {
return Modifiers(MODIFIERS_MAP.filter { owner.hasModifierProperty(it.first) }.map { it.second })
public fun convertModifiers(owner: PsiModifierListOwner, isMethodInOpenClass: Boolean): Modifiers {
var modifiers = Modifiers(MODIFIERS_MAP.filter { owner.hasModifierProperty(it.first) }.map { it.second })
.assignPrototype(owner.getModifierList(), CommentsAndSpacesInheritance.NO_SPACES)
if (owner is PsiMethod) {
val isOverride = isOverride(owner)
if (isOverride) {
modifiers = modifiers.with(Modifier.OVERRIDE)
}
if (needOpenModifier(owner, isMethodInOpenClass, modifiers)) {
modifiers = modifiers.with(Modifier.OPEN)
}
modifiers = modifiers.adaptForContainingClassVisibility(owner.containingClass)
}
else if (owner is PsiField) {
modifiers = modifiers.adaptForContainingClassVisibility(owner.containingClass)
}
return modifiers
}
// to convert package local members in package local class into public member (when it's not override, open or abstract)
private fun Modifiers.adaptForContainingClassVisibility(containingClass: PsiClass?): Modifiers {
if (containingClass == null || !containingClass.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) return this
if (!contains(Modifier.INTERNAL) || contains(Modifier.OVERRIDE) || contains(Modifier.OPEN) || contains(Modifier.ABSTRACT)) return this
return without(Modifier.INTERNAL).with(Modifier.PUBLIC)
}
public fun convertAnonymousClassBody(anonymousClass: PsiAnonymousClass): AnonymousClassBody {
+4 -4
View File
@@ -17,16 +17,16 @@ internal class C {
@Anon5(1)
private val field2 = 0
@Anon5(1) internal var field3 = 0
@Anon5(1) var field3 = 0
@Anon5(1)
internal var field4 = 0
var field4 = 0
@Anon6
internal fun foo(@Deprecated("") p1: Int, @Deprecated("") @Anon5(2) p2: Char) {
fun foo(@Deprecated("") p1: Int, @Deprecated("") @Anon5(2) p2: Char) {
@Deprecated("") @Anon5(3) val c = 'a'
}
@Anon5(1) internal fun bar() {
@Anon5(1) fun bar() {
}
}
@@ -3,13 +3,13 @@
package test
internal class Foo {
internal fun execute() {
fun execute() {
}
}
internal class Bar {
internal var fooNotNull = Foo()
internal var fooNullable: Foo? = null
var fooNotNull = Foo()
var fooNullable: Foo? = null
}
internal class Test {
+1 -1
View File
@@ -1,5 +1,5 @@
internal class Test {
internal var str: String
var str: String
init {
str = "Ola"
@@ -1,5 +1,5 @@
internal object Test {
internal var str: String
var str: String
init {
str = "Ola"
+1 -1
View File
@@ -1,2 +1,2 @@
internal fun fromArrayToCollection(a: Array<Foo>) {
fun fromArrayToCollection(a: Array<Foo>) {
}
@@ -3,7 +3,7 @@
import java.util.HashSet
internal class Foo {
internal fun foo(o: HashSet<Any?>?) {
fun foo(o: HashSet<Any?>?) {
val o2: HashSet<Any?>? = o
var foo: Int = 0
foo = o2!!.size()
@@ -1,7 +1,7 @@
import java.util.HashSet
internal class Foo {
internal fun foo(o: HashSet<Any>) {
fun foo(o: HashSet<Any>) {
val o2 = o
var foo = 0
foo = o2.size()
+1 -1
View File
@@ -1,4 +1,4 @@
internal fun foo() {
fun foo() {
run {
val a = 1
bar(a)
+1 -1
View File
@@ -1,7 +1,7 @@
import java.util.ArrayList
internal class Boxing {
internal fun test() {
fun test() {
var i: Int? = 0
val n = 0.0f
i = 1
+1 -1
View File
@@ -2,7 +2,7 @@
package demo
internal class Test {
internal fun test() {
fun test() {
val i = Integer.valueOf(100)
val s = 3
val ss = java.lang.Short.valueOf(s)
@@ -1,10 +1,10 @@
// ERROR: Property must be initialized or be abstract
internal object Library {
internal val ourOut: java.io.PrintStream
val ourOut: java.io.PrintStream
}
internal class User {
internal fun main() {
fun main() {
Library.ourOut.print(1)
}
}
@@ -1,14 +1,14 @@
internal object Library {
internal fun call() {
fun call() {
}
internal fun getString(): String {
fun getString(): String {
return ""
}
}
internal class User {
internal fun main() {
fun main() {
Library.call()
Library.getString().isEmpty()
}
@@ -1,16 +1,16 @@
// !forceNotNullTypes: false
// !specifyLocalVariableTypeByDefault: true
internal class Library {
internal fun call() {
fun call() {
}
internal fun getString(): String? {
fun getString(): String? {
return ""
}
}
internal class User {
internal fun main() {
fun main() {
val lib: Library = Library()
lib.call()
lib.getString()!!.isEmpty()
@@ -1,14 +1,14 @@
internal class Library {
internal fun call() {
fun call() {
}
internal fun getString(): String {
fun getString(): String {
return ""
}
}
internal class User {
internal fun main() {
fun main() {
val lib = Library()
lib.call()
lib.getString().isEmpty()
@@ -4,7 +4,7 @@ internal class Library {
}
internal class User {
internal fun main() {
fun main() {
Library().myString.isEmpty()
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
internal abstract class A {
internal abstract fun callme()
internal fun callmetoo() {
fun callmetoo() {
print("This is a concrete method.")
}
}
+3 -3
View File
@@ -1,10 +1,10 @@
internal class T {
internal fun main() {
fun main() {
}
internal fun i(): Int {
fun i(): Int {
}
internal fun s(): String {
fun s(): String {
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
internal class T {
internal var a = "abc"
internal var b = 10
var a = "abc"
var b = 10
}
@@ -1,5 +1,5 @@
internal class T {
internal var a: String
internal var b: String
internal var c = "abc"
var a: String
var b: String
var c = "abc"
}
+3 -3
View File
@@ -5,15 +5,15 @@ package demo
import java.util.HashMap
internal class Test {
internal constructor() {
constructor() {
}
internal constructor(s: String) {
constructor(s: String) {
}
}
internal class User {
internal fun main() {
fun main() {
val m = HashMap(1)
val m2 = HashMap(10)
+1 -1
View File
@@ -5,6 +5,6 @@ internal open class Base {
}
internal class Derived : Base() {
internal fun foo() {
fun foo() {
}
}
@@ -1,9 +1,9 @@
internal class S {
internal fun sB(): Boolean {
fun sB(): Boolean {
return true
}
companion object {
internal var myI = 10
var myI = 10
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
internal object S {
internal fun staticF(): Boolean {
fun staticF(): Boolean {
return true
}
}
@@ -1,10 +1,10 @@
internal class S {
internal fun sB(): Boolean {
fun sB(): Boolean {
return true
}
companion object {
internal fun sI(): Int {
fun sI(): Int {
return 1
}
}
+2 -2
View File
@@ -1,9 +1,9 @@
internal object S {
internal fun sB(): Boolean {
fun sB(): Boolean {
return true
}
internal fun sI(): Int {
fun sI(): Int {
return 1
}
}
@@ -1,7 +1,7 @@
import java.io.File
internal class C {
internal fun foo(file: File): String {
fun foo(file: File): String {
val parent = file.parentFile ?: return ""
return parent.name
}
@@ -1,5 +1,5 @@
internal class C {
internal fun foo(s: String?): String {
fun foo(s: String?): String {
return s ?: ""
}
}
@@ -1,7 +1,7 @@
import java.io.File
internal class C {
internal fun foo(file: File?) {
fun foo(file: File?) {
file?.delete()
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
internal class C {
internal fun foo(o: Any) {
fun foo(o: Any) {
if (o !is String) return
println("String")
}
@@ -1,5 +1,5 @@
internal class C {
internal fun foo(o: Any) {
fun foo(o: Any) {
if (o is String) {
val l = o.length()
}
@@ -1,5 +1,5 @@
internal class C {
internal fun foo(o: Any) {
fun foo(o: Any) {
if (o is String) {
val l = o.length()
val substring = o.substring(l - 2)
+1 -1
View File
@@ -8,7 +8,7 @@ import java.util.ArrayList // we need ArrayList
// let's declare a class:
internal class A /* just a sample name*/ : Runnable /* let's implement Runnable */ {
internal fun foo/* again a sample name */(p: Int /* parameter p */, c: Char /* parameter c */) {
fun foo/* again a sample name */(p: Int /* parameter p */, c: Char /* parameter c */) {
// let's print something:
println("1") // print 1
println("2") // print 2
+2 -2
View File
@@ -3,13 +3,13 @@
package foo
internal class A {
internal fun /* nothing to return */ foo(/* no parameters at all */) {
fun /* nothing to return */ foo(/* no parameters at all */) {
// let declare a variable
// with 2 comments before
val /*int*/ a /* it's a */ = 2 /* it's 2 */ + 1 /* it's 1 */ // variable a declared
} // end of foo
internal fun /* we return int*/ foo(/*int*/ p: Int/* parameter p */): Int {
fun /* we return int*/ foo(/*int*/ p: Int/* parameter p */): Int {
/* body is empty */
}
@@ -1,5 +1,5 @@
internal class A// this is a primary constructor
@JvmOverloads internal constructor(p: Int = 1) {
@JvmOverloads constructor(p: Int = 1) {
private val v: Int
init {
@@ -7,7 +7,7 @@ internal class A// this is a primary constructor
} // end of primary constructor body
// this is a secondary constructor 2
internal constructor(s: String) : this(s.length()) {
constructor(s: String) : this(s.length()) {
} // end of secondary constructor 2 body
}// this is a secondary constructor 1
// end of secondary constructor 1 body
@@ -16,6 +16,6 @@ internal class B// this constructor will disappear
(private val x: Int) // end of constructor body
{
internal fun foo() {
fun foo() {
}
}
@@ -1,4 +1,4 @@
internal fun foo(b: Boolean) {
fun foo(b: Boolean) {
if (b)
println("true")
else
+1 -1
View File
@@ -1,6 +1,6 @@
package pack
internal class C @JvmOverloads internal constructor(arg1: Int, arg2: Int = 0, arg3: Int = 0)
internal class C @JvmOverloads constructor(arg1: Int, arg2: Int = 0, arg3: Int = 0)
object User {
fun main() {
@@ -1,13 +1,13 @@
internal class C internal constructor(internal val myArg1: Int) {
internal var myArg2: Int = 0
internal var myArg3: Int = 0
internal class C(val myArg1: Int) {
var myArg2: Int = 0
var myArg3: Int = 0
internal constructor(arg1: Int, arg2: Int, arg3: Int) : this(arg1) {
constructor(arg1: Int, arg2: Int, arg3: Int) : this(arg1) {
myArg2 = arg2
myArg3 = arg3
}
internal constructor(arg1: Int, arg2: Int) : this(arg1) {
constructor(arg1: Int, arg2: Int) : this(arg1) {
myArg2 = arg2
myArg3 = 0
}
+3 -3
View File
@@ -1,10 +1,10 @@
internal class C internal constructor(arg1: Int, arg2: Int, arg3: Int) {
internal class C(arg1: Int, arg2: Int, arg3: Int) {
internal constructor(arg1: Int, arg2: Int) : this(arg1, arg2, 0) {
constructor(arg1: Int, arg2: Int) : this(arg1, arg2, 0) {
println()
}
internal constructor(arg1: Int) : this(arg1, 0) {
constructor(arg1: Int) : this(arg1, 0) {
println()
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
package org.test.customer
internal class Customer internal constructor(val firstName: String, val lastName: String) {
internal class Customer(val firstName: String, val lastName: String) {
init {
doSmthBefore()
@@ -1,3 +1,3 @@
internal open class Base internal constructor(o: Any, l: Int)
internal open class Base(o: Any, l: Int)
internal class C(private val string: String) : Base(string, string.length())
@@ -1,12 +1,12 @@
internal class C1 internal constructor(arg1: Int,
arg2: Int,
arg3: Int) {
internal class C1(arg1: Int,
arg2: Int,
arg3: Int) {
internal constructor(x: Int,
y: Int) : this(x, x + y, 0) {
constructor(x: Int,
y: Int) : this(x, x + y, 0) {
}
}
internal class C2 internal constructor(private val arg1: Int,
private val arg2: Int,
arg3: Int)
internal class C2(private val arg1: Int,
private val arg2: Int,
arg3: Int)
@@ -1,10 +1,10 @@
internal class C internal constructor(private val arg1: Int, private val arg2: Int, private val arg3: Int) {
internal class C(private val arg1: Int, private val arg2: Int, private val arg3: Int) {
internal fun foo(p: Int): Int {
fun foo(p: Int): Int {
return p
}
internal constructor(arg1: Int, arg2: Int, other: C) : this(arg1, arg2, 0) {
constructor(arg1: Int, arg2: Int, other: C) : this(arg1, arg2, 0) {
println(foo(1) + this.foo(2) + other.foo(3) + staticFoo(4) + C.staticFoo(5))
}
@@ -1,6 +1,6 @@
internal class A @JvmOverloads internal constructor(nested: A.Nested = A.Nested(A.Nested.FIELD)) {
internal class A @JvmOverloads constructor(nested: A.Nested = A.Nested(A.Nested.FIELD)) {
internal class Nested internal constructor(p: Int) {
internal class Nested(p: Int) {
companion object {
val FIELD = 0
@@ -1,9 +1,9 @@
// ERROR: Property must be initialized or be abstract
import A.Nested
internal class A @JvmOverloads internal constructor(nested: Nested = Nested(Nested.FIELD)) {
internal class A @JvmOverloads constructor(nested: Nested = Nested(Nested.FIELD)) {
internal class Nested internal constructor(p: Int) {
internal class Nested(p: Int) {
companion object {
val FIELD = 0
@@ -12,5 +12,5 @@ internal class A @JvmOverloads internal constructor(nested: Nested = Nested(Nest
}
internal class B {
internal var nested: Nested
var nested: Nested
}
@@ -3,9 +3,9 @@ package pack
import pack.A.Nested
internal class A @JvmOverloads internal constructor(nested: Nested = Nested(Nested.FIELD)) {
internal class A @JvmOverloads constructor(nested: Nested = Nested(Nested.FIELD)) {
internal class Nested internal constructor(p: Int) {
internal class Nested(p: Int) {
companion object {
val FIELD = 0
@@ -14,5 +14,5 @@ internal class A @JvmOverloads internal constructor(nested: Nested = Nested(Nest
}
internal class B {
internal var nested: Nested
var nested: Nested
}
@@ -3,9 +3,9 @@ package pack
import pack.A.*
internal class A @JvmOverloads internal constructor(nested: Nested = Nested(Nested.FIELD)) {
internal class A @JvmOverloads constructor(nested: Nested = Nested(Nested.FIELD)) {
internal class Nested internal constructor(p: Int) {
internal class Nested(p: Int) {
companion object {
val FIELD = 0
@@ -14,5 +14,5 @@ internal class A @JvmOverloads internal constructor(nested: Nested = Nested(Nest
}
internal class B {
internal var nested: Nested
var nested: Nested
}
@@ -1,6 +1,6 @@
internal open class Base internal constructor(nested: Base.Nested) {
internal open class Base(nested: Base.Nested) {
internal class Nested internal constructor(p: Int) {
internal class Nested(p: Int) {
companion object {
val FIELD = 0
@@ -8,4 +8,4 @@ internal open class Base internal constructor(nested: Base.Nested) {
}
}
internal class Derived internal constructor() : Base(Base.Nested(Base.Nested.FIELD))
internal class Derived : Base(Base.Nested(Base.Nested.FIELD))
+3 -3
View File
@@ -1,14 +1,14 @@
internal open class Base
internal class C : Base {
internal constructor(arg1: Int, arg2: Int, arg3: Int) {
constructor(arg1: Int, arg2: Int, arg3: Int) {
}
internal constructor(arg1: Int, arg2: Int) : this(arg1, arg2, 0) {
constructor(arg1: Int, arg2: Int) : this(arg1, arg2, 0) {
println()
}
internal constructor(arg: Int) {
constructor(arg: Int) {
println(arg)
}
}
@@ -1,7 +1,7 @@
package pack
internal class C @JvmOverloads internal constructor(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
internal class C @JvmOverloads constructor(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
internal constructor(a: Int) : this(a, 0, 0, 0, 1) {
constructor(a: Int) : this(a, 0, 0, 0, 1) {
}
}
@@ -1,10 +1,10 @@
package pack
internal class C @JvmOverloads internal constructor(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
internal class C @JvmOverloads constructor(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
internal constructor(a1: Int, b1: Int, c1: Int) : this(a1, b1, c1, 0, 0) {
constructor(a1: Int, b1: Int, c1: Int) : this(a1, b1, c1, 0, 0) {
}
internal constructor(b: Byte) : this(b.toInt(), 0, 0, 0, 0) {
constructor(b: Byte) : this(b.toInt(), 0, 0, 0, 0) {
}
}
@@ -1,7 +1,7 @@
package pack
internal class C @JvmOverloads internal constructor(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
internal class C @JvmOverloads constructor(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0) {
internal constructor(a: Int, b: Int, c: Int) : this(b, a, c, 0, 0) {
constructor(a: Int, b: Int, c: Int) : this(b, a, c, 0, 0) {
}
}
@@ -1,3 +1,3 @@
package pack
internal class C @JvmOverloads internal constructor(a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
internal class C @JvmOverloads constructor(a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
@@ -1,3 +1,3 @@
package pack
internal class C @JvmOverloads internal constructor(a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
internal class C @JvmOverloads constructor(a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
@@ -1,4 +1,4 @@
internal class C @JvmOverloads internal constructor(arg1: Int, arg2: Int = 0, arg3: Int = 0) {
internal class C @JvmOverloads constructor(arg1: Int, arg2: Int = 0, arg3: Int = 0) {
private val field: Int
init {
@@ -10,7 +10,7 @@ internal class C @JvmOverloads internal constructor(arg1: Int, arg2: Int = 0, ar
arg3++
}
internal constructor(arg1: Int, arg2: Int) : this(arg1, arg2, 0) {
constructor(arg1: Int, arg2: Int) : this(arg1, arg2, 0) {
var arg2 = arg2
arg2++
}
@@ -1,12 +1,12 @@
internal class C internal constructor(private val arg1: Int, private val arg2: Int, private val arg3: Int) {
internal class C(private val arg1: Int, private val arg2: Int, private val arg3: Int) {
internal constructor(arg1: Int, arg2: Int, other: C) : this(arg1, arg2, 0) {
constructor(arg1: Int, arg2: Int, other: C) : this(arg1, arg2, 0) {
println(this.arg1 + other.arg2)
}
}
internal class User {
internal fun foo() {
fun foo() {
val c1 = C(100, 100, 100)
val c2 = C(100, 100, c1)
}
@@ -48,7 +48,7 @@ internal class Outer {
}
}
internal fun foo() {
fun foo() {
val inner1 = Inner1(1)
val inner2 = Inner2(2)
val inner3 = Inner3(3)
@@ -48,7 +48,7 @@ internal object Outer {
}
}
internal fun foo() {
fun foo() {
val nested1 = Nested1(1)
val nested2 = Nested2(2)
val nested3 = Nested3(3)
@@ -6,7 +6,7 @@ internal class A() {
protected constructor(c: Char) : this() {
}
internal constructor(f: Float) : this() {
constructor(f: Float) : this() {
}
private constructor(d: Double) : this() {
@@ -1,6 +1,6 @@
internal class C internal constructor() {
internal class C() {
internal constructor(p: Int) : this() {
constructor(p: Int) : this() {
println(staticField1 + C.staticField2)
}
+1 -1
View File
@@ -2,6 +2,6 @@
* [C.foo]
*/
internal class C {
internal fun foo(i: Int) {
fun foo(i: Int) {
}
}
+1 -1
View File
@@ -2,6 +2,6 @@
* [the best foo method ever][C.foo]
*/
internal class C {
internal fun foo(i: Int) {
fun foo(i: Int) {
}
}
+1 -1
View File
@@ -2,6 +2,6 @@
* @see C.foo
*/
internal class C {
internal fun foo(i: Int) {
fun foo(i: Int) {
}
}
@@ -7,4 +7,4 @@ open class Base internal constructor(x: Int) {
}
}
internal class Derived internal constructor(b: Base) : Base(b.x)
internal class Derived(b: Base) : Base(b.x)
@@ -10,7 +10,7 @@ open class AAA {
}
internal class BBB : AAA() {
internal fun bar() {
fun bar() {
println(x)
x = 10
}
@@ -1,13 +1,13 @@
internal class C internal constructor(internal val arg1: Int) {
internal var arg2: Int = 0
internal var arg3: Int = 0
internal class C(val arg1: Int) {
var arg2: Int = 0
var arg3: Int = 0
internal constructor(arg1: Int, arg2: Int, arg3: Int) : this(arg1) {
constructor(arg1: Int, arg2: Int, arg3: Int) : this(arg1) {
this.arg2 = arg2
this.arg3 = arg3
}
internal constructor(arg1: Int, arg2: Int) : this(arg1) {
constructor(arg1: Int, arg2: Int) : this(arg1) {
this.arg2 = arg2
arg3 = 0
}
@@ -11,7 +11,7 @@ class AAA {
}
internal class B {
internal fun foo(a: AAA) {
fun foo(a: AAA) {
a.x = a.x + 1
}
}
@@ -1,7 +1,7 @@
internal class C {
val default = 0
internal fun foo() {
fun foo() {
println(default)
}
}
@@ -1,7 +1,7 @@
internal class C {
val `this` = 0
internal fun foo() {
fun foo() {
println(`this`)
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ enum class TestEnum {
}
internal class Go {
internal fun fn() {
fun fn() {
val x = TestEnum.parse()
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
internal enum class E {
FOO;
internal fun foo() {
fun foo() {
FOO.toString()
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ internal enum class EE {
}
internal class X {
internal fun foo(i1: I?, i2: I?, s1: String, s2: String, c1: C, c2: C, i: Int, o1: O, o2: O, e1: E, e2: E, bb1: BB, bb2: BB, arr1: IntArray, arr2: IntArray, ee1: EE?, ee2: EE) {
fun foo(i1: I?, i2: I?, s1: String, s2: String, c1: C, c2: C, i: Int, o1: O, o2: O, e1: E, e2: E, bb1: BB, bb2: BB, arr1: IntArray, arr2: IntArray, ee1: EE?, ee2: EE) {
if (i1 === i2) return
if (s1 === s2) return
if (c1 == c2) return
+2 -2
View File
@@ -1,11 +1,11 @@
internal interface I
internal class C {
internal fun foo1(i1: I, i2: I): Boolean {
fun foo1(i1: I, i2: I): Boolean {
return i1 == i2
}
internal fun foo2(i1: I, i2: I): Boolean {
fun foo2(i1: I, i2: I): Boolean {
return i1 != i2
}
}
+2 -2
View File
@@ -1,9 +1,9 @@
internal class C {
internal fun foo1(s1: String, s2: String): Boolean {
fun foo1(s1: String, s2: String): Boolean {
return s1 == s2
}
internal fun foo2(s1: String, s2: String): Boolean {
fun foo2(s1: String, s2: String): Boolean {
return s1 != s2
}
}
+1 -1
View File
@@ -3,7 +3,7 @@ internal class C {
return false
}
internal fun foo(c1: C, c2: C): Boolean {
fun foo(c1: C, c2: C): Boolean {
return c1.equals(c2)
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
internal class C {
internal fun foo(s1: String, s2: String, s3: String, s4: String): Boolean {
fun foo(s1: String, s2: String, s3: String, s4: String): Boolean {
return s1 == s2 == (s3 != s4)
}
}
+2 -2
View File
@@ -3,11 +3,11 @@ import java.util.Objects
internal interface I
internal class C {
internal fun foo1(i1: I, i2: I): Boolean {
fun foo1(i1: I, i2: I): Boolean {
return i1 == i2
}
internal fun foo2(i1: I, i2: I): Boolean {
fun foo2(i1: I, i2: I): Boolean {
return i1 != i2
}
}
+2 -2
View File
@@ -1,13 +1,13 @@
internal class A {
private var i: Int? = getByte().toInt()
internal fun foo() {
fun foo() {
i = 10
}
companion object {
internal fun getByte(): Byte {
fun getByte(): Byte {
return 0
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
// ERROR: Unresolved reference: Foo
// ERROR: Property must be initialized or be abstract
internal class C {
internal var f: Foo
var f: Foo
}
+5 -5
View File
@@ -2,24 +2,24 @@ import java.util.*
internal class A {
private val field1 = ArrayList<String>()
internal val field2: List<String> = ArrayList()
val field2: List<String> = ArrayList()
val field3 = 0
protected val field4 = 0
private var field5: List<String> = ArrayList()
internal var field6: List<String> = ArrayList()
var field6: List<String> = ArrayList()
private var field7 = 0
internal var field8 = 0
var field8 = 0
private var field9: String? = "a"
private var field10: String? = foo()
internal fun foo(): String {
fun foo(): String {
return "x"
}
internal fun bar() {
fun bar() {
field5 = ArrayList<String>()
field7++
field8++
+4 -4
View File
@@ -1,9 +1,9 @@
internal class A internal constructor(private val field6: Int, private val field8: Int, a: A) {
internal class A(private val field6: Int, private val field8: Int, a: A) {
private val field1 = 0
private val field2 = 0
private var field3 = 0
internal val field4 = 0
internal var field5 = 0
val field4 = 0
var field5 = 0
private val field7: Int
private val field9: Int
private var field10: Int = 0
@@ -18,7 +18,7 @@ internal class A internal constructor(private val field6: Int, private val field
a.field11 = 10
}
internal fun foo() {
fun foo() {
field3 = field2
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// ERROR: Unresolved reference: Foo
internal class C {
internal val f = Foo(1, 2)
val f = Foo(1, 2)
}
+1 -1
View File
@@ -1,4 +1,4 @@
// ERROR: Unresolved reference: Foo
internal class C {
internal var f = Foo(1, 2)
var f = Foo(1, 2)
}
+1 -1
View File
@@ -1,5 +1,5 @@
// ERROR: Unresolved reference: Foo
// ERROR: Property must be initialized or be abstract
internal class C {
internal var f: Foo
var f: Foo
}
@@ -1,10 +1,10 @@
// ERROR: This annotation is not applicable to target 'member property'
internal class A {
@Deprecated("")
@Volatile internal var field1 = 0
@Volatile var field1 = 0
@Transient internal var field2 = 1
@Transient var field2 = 1
// Should work even for bad modifiers
@Strictfp internal var field3 = 2.0
@Strictfp var field3 = 2.0
}
@@ -1,7 +1,7 @@
import java.lang.System
internal class C {
internal fun foo1(collection: Collection<String>) {
fun foo1(collection: Collection<String>) {
for (i in collection.indices) {
print(i)
}
+2 -2
View File
@@ -1,13 +1,13 @@
import java.util.ArrayList
internal class C {
internal fun foo1(list: MutableList<String>) {
fun foo1(list: MutableList<String>) {
for (i in list.indices) {
list.set(i, "a")
}
}
internal fun foo2(list: ArrayList<String>) {
fun foo2(list: ArrayList<String>) {
for (i in list.indices) {
list.set(i, "a")
}
+1 -1
View File
@@ -1,7 +1,7 @@
import java.util.ArrayList
internal class C {
internal fun foo(list: MutableList<String>) {
fun foo(list: MutableList<String>) {
for (i in list.indices) {
list.set(i, "a")
}
@@ -3,7 +3,7 @@ internal class X {
}
internal class C {
internal fun foo(x: X) {
fun foo(x: X) {
for (i in 0..x.length - 1) {
print(i)
}
@@ -5,7 +5,7 @@ internal class X {
}
internal class C {
internal fun foo(x: X) {
fun foo(x: X) {
for (i in 0..x.size() - 1) {
print(i)
}
+1 -1
View File
@@ -1,4 +1,4 @@
internal fun foo() {
fun foo() {
while (true) {
if (!stop()) break
}
+1 -1
View File
@@ -1,5 +1,5 @@
internal class A {
internal fun foo() {
fun foo() {
run {
var i = 1
while (i < 1000) {
+1 -1
View File
@@ -1,5 +1,5 @@
internal class A {
internal fun foo() {
fun foo() {
run {
var i = 1
var j = 0

Some files were not shown because too many files have changed in this diff Show More