Merge branch 'bug-1449' into pmd/5.4.x

This commit is contained in:
Andreas Dangel
2016-01-24 17:33:28 +01:00
3 changed files with 16 additions and 1 deletions

View File

@ -379,7 +379,7 @@ adverse impacts on performance.
<property name="xpath">
<value>
<![CDATA[
//PrimitiveType[@Image = 'short']
//PrimitiveType[@Image = 'short'][name(../..) != 'CastExpression']
]]>
</value>
</property>

View File

@ -66,4 +66,17 @@ Short as method return type
]]>
</code>
</test-code>
<test-code>
<description>#1449 false positive when casting a variable to short</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class CastToShort {
public void testcase() {
ByteBuffer buffer = ByteBuffer.allocate(2);
buffer.putShort((short) "1111".getBytes().length);
}
}
]]></code>
</test-code>
</test-data>

View File

@ -25,6 +25,8 @@
**Bugfixes:**
* java-controversial/AvoidUsingShortType:
* [#1449](https://sourceforge.net/p/pmd/bugs/1449/): false positive when casting a variable to short
* java-design/AccessorClassGeneration:
* [#1452](https://sourceforge.net/p/pmd/bugs/1452/): ArrayIndexOutOfBoundsException with Annotations for AccessorClassGenerationRule