Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Deprecate CharStream & generated classes #2244

Merged
merged 3 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/pages/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ You can identify them with the `@InternalApi` annotation. You'll also get a depr
methods on {% jdoc apex::lang.apex.ast.ApexParserVisitor %} and its implementations.
Use {% jdoc apex::lang.apex.ast.ApexNode %} instead, now considers comments too.

* {% jdoc core::lang.ast.CharStream %}, {% jdoc core::lang.ast.JavaCharStream %},
{% jdoc core::lang.ast.SimpleCharStream %}: these are APIs used by our JavaCC
implementations and that will be moved/refactored for PMD 7.0.0. They should not
be used, extended or implemented directly.
* All classes generated by JavaCC, eg {% jdoc java::lang.ast.JJTJavaParserState %}.
This includes token classes, which will be replaced with a single implementation, and
subclasses of {% jdoc core::lang.ast.ParseException %}, whose usages will be replaced
by just that superclass.


##### For removal

* pmd-core
Expand Down
7 changes: 5 additions & 2 deletions pmd-core/src/main/ant/alljavacc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<replace file="${target}/net/sourceforge/pmd/lang/ast/dummy/CharStream.java"
token="net.sourceforge.pmd.lang.ast.dummy"
value="net.sourceforge.pmd.lang.ast" />
<replace file="${target}/net/sourceforge/pmd/lang/ast/dummy/CharStream.java"
token="interface"
value="@Deprecated @net.sourceforge.pmd.annotation.InternalApi interface" />
<move overwrite="true"
file="${target}/net/sourceforge/pmd/lang/ast/dummy/CharStream.java"
tofile="${target}/net/sourceforge/pmd/lang/ast/CharStream.java" />
Expand All @@ -59,7 +62,7 @@
value="net.sourceforge.pmd.lang.ast" />
<replace file="${target}/net/sourceforge/pmd/lang/ast/dummy/JavaCharStream.java"
token="class JavaCharStream"
value="class JavaCharStream implements CharStream" />
value="@Deprecated @net.sourceforge.pmd.annotation.InternalApi class JavaCharStream implements CharStream" />
<move overwrite="true"
file="${target}/net/sourceforge/pmd/lang/ast/dummy/JavaCharStream.java"
tofile="${target}/net/sourceforge/pmd/lang/ast/JavaCharStream.java" />
Expand All @@ -77,7 +80,7 @@
value="net.sourceforge.pmd.lang.ast" />
<replace file="${target}/net/sourceforge/pmd/lang/ast/dummy/SimpleCharStream.java"
token="public class SimpleCharStream"
value="public class SimpleCharStream implements CharStream" />
value="@Deprecated @net.sourceforge.pmd.annotation.InternalApi public class SimpleCharStream implements CharStream" />
<move overwrite="true"
file="${target}/net/sourceforge/pmd/lang/ast/dummy/SimpleCharStream.java"
tofile="${target}/net/sourceforge/pmd/lang/ast/SimpleCharStream.java" />
Expand Down
17 changes: 16 additions & 1 deletion pmd-cpp/src/main/ant/alljavacc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ public class Token implements GenericToken, java.io.Serializable]]></replacevalu
]]></replacevalue>
</replace>



<replaceregexp>
<regexp pattern="class|interface" />
<substitution expression="@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/cpp/ast"/>
</replaceregexp>

<replaceregexp>
<regexp pattern="public class ParseException " />
<substitution expression=" /** @deprecated Use superclass {@link net.sourceforge.pmd.lang.ast.ParseException} */
@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset file="${target}/net/sourceforge/pmd/lang/cpp/ast/ParseException.java"/>
</replaceregexp>

</target>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.Reader;
import java.util.regex.Pattern;

import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.ast.SimpleCharStream;

/**
Expand All @@ -16,6 +17,8 @@
*
* @author Andreas Dangel
*/
@Deprecated
@InternalApi
public class CppCharStream extends SimpleCharStream {

private static final Pattern CONTINUATION = Pattern.compile("\\\\\\n|\\\\\\r\\n");
Expand Down
14 changes: 14 additions & 0 deletions pmd-java/src/main/ant/alljavacc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,19 @@ public class Token implements GenericToken, java.io.Serializable]]></replacevalu
<include name="AST*.java" />
</fileset>
</delete>


<replaceregexp>
<regexp pattern="class|interface" />
<substitution expression="@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/java/ast"/>
</replaceregexp>

<replaceregexp>
<regexp pattern="public class ParseException " />
<substitution expression=" /** @deprecated Use superclass {@link net.sourceforge.pmd.lang.ast.ParseException} */
@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset file="${target}/net/sourceforge/pmd/lang/java/ast/ParseException.java"/>
</replaceregexp>
</target>
</project>
15 changes: 15 additions & 0 deletions pmd-javascript/src/main/ant/alljavacc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,20 @@ public class Token implements GenericToken, java.io.Serializable]]></replacevalu

]]></replacevalue>
</replace>



<replaceregexp>
<regexp pattern="class|interface" />
<substitution expression="@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/ecmascript5/ast"/>
</replaceregexp>

<replaceregexp>
<regexp pattern="public class ParseException " />
<substitution expression=" /** @deprecated Use superclass {@link net.sourceforge.pmd.lang.ast.ParseException} */
@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset file="${target}/net/sourceforge/pmd/lang/ecmascript5/ast/ParseException.java"/>
</replaceregexp>
</target>
</project>
15 changes: 15 additions & 0 deletions pmd-jsp/src/main/ant/alljavacc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,21 @@ public class Token implements GenericToken, java.io.Serializable]]></replacevalu
<include name="AST*.java" />
</fileset>
</delete>



<replaceregexp>
<regexp pattern="class|interface" />
<substitution expression="@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/jsp/ast"/>
</replaceregexp>

<replaceregexp>
<regexp pattern="public class ParseException " />
<substitution expression=" /** @deprecated Use superclass {@link net.sourceforge.pmd.lang.ast.ParseException} */
@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset file="${target}/net/sourceforge/pmd/lang/jsp/ast/ParseException.java"/>
</replaceregexp>
</target>

</project>
15 changes: 15 additions & 0 deletions pmd-matlab/src/main/ant/alljavacc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,21 @@ public class Token implements GenericToken, java.io.Serializable]]></replacevalu

]]></replacevalue>
</replace>



<replaceregexp>
<regexp pattern="class|interface" />
<substitution expression="@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/matlab/ast"/>
</replaceregexp>

<replaceregexp>
<regexp pattern="public class ParseException " />
<substitution expression=" /** @deprecated Use superclass {@link net.sourceforge.pmd.lang.ast.ParseException} */
@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset file="${target}/net/sourceforge/pmd/lang/matlab/ast/ParseException.java"/>
</replaceregexp>
</target>

</project>
15 changes: 15 additions & 0 deletions pmd-modelica/src/main/ant/alljavacc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,20 @@ public class Token implements GenericToken, java.io.Serializable]]></replacevalu
</fileset>
</delete>



<replaceregexp>
<regexp pattern="class|interface" />
<substitution expression="@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/modelica/ast"/>
</replaceregexp>

<replaceregexp>
<regexp pattern="public class ParseException " />
<substitution expression=" /** @deprecated Use superclass {@link net.sourceforge.pmd.lang.ast.ParseException} */
@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset file="${target}/net/sourceforge/pmd/lang/modelica/ast/ParseException.java"/>
</replaceregexp>

</target>
</project>
15 changes: 15 additions & 0 deletions pmd-objectivec/src/main/ant/alljavacc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,21 @@ public class Token implements GenericToken, java.io.Serializable]]></replacevalu

]]></replacevalue>
</replace>



<replaceregexp>
<regexp pattern="class|interface" />
<substitution expression="@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/objectivec/ast"/>
</replaceregexp>

<replaceregexp>
<regexp pattern="public class ParseException " />
<substitution expression=" /** @deprecated Use superclass {@link net.sourceforge.pmd.lang.ast.ParseException} */
@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset file="${target}/net/sourceforge/pmd/lang/objectivec/ast/ParseException.java"/>
</replaceregexp>
</target>

</project>
13 changes: 13 additions & 0 deletions pmd-plsql/src/main/ant/alljavacc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,18 @@ public class Token implements GenericToken, java.io.Serializable]]></replacevalu
]]></replacevalue>
</replace>


<replaceregexp>
<regexp pattern="class|interface" />
<substitution expression="@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/plsql/ast"/>
</replaceregexp>

<replaceregexp>
<regexp pattern="public class ParseException " />
<substitution expression=" /** @deprecated Use superclass {@link net.sourceforge.pmd.lang.ast.ParseException} */
@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset file="${target}/net/sourceforge/pmd/lang/plsql/ast/ParseException.java"/>
</replaceregexp>
</target>
</project>
15 changes: 15 additions & 0 deletions pmd-python/src/main/ant/alljavacc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,21 @@ public class Token implements GenericToken, java.io.Serializable]]></replacevalu

]]></replacevalue>
</replace>



<replaceregexp>
<regexp pattern="class|interface" />
<substitution expression="@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/python/ast"/>
</replaceregexp>

<replaceregexp>
<regexp pattern="public class ParseException " />
<substitution expression=" /** @deprecated Use superclass {@link net.sourceforge.pmd.lang.ast.ParseException} */
@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset file="${target}/net/sourceforge/pmd/lang/python/ast/ParseException.java"/>
</replaceregexp>
</target>

</project>
17 changes: 16 additions & 1 deletion pmd-visualforce/src/main/ant/alljavacc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
javacchome="${javacc-home.path}" />
<!-- Ensure generated using CharStream interface debugparser="true"
debugtokenmanager="true"-->
<javacc static="false"
<javacc static="false"
usercharstream="true"
unicodeinput="true"
javaunicodeescape="false"
Expand Down Expand Up @@ -116,6 +116,21 @@ public class Token implements GenericToken, java.io.Serializable]]></replacevalu
<include name="AST*.java" />
</fileset>
</delete>



<replaceregexp>
<regexp pattern="class|interface" />
<substitution expression="@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/vf/ast"/>
</replaceregexp>

<replaceregexp>
<regexp pattern="public class ParseException " />
<substitution expression=" /** @deprecated Use superclass {@link net.sourceforge.pmd.lang.ast.ParseException} */
@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset file="${target}/net/sourceforge/pmd/lang/vf/ast/ParseException.java"/>
</replaceregexp>
</target>

</project>
15 changes: 15 additions & 0 deletions pmd-vm/src/main/ant/alljavacc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,20 @@ public class Token implements GenericToken, java.io.Serializable]]></replacevalu

]]></replacevalue>
</replace>



<replaceregexp>
<regexp pattern="class|interface" />
<substitution expression="@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/vm/ast"/>
</replaceregexp>

<replaceregexp>
<regexp pattern="public class ParseException " />
<substitution expression=" /** @deprecated Use superclass {@link net.sourceforge.pmd.lang.ast.ParseException} */
@Deprecated @net.sourceforge.pmd.annotation.InternalApi \0" />
<fileset file="${target}/net/sourceforge/pmd/lang/vm/ast/ParseException.java"/>
</replaceregexp>
</target>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* $
* @since 1.5
*/
@Deprecated
public class TemplateParseException extends ParseException {
private static final long serialVersionUID = -3146323135623083918L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* under the License.
*/

/**
Expand All @@ -36,8 +36,10 @@
/**
* An implementation of interface CharStream, where the stream is assumed to
* contain only ASCII characters (without unicode processing).
*
* @deprecated Will be removed, replaced with SimpleCharStream
*/

@Deprecated
public final class VelocityCharStream implements CharStream {
public static final boolean STATIC_FLAG = false;
int bufsize;
Expand Down Expand Up @@ -401,7 +403,7 @@ public void Done() {

/**
* Method to adjust line and column numbers for the start of a token.<BR>
*
*
* @param newLine
* @param newCol
*/
Expand Down