Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overload resolution ambiguity #94

Closed
scott-rc opened this issue Mar 14, 2019 · 7 comments
Closed

Overload resolution ambiguity #94

scott-rc opened this issue Mar 14, 2019 · 7 comments
Assignees
Labels
Milestone

Comments

@scott-rc
Copy link

Hello 👋

After upgrading from 1.3.6 -> 2.0.0-M3, I am getting a function ambiguity issue when invoking any of the log levels (info, warn, etc...) with a String as the only argument.

One of the ways to get around this is to cast the string to Any (Object in Kotlin) to give the compiler a hint.

tinylog_ambiguity_error

This may not be a priority if Kotlin is not supported (or if this is intended behavior) - but I thought I'd share.

PS: I love the size, performance, and simplicity of this lib - keep up the great work! 👍

@pmwmedia pmwmedia added this to the 2.0 milestone Mar 14, 2019
@pmwmedia
Copy link
Member

pmwmedia commented Mar 14, 2019

I will look at that. tinylog 2 should also be easy to use with Kotlin.

@pmwmedia pmwmedia self-assigned this Mar 15, 2019
pmwmedia added a commit that referenced this issue Mar 15, 2019
Improved Kotlin support for issue #94
@pmwmedia
Copy link
Member

After trying several things, I decided to provide a separate logging API for Kotlin, Scala and Groovy. This is the only way I can deal with the features and specialties of all three programming languages.

Here is a preview version for Kotlin: tinylog-kotlin-2.0-SNAPSHOT.zip

Some examples that are working now:

Logger.info("Hello World!")
Logger.info("Hello {}!", { "Mister" })
Logger.info { "Hello $name!" }
Logger.info(exception) { "Hello $name!" }

@danielwilson1702
Copy link

@pmwmedia can you think of a reason this might come up again, in a library project? I think I'm going insane :)

@pmwmedia
Copy link
Member

@danielwilson1702 Which Kotlin and IntelliJ version are you using?

@danielwilson1702
Copy link

Sorry for the delay! Kotlin is 1.3.61 and IntelliJ is Android Studio 3.5.3 (actually can't tell how the hell to see a specific IntelliJ version). I think it must be something about marking the project as a library. Whilst the app module in the library project also throws the error, remote consumers of the library are fine.

Dependencies in the library gradle file are specified like so:

    api 'org.tinylog:tinylog-api-kotlin:2.0.1'
    api 'org.tinylog:tinylog-impl:2.0.1'

I will try and make a sample if it helps.

@danielwilson1702
Copy link

Ok I spent a little over an hour basically being an idiot, maybe someone else will run into this, you never know! It was confused a little by the fact that the lib consumer is a Java project, so while he uses org.tinylog.Logger without issue, my library project was also trying to use that when he should be using org.tinylog.kotlin.Logger. Now all my problems are gone (doh)

@github-actions
Copy link

github-actions bot commented Oct 9, 2022

This closed issue has been locked automatically. However, please feel free to file a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants