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

SourceFile attribute is not remapped #65

Open
jpenilla opened this issue Jun 19, 2021 · 2 comments
Open

SourceFile attribute is not remapped #65

jpenilla opened this issue Jun 19, 2021 · 2 comments

Comments

@jpenilla
Copy link

When compiling against Spigot's Mojang-mapped jar, I was getting tons of warnings about auxiliary classes:

/home/runner/work/special-gradle/special-gradle/test-plugin/src/main/java/xyz/jpenilla/specialgradle/testplugin/TestPlugin.java:27: warning: auxiliary class EntityArgument in ArgumentEntity.java should not be accessed from outside its own source file
import net.minecraft.commands.arguments.EntityArgument;
                                       ^
/home/runner/work/special-gradle/special-gradle/test-plugin/src/main/java/xyz/jpenilla/specialgradle/testplugin/TestPlugin.java:30: warning: auxiliary class Component in IChatBaseComponent.java should not be accessed from outside its own source file
import net.minecraft.network.chat.Component;
                                 ^
/home/runner/work/special-gradle/special-gradle/test-plugin/src/main/java/xyz/jpenilla/specialgradle/testplugin/TestPlugin.java:33: warning: auxiliary class ServerPlayer in EntityPlayer.java should not be accessed from outside its own source file
import net.minecraft.server.level.ServerPlayer;
                                 ^
/home/runner/work/special-gradle/special-gradle/test-plugin/src/main/java/xyz/jpenilla/specialgradle/testplugin/TestPlugin.java:42: warning: auxiliary class Commands in CommandDispatcher.java should not be accessed from outside its own source file
import static net.minecraft.commands.Commands.argument;
                                    ^
/home/runner/work/special-gradle/special-gradle/test-plugin/src/main/java/xyz/jpenilla/specialgradle/testplugin/TestPlugin.java:43: warning: auxiliary class Commands in CommandDispatcher.java should not be accessed from outside its own source file
import static net.minecraft.commands.Commands.literal;
                                    ^

... truncated, but there were many more similar warnings

Upon further inspection, I noticed that this is due to SpecialSource not remapping the SourceFile attribute at all.

This can bee seen by unzipping the Mojang-mapped Spigot jar from BuildTools, and running javap -v on any class file edited by Spigot or CraftBukkit, for example, ServerPlayer (EntityPlayer in Spigot names):

javap -v net/minecraft/server/level/ServerPlayer.class | grep SourceFile
  #3363 = Utf8               SourceFile
SourceFile: "EntityPlayer.java"
@md-5
Copy link
Owner

md-5 commented Jun 19, 2021

I assume you have Xlint:all or something as I've never seen that warning.
As a workaround you can use --kill-source to remove the SourceFile attribute or disable that specific warning in javac (-Xlint:-auxiliaryclass).

@jpenilla
Copy link
Author

BuildTools is the one running SpecialSource in this case, otherwise I would have used --kill-source.

For my own projects I can disable the warning, sure, but I think it would be a better solution to either remap the attribute in SpecialSource, or to have BuildTools pass the argument to strip the attribute when building Spigot, this way Spigot jars won't have invalid metadata.

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