[core] Consolidate internal api in LexException
This commit is contained in:
@ -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.
|
||||
|
@ -283,7 +283,7 @@
|
||||
<!-- Use own LexException instead of JavaCC's TokenMgrError -->
|
||||
<replaceregexp>
|
||||
<regexp pattern='throw new TokenMgrError\(EOFSeen' />
|
||||
<substitution expression='throw new net.sourceforge.pmd.lang.ast.LexException(EOFSeen' />
|
||||
<substitution expression='throw net.sourceforge.pmd.lang.ast.InternalApiBridge.newLexException(EOFSeen' />
|
||||
<file name="${tokenmgr-file}" />
|
||||
</replaceregexp>
|
||||
|
||||
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.ast;
|
||||
|
||||
import net.sourceforge.pmd.annotation.InternalApi;
|
||||
|
||||
/**
|
||||
* Internal API.
|
||||
*
|
||||
* <p>Acts as a bridge between outer parts of PMD and the restricted access
|
||||
* internal API of this package.
|
||||
*
|
||||
* <p><b>None of this is published API, and compatibility can be broken anytime!</b>
|
||||
* 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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
Reference in New Issue
Block a user