Bug 189310 - [1.5][compiler] Add a warning when auto boxing primitives using generics on Methods that have both an object and primitive version.
Summary: [1.5][compiler] Add a warning when auto boxing primitives using generics on M...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.2   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-27 05:55 EDT by Ryan Henszey CLA
Modified: 2016-01-14 13:00 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Henszey CLA 2007-05-27 05:55:57 EDT
Add a warning when auto boxing primitives using generics on Methods that have both an object and primitive version.

Example:
List<Integer> list = new ArrayList<Integer>();
list.add(7);
list.remove(7);

For this example there would be a warning for the line with the remove since there is both a .remove(Integer) and a .remove(int). There would also possibly be a suppress warning annotation for this.

I was having some unbelievably strange behavior in a program I was moving to 1.5 when I came across this.
Comment 1 Ryan Henszey CLA 2007-05-27 05:57:57 EDT
(After thinking about this I think this enhancement is more suited for a project like FindBugs)
Comment 2 Philipe Mulet CLA 2007-05-28 09:23:43 EDT
Interesting. We do have some warnings for autoboxing situations (with appropriate @SuppressWarning). This is an interesting situation.

Will think about it.
Comment 3 Ryan Henszey CLA 2007-05-29 04:26:42 EDT
Here is an example that is closer to what I actually ran into, the integer example is kind of easy to catch.


List<Character> list = new ArrayList<Character>();
		
char c = 0xff;
		
list.add(c);
list.remove(c);