diff --git a/p3c-pmd/src/main/java/com/alibaba/p3c/pmd/lang/java/rule/oop/PojoMustOverrideToStringRule.java b/p3c-pmd/src/main/java/com/alibaba/p3c/pmd/lang/java/rule/oop/PojoMustOverrideToStringRule.java
index a8ed12c16..b5193edda 100644
--- a/p3c-pmd/src/main/java/com/alibaba/p3c/pmd/lang/java/rule/oop/PojoMustOverrideToStringRule.java
+++ b/p3c-pmd/src/main/java/com/alibaba/p3c/pmd/lang/java/rule/oop/PojoMustOverrideToStringRule.java
@@ -59,6 +59,10 @@ public class PojoMustOverrideToStringRule extends AbstractPojoRule {
@Override
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) {
+ if (node.isInterface()) {
+ return super.visit(node, data);
+ }
+
if (!isPojo(node)) {
return super.visit(node, data);
}
diff --git a/p3c-pmd/src/test/resources/com/alibaba/p3c/pmd/lang/java/rule/oop/xml/PojoMustOverrideToStringRule.xml b/p3c-pmd/src/test/resources/com/alibaba/p3c/pmd/lang/java/rule/oop/xml/PojoMustOverrideToStringRule.xml
index 23796e2a3..7bc082797 100644
--- a/p3c-pmd/src/test/resources/com/alibaba/p3c/pmd/lang/java/rule/oop/xml/PojoMustOverrideToStringRule.xml
+++ b/p3c-pmd/src/test/resources/com/alibaba/p3c/pmd/lang/java/rule/oop/xml/PojoMustOverrideToStringRule.xml
@@ -132,4 +132,19 @@
0
+
+
+
+
+
+
+
+ interface with POJO surfix
+ 0
+
+
+
\ No newline at end of file