-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b142
-
generic
-
generic
-
Verified
From Jan Lahoda:
Hi,
in JDK7's javac, casts like:
Object o = 42;
int i = (int) o;
are allowed, but these were not allowed in JDK6's javac. This is causing problems in NetBeans, as we are proposing "Add cast" fix and not showing an error for such casts, although the code is not compilable using pre-JDK6 compiler. This is a NetBeans bug:
http://netbeans.org/bugzilla/show_bug.cgi?id=197164
I think that such casts should be source level >= 1.7 only, which I tried to achieve in the attached patch.
Thanks,
Jan
Hi,
in JDK7's javac, casts like:
Object o = 42;
int i = (int) o;
are allowed, but these were not allowed in JDK6's javac. This is causing problems in NetBeans, as we are proposing "Add cast" fix and not showing an error for such casts, although the code is not compilable using pre-JDK6 compiler. This is a NetBeans bug:
http://netbeans.org/bugzilla/show_bug.cgi?id=197164
I think that such casts should be source level >= 1.7 only, which I tried to achieve in the attached patch.
Thanks,
Jan
- relates to
-
JDK-6979683 inconsistent interaction of reference cast with box/unbox conversions leaves out a useful case
- Closed
-
JDK-6526446 Fixes to JLS5.5 Casting Conversion
- Closed