Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow byte[] as no-varargs final argument #46

Merged
merged 2 commits into from
Dec 12, 2014
Merged

Conversation

albfernandez
Copy link
Contributor

Allow byte[] as no-vargars last argument.

Example:
public void writeToFile(File theFile, byte[] data) {
// ..
}

@adangel adangel merged commit a07d8bd into pmd:master Dec 12, 2014
@@ -1767,7 +1767,7 @@ having to deal with the creation of an array.
<properties>
<property name="xpath">
<value><![CDATA[
//FormalParameters/FormalParameter[position()=last() and @Array='true' and @Varargs='false']
//FormalParameters/FormalParameter[position()=last() and @Array='true' and @Varargs='false' and not (./Type/ReferenceType/PrimitiveType[@Image='byte']) and not (./Type/PrimitiveType[@Image='byte'])]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the last condition as it doesn't seem to be required (and not (./Type/PrimitiveType[@Image='byte'])).
If this is really needed - please provide a test case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for not providing test-case for the second case. It was a quick edit.
The AST parsed is different in those two cases

byte[] data 

byte data[]

I've created another pull request with test-cases and proposed solution.

@adangel
Copy link
Member

adangel commented Dec 12, 2014

Thanks!

@adangel adangel mentioned this pull request Apr 15, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants