Bug 288749 - Redundant superinterface not flagged inside one declaration
Summary: Redundant superinterface not flagged inside one declaration
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M3   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 294389 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-09-07 09:19 EDT by Markus Keller CLA
Modified: 2009-11-05 17:13 EST (History)
3 users (show)

See Also:


Attachments
Proposed fix (5.09 KB, patch)
2009-09-10 13:38 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix (4.80 KB, patch)
2009-09-10 13:41 EDT, Olivier Thomann CLA
no flags Details | Diff
Regression test (5.10 KB, patch)
2009-09-10 14:40 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed patch and testcase (5.26 KB, patch)
2009-09-11 13:40 EDT, Kent Johnson CLA
no flags Details | Diff
Proposed fix + regression test (5.90 KB, patch)
2009-10-02 10:05 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2009-09-07 09:19:07 EDT
HEAD - Redundant superinterface not flagged inside same declaration

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public interface Mix<E> extends List<E>, Collection<E> {
}

abstract class AbstractMix implements List<Object>, Collection<Object> {
}

class MixList<E> extends ArrayList<E> implements List<E> {
}

abstract class A implements Runnable {}
abstract class B extends A implements Runnable {}

interface I {}
class X implements I {}
class Y extends X implements I {}


=> In the first 2 types, Collection<E> is not flagged as redundant, although it is. Rest is OK.
Comment 1 Olivier Thomann CLA 2009-09-10 13:37:47 EDT
We only detect redundant super interfaces when they come from the superclass.
Comment 2 Olivier Thomann CLA 2009-09-10 13:38:12 EDT
Created attachment 146887 [details]
Proposed fix
Comment 3 Olivier Thomann CLA 2009-09-10 13:39:09 EDT
Kent, please review.
We might have a better place to make the detection.
If ok, I'll add some regression tests.
Comment 4 Olivier Thomann CLA 2009-09-10 13:41:38 EDT
Created attachment 146888 [details]
Proposed fix

Same patch without two unused imports.
Comment 5 Olivier Thomann CLA 2009-09-10 14:40:52 EDT
Created attachment 146899 [details]
Regression test
Comment 6 Kent Johnson CLA 2009-09-11 13:40:10 EDT
Created attachment 146974 [details]
Proposed patch and testcase
Comment 7 Kent Johnson CLA 2009-09-11 13:41:57 EDT
Released in HEAD for 3.6M2
Comment 8 Srikanth Sankaran CLA 2009-09-15 02:18:48 EDT
Verified for 3.6M2 using I20090914-1800
Comment 9 Markus Keller CLA 2009-10-02 09:36:39 EDT
Reopening, the fix is not good.

In I20090929-0800, I get problems on List, but it's not List that is redundant, it's Collection. In real life, I got compile errors after applying the quick fix for this problem in org.eclipse.jdt.internal.corext.fix.StringFix 1.18.
Comment 10 Olivier Thomann CLA 2009-10-02 10:05:15 EDT
Created attachment 148645 [details]
Proposed fix + regression test

Kent, please review. I think the mistake only comes from the order of the parameters for the problem reporter method.
Comment 11 Kent Johnson CLA 2009-10-02 11:04:07 EDT
Looks good - I screwed up & got the interfaces backwards in the call to the problem reporter.

Released to HEAD for 3.6M3
Comment 12 Srikanth Sankaran CLA 2009-10-27 05:20:43 EDT
Screwed up with the verification for M1.

Verified for 3.6M3 using build I20091025-2000
Comment 13 Olivier Thomann CLA 2009-11-05 17:13:41 EST
*** Bug 294389 has been marked as a duplicate of this bug. ***