Skip to content

SourceFile attribute is not remapped #65

@jpenilla

Description

@jpenilla

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions