Commit Graph

2769 Commits

Author SHA1 Message Date
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
Andreas Dangel
9c8cab088e Merge remote-tracking branch 'origin/master' 2019-10-05 15:06:24 +02:00
Andreas Dangel
f4d590a3b2 Merge branch 'pr-2012' 2019-10-05 14:55:25 +02:00
Andreas Dangel
744fea7366 [doc] Update rule descriptions for supported logging frameworks 2019-10-05 14:53:24 +02:00
Andreas Dangel
0d9419ef3e Remove unnecessary CDATA for test descriptions 2019-10-05 14:50:50 +02:00
Clément Fournier
04e5619fa8 Deprecations for #2034
Also, replace deprecated method usages
2019-10-05 13:55:18 +02:00
Andreas Dangel
6ace28fdca Merge branch 'pr-2047' 2019-10-03 18:48:49 +02:00
Andreas Dangel
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
andi
ea6174ebed Fix computation of metrics with annotations 2019-09-28 12:32:31 +02:00
Clément Fournier
54b7679329 Same for apex 2019-09-25 01:11:46 +02:00
Clément Fournier
bcb7774795 [pmd-java] Deprecate CanSuppressWarnings following #1927 2019-09-25 01:08:19 +02:00
markhall1982
ab434f3747 changes in response to feedback
Remove wrapping HashMap
Add log4j2 to test descriptions
2019-09-19 21:04:01 +01:00
Juan Martín Sotuyo Dodero
494a5bc3f8 Fix #2017 2019-09-19 16:12:08 -03:00
Juan Martín Sotuyo Dodero
8d5cb1968d Add failing test for UnnecessaryFullyQualifiedName
- Tests for #2017
2019-09-19 16:11:35 -03:00
Andreas Dangel
e536ca1947 [maven-release-plugin] prepare for next development iteration 2019-09-15 10:14:14 +02:00
Andreas Dangel
3f42cca200 [maven-release-plugin] prepare release pmd_releases/6.18.0 2019-09-15 10:14:05 +02:00
Andreas Dangel
8f3abf9349 Merge branch 'pr-2015' 2019-09-15 09:47:04 +02:00
Andreas Dangel
eeb147e594 formatting 2019-09-15 09:46:07 +02:00
Amish Shah
73006a420e Update doc for unused formal parameter 2019-09-14 14:17:06 -05:00
Clément Fournier
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
Clément Fournier
c7b83fc0bc Merge branch 'adangel-java13' 2019-09-14 01:08:20 +02:00
Andreas Dangel
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
Andreas Dangel
eba98b3898 Fixes from review, refs #1973 2019-09-12 20:22:45 +02:00
Clément Fournier
f9f7062a65 Mark typeres implementation as internal API 2019-09-12 18:43:22 +02:00
markhall82
96449c2ae5 Ensure pom formatting remains same as master 2019-09-11 20:45:42 +01:00
markhall82
16f7f9385b Correct previous error in doc re: placeholders
Revert IntelliJ added tags from pom.xml
2019-09-11 20:43:37 +01:00