Bug 84055 - [1.5] Unnecessary cast wrongly reported with boxing
Summary: [1.5] Unnecessary cast wrongly reported with boxing
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-31 11:29 EST by Olivier Thomann CLA
Modified: 2005-02-15 06:44 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2005-01-31 11:29:01 EST
Using latest, compiling the following example reports an unnecessary cast that
is indeed required, otherwise it is a compile error.

public class X {

	private static void checkConversions(byte _byte) {
		Short s = (short) _byte; // cast reported as unnecessary
	} 

    public static void main(String args[]) {
        byte _byte = 2;

        checkConversions(_byte);
        System.out.println("OK");
      }
}

This might be related to bug 83965.
Comment 1 Philipe Mulet CLA 2005-02-03 04:41:37 EST
Tuned unnecessary cast reporting to handle this situation.
Added AutoboxingTest#test086
Fixed
Comment 2 Jerome Lanneluc CLA 2005-02-15 06:44:30 EST
Verified in I20050214