Make AbstractAnyTypeDeclaration extend AbstractJavaTypeNode

This commit is contained in:
Clément Fournier
2020-02-12 17:56:54 +01:00
parent f16f671aac
commit 8938756997
2 changed files with 2 additions and 14 deletions

View File

@ -11,11 +11,9 @@ import net.sourceforge.pmd.lang.java.typeresolution.typedefinition.JavaTypeDefin
/**
* Abstract class for type declarations nodes.
*/
abstract class AbstractAnyTypeDeclaration extends AbstractJavaNode implements ASTAnyTypeDeclaration, LeftRecursiveNode {
abstract class AbstractAnyTypeDeclaration extends AbstractJavaTypeNode implements ASTAnyTypeDeclaration, LeftRecursiveNode {
private JavaTypeQualifiedName qualifiedName;
private JavaTypeDefinition typeDefinition;
AbstractAnyTypeDeclaration(int i) {
super(i);
@ -44,16 +42,8 @@ abstract class AbstractAnyTypeDeclaration extends AbstractJavaNode implements AS
void setQualifiedName(JavaTypeQualifiedName qualifiedName) {
this.qualifiedName = qualifiedName;
this.typeDefinition = JavaTypeDefinition.forClass(qualifiedName.getType());
setTypeDefinition(JavaTypeDefinition.forClass(qualifiedName.getType()));
}
void setTypeDefinition(JavaTypeDefinition typeDefinition) {
this.typeDefinition = typeDefinition;
}
@Override
public JavaTypeDefinition getTypeDefinition() {
return typeDefinition;
}
}

View File

@ -55,8 +55,6 @@ public final class InternalApiBridge {
public static void setTypeDefinition(TypeNode node, JavaTypeDefinition definition) {
if (node instanceof AbstractJavaTypeNode) {
((AbstractJavaTypeNode) node).setTypeDefinition(definition);
} else if (node instanceof AbstractAnyTypeDeclaration) {
((AbstractAnyTypeDeclaration) node).setTypeDefinition(definition);
}
}