Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322553 - Missing Warning about Boxing in for loop
Summary: Missing Warning about Boxing in for loop
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 349181 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-08-12 11:44 EDT by Marc R. Hoffmann CLA
Modified: 2020-01-27 14:49 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc R. Hoffmann CLA 2010-08-12 11:44:41 EDT
Build Identifier: I20100608-0911

With Java5-style loops over collections wrapper types can be unboxed into primitive types. For example:

	void print(List<Integer> list) {
		for (int i : list) { // <-- Warning missing here
			System.out.println(i);
		}
	}

If boxing warnings are enabled a warning should be issued in this situation.

This was reported before in bug #85518 together with two other scenarios (with arrays instead of collections). The array case seems to be fixed.

Reproducible: Always

Steps to Reproduce:
1. Enable Compiler Warning "boxing and unboxing" conversions
2. Paste the following snippet into an Java editor

	void print(List<Integer> list) {
		for (int i : list) { // <-- Warning missing here
			System.out.println(i);
		}
	}

3. No warning is given at the line where the Integer elements of the list are unboxed into primitive int.
Comment 1 Ayushman Jain CLA 2010-08-12 13:45:44 EDT
I'll investigate
Comment 2 Srikanth Sankaran CLA 2011-06-13 08:39:56 EDT
*** Bug 349181 has been marked as a duplicate of this bug. ***
Comment 3 Eclipse Genie CLA 2020-01-27 14:49:52 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.