0
public enum CardinalDirection {
    NORTH (90),
    EAST (0),
    SOUTH (270),
    WEST (180);

    private float angle;

    CardinalDirection(float angle) {
        this.angle = angle;
    }

    public float angle() {
        return angle;
    }

    public CardinalDirection opposite() {
        switch (this) {
        case EAST: return WEST;
        case NORTH: return SOUTH;
        case SOUTH: return NORTH;
        case WEST: return EAST;
        default: return null;
        }
    }
}

Hello, I've created this enum quite a while ago. The enum is being used within forked code, meaning, another project has this exact code in it every time when exported.

However recently, after exporting the entire project, the method "angle()" is throwing a NoSuchMethodError: ...angle()F

First of all, what does the F at the end of the method mean? Second of all, how is it possible that code which is 100% up to date with certainty throws this error?

Caused by: java.lang.NoSuchMethodError: org.thearaxgroup.surf.enums.CardinalDirection.angle()F
        at org.thearaxgroup.act.object.ActionBoxDisplayManager.newArmorStand(ActionBoxDisplayManager.java:65) ~[?:?]
        at org.thearaxgroup.act.object.ActionBoxDisplayManager.getArmorStand(ActionBoxDisplayManager.java:80) ~[?:?]
        at org.thearaxgroup.act.object.ActionBoxDisplayManager.reloadArmorStand(ActionBoxDisplayManager.java:30) ~[?:?]
        at org.thearaxgroup.act.command.CommandActBox.onCommand(CommandActBox.java:171) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot-1.9.jar:git-Spigot-bc01c3a-55b0def]
        ... 15 more

EDIT: I did find out what caused the issue ... more or less. Another .jar (plugin) also uses the code in the affected project. However, it only depends on it, it doesn't redefine it in any way. I checked for a lot of possible causes and I can't find any reason.

It seems like the jar's sole existence is causing the error.

Jan Schultke
  • 17,446
  • 6
  • 47
  • 96

1 Answers1

1

This is a runtime error. The code that throws the exception was compiled against a version of your code that contains the method, but the version available where the code is deployed does not have that method.

In other words there is a version mismatch between the library available to the compiler or IDE and the library at the deployment location.

Jim Garrison
  • 85,615
  • 20
  • 155
  • 190