Merge branch 'pr-2372'

[core] Deprecations for token managers #2372
This commit is contained in:
Andreas Dangel
2020-04-03 15:19:52 +02:00
4 changed files with 21 additions and 0 deletions

View File

@ -98,6 +98,12 @@ implementations, and their corresponding Parser if it exists (in the same packag
* {% jdoc matlab::lang.matlab.MatlabTokenManager %}
* {% jdoc objectivec::lang.objectivec.ObjectiveCTokenManager %}
##### For removal
* {% jdoc !!core::lang.Parser#getTokenManager(java.lang.String,java.io.Reader) %}
* {% jdoc !!core::lang.TokenManager#setFileName(java.lang.String) %}
* {% jdoc !!core::lang.ast.AbstractTokenManager#setFileName(java.lang.String) %}
* {% jdoc !!core::lang.ast.AbstractTokenManager#getFileName(java.lang.String) %}
### External Contributions

View File

@ -29,7 +29,9 @@ public interface Parser {
* @param source
* Reader that provides the source code to tokenize.
* @return A TokenManager for reading token.
* @deprecated For removal in 7.0.0
*/
@Deprecated
TokenManager getTokenManager(String fileName, Reader source);

View File

@ -11,5 +11,10 @@ public interface TokenManager {
// TODO : Change the return to GenericToken in 7.0.0 - maybe even use generics TokenManager<T extends GenericToken>
Object getNextToken();
/**
* @deprecated For removal in 7.0.0
*/
@Deprecated
void setFileName(String fileName);
}

View File

@ -19,10 +19,18 @@ public abstract class AbstractTokenManager {
protected Map<Integer, String> suppressMap = new HashMap<>();
protected String suppressMarker = PMD.SUPPRESS_MARKER;
/**
* @deprecated For removal in 7.0.0
*/
@Deprecated
public static void setFileName(String fileName) {
AbstractTokenManager.fileName.set(fileName);
}
/**
* @deprecated For removal in 7.0.0
*/
@Deprecated
public static String getFileName() {
String fileName = AbstractTokenManager.fileName.get();
return fileName == null ? "(no file name provided)" : fileName;