This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Dev 201103260400 Given this code: Object o = 42; int i = o; A hint is displayed for the second line: "Case o to int" If the suggested hint is applied, you get int i = (int)o; This is incorrect as a ReferenceType cannot be cast to a PrimitiveType. This displays no error indication in the editor, but javac reports: NewClass.java:15: inconvertible types found : java.lang.Object required: int int i = (int)o; Expeced behavior: "Case o to Integer" and int i = (Integer)o; Note: for pre-JDK 5 sources, the change needs to be: int i = ((Integer)o).intValue();
This has been changed in 1.7 javac (i.e. the cast in valid in 1.7), but is missing a source level check.
The fix in (nb-)javac: http://hg.netbeans.org/main/nb-javac/rev/4c5f13798b8d Integrating the nb-javac into NetBeans IDE: http://hg.netbeans.org/jet-main/rev/d0a27b4198cf I think this might be a good candidate for a patch, but none of the changesets above should be applied directly. The (nb-)javac patch would need to be applied to a branch nb-javac and rebuilding the nb-javac. Please let me known if this should be done. Thanks.
Verified in the trunk build #Build 201105160400. The changes seem to be clear so I don't see any reason to give it up. So Honzo, please rebuild and integrate. Thanks.
Applied to release70_fixes: http://hg.netbeans.org/releases/rev/367b82e4118e Spec. versions and long descriptions updated: http://hg.netbeans.org/releases/rev/ab821ef74098
Verified in the following build + patch1: Product Version: NetBeans IDE 7.0 (Build 201104080000) Java: 1.6.0_25; Java HotSpot(TM) Client VM 20.0-b11 System: Windows 7 version 6.1 running on x86; Cp1250; cs_CZ (nb)