-
Notifications
You must be signed in to change notification settings - Fork 7
Macro classpath entries are flagged as unused #4
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
Comments
A complete solution to this would probably involve changing the classloader used to reflectively load and execute macro implementations to track which JARs have actually been touched. An intermediate solution might be to change ~~~jar-lister~~~ classpath-shrinker to accept as a configuration parameter a whitelist of JARs that it should not treat as unused. |
I like the first solution, but am new to the Scala compiler, so it will likely take me a while. I also like the idea of the intermediate whitelist solution. I'll work on that for now, it should make it easy to workaround any other issues that crop up in the future as well. I assume when you refer to |
Yes, I meant |
I think I have an alternative solution, I’ll try it out today. |
@retronym I think we could have |
The macro expansions would not reference these "unused" JARs. If they did, some The problem here is utility JARs called by the macro implementation method itself. Most macros are self contained, only calling into Ideally, the compiler would have a separate setting for A custom macro classloader could log all JARs that are actually referenced. This isn't a big change, but it can't be made without a change to the compiler itself. |
@johnynek sounds like the above suggestion about |
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
I am currently working on trying out the
classpath-shrinker
plugin with our codebase. I ran into an issue in which the plugin warns about certain used classpath entries as unused. The classpath entries warned about contain macros. If you remove the classpath entries that are flagged as unused, the code no longer compiles.I created a repro example here: https://github.com/lucidsoftware/classpath-shrinker-example1
In this example, I have a simple source file
that compiles under both Scala 2.11 and 2.12 and warns about unused classpath entries:
2.11:
2.12:
If I remove those classpath entries, then both 2.11 and 2.12 fail to compile:
2.11:
2.12:
My knowledge of the Scala compiler is not very good. I've been poking at the plugin and the Scala source without much luck. Anyone have any guidance or recommendations?
Thanks in advance for the help!
The text was updated successfully, but these errors were encountered: