Interopability with overloaded methods


#1

https://github.com/FasterXML/jackson-jr This row is not compiled.

JSON.std.with(JSON.Feature.PRETTY_PRINT_OUTPUT)

This row is not compiled:

Error:(15, 18) Kotlin: Overload resolution ambiguity: public open fun with(c: [ERROR : Unresolved java classifier: TreeCodec]?): com.fasterxml.jackson.jr.ob.JSON? defined in com.fasterxml.jackson.jr.ob.JSON public open fun with(f: [ERROR : Unresolved java classifier: JsonFactory]?): com.fasterxml.jackson.jr.ob.JSON? defined in com.fasterxml.jackson.jr.ob.JSON public open fun with(pp: [ERROR : Unresolved java classifier: PrettyPrinter]?): com.fasterxml.jackson.jr.ob.JSON? defined in com.fasterxml.jackson.jr.ob.JSON public open fun with(vararg features: com.fasterxml.jackson.jr.ob.JSON.Feature?): com.fasterxml.jackson.jr.ob.JSON? defined in com.fasterxml.jackson.jr.ob.JSON

If write same row in Java file then no problem.


#2

Hi, It seems that you should reimport your project from maven because the dependency com.fasterxml.jackson.core:jackson-core:2.4.2 is broken. You can open JSON.java and check that there is no errors.


#3

This row must compile without another libs. I have JacksonJr-all.jar in my classpath.

  1. I dont use maven 2) depedency on TreeCodec and etc is optitonal 3) this row compiles and work in same project in Java

#4

As you can see from error message IDE found more than one `with` function:

public open fun with(c: [ERROR : Unresolved java classifier: TreeCodec]?): com.fasterxml.jackson.jr.ob.JSON? defined in com.fasterxml.jackson.jr.ob.JSON
public open fun with(f: [ERROR : Unresolved java classifier: JsonFactory]?): com.fasterxml.jackson.jr.ob.JSON? defined in com.fasterxml.jackson.jr.ob.JSON
public open fun with(pp: [ERROR : Unresolved java classifier: PrettyPrinter]?): com.fasterxml.jackson.jr.ob.JSON? defined in com.fasterxml.jackson.jr.ob.JSON
public open fun with(vararg features: com.fasterxml.jackson.jr.ob.JSON.Feature?): com.fasterxml.jackson.jr.ob.JSON? defined in com.fasterxml.jackson.jr.ob.JSON

but couldn't resolve TreeCodec, JsonFactory and PrettyPrinter, so IDE couldn't check that those functions are inaplicable with given argument.

Are there some error in JSON.java file (https://github.com/FasterXML/jackson-jr/blob/master/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/JSON.java)?

2) depedency on TreeCodec and etc is optitonal

As I see this dependency should be present to compile jr-objects module, so I don’t understand how it can be optional.