Akshat-Jain commented on code in PR #17466:
URL: https://github.com/apache/druid/pull/17466#discussion_r1846560433
##########
pom.xml:
##########
@@ -1830,7 +1851,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
- <version>3.1.1</version>
+ <version>3.1.2</version>
Review Comment:
I tried exploring different versions for this.
If we don't explicitly specify a version, it uses `3.2.0` from the parent,
which runs into the following issue:
```
<pmd xmlns="http://pmd.sourceforge.net/report/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/report/2.0.0
http://pmd.sourceforge.net/report_2_0_0.xsd" version="6.42.0"
timestamp="2024-11-18T17:56:13.310">
<error
filename="/Users/akjn/code/druid/processing/src/main/java/org/apache/druid/query/aggregation/JavaScriptAggregatorFactory.java"
msg="PMDException: Error while parsing
/Users/akjn/code/druid/processing/src/main/java/org/apache/druid/query/aggregation/JavaScriptAggregatorFactory.java">
<![CDATA[ net.sourceforge.pmd.PMDException: Error while parsing
/Users/akjn/code/druid/processing/src/main/java/org/apache/druid/query/aggregation/JavaScriptAggregatorFactory.java
at
net.sourceforge.pmd.SourceCodeProcessor.processSourceCodeWithoutCache(SourceCodeProcessor.java:124)
at
net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:100)
at
net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:62)
at net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:85) at
net.sourceforge.pmd.processor.PmdRunnable.call(PmdRunnable.java:29) at
java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadP
oolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: net.sourceforge.pmd.lang.java.ast.ParseException: Encountered " "."
". "" at line 71, column 40. Was expecting one of: <IDENTIFIER> ... "@" ... "@"
... "@" ... "@" ... <IDENTIFIER> ... <IDENTIFIER> ... <IDENTIFIER> ...
<IDENTIFIER> ... <IDENTIFIER> ... <IDENTIFIER> ... <IDENTIFIER> ...
<IDENTIFIER> ... <IDENTIFIER> ... <IDENTIFIER> ... <IDENTIFIER> ...
<IDENTIFIER> ... <IDENTIFIER> ... <IDENTIFIER> ... <IDENTIFIER> ... at
net.sourceforge.pmd.lang.java.ast.JavaParser.generateParseException(JavaParser.java:13532)
at
net.sourceforge.pmd.lang.java.ast.JavaParser.jj_consume_token(JavaParser.java:13416)
at
net.sourceforge.pmd.lang.java.ast.JavaParser.MethodDeclarator(JavaParser.java:2169)
at
net.sourceforge.pmd.lang.java.ast.JavaParser.MethodDeclaration(JavaParser.java:2118)
at
net.sourceforge.pmd.lang.java.ast.JavaParser.ClassOrInterfaceBodyDeclaration(JavaParser.java:1811)
at net.sourceforge.pmd.lang.jav
a.ast.JavaParser.ClassOrInterfaceBody(JavaParser.java:1764) at
net.sourceforge.pmd.lang.java.ast.JavaParser.ClassOrInterfaceDeclaration(JavaParser.java:905)
at
net.sourceforge.pmd.lang.java.ast.JavaParser.TypeDeclaration(JavaParser.java:807)
at
net.sourceforge.pmd.lang.java.ast.JavaParser.CompilationUnit(JavaParser.java:527)
at
net.sourceforge.pmd.lang.java.AbstractJavaParser.parse(AbstractJavaParser.java:62)
at net.sourceforge.pmd.lang.AbstractParser.doParse(AbstractParser.java:44) at
net.sourceforge.pmd.SourceCodeProcessor.parse(SourceCodeProcessor.java:136) at
net.sourceforge.pmd.SourceCodeProcessor.processSource(SourceCodeProcessor.java:200)
at
net.sourceforge.pmd.SourceCodeProcessor.processSourceCodeWithoutCache(SourceCodeProcessor.java:118)
... 10 more ]]>
</error>
</pmd>
```
The above can be simulated using:
```
mvn dependency:analyze -DoutputXML=true -DignoreNonCompile=true
-DfailOnWarning=true -X
```
The above is happening for the following line:
https://github.com/apache/druid/blob/24a1fafaa745fb93bf1522490c095cd689fd9996/processing/src/main/java/org/apache/druid/query/aggregation/JavaScriptAggregatorFactory.java#L71
I tried using `@SuppressWarnings()` for the above line, but that also
doesn't help since it's a parsing error for PMD.
Thoughts?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]