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 - Incorrect warning about unnecessary cast to Integer
Summary: Incorrect warning about unnecessary cast to Integer
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
: 242856 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-02-23 12:16 UTC by cezariusz
Modified: 2015-04-17 06:26 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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