https://kotlinlang.org logo
#announcements
Title
# announcements
n

nfrankel

09/14/2019, 6:01 AM
i don’t know but sometimes, by listening to what intellij tells you do to the code doesn’t compile anymore
👍 2
s

s1m0nw1

09/14/2019, 11:36 AM
Do you have an example? Never experienced it myself
n

nfrankel

09/14/2019, 11:43 AM
Copy code
@SpringBootApplication
class SwissTrainApplication {

    @Bean
    fun demo(config: ServiceConfig): CommandLineRunner {
        return CommandLineRunner {
            with(Pipeline.create()) {
                drawFrom(remoteService(config.url, config.token))
                    .withoutTimestamps()
                    .filter(PredicateEx { it.startsWith("{\"id\":\"") })
                    .map(FunctionEx<String, String> { it.removeSuffix(",") })
                    .mapUsingContext(ContextFactory.withCreateFn(createObjectMapper), toWrapper)
                    .drainTo(Sinks.logger())
                Jet.newJetInstance().withCloseable().use {
                    it.newJob(this).join()
                }
            }
        }
    }
}
if one removes `PredicateEx`and
FunctionEx<String, String>
it compiles but fails at runtime
(this is hazelcast jet API, serializable flavors of the
java.util
package)
now i realize i didn’t have the example you required 😅
m

Mike

09/14/2019, 1:09 PM
Are you using an older version of Kotlin? This sounds like a difference in inference computations. The plugin is using the latest, so if you aren't on 1.3.50, you may notice differences at compile time.
n

nfrankel

09/14/2019, 1:56 PM
nope it’s just that simon asked for an example about wrong inference at compile-time and i showed a sample with an issue at runtime
3 Views