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

Non-descriptive errors #1622

Closed
OlegYch opened this issue Jun 24, 2022 · 3 comments
Closed

Non-descriptive errors #1622

OlegYch opened this issue Jun 24, 2022 · 3 comments

Comments

@OlegYch
Copy link
Contributor

OlegYch commented Jun 24, 2022

When running scalafix via sbt i get (Compile / scalafix) scalafix.sbt.InvalidArgument: scalafix.v1.Rule: Error reading configuration file with no explanation what is wrong or even a stacktrace.
sbt-scalafix 0.10.1

@bjaglin
Copy link
Collaborator

bjaglin commented Jun 24, 2022

Thanks for reporting!

I guess this comes from https://github.com/openjdk/jdk/blob/9a9add8825a040565051a09010b29b099c2e7d49/jdk/src/share/classes/java/util/ServiceLoader.java#L309 (Java 8, exact wording changed starting Java 9). Is there something special with the scalafix dependencies (community rules) or your JVM?

Removing exception wrapping in https://github.com/scalacenter/sbt-scalafix/blob/d1abcb1defcde78b9bb03d3dae7870dddfb98229/src/main/scala/scalafix/internal/sbt/ScalafixInterface.scala#L117 exposes the most likely silenced trace:

sbt:sbt-scalafix> scalafix
[info] Using SNAPSHOT artifacts for Scalafix and/or external rules, binary compatibility checks disabled
[error] stack trace is suppressed; run last Compile / scalafix for the full output
[error] (Compile / scalafix) java.util.ServiceConfigurationError: thrown manually for testing
[error] Total time: 1 s, completed Jun 24, 2022, 11:16:34 PM
sbt:sbt-scalafix> last Compile / scalafix
[error] java.util.ServiceConfigurationError: thrown manually for testing
[error] 	at scalafix.internal.v1.Rules$.all(Rules.scala:109)
[error] 	at scalafix.v1.RuleDecoder$$anon$1.<init>(RuleDecoder.scala:106)
[error] 	at scalafix.v1.RuleDecoder$.decoder(RuleDecoder.scala:105)
[error] 	at scalafix.internal.interfaces.ScalafixArgumentsImpl.rulesThatWillRun(ScalafixArgumentsImpl.scala:241)
[error] 	at scalafix.internal.sbt.ScalafixInterface.rulesThatWillRun(ScalafixInterface.scala:102)
[error] 	at scalafix.sbt.ScalafixPlugin$.$anonfun$scalafixTask$1(ScalafixPlugin.scala:364)

@bjaglin
Copy link
Collaborator

bjaglin commented Jun 25, 2022

The latest sbt-scalafix snapshot should give you a stack trace

 // project/plugins.sbt
-addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.0")
+addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.1+4-22433065-SNAPSHOT")
+resolvers += Resolver.sonatypeRepo("snapshots")

Can you try it out on your build so we can see what we could do in scalafix itself?

@OlegYch
Copy link
Contributor Author

OlegYch commented Jun 27, 2022

i think the jar with rules was broken somehow, can't reproduce right now
the fix looks good to me, thanks!

@OlegYch OlegYch closed this as completed Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants