[jsp] Cleanup InternalApi methods

Refs #4348
This commit is contained in:
Andreas Dangel 2024-02-01 10:08:16 +01:00
parent 35db84a0a8
commit 3ff3f5b4d1
No known key found for this signature in database
GPG Key ID: 93450DF2DF9A3FA3
5 changed files with 27 additions and 12 deletions

View File

@ -200,6 +200,8 @@ package or made (package) private and are not accessible anymore.
* {%jdoc java::types.ast.internal.LazyTypeResolver %}
* {%jdoc java::types.JMethodSig#internalApi() %} has been removed.
* {%jdoc java::types.TypeOps#isSameTypeInInference(java::types.JTypeMirror,java::types.JTypeMirror) %} (now package private)
* pmd-jsp
* {%jdoc jsp::ast.JspParser#getTokenBehavior() %} has been removed.
**Newly internal classes, interfaces and methods**

View File

@ -0,0 +1,22 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.jsp.ast;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccTokenDocument;
/**
* @apiNote Internal API
*/
@InternalApi
public final class InternalApiBridge {
private InternalApiBridge() {
// internal
}
public static JavaccTokenDocument.TokenDocumentBehavior getJspTokenBehavior() {
return JspParser.TOKEN_BEHAVIOR;
}
}

View File

@ -4,7 +4,6 @@
package net.sourceforge.pmd.lang.jsp.ast;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.ast.ParseException;
import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccTokenDocument.TokenDocumentBehavior;
@ -15,7 +14,7 @@ import net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeParserAdapter;
*/
public final class JspParser extends JjtreeParserAdapter<ASTCompilationUnit> {
private static final TokenDocumentBehavior TOKEN_BEHAVIOR = new TokenDocumentBehavior(JspTokenKinds.TOKEN_NAMES);
static final TokenDocumentBehavior TOKEN_BEHAVIOR = new TokenDocumentBehavior(JspTokenKinds.TOKEN_NAMES);
@Override
protected TokenDocumentBehavior tokenBehavior() {
@ -26,9 +25,4 @@ public final class JspParser extends JjtreeParserAdapter<ASTCompilationUnit> {
protected ASTCompilationUnit parseImpl(CharStream cs, ParserTask task) throws ParseException {
return new JspParserImpl(cs).CompilationUnit().makeTaskInfo(task);
}
@InternalApi
public static TokenDocumentBehavior getTokenBehavior() {
return TOKEN_BEHAVIOR;
}
}

View File

@ -9,8 +9,6 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import net.sourceforge.pmd.annotation.InternalApi;
/**
* Utility class to keep track of unclosed tags. The mechanism is rather simple.
* If a end tag (&lt;/x&gt;) is encountered, it will iterate through the open
@ -21,7 +19,6 @@ import net.sourceforge.pmd.annotation.InternalApi;
* @author Victor Bucutea
*
*/
@InternalApi
class OpenTagRegister {
private List<ASTElement> tagList = new ArrayList<>();

View File

@ -9,14 +9,14 @@ import net.sourceforge.pmd.lang.TokenManager;
import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
import net.sourceforge.pmd.lang.document.TextDocument;
import net.sourceforge.pmd.lang.jsp.ast.JspParser;
import net.sourceforge.pmd.lang.jsp.ast.InternalApiBridge;
import net.sourceforge.pmd.lang.jsp.ast.JspTokenKinds;
public class JSPTokenizer extends JavaCCTokenizer {
@Override
protected TokenManager<JavaccToken> makeLexerImpl(TextDocument doc) {
return JspTokenKinds.newTokenManager(CharStream.create(doc, JspParser.getTokenBehavior()));
return JspTokenKinds.newTokenManager(CharStream.create(doc, InternalApiBridge.getJspTokenBehavior()));
}
}