diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md
index ace594edfe..58e00a9029 100644
--- a/docs/pages/release_notes.md
+++ b/docs/pages/release_notes.md
@@ -314,6 +314,8 @@ package or made (package) private and are _not accessible_ anymore.
* Method `loadRuleSetsWithoutException(java.util.List)` is now package private.
* {%jdoc !!core::lang.rule.RuleSetLoadException %}
* All constructors are package private now.
+ * {%jdoc !!core::lang.ast.LexException %} - the constructor `LexException(boolean, String, int, int, String, char)` is now package private.
+ It is only used by JavaCC-generated token managers.
* pmd-ant
* {%jdoc !!ant::ant.Formatter %}
* Method `getRenderer()` has been removed.
diff --git a/javacc-wrapper.xml b/javacc-wrapper.xml
index ece4307099..306c0601be 100644
--- a/javacc-wrapper.xml
+++ b/javacc-wrapper.xml
@@ -283,7 +283,7 @@
Acts as a bridge between outer parts of PMD and the restricted access + * internal API of this package. + * + *
None of this is published API, and compatibility can be broken anytime! + * Use this only at your own risk. + * + * @apiNote Internal API + */ +@InternalApi +public final class InternalApiBridge { + private InternalApiBridge() {} + + public static LexException newLexException(boolean eofSeen, String lexStateName, int errorLine, int errorColumn, String errorAfter, char curChar) { + return new LexException(eofSeen, lexStateName, errorLine, errorColumn, errorAfter, curChar); + } +} diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/LexException.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/LexException.java index 3aea6b656d..6331d798c9 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/LexException.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/LexException.java @@ -9,7 +9,6 @@ import static java.lang.Math.max; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; -import net.sourceforge.pmd.annotation.InternalApi; import net.sourceforge.pmd.lang.document.FileId; import net.sourceforge.pmd.lang.document.FileLocation; import net.sourceforge.pmd.util.StringUtil; @@ -44,9 +43,10 @@ public final class LexException extends FileAnalysisException { /** * Constructor called by JavaCC. + * + * @apiNote Internal API. */ - @InternalApi - public LexException(boolean eofSeen, String lexStateName, int errorLine, int errorColumn, String errorAfter, char curChar) { + LexException(boolean eofSeen, String lexStateName, int errorLine, int errorColumn, String errorAfter, char curChar) { super(makeReason(eofSeen, lexStateName, errorAfter, curChar)); line = max(errorLine, 1); column = max(errorColumn, 1);