Fix UseObjectForClearerAPI rule that treated String and String[] the same

This commit is contained in:
Björn Kautler
2019-04-03 12:00:40 +02:00
parent 06625b23f9
commit f3c0d39f66
2 changed files with 21 additions and 1 deletions

View File

@ -1639,7 +1639,7 @@ your API.
<value> <value>
<![CDATA[ <![CDATA[
//MethodDeclaration[@Public = 'true']/MethodDeclarator/FormalParameters[ //MethodDeclaration[@Public = 'true']/MethodDeclarator/FormalParameters[
count(FormalParameter/Type/ReferenceType/ClassOrInterfaceType[@Image = 'String']) > 3 count(FormalParameter/Type/ReferenceType/ClassOrInterfaceType[@Image = 'String' and @Array = 'false']) > 3
] ]
]]> ]]>
</value> </value>

View File

@ -86,6 +86,26 @@ public class MyClass {
String databaseAdress) String databaseAdress)
{ {
} }
}
]]>
</code>
</test-code>
<test-code>
<description>
<![CDATA[
String[] should not be treated as String
]]>
</description>
<expected-problems>0</expected-problems>
<code>
<![CDATA[
public class MyClass {
public void connectProtected(String username,
String[] pssd,
String databaseName,
String databaseAdress)
{
}
} }
]]> ]]>
</code> </code>