Mandated/implicit parameters

Hannes Greule hannesgreule at outlook.de
Wed May 25 14:42:52 UTC 2022


> It would be legitimate to emit MethodParameters without -parameters, so as to record `final` and "implicitly declared" but not the parameter name, but at some cost to implementation complexity in java.lang.reflect.

What implementation complexity are you thinking of? The JVMS says "If the value of the name_index item is zero, then this parameters element indicates a formal parameter with no name."[1]. 
Shouldn't this case be already handled by the reflect impl?

Wouldn't it be also possible to just emit the attribute *with* names when it contains a mandated parameter? This would solve the problem with minimal changes as far as I can tell (with the downside of slightly increased class file sizes in such cases).

> That is weird, and sounds like a javac bug.
What would be the next steps here? Is my linked solution feasible?

Hannes

[1] https://docs.oracle.com/javase/specs/jvms/se18/html/jvms-4.html#jvms-4.7.24


More information about the compiler-dev mailing list