zlataovce / takenaka

A Kotlin library for reconciling multiple obfuscation mapping files from multiple versions of Minecraft: JE.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inconsistency on showing modifiers

mfnalex opened this issue · comments

Hi!

I've noticed some inconsistencies while looking at method and field modifiers.

Imagine the following class:

interface MyInterface {
  void abstractMethod();
  default void implementedMethod() { };
}

Both methods are shown without any modifier, hence it is not visible whether an interface-method actually has an implementation or not. There's two solutions:

  1. Show the abstractMethod() using the abstract modifier (I'd prefer this, as the method technically is abstract)
  2. Show the implementedMethod() using the default keyword, like the javadocs do

It's also a bit confusing that both methods are not shown as public, because that means that whether this modifier is displayed or not depends on whether one is currently looking at an interface, or not. However since the javadocs also don't show the public keyword, I guess it's fine as it currently is.

Another thing is that enum constants are shown using public static final. While this is ofc technically true, I would then also expect that interface methods are shown as abstract - or, just get rid of the all the modifiers for enum constants and show them in a separate table called "Enum constats" or something like this.

Just a quick information - the old mappings viewer also shows enum constants as public static final, and shows interface methods as abstract - basically like what I'd expect when just looking at a method and then checking the modifiers with reflection. So I'd suggest to either always show modifiers as returned by Method.getModifiers() or Field.getModifiers(), or show them like the javadocs would.

If I could decide, I would show the "technically true" modifiers as it's more consistent - if one sees a method that's missing the "public" modifier, you don't have to check whether you're looking at an interface or not to determine whether this method is actually public or package-private, and the other reason is that "default" actually isn't a modifier and hence doesn't actually belong in the "Modifier and Type" column. That's why I'd suggest to show "public" for all public interface methods, "abstract" for all non-default interface methods, and keep "public static final" for enum constants - but that's ofc just my opinion :D

Just my 2 cents, thanks for reading!

Thank you for your feedback, it should be available on the site tomorrow.