Skip to content

Commit 12b9ece

Browse files
committed
[doc] Update release notes (#4396)
1 parent 70296ae commit 12b9ece

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

docs/pages/pmd/devdocs/major_contributions/adding_new_cpd_language.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: How to add a new CPD language
33
short_title: Adding a new CPD language
44
tags: [devdocs, extending]
55
summary: How to add a new language module with CPD support.
6-
last_updated: April 2023 (7.0.0)
6+
last_updated: June 2024 (7.3.0)
77
permalink: pmd_devdocs_major_adding_new_cpd_language.html
88
author: Matías Fraga, Clément Fournier
99
---
@@ -45,8 +45,15 @@ Use the following guide to set up a new language module that supports CPD.
4545
}
4646
```
4747

48+
- If your language is case-insensitive, then you might want to overwrite `getImage(AntlrToken)`. There you can
49+
change each token e.g. into uppercase, so that CPD sees the same strings and can find duplicates even when
50+
the casing differs. See {% jdoc tsql::lang.tsql.cpd.TSqlCpdLexer %} for an example. You will also need a
51+
"CaseChangingCharStream", so that antlr itself is case-insensitive.
4852
- For JavaCC grammars, place your grammar in `etc/grammar` and edit the `pom.xml` like the [Python implementation](https://github.com/pmd/pmd/blob/master/pmd-python/pom.xml) does.
4953
You can then subclass {% jdoc core::cpd.impl.JavaccCpdLexer %} instead of AntlrCpdLexer.
54+
- If your JavaCC based language is case-insensitive (option `IGNORE_CASE=true`), then you need to implement
55+
{%jdoc core::lang.ast.impl.javacc.JavaccTokenDocument.TokenDocumentBehavior %}, which can change each token
56+
e.g. into uppercase. See {%jdoc plsql::lang.plsql.ast.PLSQLParser %} for an example.
5057
- For any other scenario just implement the interface however you can. Look at the Scala or Apex module for existing implementations.
5158

5259
3. Create a {% jdoc core::lang.Language %} implementation, and make it implement {% jdoc core::cpd.CpdCapableLanguage %}.

docs/pages/release_notes.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ See also [Maven PMD Plugin]({{ baseurl }}pmd_userdocs_tools_maven.html).
3939
* cli
4040
* [#2827](https://github.com/pmd/pmd/issues/2827): \[cli] Consider processing errors in exit status
4141
* core
42+
* [#4396](https://github.com/pmd/pmd/issues/4396): \[core] CPD is always case sensitive
4243
* [#4992](https://github.com/pmd/pmd/pull/4992): \[core] CPD: Include processing errors in XML report
4344
* apex
4445
* [#4922](https://github.com/pmd/pmd/issues/4922): \[apex] SOQL syntax error with TYPEOF in sub-query
@@ -112,11 +113,18 @@ read the XML format should be updated.
112113
* {% jdoc !!core::cpd.CPDConfiguration#isSkipLexicalErrors() %} and {% jdoc core::cpd.CPDConfiguration#setSkipLexicalErrors(boolean) %}:
113114
Use {%jdoc core::AbstractConfiguration#setFailOnError(boolean) %} to control whether to ignore errors or fail the build.
114115
* {%jdoc !!core::cpd.XMLOldRenderer %} (the CPD format "xmlold").
116+
* The constructor
117+
{%jdoc !!core::lang.ast.impl.antlr4.AntlrToken#AntlrToken(org.antlr.v4.runtime.Token,core::lang.ast.impl.antlr4.AntlrToken,core::lang.document.TextDocument) %}
118+
shouldn't be used directly. Use {%jdoc core::lang.ast.impl.antlr4.AntlrTokenManager %} instead.
115119
* pmd-java
116120
* {% jdoc !!java::lang.java.ast.ASTResource#getStableName() %} and the corresponding attribute `@StableName`.
117121
* {%jdoc !!java::lang.java.ast.ASTRecordPattern#getVarId() %} This method was added here by mistake. Record
118122
patterns don't declare a pattern variable for the whole pattern, but rather for individual record
119123
components, which can be accessed via {%jdoc java::lang.java.ast.ASTRecordPattern#getComponentPatterns() %}.
124+
* pmd-plsql
125+
* {%jdoc plsql::lang.plsql.ast.PLSQLParserImpl %} is deprecated now. It should have been package-private
126+
because this is an implementation class that should not be used directly.
127+
* The node {%jdoc plsql::lang.plsql.ast.ASTKEYWORD_UNRESERVED %} is deprecated and is now removed from the AST.
120128

121129
#### Breaking changes: pmd-compat6 removed
122130

pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/javacc/JavaccToken.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ public String getImage() {
147147
return image.toString();
148148
}
149149

150-
/** Returns the original text of the token. The image may be normalized. */
150+
/**
151+
* Returns the original text of the token.
152+
* The image may be normalized, e.g. for case-insensitive languages.
153+
*
154+
* @since 7.3.0
155+
*/
151156
public Chars getText() {
152157
return document.getTextDocument().sliceOriginalText(getRegion());
153158
}

0 commit comments

Comments
 (0)