Strumenta / antlr-kotlin

Support for Kotlin as a target for ANTLR 4
Apache License 2.0
222 stars 47 forks source link

fix: add @ ExperimentalStdlibApi on Enum.entries for kotlin 1.9.x. #137

Closed atsushieno closed 8 months ago

atsushieno commented 8 months ago

This should fix issue #136.

ftomassetti commented 8 months ago

Thank you @atsushieno for your analysis and for this PR. I am going to merge it

lppedd commented 8 months ago

Marking these properties with ExperimentalStdlibApi is not what needs to be done, as you're then asking for every consumer to opt-in, adding an unnecessary step for most.

image

The correct way to handle this is at the consumer level, by opting-in through a compiler flag or via a local OptIn(...) annotation.
This library should not propagate opt-ins.

This PR needs to be undone.

lppedd commented 8 months ago

Also I'm not sure what's going on, but entries isn't experimental in 1.9.

What is experimental is the enumEntries<T>() function, which is not used here.
Example: enumEntries<css3Lexer.Rules>()

The root of your problem seems to be elsewhere.

atsushieno commented 8 months ago

I ran some experimental builds on my project and it seems correct - I'm getting those compilation errors somehow only locally. I'm not very happy with the problem the Gradle or Kotlin toolchains have caused, but I agree that the change is unnecessary.

I'll create another PR to revert it. Sorry for the noise!

ftomassetti commented 8 months ago

Thank you @lppedd and @atsushieno . @atsushieno no reason to be sorry, we appreciate the contribution and the explanation. This error was quite misleading. Thank you also for the new PR reverting the change, I will merge it straight away