Branch: refs/heads/main
  Home:   https://github.com/pmd/pmd
  Commit: 0fcba96e9413c6e2acaed7047cbcdfbd1f5743c1
      https://github.com/pmd/pmd/commit/0fcba96e9413c6e2acaed7047cbcdfbd1f5743c1
  Author: anying <[email protected]>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    M docs/pages/release_notes.md
    M 
pmd-groovy/src/main/java/net/sourceforge/pmd/lang/groovy/ast/impl/antlr4/GroovyTokenManager.java
    M 
pmd-groovy/src/main/java/net/sourceforge/pmd/lang/groovy/cpd/GroovyCpdLexer.java
    M 
pmd-groovy/src/test/java/net/sourceforge/pmd/lang/groovy/cpd/GroovyCpdLexerTest.java
    M 
pmd-groovy/src/test/resources/net/sourceforge/pmd/lang/groovy/cpd/testdata/cpdoff.txt
    A 
pmd-groovy/src/test/resources/net/sourceforge/pmd/lang/groovy/cpd/testdata/gstrings.groovy
    A 
pmd-groovy/src/test/resources/net/sourceforge/pmd/lang/groovy/cpd/testdata/gstrings.txt
    M 
pmd-groovy/src/test/resources/net/sourceforge/pmd/lang/groovy/cpd/testdata/sample.txt

  Log Message:
  -----------
  [groovy] Fix #7100: CPD fails on GStrings ending in an interpolated variable 
(#7110)

* Fix #7100: CPD fails on GStrings ending in an interpolated variable

GroovyCpdLexer used org.apache.groovy.parser.antlr4.GroovyLexer directly.
That lexer depends on its subclass GroovyLangLexer (the one the Groovy
compiler uses) to roll back one character after a GString path such as
"$i". Without it the character after the variable is swallowed: for
"x $i y" the following GString part lost its leading space, and for
"$i" or "x-$i" the closing quote was consumed, which made lexing fail.

Use GroovyLangLexer instead, and report GroovySyntaxError (an
AssertionError thrown by the Groovy lexer for some errors) as a
LexException so that it is handled like any other lexical error.

* [docs] Update release notes

---------

Co-authored-by: Sören Glimm <[email protected]>



To unsubscribe from these emails, change your notification settings at 
https://github.com/pmd/pmd/settings/notifications


_______________________________________________
Pmd-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pmd-commits

Reply via email to