andrewoma/kotlin-scripting-kickstarter

Java 8 (type inferacnce)

Closed this issue · 2 comments

I get the following error when compiling on Ubuntu with java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

histogram.kt:77:Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type java.util.stream.Stream<kotlin.String>?
^
histogram.kt:77:Type inference failed: fun map(p0: java.util.function.Function<in kotlin.String, out R>?): java.util.stream.Stream?
cannot be applied to
(() -> [ERROR : ])

                            ^

histogram.kt:77:Type mismatch: inferred type is () -> [ERROR : ] but java.util.function.Function<in kotlin.String, out ???>? was expected
^
histogram.kt:77:Unresolved reference: it
^

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':compileKotlin'.

    Compilation error. See log for more details

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
    :clean
    :compileKotlin
    warning:Annotations path entry points to a non-existent location:
    :compileKotlin FAILED

BUILD FAILED

Total time: 7.28 secs

Seems to be a clash with Kotlin's standard library and new JDK .18 methods: http://youtrack.jetbrains.com/issue/KT-4761

Fixed. Work around in 4c56b84