Affects PMD Version:
PMD 7.2.0
Description:
PMD 7.2.0 CPD fails when parsing Apex class with string characters such as \u, ", %, etc.
This did not occur in PMD 6.55
Exception Stacktrace:
[TRACE] Tokenizing C:\Users\myname\Downloads\pmd-dist-7.2.0-bin\pmd-bin-7.2.0\bin\PMD7CPD.cls
line 4:86 token recognition error at: ''\u00A'
line 4:98 token recognition error at: '"'
line 4:102 token recognition error at: '%'
line 4:103 token recognition error at: '"'
line 4:104 token recognition error at: '');\n } \n}'
Code Sample demonstrating the issue:
public with sharing class PMD7CPD { public static void example(){ String str = 'alice'; str = str.replace('alice', '<bob></charlie>dan<!--JohannHeinrichvonThünen-->' + '\u00A0' + '"100%"'); } }
Steps to reproduce:
Please provide detailed steps for how we can reproduce the bug.
PMD7CPD.cls
and paste in the above apex codepmd cpd --debug --dir ./ --minimum-tokens 100 --language apex --format csv > result.csv
Running PMD through: Command line (Bash)
OpenJDK 17
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4