[lambda-leftovers] Underscore parameter for abstract/native methods

Brian Goetz brian.goetz at oracle.com
Sat Jul 29 14:46:47 UTC 2017


As evidence of Tagir's point that people will confuse this for a 
declaration-site feature, I offer this tweet of a random Java developer 
who saw the blink-poll on twitter and immediately lept to the wrong 
conclusion:

     https://twitter.com/wbasrs/status/891213337454940160

On 6/25/2017 6:51 AM, Tagir Valeev wrote:
> Hello!
>
> Currently in lambda-leftovers underscore is allowed as a parameter name for
> abstract methods. This looks dubious as normally underscore means that
> parameter is not used in the corresponding method/lambda/catch body, but
> there's no actual body and no parameter is actually used anyways (but could
> be used in abstract method implementations). I think, allowing underscores
> for interface methods may encorage bad practices of defining interfaces
> without readable parameter names:
>
> interface X {
>    void doSomething(int _, long _, String _);
> }
>
> Should not this be disabled?
>
> It's even worse for native methods, because underscore assumes that
> parameter is not used, but it does not limit the corresponding native
> implementation from using it.
>
> With best regards,
> Tagir Valeev.



More information about the amber-dev mailing list