unused-code icon indicating copy to clipboard operation
unused-code copied to clipboard

InvocationTargetException when running unusedCode

Open falconepl opened this issue 3 years ago • 7 comments

When running unusedCode from sbt shell in our codebase we always get:

[error] (Global / unusedCode) java.lang.reflect.InvocationTargetException

with no additional output, for every sbt module. Is it some known issue/limitation of the current version of the plugin? If not, do you know if there is some nice way to track down the real reason behind it? I've tried sbt --verbose --debug but it doesn't help much in this case. I don't have any minimal yet, but I can try to create some

falconepl avatar Mar 17 '22 11:03 falconepl

please try set ThisBuild / scalafixOnCompile := false or remove scalafixOnCompile := true

xuwei-k avatar Mar 28 '22 06:03 xuwei-k

Thanks. I've tried set ThisBuild / scalafixOnCompile := false (we don't use scalafixOnCompile := true), but the issue still remains, unfortunately. Also, we've got a bunch of plugins in project/plugins.sbt - I've disabled them all, except sbt-native-packager, but it didn't help either

falconepl avatar Apr 11 '22 11:04 falconepl

I'm seeing the exact same thing on the latest version 0.2.0

rleibman avatar Jul 15 '22 17:07 rleibman

I made a minimal example to reproduce this issue. https://github.com/tkawachi/testunused

tkawachi avatar Jul 18 '22 04:07 tkawachi

I made a minimal example to reproduce this issue. https://github.com/tkawachi/testunused

  • https://github.com/xuwei-k/testunused/runs/7384036712
  • https://github.com/xuwei-k/testunused/commit/913822f72ca8cca8b23e61f01f18ed45b0df08a7

Could not reproduce.

xuwei-k avatar Jul 18 '22 06:07 xuwei-k

When I ran unusedCode from IntelliJ IDEA's sbt shell on Windows, the problem occurred, but not when I ran it from WSL's sbt. Hmmm. I wonder what it is?

tkawachi avatar Jul 18 '22 06:07 tkawachi

I thought IntelliJ IDEA sbt shell was suspicious, so I tried IntelliJ IDEA sbt shell on Linux as another environment, but the problem didn't occur.

tkawachi avatar Jul 18 '22 08:07 tkawachi