kotlin-koans-edu-obsolete icon indicating copy to clipboard operation
kotlin-koans-edu-obsolete copied to clipboard

Java to Kotlin conversion test fails

Open eos2102 opened this issue 6 years ago • 1 comments

For this step: https://github.com/Kotlin/kotlin-koans-edu/tree/master/Kotlin%20Koans/Introduction/Java%20to%20Kotlin%20conversion

Copying the Java Class code:

public class JavaCode { public String toJSON(Collection<Integer> collection) { ....... } }

Produces Kotlin code:

class JavaCode { fun toJSON(collection:Collection<Int>):String { ........ } }

Which fails the test with "Error:(7, 80) Unresolved reference: toJSON":

Assert.assertEquals("toJSON".toMessageInEquals(), "[1, 2, 3, 42, 555]", toJSON(listOf(1, 2, 3, 42, 555)))

eos2102 avatar Sep 23 '18 17:09 eos2102

I ran into this too. The fix suggested in the PR worked for me 🤔

Seems like maybe the koan is assuming that the code converter will create a top-level function, instead of a class method?

matchu avatar Jan 16 '19 23:01 matchu