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 a8ed12c161099aee8a3607fbaf65c099440424bd..b5193edda3324c58a63ab7a658497105bf740737 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 23796e2a3f8e6489a877a9ffcffa8588b8de3b47..7bc08279746c98b4325f360638383e3e99b431b9 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