A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/5028 below:

[java] FormalParameterNamingConventions should accept unnamed parameters by default · Issue #5028 · pmd/pmd · GitHub

Is your feature request related to a problem? Please describe.
https://openjdk.org/jeps/456 (Java 22) added unnamed variables denoted by _ (underscore)

Rule: FormalParameterNamingConventions

Describe the solution you'd like
FormalParameterNamingConventions should accept _ as a valid name by default. Currently it complains The lambda parameter name '_' doesn't match '[a-z][a-zA-Z0-9]*'.

Describe alternatives you've considered

I'm using the following workaround:

<rule ref="category/java/codestyle.xml/FormalParameterNamingConventions">
	<properties>
		<property name="methodParameterPattern" value="_|[a-z][a-zA-Z0-9]*"/>
		<property name="finalMethodParameterPattern" value="_|[a-z][a-zA-Z0-9]*"/>
		<property name="lambdaParameterPattern" value="_|[a-z][a-zA-Z0-9]*"/>
		<property name="explicitLambdaParameterPattern" value="_|[a-z][a-zA-Z0-9]*"/>
	</properties>
</rule>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4