diff --git a/findbugs/src/java/edu/umd/cs/findbugs/detect/RedundantInterfaces.java b/findbugs/src/java/edu/umd/cs/findbugs/detect/RedundantInterfaces.java index 7b55a396d6..df8de4432e 100644 --- a/findbugs/src/java/edu/umd/cs/findbugs/detect/RedundantInterfaces.java +++ b/findbugs/src/java/edu/umd/cs/findbugs/detect/RedundantInterfaces.java @@ -58,7 +58,7 @@ public void visitClassContext(ClassContext classContext) { SortedSet redundantInfNames = new TreeSet(); for (String interfaceName : interfaceNames) { - if (!"java/io/Serializable".equals(interfaceName)) { + if (!"java.io.Serializable".equals(interfaceName)) { JavaClass inf = Repository.lookupClass(interfaceName.replace('/', '.')); if (superObj.instanceOf(inf)) { redundantInfNames.add(inf.getClassName()); diff --git a/findbugsTestCases/src/java/ghIssues/Issue0049.java b/findbugsTestCases/src/java/ghIssues/Issue0049.java new file mode 100644 index 0000000000..eb788faeeb --- /dev/null +++ b/findbugsTestCases/src/java/ghIssues/Issue0049.java @@ -0,0 +1,33 @@ + +import java.io.Serializable; + +import edu.umd.cs.findbugs.annotations.ExpectWarning; +import edu.umd.cs.findbugs.annotations.NoWarning; + +public class Issue0049 { + public interface TestInterface {} + + @NoWarning("RI_REDUNDANT_INTERFACES") + public static class SuperClass implements TestInterface {} + + @ExpectWarning("RI_REDUNDANT_INTERFACES") + public static class SubClassWithDuplicate extends SuperClass implements TestInterface {} + + @NoWarning("RI_REDUNDANT_INTERFACES") + public static class SubClassWithoutDuplicate extends SuperClass {} + + @ExpectWarning("RI_REDUNDANT_INTERFACES") + public static class SubSubClassWithDuplicate extends SubClassWithoutDuplicate implements TestInterface {} + + @NoWarning("RI_REDUNDANT_INTERFACES") + public static class SerializableSuperClass implements Serializable {} + + @NoWarning("RI_REDUNDANT_INTERFACES") + public static class SerializableSubClassWithDuplicate extends SerializableSuperClass implements Serializable {} + + @NoWarning("RI_REDUNDANT_INTERFACES") + public static class SerializableSubClassWithoutDuplicate extends SerializableSuperClass {} + + @NoWarning("RI_REDUNDANT_INTERFACES") + public static class SerializableSubSubClassDuplicate extends SerializableSubClassWithoutDuplicate implements Serializable {} +}