On Thu, Aug 19, 2010 at 08:21, Rémi Forax <fo...@univ-mlv.fr> wrote:
> > Changeset: d6fe0ea070aa >> Author: mcimadamore >> Date: 2010-08-19 11:52 +0100 >> URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/d6fe0ea070aa >> >> 6885255: Improve usability of raw warnings >> Summary: raw warnings should be disabled in (i) instanceof expressions and >> (ii) when java.lang.Class is not parameterized >> Reviewed-by: jjg >> >> ! src/share/classes/com/sun/tools/javac/comp/Attr.java >> ! src/share/classes/com/sun/tools/javac/comp/Check.java >> ! test/tools/javac/warnings/6747671/T6747671.java >> ! test/tools/javac/warnings/6747671/T6747671.out >> + test/tools/javac/warnings/6885255/T6885255.java >> + test/tools/javac/warnings/6885255/T6885255.out >> >> > > We discuss [1] about Class<rawtype> and instanceof rawtype but not cast > (rawtype). > I was able to convince myself that a cast with a raw type doesn't harm. > > I just want to be sure that it's ok for everybody (Martin?). > > > Rémi > [1] http://blogs.sun.com/mcimadamore/entry/diagnosing_raw_types > > Remi, Thanks for reminding me of that blog entry. Maurizio, thanks for fixing this. I may try to clean up warnings in j.u.c. someday, and see what happens. One more thought... if we accept your statement that """The second argument of an instanceof should be a reifiable (see JLS 4.7) reference type""" then in today's world if they wrote if (x instanceof List<?>) { ..... ((List<String>) x) } then that would fail in some future world when reification allowed us to distinguish between List<?> and List<String> at runtime. In other words, pushing people to switch from instanceof List to instanceof List<?> may be doing them a disservice. Martin (not a compiler guy)