Commit Graph

2572 Commits

Author SHA1 Message Date
f93bea624c [java] False positive MissingStaticMethodInNonInstantiatableClass when inheritors are instantiable
Fixes #2102
2019-11-15 09:52:55 +01:00
60f11fcb7d fix reporting of innerclass classnames 2019-11-12 14:33:33 +01:00
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
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
deec9c44b2 [maven-release-plugin] prepare for next development iteration 2019-10-31 18:36:51 +01:00
2881b6f585 [maven-release-plugin] prepare release pmd_releases/6.19.0 2019-10-31 18:36:42 +01:00
73e48edaaa Merge branch 'pr-2054'
[java] Rename rule InvalidSlf4jLoggingFormat to InvalidLogMessageFormat
2019-10-30 19:30:44 +01:00
34455b3051 Merge branch 'pr-2066' 2019-10-29 16:38:42 +01:00
0a94dec8f0 Merge branch 'pr-2044'
[core] Wrong deprecation warnings for unused XPath attributes
2019-10-28 19:27:52 +01:00
752e5f8ad5 [java] Deprecate AbstractJavaRule#getDeclaringType(Node)
Refs #2034
2019-10-26 12:17:43 +02:00
c1f36d9d70 [java] Rename InvalidSlf4jMessageFormat to InvalidLogMessageFormat
Follow-up on #2012
2019-10-25 18:42:50 +02:00
63395684c4 Merge branch 'pr-2076' 2019-10-25 15:01:58 +02:00
ecc4e7558f [java] Use full name for CLASS_FAN_OUT metric for operations as well 2019-10-25 14:44:45 +02:00
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
e2877ab95c use full name instead of abbreviation for classfanout & fix spelling 2019-10-22 20:22:20 +02:00
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
b32c7ad6a8 [java] DoNotUseThreads should not warn on Runnable #1627 2019-10-19 20:55:49 +02:00
5739041b16 [java] DoNotUseThreads should not warn on Runnable on java8+ #1627 2019-10-18 17:43:33 +02:00
1515209a48 add classfanoutcomplexity metric 2019-10-17 13:05:36 +02:00
52341d9d67 [java] Fix deprecated attributes in XPath rules 2019-10-14 19:50:52 +02:00
e4e4c7ceae Merge branch 'pr-2060' 2019-10-14 19:36:45 +02:00
a8dbc91b5e Make comment consistent with expected failures
Three of the problems were UR anomalies.

Addresses: #1636
2019-10-12 21:45:15 -07:00
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
7911d733d4 Deprecate various utility classes 2019-10-09 22:38:52 +02:00
a61835fe1e [java] Fix regexp to properly parse references 2019-10-06 17:38:50 -03:00
92f393f32c [java] Add failing tests for #2025 2019-10-06 17:38:50 -03:00
5156e8922e Merge branch 'pr-2010' 2019-10-05 18:28:48 +02:00
06add3a5a7 [doc] Update release notes, refs #2010 2019-10-05 18:27:56 +02:00
9c8cab088e Merge remote-tracking branch 'origin/master' 2019-10-05 15:06:24 +02:00
f4d590a3b2 Merge branch 'pr-2012' 2019-10-05 14:55:25 +02:00
744fea7366 [doc] Update rule descriptions for supported logging frameworks 2019-10-05 14:53:24 +02:00
0d9419ef3e Remove unnecessary CDATA for test descriptions 2019-10-05 14:50:50 +02:00
04e5619fa8 Deprecations for #2034
Also, replace deprecated method usages
2019-10-05 13:55:18 +02:00
6ace28fdca Merge branch 'pr-2047' 2019-10-03 18:48:49 +02:00
8e28fb35dc fix: [java] PMD crashes with ClassFormatError: Absent Code attribute...
Retrieving the enclosing class might result in a LinkageError or
ClassFormatError.
For now this error is just logged as a warning and ignored.

fixes #2042
2019-09-28 19:54:56 +02:00
ea6174ebed Fix computation of metrics with annotations 2019-09-28 12:32:31 +02:00
54b7679329 Same for apex 2019-09-25 01:11:46 +02:00
bcb7774795 [pmd-java] Deprecate CanSuppressWarnings following #1927 2019-09-25 01:08:19 +02:00
ab434f3747 changes in response to feedback
Remove wrapping HashMap
Add log4j2 to test descriptions
2019-09-19 21:04:01 +01:00
494a5bc3f8 Fix #2017 2019-09-19 16:12:08 -03:00
8d5cb1968d Add failing test for UnnecessaryFullyQualifiedName
- Tests for #2017
2019-09-19 16:11:35 -03:00
e536ca1947 [maven-release-plugin] prepare for next development iteration 2019-09-15 10:14:14 +02:00
3f42cca200 [maven-release-plugin] prepare release pmd_releases/6.18.0 2019-09-15 10:14:05 +02:00
8f3abf9349 Merge branch 'pr-2015' 2019-09-15 09:47:04 +02:00
eeb147e594 formatting 2019-09-15 09:46:07 +02:00
73006a420e Update doc for unused formal parameter 2019-09-14 14:17:06 -05:00
9ae5342eb5 Normalise line terminators in tests
Comparison was failing because the test file was checked
out with CRLF and the expected result is written with LF.

Maybe we should normalise consistently across tests. Using
PMD.EOL in tests is just code obfuscation.
2019-09-14 02:06:39 +02:00
c7b83fc0bc Merge branch 'adangel-java13' 2019-09-14 01:08:20 +02:00
76bf20a0c7 Analyze only src/main/java and not src anymore, since mixing
java12 preview and java13 preview is now not possible anymore

see
src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java12
src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java13
2019-09-12 20:35:36 +02:00
eba98b3898 Fixes from review, refs #1973 2019-09-12 20:22:45 +02:00