java/design/UseVargs - update changelog, extend test case

This commit is contained in:
Andreas Dangel
2014-12-12 19:26:36 +01:00
parent bdf454a967
commit aea6c74a8f
3 changed files with 22 additions and 5 deletions

View File

@ -1766,9 +1766,13 @@ having to deal with the creation of an array.
<priority>4</priority>
<properties>
<property name="xpath">
<value><![CDATA[
//FormalParameters/FormalParameter[position()=last() and @Array='true' and @Varargs='false' and not (./Type/ReferenceType/PrimitiveType[@Image='byte']) and not (./Type/PrimitiveType[@Image='byte'])]
]]></value>
<value><![CDATA[
//FormalParameters/FormalParameter
[position()=last()]
[@Array='true']
[@Varargs='false']
[not (./Type/ReferenceType[@Array='true'][PrimitiveType[@Image='byte']] or ./Type/ReferenceType[@Array='true'][ClassOrInterfaceType[@Image='Byte']])]
]]></value>
</property>
</properties>
<example><![CDATA[

View File

@ -63,7 +63,7 @@ public class Foo implements InvocationHandler {
<test-code>
<description><![CDATA[
method, do not varargs, allow byte[] as not vargars
method, do not varargs, allow byte[] as not varargs
]]></description>
<expected-problems>0</expected-problems>
<code><![CDATA[
@ -72,5 +72,15 @@ public class Foo {
}
]]></code>
</test-code>
<test-code>
<description><![CDATA[
method, do not varargs, allow Byte[] as not varargs
]]></description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class Foo {
public void bar(File file, Byte[] data) { }
}
]]></code>
</test-code>
</test-data>