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

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Sun Jul 30 10:41:43 UTC 2017


While I understand the point, overriding a method has never been about 
'inheriting' parameter names, so I'm also kind of hopeful that the 
confusion can be cleared up easily. I guess the fact that when you add 
an override through the IDE, the IDE already prepopulates your 
overriding declaration with parameter names from the overidden one might 
throw people of into thinking that there's some 'constraint' between 
names in the overriding vs. overridden. Of course there's not.

Maurizio



On 29/07/17 15:46, Brian Goetz wrote:
> 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