Enigma icon indicating copy to clipboard operation
Enigma copied to clipboard

Making static members that hide a superclass member is impossible

Open Juuxel opened this issue 5 years ago • 2 comments

Java allows hiding a superclass method A.doSomething() with a subclass method B.doSomething(), but Enigma doesn't allow giving static methods names that do that.

See also https://github.com/FabricMC/yarn/pull/1040#discussion_r364046631 and https://github.com/FabricMC/yarn/pull/858#discussion_r324467245.

Juuxel avatar Jan 08 '20 15:01 Juuxel

Reopening because the PR that fixed this was reverted due to not 100% working

2xsaiko avatar Oct 27 '20 19:10 2xsaiko

Enigma's concern is real as if we have class A and B extends A, static void work() in A, then B.work() compiles to invokestatic on owner B name work type ()V. This is probably best addressed by a separate jar index scanning the hiding relations exhibited in bytecode putstatic getstatic invokestatic (need to check custom bootstrap methods like lambda metafactory as well)

liach avatar Apr 20 '22 23:04 liach