Hi,
explicit receiver parameters are an obscure new language feature in Java 8.
See blog post by Stephen Colebourne:
http://blog.joda.org/2015/12/explicit-receiver-parameters.html
I tried it out with the Maven PMD plugin 3.6 and it looks like PMD cannot
parse the code.
Here's a small example project, see the Readme:
https://github.com/arend-von-reinersdorff/explicit-receiver-parameters-example
That this very obscure feature is not parsed, is in my opinion a minor
issue.
What I found more annoying is that the file with the code was apparently
silently dropped from the analysis. When a file cannot be parsed, I would
expect a warning or info message.
Main.java contains an "empy if block" violation and demo code to
demonstrate explicit receiver parameters. If I comment out the demo code,
mvn pmd:check fails because of the empty if block. If I leave the demo code
unchanged, the build succeeds.
Adding -Dpmd.verbose=true doesn't give a warning about the ignored file
either.
This might be a problem with the Maven plugin. At first I ran the code
through a Sonarqube analysis (using the PMD plugin) where a warning about
the ignored file appeared.
Warning from Sonarqube analysis:
[ERROR] [08:08:24.864] Fail to execute PMD. Following file is ignored:
<DELETED>\Main.javanet.sourceforge.pmd.PMDException: Error while
parsing <DELETED>\Main.java
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:79)
~[pmd-core-5.4.0.jar:na]
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:43)
~[pmd-core-5.4.0.jar:na]
at org.sonar.plugins.pmd.PmdTemplate.process(PmdTemplate.java:82)
~[sonar-pmd-plugin-2.5.jar:na]
at org.sonar.plugins.pmd.PmdExecutor.executeRules(PmdExecutor.java:120)
[sonar-pmd-plugin-2.5.jar:na]
Best regards,
Arend
|