GeezerVison is showing github.com — [java] Error processing identifiers with Unicode · Issue #3423 · pmd/pmd
[java] Error processing identifiers with Unicode #3423
Labels
a:bugPMD crashes or fails to analyse a file.in:grammarAbout the grammar of a lexer or parser, eg, a parse/lex exception Description
Affects PMD Version:
6.36.0
Description:
PMD fails to analyze Java source with variables named with Unicode characters. Additionally, I think this is causing Eclipse to entirely crash when this is encountered (as opposed to failing more gracefully) while using the com.basistech.m2e.code.quality.pmd plugin but I'm not certain how to diagnose this specifically.
This is likely related to the following issues but I created this issues for Java specifically and to mention the Eclipse crash:
Exception Stacktrace:
net.sourceforge.pmd.PMDException: Error while processing /home/nidoyle/Work/Source/PmdTest/src/main/java/com/example/pmdtest/PmdTest.java
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCodeWithoutCache(SourceCodeProcessor.java:119)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:95)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:57)
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:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: net.sourceforge.pmd.lang.ast.TokenMgrError: Lexical error at line 5, column 28. Encountered: "\u1d64" (7524), after : "" (in lexical state 0)
at net.sourceforge.pmd.lang.java.ast.JavaParserTokenManager.getNextToken(JavaParserTokenManager.java:2377)
at net.sourceforge.pmd.lang.java.ast.JavaParser.jj_scan_token(JavaParser.java:13219)
at net.sourceforge.pmd.lang.java.ast.JavaParser.jj_3R_126(JavaParser.java:9270)
at net.sourceforge.pmd.lang.java.ast.JavaParser.jj_3_13(JavaParser.java:9421)
at net.sourceforge.pmd.lang.java.ast.JavaParser.jj_2_13(JavaParser.java:7931)
at net.sourceforge.pmd.lang.java.ast.JavaParser.ClassOrInterfaceBodyDeclaration(JavaParser.java:1782)
at net.sourceforge.pmd.lang.java.ast.JavaParser.ClassOrInterfaceBody(JavaParser.java:1738)
at net.sourceforge.pmd.lang.java.ast.JavaParser.ClassOrInterfaceDeclaration(JavaParser.java:879)
at net.sourceforge.pmd.lang.java.ast.JavaParser.TypeDeclaration(JavaParser.java:781)
at net.sourceforge.pmd.lang.java.ast.JavaParser.CompilationUnit(JavaParser.java:501)
at net.sourceforge.pmd.lang.java.AbstractJavaParser.parse(AbstractJavaParser.java:62)
at net.sourceforge.pmd.SourceCodeProcessor.parse(SourceCodeProcessor.java:127)
at net.sourceforge.pmd.SourceCodeProcessor.processSource(SourceCodeProcessor.java:191)
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCodeWithoutCache(SourceCodeProcessor.java:113)
... 10 more
Code Sample demonstrating the issue:
package com.example.pmdtest;
public class PmdTest {
private static final int lᵤ = 1;
private static final int μᵤ = 2;
public static void main(String[] args) {
System.out.println(lᵤ + μᵤ);
}
}
Steps to reproduce:
Please provide detailed steps for how we can reproduce the bug.
mvn clean verify
Running PMD through: [Maven]
Activity
added a commit that references this issue
on May 1, 2022This issue will close once commit 98f44b7 is merged into the 'main' branch.98f44b7
Metadata
Metadata
a:bugPMD crashes or fails to analyse a file.in:grammarAbout the grammar of a lexer or parser, eg, a parse/lex exception Development
No branches or pull requestsIssue actions