2594 Commits

Author SHA1 Message Date
Andreas Dangel
78da370fb8 [maven-release-plugin] prepare release pmd_releases/6.20.0 2019-11-29 19:46:05 +01:00
Andreas Dangel
c5d79a0db4 Merge branch 'pr-2138'
[java] Preserve possible type of the target reference for method invocations
2019-11-29 18:41:20 +01:00
Andreas Dangel
3a2791007e Fix checkstyle 2019-11-29 10:39:51 +01:00
Andreas Dangel
a85638a0e0 [java] Preserve possible type of the target reference for method invocations
We already resolved the result type of a method invocation,
but in some cases, we also need the type of the target reference
for static method calls.

Reverts the previously introduced fix in UnusedImportsRule.

Fixes #2016
2019-11-29 10:27:19 +01:00
Andreas Dangel
e106e7ac12 [java] ImmutableField: False positive when variable is updated in conditional loop
Fixes #2125
2019-11-24 10:20:21 +01:00
Andreas Dangel
f013497b1c fix import 2019-11-22 15:10:55 +01:00
Andreas Dangel
dd391ab78e [java] UnusedImports: False positive if wildcard is used and only static methods
Added workaround for wrong typeresolution
(method result vs. class of method)

Refs #2016
2019-11-22 15:04:17 +01:00
Andreas Dangel
e485396b3a Merge branch 'pr-2121'
[java] Predicates treated like booleans
2019-11-21 20:23:06 +01:00
Andreas Dangel
f5dc2fe80f [java] LinguisticNaming: Add test case for method returning predicate 2019-11-21 20:20:21 +01:00
Andreas Dangel
f8bf862d43 Merge branch 'pr-2113'
[java] UnnecessaryFullyQualifiedName false-positive for non-static
nested classes
2019-11-21 20:09:15 +01:00
Andreas Dangel
9cf0083bce Merge branch 'pr-2112'
[java] ImmutableField false positive with inner class
2019-11-21 20:06:46 +01:00
Andreas Dangel
c25049a24b Merge branch 'pr-2111'
[java] False positive MissingStaticMethodInNonInstantiatableClass ...
when inheritors are instantiable
2019-11-21 20:05:20 +01:00
Andreas Dangel
b1b3b37095 Merge branch 'pr-2099'
[java] UnnecessaryFullyQualifiedName: regression / false positive
2019-11-21 20:00:49 +01:00
Ozan Gulle
533b32a992 Slight adjustments in the test cases 2019-11-19 21:13:58 +01:00
Ozan Gulle
6306809a8d Corrected naming 2019-11-19 20:50:34 +01:00
Ozan Gulle
c41dc3f5ab Fixed the test and added a second one 2019-11-19 20:25:50 +01:00
Ozan Gulle
ef476a6e9e isBoolean method also returns true for Predicates
Tests are commented out. They only work if the java version is increased to 8 on the pom.xml.
2019-11-18 22:40:44 +01:00
Andreas Dangel
461977b8f6 [java] UnnecessaryFullyQualifiedName false-positive for non-static nested classes
Fixes #2029
2019-11-15 13:06:31 +01:00
Andreas Dangel
9dbbfba420 [java] ImmutableField false positive with inner class
Fixes #2075
2019-11-15 10:17:59 +01:00
Andreas Dangel
f93bea624c [java] False positive MissingStaticMethodInNonInstantiatableClass when inheritors are instantiable
Fixes #2102
2019-11-15 09:52:55 +01:00
andi
60f11fcb7d fix reporting of innerclass classnames 2019-11-12 14:33:33 +01:00
Andreas Dangel
206ae6ef96 [java] UnnecessaryFullyQualifiedName: Fix false-neg with nested exceptions 2019-11-08 18:05:24 +01:00
Andreas Dangel
bb8fbb8c1d [java] UnnecessaryFullyQualifiedName: Fix false-neg with nested classes 2019-11-08 15:12:15 +01:00
Andreas Dangel
f3c4ec9ad9 [java] UnnecessaryFullyQualifiedName: regression / false positive
Fixes #2098
2019-11-08 11:36:26 +01:00
Andreas Dangel
33b5263035 [java] Support more language version aliases
javac understands for --source both "1.5" and "5" and also "1.9" and
"1.10". Tested with openjdk13.
javac understands for --release "7" and higher. javac 10 had
support for "6".
This means, not all variants work in all constellations, but PMD
should understand now the correct version regardless how it is
specified.
2019-11-08 10:19:15 +01:00
Henning Schmiedehausen
b2a34c104d Add more version shortcuts for older java
Newer java compiler (java 9+) support the `--release` option to choose
for which version of the JRE to compile. This parameter only takes
simple values as documented by `javac --help`:

