Skip to content

Commit

Permalink
Remove redundant interface declarations in pmd-java
Browse files Browse the repository at this point in the history
Related to pmd#4885
  • Loading branch information
oowekyala committed May 16, 2024
1 parent f1701df commit 4213083
Show file tree
Hide file tree
Showing 34 changed files with 34 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* </pre>
*/
public final class ASTAnnotation extends AbstractJavaTypeNode implements TypeNode, ASTMemberValue, Iterable<ASTMemberValuePair> {
public final class ASTAnnotation extends AbstractJavaTypeNode implements ASTMemberValue, Iterable<ASTMemberValuePair> {

ASTAnnotation(int id) {
super(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* </pre>
*/
public final class ASTArrayDimExpr extends ASTArrayTypeDim implements Annotatable {
public final class ASTArrayDimExpr extends ASTArrayTypeDim {

ASTArrayDimExpr(int id) {
super(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* </pre>
*
*/
public final class ASTArrayInitializer extends AbstractJavaExpr implements ASTExpression, Iterable<ASTExpression> {
public final class ASTArrayInitializer extends AbstractJavaExpr implements Iterable<ASTExpression> {

ASTArrayInitializer(int id) {
super(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
import net.sourceforge.pmd.lang.java.ast.ASTList.ASTMaybeEmptyListOf;
import net.sourceforge.pmd.lang.java.ast.InternalInterfaces.AllChildrenAreOfType;

/**
* A block of code. This is a {@linkplain ASTStatement statement} that
Expand All @@ -19,7 +18,7 @@
* </pre>
*/
public final class ASTBlock extends ASTMaybeEmptyListOf<ASTStatement>
implements ASTSwitchArrowRHS, ASTStatement, AllChildrenAreOfType<ASTStatement> {
implements ASTSwitchArrowRHS, ASTStatement {

ASTBlock(int id) {
super(id, ASTStatement.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* The boolean literal, either "true" or "false".
*/
public final class ASTBooleanLiteral extends AbstractLiteral implements ASTLiteral {
public final class ASTBooleanLiteral extends AbstractLiteral {

private boolean isTrue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* </pre>
*/
public final class ASTCastExpression extends AbstractJavaExpr implements ASTExpression {
public final class ASTCastExpression extends AbstractJavaExpr {

ASTCastExpression(int id) {
super(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* retrieve the actual runtime value. Use {@link #getLiteralText()} to
* retrieve the text.
*/
public final class ASTCharLiteral extends AbstractLiteral implements ASTLiteral {
public final class ASTCharLiteral extends AbstractLiteral {


ASTCharLiteral(int id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import net.sourceforge.pmd.lang.ast.AstInfo;
import net.sourceforge.pmd.lang.ast.NodeStream;
import net.sourceforge.pmd.lang.ast.RootNode;
import net.sourceforge.pmd.lang.ast.impl.GenericNode;
import net.sourceforge.pmd.lang.java.symbols.table.JSymbolTable;
import net.sourceforge.pmd.lang.java.types.TypeSystem;
import net.sourceforge.pmd.lang.java.types.ast.internal.LazyTypeResolver;
Expand Down Expand Up @@ -49,7 +48,7 @@
* @see <a href="https://openjdk.org/jeps/445">JEP 445: Unnamed Classes and Instance Main Methods (Preview)</a> (Java 21)
* @see #isUnnamedClass()
*/
public final class ASTCompilationUnit extends AbstractJavaNode implements JavaNode, GenericNode<JavaNode>, RootNode {
public final class ASTCompilationUnit extends AbstractJavaNode implements RootNode {

private LazyTypeResolver lazyTypeResolver;
private List<JavaComment> comments;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
*
* </pre>
*/
public final class ASTConstructorCall extends AbstractInvocationExpr
implements ASTPrimaryExpression,
QualifiableExpression,
LeftRecursiveNode,
InvocationNode {
public final class ASTConstructorCall extends AbstractInvocationExpr implements QualifiableExpression, LeftRecursiveNode {

ASTConstructorCall(int id) {
super(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
* </pre>
*/
public final class ASTEnumConstant extends AbstractJavaTypeNode
implements Annotatable,
InvocationNode,
ModifierOwner,
implements InvocationNode,
ModifierOwner,
ASTBodyDeclaration,
InternalInterfaces.VariableIdOwner,
JavadocCommentOwner {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

import net.sourceforge.pmd.lang.ast.impl.GenericNode;
import net.sourceforge.pmd.lang.java.symbols.JExecutableSymbol;
import net.sourceforge.pmd.lang.java.types.JClassType;
import net.sourceforge.pmd.lang.java.types.JMethodSig;
Expand All @@ -32,7 +31,6 @@ public interface ASTExecutableDeclaration
extends ModifierOwner,
ASTBodyDeclaration,
TypeParamOwnerNode,
GenericNode<JavaNode>,
JavadocCommentOwner {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@
*
* </pre>
*/
public interface ASTExpression
extends JavaNode,
TypeNode,
ASTMemberValue,
ASTSwitchArrowRHS {
public interface ASTExpression extends TypeNode, ASTMemberValue, ASTSwitchArrowRHS {

/**
* Always returns true. This is to allow XPath queries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
* </pre>
*/
public final class ASTFieldDeclaration extends AbstractJavaNode
implements Iterable<ASTVariableId>,
LeftRecursiveNode,
ModifierOwner,
implements LeftRecursiveNode,
ASTBodyDeclaration,
InternalInterfaces.MultiVariableIdOwner,
JavadocCommentOwner {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@
* </pre>
*/
public final class ASTFormalParameter extends AbstractJavaNode
implements ModifierOwner,
TypeNode,
Annotatable,
VariableIdOwner {
implements ModifierOwner, TypeNode, VariableIdOwner {

ASTFormalParameter(int id) {
super(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
*/
// TODO extend AbstractStatement
public final class ASTLocalVariableDeclaration extends AbstractJavaNode
implements Iterable<ASTVariableId>,
ASTStatement,
ModifierOwner,
implements ASTStatement,
LeftRecursiveNode, // ModifierList is parsed separately in BlockStatement
InternalInterfaces.MultiVariableIdOwner {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
*
* </pre>
*/
public final class ASTMethodCall extends AbstractInvocationExpr
implements ASTPrimaryExpression,
QualifiableExpression,
InvocationNode,
MethodUsage {
public final class ASTMethodCall extends AbstractInvocationExpr implements QualifiableExpression {

ASTMethodCall(int id) {
super(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
* </pre>
*/
public final class ASTMethodReference extends AbstractJavaExpr
implements ASTPrimaryExpression,
QualifiableExpression,
implements QualifiableExpression,
LeftRecursiveNode,
MethodUsage,
FunctionalExpression {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* </pre>
*/
public final class ASTNullLiteral extends AbstractLiteral implements ASTLiteral {
public final class ASTNullLiteral extends AbstractLiteral {
ASTNullLiteral(int id) {
super(id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* A numeric literal of any type (double, int, long, float, etc).
*/
public final class ASTNumericLiteral extends AbstractLiteral implements ASTLiteral {
public final class ASTNumericLiteral extends AbstractLiteral {

/**
* True if this is an integral literal, ie int OR long,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package net.sourceforge.pmd.lang.java.ast;

import net.sourceforge.pmd.lang.java.ast.ASTList.ASTMaybeEmptyListOf;
import net.sourceforge.pmd.lang.java.ast.InternalInterfaces.AllChildrenAreOfType;
import net.sourceforge.pmd.lang.java.symbols.JConstructorSymbol;

/**
Expand All @@ -18,8 +17,7 @@
*
* </pre>
*/
public final class ASTRecordComponentList extends ASTMaybeEmptyListOf<ASTRecordComponent>
implements SymbolDeclaratorNode, AllChildrenAreOfType<ASTRecordComponent> {
public final class ASTRecordComponentList extends ASTMaybeEmptyListOf<ASTRecordComponent> implements SymbolDeclaratorNode {

private JConstructorSymbol symbol;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* in the source ({@link #getLiteralText()}). {@link #getConstValue()} allows to recover
* the actual runtime value, by processing escapes.
*/
public final class ASTStringLiteral extends AbstractLiteral implements ASTLiteral {
public final class ASTStringLiteral extends AbstractLiteral {

private static final String TEXTBLOCK_DELIMITER = "\"\"\"";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
*
* <p>Their syntax is identical though, and described on {@link ASTSwitchLike}.
*/
public final class ASTSwitchExpression extends AbstractJavaExpr
implements ASTExpression,
ASTSwitchLike {
public final class ASTSwitchExpression extends AbstractJavaExpr implements ASTSwitchLike {

ASTSwitchExpression(int id) {
super(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* <p>Note: This node has been called ASTVariableDeclaratorId in PMD 6.
*/
// @formatter:on
public final class ASTVariableId extends AbstractTypedSymbolDeclarator<JVariableSymbol> implements ModifierOwner, SymbolDeclaratorNode {
public final class ASTVariableId extends AbstractTypedSymbolDeclarator<JVariableSymbol> implements ModifierOwner {

private String name;
private List<ASTNamedReferenceExpr> usages = Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author Clément Fournier
* @since 6.2.0
*/
abstract class AbstractTypeBodyDeclaration extends AbstractJavaNode implements JavaNode {
abstract class AbstractTypeBodyDeclaration extends AbstractJavaNode {

AbstractTypeBodyDeclaration(int id) {
super(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ interface VariableIdOwner extends JavaNode {
ASTVariableId getVarId();
}

interface MultiVariableIdOwner extends JavaNode, Iterable<ASTVariableId>, ModifierOwner {
interface MultiVariableIdOwner extends Iterable<ASTVariableId>, ModifierOwner {

/**
* Returns a stream of the variable ids declared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @since 7.0.0
*/
public interface JAccessibleElementSymbol extends JElementSymbol, AnnotableSymbol {
public interface JAccessibleElementSymbol extends AnnotableSymbol {

/**
* Conventional return value of {@link #getPackageName()} for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Common supertype for {@linkplain JMethodSymbol method}
* and {@linkplain JConstructorSymbol constructor symbols}.
*/
public interface JExecutableSymbol extends JAccessibleElementSymbol, JTypeParameterOwnerSymbol {
public interface JExecutableSymbol extends JTypeParameterOwnerSymbol {


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* @since 7.0.0
*/
public interface JTypeDeclSymbol extends JElementSymbol, JAccessibleElementSymbol {
public interface JTypeDeclSymbol extends JAccessibleElementSymbol {

/**
* Returns true if this class is a symbolic reference to an unresolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTVariableId;
import net.sourceforge.pmd.lang.java.ast.JModifier;
import net.sourceforge.pmd.lang.java.symbols.JClassSymbol;
import net.sourceforge.pmd.lang.java.symbols.JFieldSymbol;
import net.sourceforge.pmd.lang.java.symbols.JMethodSymbol;
import net.sourceforge.pmd.lang.java.symbols.internal.EmptyClassSymbol;

class AstUnnamedClassSym extends EmptyClassSymbol implements JClassSymbol {
class AstUnnamedClassSym extends EmptyClassSymbol {
private final List<JMethodSymbol> declaredMethods;
private final List<JFieldSymbol> declaredFields;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

import net.sourceforge.pmd.lang.java.symbols.JClassSymbol;
import net.sourceforge.pmd.lang.java.symbols.internal.EmptyClassSymbol;
import net.sourceforge.pmd.lang.java.symbols.internal.SymbolEquality;
import net.sourceforge.pmd.lang.java.symbols.internal.SymbolToStrings;
import net.sourceforge.pmd.lang.java.types.JPrimitiveType.PrimitiveTypeKind;

abstract class BasePrimitiveSymbol extends EmptyClassSymbol implements JClassSymbol {
abstract class BasePrimitiveSymbol extends EmptyClassSymbol {

BasePrimitiveSymbol(TypeSystem ts) {
super(() -> ts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* <p>Type variables do not, in general, use reference identity. Use
* equals to compare them.
*/
public interface JTypeVar extends JTypeMirror, SubstVar {
public interface JTypeVar extends SubstVar {


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* type is of no importance outside the implementation of this framework.
*/
@SuppressWarnings("PMD.CompareObjectsWithEquals")
public final class InferenceVar implements JTypeMirror, SubstVar {
public final class InferenceVar implements SubstVar {

// we used to use greek letters (for style), but they're hard to type
private static final String NAMES = "abcdefghijklmnopqrstuvwxyz"; // + "αβγδεζηθκλμνξπρςυφχψω"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
import net.sourceforge.pmd.lang.java.types.TypeOps;
import net.sourceforge.pmd.lang.java.types.internal.InternalMethodTypeItf;
import net.sourceforge.pmd.lang.java.types.internal.infer.ExprMirror;
import net.sourceforge.pmd.lang.java.types.internal.infer.ExprMirror.InvocationMirror;
import net.sourceforge.pmd.lang.java.types.internal.infer.ast.JavaExprMirrors.MirrorMaker;

class MethodInvocMirror extends BaseInvocMirror<ASTMethodCall> implements InvocationMirror {
class MethodInvocMirror extends BaseInvocMirror<ASTMethodCall> {


MethodInvocMirror(JavaExprMirrors mirrors, ASTMethodCall call, @Nullable ExprMirror parent, MirrorMaker subexprMaker) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.sourceforge.pmd.lang.java.types.JTypeMirror;
import net.sourceforge.pmd.lang.java.types.internal.infer.ExprMirror;

class StandaloneExprMirror extends BaseExprMirror<ASTExpression> implements ExprMirror {
class StandaloneExprMirror extends BaseExprMirror<ASTExpression> {

StandaloneExprMirror(JavaExprMirrors factory, ASTExpression myNode, @Nullable ExprMirror parent) {
super(factory, myNode, parent);
Expand Down

0 comments on commit 4213083

Please sign in to comment.