Summary: | [1.5][compiler] raw type diagnostic not coherent with javac one | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Rémi Forax <forax> | ||||
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | jerome_lanneluc, joerg, philippe_mulet | ||||
Version: | 3.5 | ||||||
Target Milestone: | 3.5 M4 | ||||||
Hardware: | PC | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Rémi Forax
2008-10-26 16:00:50 EDT
Eclipse compiler explicitly doesn't report any warning for: - class literal - instanceof - cast Need to find out why I did disable these patterns previously. Ignore previous comment re:cast. This is already implemented. Class literal is also not diagnosed, since A<?>.class is not syntactically correct. Added GenericTypeTest#test1398-1403 Created attachment 116806 [details]
Proposed patch
Released for 3.5M4 Fixed Verified for 3.5M4 using I20081209-0100 What have you done? Could you please explain why you start begging everybody if he does some "o instanceof Class" rather than "o instanceof Class<?>" ? I can NOT see any particular use in this warning. It is just totally nasty! What do I miss here? (In reply to comment #6) > What have you done? > Could you please explain why you start begging everybody if he does > some "o instanceof Class" rather than "o instanceof Class<?>" ? > I can NOT see any particular use in this warning. > It is just totally nasty! > What do I miss here? > The answer is in the comments of this blog: http://blogs.sun.com/mcimadamore/entry/diagnosing_raw_types Rémi Forax Thanks for the hint. Still I do not agree and in the discussions there where arguments against it. Anyways I might not reopen the discussion here. I just wanted to add a clear statement, that some eclipse-guyz made a decision here that I do NOT like and IMHO I guess that there are many others out there. It is already hard to make developers care about warnings and not tend to add @SuppressWarnings("unchecked") everywhere. You gave those developers new dogfood. Please note that refactoring operations that change the number of generic arguments break code if references get generified with wildcards so it is not always the best choice. There is no way to do something like (object instanceof Class<String>) because of the erasure. Therefore I can only do (object instanceof Class) or (object instanceof Class<?>). Both expressions are semantically equivalent. Why should you raise a warning for the variant that people got used to over many years and that is absolutely harmless. Should millions of users rewrite their code to avoid your new warnings? I was already annoyed by all the abstract serializable classes where I had to generate UIDs for to avoid warnings in new eclipse versions but at least I could see a point in doing this. In this case this is pointless effort and I have tons of new warnings. Maybe I should apologize that I expressed my anger directly. After all I thank you for Eclipse which is probably the best IDE. If in the future a similar decision is made, I would be very pleased if you consider to add an option for downward compatible behavior. Maybe you might even think about adding such option for instanceof on raw types. Thanks. I completely agree Jörg. He makes a very good point and it is a pity the bug is not fixed in 3.5 final. Which brings us to a good point, why is this bug marked as fixed any way? Target milestone 3.5 M4 ? Please, disregard my last question. I was mislead by some of the previous comments. |