Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349181

Summary: Unboxing warning is not reported when using enhanced 'for' (foreach) on Iterable
Product: [Eclipse Project] JDT Reporter: Ben Davis <entheh>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: RESOLVED DUPLICATE QA Contact:
Severity: minor    
Priority: P3 CC: srikanth_sankaran
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Ben Davis CLA 2011-06-13 08:13:12 EDT
Build Identifier: I20100129-1300

for (int i:new HashSet<Integer>()) {} //Should warn but doesn't
for (int i:new Integer[10]) {} //Warns as expected
for (Integer i:new int[10]) {} //Warns as expected

I'd expect an unboxing warning on the first line.

Reproducible: Always

Steps to Reproduce:
1. Make sure unboxing warnings are enabled.
2. Put the above code in a function in an editor.
3. Observe where the warnings are and aren't. (I didn't save the code for my test.)
Comment 1 Srikanth Sankaran CLA 2011-06-13 08:39:56 EDT
Same as bug 322553

*** This bug has been marked as a duplicate of bug 322553 ***
Comment 2 Ben Davis CLA 2011-06-13 10:45:56 EDT
Ah, sorry. I searched for 'unboxing' but not 'boxing'. Hopefully anyone else who does the same will find this bug :)