Deprecate ASTPackageDeclaration#getPackageNameImage
This commit is contained in:
@@ -72,7 +72,7 @@ public class ASTCompilationUnit extends AbstractJavaTypeNode implements RootNode
|
||||
// @NonNull
|
||||
public String getPackageName() {
|
||||
ASTPackageDeclaration pdecl = getPackageDeclaration();
|
||||
return pdecl == null ? "" : pdecl.getPackageNameImage();
|
||||
return pdecl == null ? "" : pdecl.getName();
|
||||
}
|
||||
|
||||
@InternalApi
|
||||
|
@@ -5,6 +5,7 @@
|
||||
package net.sourceforge.pmd.lang.java.ast;
|
||||
|
||||
import net.sourceforge.pmd.annotation.InternalApi;
|
||||
import net.sourceforge.pmd.lang.ast.xpath.internal.DeprecatedAttribute;
|
||||
|
||||
public class ASTPackageDeclaration extends AbstractJavaAnnotatableNode {
|
||||
|
||||
@@ -25,7 +26,22 @@ public class ASTPackageDeclaration extends AbstractJavaAnnotatableNode {
|
||||
return visitor.visit(this, data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getName()}
|
||||
*/
|
||||
@Deprecated
|
||||
@DeprecatedAttribute(replaceWith = "@Name")
|
||||
public String getPackageNameImage() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the package.
|
||||
*
|
||||
* @since 6.30.0
|
||||
*/
|
||||
public String getName() {
|
||||
return ((ASTName) getChild(this.getNumChildren() - 1)).getImage();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user