Project
IntelliJ IDEA
Priority
Normal
Type
Bug
Fix versions
No Fix versions
State
Fixed
Assignee
Bas Leijdekkers
Subsystem
Code Analysis. Inspection
Affected versions
No Affected versions
Fixed in build
108.65  
  • Created by   Fred Faber
    6 years ago (26 Sep 2005 17:56)
  • Updated by   root
    2 years ago (17 Jan 2010 20:23)
  • Jira: IDEADEV-3919
    (history, comments)
 
IDEA-30198 Inaccurate "unnecessary autoboxing" warning
0
Issue is visible to: All Users
  The issue is visible to the selected user group only
The following code does not compile because of the following error:

"reference to assertEquals is ambiguous, both method assertEquals(java.lang.String,java.lang.Object,java.lang.Object) in junit.framework.Assert and method assertEquals(java.lang.String,long,long) in junit.framework.Assert match"

assertEquals("Some testing message....",
callThatReturnsAJavaLangLong(),
callThatReturnsAPrimativeLong() );

This can be resolved by invoking .longValue() on the call that returns a java.lang.Long, such as:

assertEquals("Some testing message....",
callThatReturnsAJavaLangLong().longValue(),
callThatReturnsAPrimativeLong() );

When I do this, IntelliJ suggests that this is "Unnecessary autoboxing" (via a code inspection). This, however, is necessary to make the code compile.

Environment: RH 9

Issue was resolved
Comments (0)
 
History
 
Linked Issues (?)
 
Issue has no comments