J2K: adapted for default visibility modifier 'public'
This commit is contained in:
+2
-2
@@ -7,8 +7,8 @@ package foo
|
||||
import java.util.ArrayList // we need ArrayList
|
||||
|
||||
// let's declare a class:
|
||||
class A /* just a sample name*/ : Runnable /* let's implement Runnable */ {
|
||||
fun foo/* again a sample name */(p: Int /* parameter p */, c: Char /* parameter c */) {
|
||||
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 */) {
|
||||
// let's print something:
|
||||
println("1") // print 1
|
||||
println("2") // print 2
|
||||
|
||||
+5
-5
@@ -2,20 +2,20 @@
|
||||
// ERROR: A 'return' expression required in a function with a block body ('{...}')
|
||||
package foo
|
||||
|
||||
class A {
|
||||
fun /* nothing to return */ foo(/* no parameters at all */) {
|
||||
internal class A {
|
||||
internal 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
|
||||
|
||||
fun /* we return int*/ foo(/*int*/ p: Int/* parameter p */): Int {
|
||||
internal fun /* we return int*/ foo(/*int*/ p: Int/* parameter p */): Int {
|
||||
/* body is empty */
|
||||
}
|
||||
|
||||
private /*it's private*/ val field = 0
|
||||
|
||||
public /*it's public*/ fun foo(s: String): Char {
|
||||
/*it's public*/ fun foo(s: String): Char {
|
||||
}
|
||||
|
||||
protected /*it's protected*/ fun foo(c: Char) {
|
||||
@@ -23,6 +23,6 @@ class A {
|
||||
|
||||
companion object {
|
||||
|
||||
public /*it's public*//*and static*//*and final*/ val C: Int = 1
|
||||
/*it's public*//*and static*//*and final*/ val C: Int = 1
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ class B {
|
||||
private int x;
|
||||
|
||||
// this constructor will disappear
|
||||
B(int x) {
|
||||
public B(int x) {
|
||||
this.x = x;
|
||||
} // end of constructor body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A// this is a primary constructor
|
||||
JvmOverloads constructor(p: Int = 1) {
|
||||
internal class A// this is a primary constructor
|
||||
JvmOverloads internal constructor(p: Int = 1) {
|
||||
private val v: Int
|
||||
|
||||
init {
|
||||
@@ -7,15 +7,15 @@ JvmOverloads constructor(p: Int = 1) {
|
||||
} // end of primary constructor body
|
||||
|
||||
// this is a secondary constructor 2
|
||||
constructor(s: String) : this(s.length()) {
|
||||
internal constructor(s: String) : this(s.length()) {
|
||||
} // end of secondary constructor 2 body
|
||||
}// this is a secondary constructor 1
|
||||
// end of secondary constructor 1 body
|
||||
|
||||
class B// this constructor will disappear
|
||||
internal class B// this constructor will disappear
|
||||
(private val x: Int) // end of constructor body
|
||||
{
|
||||
|
||||
fun foo() {
|
||||
internal fun foo() {
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
class A {
|
||||
internal class A {
|
||||
private val isOpen = true // ideally should be atomic boolean
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
class C(private val p1: Int /* parameter p1 */ // field p1
|
||||
,
|
||||
/**
|
||||
* Field myP2
|
||||
*/
|
||||
private val myP2: Int, /* Field p3 */ public var p3: Int)
|
||||
internal class C(private val p1: Int /* parameter p1 */ // field p1
|
||||
,
|
||||
/**
|
||||
* Field myP2
|
||||
*/
|
||||
private val myP2: Int, /* Field p3 */ var p3: Int)
|
||||
|
||||
Reference in New Issue
Block a user