From ed7714391a440ed8947e8666bf7a070296e006e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 2 Feb 2017 20:38:54 -0300 Subject: [PATCH 1/2] [java] Fix FP in SimplifiedTernary with null value - Fixes #232 - Alo improve the docs formatting, it's getting garbled on the web.. --- .../src/main/resources/rulesets/java/basic.xml | 16 ++++++++-------- .../java/rule/basic/xml/SimplifiedTernary.xml | 12 ++++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/pmd-java/src/main/resources/rulesets/java/basic.xml b/pmd-java/src/main/resources/rulesets/java/basic.xml index d7322cf6b9..f7f06a0ad7 100644 --- a/pmd-java/src/main/resources/rulesets/java/basic.xml +++ b/pmd-java/src/main/resources/rulesets/java/basic.xml @@ -805,24 +805,24 @@ public class Count { externalInfoUrl="${pmd.website.baseurl}/rules/java/basic.html#SimplifiedTernary"> 3 diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/basic/xml/SimplifiedTernary.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/basic/xml/SimplifiedTernary.xml index aac53df1db..f388a6cb9e 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/basic/xml/SimplifiedTernary.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/basic/xml/SimplifiedTernary.xml @@ -94,6 +94,18 @@ public class SimplifiedTernary { private SomeValue doStuff(SomeValue someValue) { return THE_VALUE.equals(rangeValue.to) ? new SomeValue(someValue.from, null, true) : someValue; } +} + ]]> + + + + #232 False positive with ternary operator using nullables + 0 + From fc1e90b7d343bf4b1968bee758339b0c43dcb882 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 12 Feb 2017 09:37:19 +0100 Subject: [PATCH 2/2] Update changelog, fixes #232 --- src/site/markdown/overview/changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index 5b14828b21..f2b5552009 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -22,6 +22,8 @@ This is a bug fixing release, no major changes were introduced. * general * [#234](https://github.com/pmd/pmd/issues/234): \[core] Zip file stream closes spuriously when loading rulesets +* java-basic + * [#232](https://github.com/pmd/pmd/issues/232): \[java] SimplifiedTernary: Incorrect ternary operation can be simplified. * java-design * [#216](https://github.com/pmd/pmd/issues/216): \[java] \[doc] NonThreadSafeSingleton: Be more explicit as to why double checked locking is not recommended * [#219](https://github.com/pmd/pmd/issues/219): \[java] UnnecessaryLocalBeforeReturn: ClassCastException in switch case with local variable returned