On Tue, 6 Dec 2022 16:13:12 GMT, Jorn Vernee <[email protected]> wrote:
>> Various code cleanups around java.lang.invoke code. Started out with dead
>> code removal in `jli.MemberName`, then piled on to fix a set of minor
>> inefficiencies (excessive vararg array allocations, unnecessary defensive
>> cloning of parameter arrays etc).
>
> src/java.base/share/classes/java/lang/invoke/MemberName.java line 578:
>
>> 576: throw new LinkageError(m.toString());
>> 577: }
>> 578: assert(isResolved());
>
> I don't see why this can be removed. Can you explain?
the `if (clazz == null)` block above either returns or throws an error, so
intellij was marking this as always true.
> src/java.base/share/classes/java/lang/invoke/MemberName.java line 657:
>
>> 655: this.name = fld.getName();
>> 656: this.type = fld.getType();
>> 657: // assert((REF_putStatic - REF_getStatic) == (REF_putField -
>> REF_getField));
>
> Intellij says this is always true. Maybe it could be put in the `static {}`
> block instead?
>
> Also, I think this should just be removed if it's not needed. (instead of
> commented out)
Will fix by extracting to a `static` block above
-------------
PR: https://git.openjdk.org/jdk/pull/11540