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.

Bug 250627

Summary: Incorrect warning about unnecessary cast to Integer
Product: java Reporter: cezariusz <cezariusz>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: VERIFIED FIXED    
Severity: normal CC: xehpuk
Priority: P3    
Version: 8.0.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description cezariusz 2015-02-23 12:16:25 UTC
In the following code:

        Integer myValue = 100;
        Assert.assertEquals((Integer) 50, myValue);

I have a warning "Unnecessary cast to Integer". After using hint I got the following code:

        Integer myValue = 100;
        Assert.assertEquals(50, myValue);

which throws the compile error:

error: reference to assertEquals is ambiguous
        Assert.assertEquals(50, myValue);
  both method assertEquals(Object,Object) in Assert and method assertEquals(long,long) in Assert match
1 error
Comment 1 Svata Dedic 2015-04-09 12:24:10 UTC
Solved as part of issue #243581
Comment 2 Svata Dedic 2015-04-09 12:30:18 UTC
*** Bug 242856 has been marked as a duplicate of this bug. ***
Comment 3 cezariusz 2015-04-17 06:26:11 UTC
Verified in 201504150001