Bug 517235 - [compiler] Unnecessary cast warning is not detected when casting a bound generic type to its super type
Summary: [compiler] Unnecessary cast warning is not detected when casting a bound gene...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-25 06:08 EDT by Lukas Eder CLA
Modified: 2022-05-31 16:52 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Eder CLA 2017-05-25 06:08:38 EDT
The following casts are unnecessary:


----------------------------------------------------
public class UnnecessaryCasts<T extends C> {
    void m(T t) {
        C c = t;

        ((C) t).x();
        ((I) t).x();
        ((I) c).x();
    }
}

interface I {
    void x();
}
class C implements I {
    @Override
    public void x() {}
}
----------------------------------------------------


Yet, the Eclipse compiler doesn't report them, and doesn't offer a quick fix to remove them.
Comment 1 Manoj N Palat CLA 2018-05-16 01:06:47 EDT
bulk move out of 4.8
Comment 2 Eclipse Genie CLA 2022-05-31 16:52:53 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.