[core] Remove deprecated members in Reportable
Reportable#getBeginLine Reportable#getBeginColumn Reportable#getEndLine Reportable#getEndColumn
This commit is contained in:
parent
50cbfe6834
commit
5c02b62623
@ -236,6 +236,11 @@ The following previously deprecated rules have been finally removed:
|
|||||||
* method `copyPropertyDescriptors()` has been removed. Use {%jdoc core::properties.AbstractPropertySource#getPropertyDescriptors() %} instead.
|
* method `copyPropertyDescriptors()` has been removed. Use {%jdoc core::properties.AbstractPropertySource#getPropertyDescriptors() %} instead.
|
||||||
* method `copyPropertyValues()` has been removed. Use {%jdoc core::properties.AbstractPropertySource#getPropertiesByPropertyDescriptor() %}
|
* method `copyPropertyValues()` has been removed. Use {%jdoc core::properties.AbstractPropertySource#getPropertiesByPropertyDescriptor() %}
|
||||||
or {%jdoc core::properties.AbstractPropertySource#getOverriddenPropertiesByPropertyDescriptor() %} instead.
|
or {%jdoc core::properties.AbstractPropertySource#getOverriddenPropertiesByPropertyDescriptor() %} instead.
|
||||||
|
* {%jdoc !!core::reporting.Reportable %} - the following methods have been removed. Use {%jdoc core::reporting.Reportable#getReportLocation() %} instead
|
||||||
|
* `getBeginLine()`
|
||||||
|
* `getBeginColumn()`
|
||||||
|
* `getEndLine()`
|
||||||
|
* `getEndColumn()`
|
||||||
* pmd-apex
|
* pmd-apex
|
||||||
* {%jdoc apex::lang.apex.ast.ApexNode %} and {% jdoc apex::lang.apex.ast.ASTApexFile %}
|
* {%jdoc apex::lang.apex.ast.ApexNode %} and {% jdoc apex::lang.apex.ast.ASTApexFile %}
|
||||||
* `#getApexVersion()`: In PMD 6, this method has been deprecated but was defined in the class `ApexRootNode`.
|
* `#getApexVersion()`: In PMD 6, this method has been deprecated but was defined in the class `ApexRootNode`.
|
||||||
|
@ -203,11 +203,11 @@
|
|||||||
<fileset dir="${target-package-dir}" />
|
<fileset dir="${target-package-dir}" />
|
||||||
</replaceregexp>
|
</replaceregexp>
|
||||||
|
|
||||||
<replace token=".beginLine" value=".getBeginLine()">
|
<replace token=".beginLine" value=".getReportLocation().getStartLine()">
|
||||||
<fileset dir="${target-package-dir}" />
|
<fileset dir="${target-package-dir}" />
|
||||||
</replace>
|
</replace>
|
||||||
|
|
||||||
<replace token=".beginColumn" value=".getBeginColumn()">
|
<replace token=".beginColumn" value=".getReportLocation().getStartColumn()">
|
||||||
<fileset dir="${target-package-dir}" />
|
<fileset dir="${target-package-dir}" />
|
||||||
</replace>
|
</replace>
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ import net.sourceforge.pmd.util.DataMap.DataKey;
|
|||||||
* like {@link #firstChild(Class)}, and {@link NodeStream}s.
|
* like {@link #firstChild(Class)}, and {@link NodeStream}s.
|
||||||
* <li>The API used to describe nodes in a form understandable by XPath expressions:
|
* <li>The API used to describe nodes in a form understandable by XPath expressions:
|
||||||
* {@link #getXPathNodeName()}, {@link #getXPathAttributesIterator()}
|
* {@link #getXPathNodeName()}, {@link #getXPathAttributesIterator()}
|
||||||
* <li>Location metadata: eg {@link #getBeginLine()}, {@link #getBeginColumn()}
|
* <li>Location metadata: {@link #getReportLocation()}
|
||||||
* <li>An extensible metadata store: {@link #getUserMap()}
|
* <li>An extensible metadata store: {@link #getUserMap()}
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
@ -48,8 +48,7 @@ import net.sourceforge.pmd.util.DataMap.DataKey;
|
|||||||
* no JSP node should have a Java node as its child. Embedding nodes from
|
* no JSP node should have a Java node as its child. Embedding nodes from
|
||||||
* different languages will not be done via these methods, and conforming
|
* different languages will not be done via these methods, and conforming
|
||||||
* implementations should ensure that every node returned by these methods
|
* implementations should ensure that every node returned by these methods
|
||||||
* are indeed of the same type. Possibly, a type parameter will be added to
|
* are indeed of the same type.
|
||||||
* the Node interface in 7.0.0 to enforce it at compile-time.
|
|
||||||
*/
|
*/
|
||||||
public interface Node extends Reportable {
|
public interface Node extends Reportable {
|
||||||
|
|
||||||
@ -127,25 +126,22 @@ public interface Node extends Reportable {
|
|||||||
|
|
||||||
// Those are kept here because they're handled specially as XPath
|
// Those are kept here because they're handled specially as XPath
|
||||||
// attributes, for now
|
// attributes, for now
|
||||||
|
// -> [core] Deprecate XPath attributes for node coordinates (eg @BeginLine) #3876 (https://github.com/pmd/pmd/issues/3876)
|
||||||
|
|
||||||
@Override
|
|
||||||
default int getBeginLine() {
|
default int getBeginLine() {
|
||||||
return Reportable.super.getBeginLine();
|
return getReportLocation().getStartLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default int getBeginColumn() {
|
default int getBeginColumn() {
|
||||||
return Reportable.super.getBeginColumn();
|
return getReportLocation().getStartColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default int getEndLine() {
|
default int getEndLine() {
|
||||||
return Reportable.super.getEndLine();
|
return getReportLocation().getEndLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default int getEndColumn() {
|
default int getEndColumn() {
|
||||||
return Reportable.super.getEndColumn();
|
return getReportLocation().getEndColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
package net.sourceforge.pmd.reporting;
|
package net.sourceforge.pmd.reporting;
|
||||||
|
|
||||||
import net.sourceforge.pmd.RuleViolation;
|
import net.sourceforge.pmd.RuleViolation;
|
||||||
import net.sourceforge.pmd.annotation.DeprecatedUntil700;
|
|
||||||
import net.sourceforge.pmd.lang.ast.GenericToken;
|
import net.sourceforge.pmd.lang.ast.GenericToken;
|
||||||
import net.sourceforge.pmd.lang.ast.Node;
|
import net.sourceforge.pmd.lang.ast.Node;
|
||||||
import net.sourceforge.pmd.lang.document.FileLocation;
|
import net.sourceforge.pmd.lang.document.FileLocation;
|
||||||
@ -26,58 +25,7 @@ public interface Reportable {
|
|||||||
/**
|
/**
|
||||||
* Returns the location at which this element should be reported.
|
* Returns the location at which this element should be reported.
|
||||||
*
|
*
|
||||||
* <p>Use this instead of {@link #getBeginColumn()}/{@link #getBeginLine()}, etc.
|
* <p>Use this instead of {@link Node#getBeginColumn()}/{@link Node#getBeginLine()}, etc.
|
||||||
*/
|
*/
|
||||||
FileLocation getReportLocation();
|
FileLocation getReportLocation();
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the line where the token's region begins
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #getReportLocation()}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@DeprecatedUntil700
|
|
||||||
default int getBeginLine() {
|
|
||||||
return getReportLocation().getStartPos().getLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the line where the token's region ends
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #getReportLocation()}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@DeprecatedUntil700
|
|
||||||
default int getEndLine() {
|
|
||||||
return getReportLocation().getEndPos().getLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the column offset from the start of the begin line where the token's region begins
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #getReportLocation()}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@DeprecatedUntil700
|
|
||||||
default int getBeginColumn() {
|
|
||||||
return getReportLocation().getStartPos().getColumn();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the column offset from the start of the end line where the token's region ends
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #getReportLocation()}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@DeprecatedUntil700
|
|
||||||
default int getEndColumn() {
|
|
||||||
return getReportLocation().getEndPos().getColumn();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -668,7 +668,7 @@ SPECIAL_TOKEN :
|
|||||||
{
|
{
|
||||||
int startOfNOPMD = matchedToken.getImage().indexOf(suppressMarker);
|
int startOfNOPMD = matchedToken.getImage().indexOf(suppressMarker);
|
||||||
if (startOfNOPMD != -1) {
|
if (startOfNOPMD != -1) {
|
||||||
suppressMap.put(matchedToken.getBeginLine(), matchedToken.getImage().substring(startOfNOPMD + suppressMarker.length()));
|
suppressMap.put(matchedToken.getReportLocation().getStartLine(), matchedToken.getImage().substring(startOfNOPMD + suppressMarker.length()));
|
||||||
}
|
}
|
||||||
comments.add(new JavaComment(matchedToken));
|
comments.add(new JavaComment(matchedToken));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user