```
--release <release>
        Compile for a specific VM version. Supported targets: 6, 7, 8, 9, 10, 11
```

adding these versions to pmd allows the use of the same versions (6, 7
and 8) with PMD as with the compiler, thus removing the need to juggle
between single digit versions for the compiler and 1.<x> for PMD.
2019-11-08 09:10:49 +01:00
Andreas Dangel
deec9c44b2 [maven-release-plugin] prepare for next development iteration 2019-10-31 18:36:51 +01:00
Andreas Dangel
2881b6f585 [maven-release-plugin] prepare release pmd_releases/6.19.0 2019-10-31 18:36:42 +01:00
Andreas Dangel
73e48edaaa Merge branch 'pr-2054'
[java] Rename rule InvalidSlf4jLoggingFormat to InvalidLogMessageFormat
2019-10-30 19:30:44 +01:00
Clément Fournier
34455b3051 Merge branch 'pr-2066' 2019-10-29 16:38:42 +01:00
Andreas Dangel
0a94dec8f0 Merge branch 'pr-2044'
[core] Wrong deprecation warnings for unused XPath attributes
2019-10-28 19:27:52 +01:00
Andreas Dangel
752e5f8ad5 [java] Deprecate AbstractJavaRule#getDeclaringType(Node)
Refs #2034
2019-10-26 12:17:43 +02:00
Andreas Dangel
c1f36d9d70 [java] Rename InvalidSlf4jMessageFormat to InvalidLogMessageFormat
Follow-up on #2012
2019-10-25 18:42:50 +02:00
Andreas Dangel
63395684c4 Merge branch 'pr-2076' 2019-10-25 15:01:58 +02:00
Andreas Dangel
ecc4e7558f [java] Use full name for CLASS_FAN_OUT metric for operations as well 2019-10-25 14:44:45 +02:00
Juan Martín Sotuyo Dodero
9a2314ab5d Merge pull request #2079 from adangel/issue-1531-unusedprivatemethod
[java] UnusedPrivateMethod false-positive with method result
2019-10-23 19:46:48 -03:00
andi
e2877ab95c use full name instead of abbreviation for classfanout & fix spelling 2019-10-22 20:22:20 +02:00
Andreas Dangel
50f748e191 [java] UnusedPrivateMethod false-positive with method result
Fixes #1531

In case we determined, that the method argument is a method call,
then we skip now completly trying to determine the correct argument
type. It was half-way fixed before for the first if condition, but
we still evaluated e.g. the allocation expression in

    print(new Integer(1).toString());

and wrongly assumed, the argument type would be an integer,
without taking into account the `toString()` method call.

The same happened with

    privateBooleanMethod(s, "true".equals(s));

where we took the 2nd argument as a literal and assumed
it is a "String", while the method call result actually
is a boolean.

With this change now, the false positive is fixed.

However, since we don't determine the argument type at all, the
method is matched solely on argument count. This will obviously
lead to wrong matches if method overloading is used.
2019-10-20 15:54:10 +02:00
Michael Clay
b32c7ad6a8 [java] DoNotUseThreads should not warn on Runnable #1627 2019-10-19 20:55:49 +02:00
Michael Clay
5739041b16 [java] DoNotUseThreads should not warn on Runnable on java8+ #1627 2019-10-18 17:43:33 +02:00
andi
1515209a48 add classfanoutcomplexity metric 2019-10-17 13:05:36 +02:00
Andreas Dangel
52341d9d67 [java] Fix deprecated attributes in XPath rules 2019-10-14 19:50:52 +02:00
Andreas Dangel
e4e4c7ceae Merge branch 'pr-2060' 2019-10-14 19:36:45 +02:00
Carlos Macasaet
a8dbc91b5e Make comment consistent with expected failures
Three of the problems were UR anomalies.

Addresses: #1636
2019-10-12 21:45:15 -07:00
Carlos Macasaet
e41b8d992c Stop checking UR anomalies (Java)
This commit stops checking for UR anomalies in the
DataflowAnomalyAnalysis rule in Java. Note, I retained the UR anomaly
test, but changed the expected number of errors to zero.

Addresses: #1636
2019-10-12 19:01:30 -07:00
Clément Fournier
7911d733d4 Deprecate various utility classes 2019-10-09 22:38:52 +02:00
Juan Martín Sotuyo Dodero
a61835fe1e [java] Fix regexp to properly parse references 2019-10-06 17:38:50 -03:00
Juan Martín Sotuyo Dodero
92f393f32c [java] Add failing tests for #2025 2019-10-06 17:38:50 -03:00
Andreas Dangel
5156e8922e Merge branch 'pr-2010' 2019-10-05 18:28:48 +02:00
Andreas Dangel
06add3a5a7 [doc] Update release notes, refs #2010 2019-10-05 18:27:56 +02:00