Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 369319 - [junit] interesting warning in JUnitPropertyTester
Summary: [junit] interesting warning in JUnitPropertyTester
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.8   Edit
Hardware: All All
: P3 trivial (vote)
Target Milestone: 3.8 M5   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-21 16:06 EST by Stephan Herrmann CLA
Modified: 2012-01-23 06:35 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 Stephan Herrmann CLA 2012-01-21 16:06:06 EST
While playing with null analysis for more kinds of expressions (bug 331649 and bug 364326) I tried my current implementation against  org.eclipse.jdt.junit.core to find the following interesting warning:

1. WARNING in src/org/eclipse/jdt/internal/junit/JUnitPropertyTester.java (in line 47):
	throw new IllegalArgumentException("Element must be of type 'IAdaptable', is " + receiver == null ? "null" : receiver.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
	                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Null comparison always yields false: this expression cannot be null

I hope the above renders correctly in bugzilla so that you can see what the compiler sees :)
Comment 1 Stephan Herrmann CLA 2012-01-21 16:09:26 EST
(In reply to comment #0)
> I hope the above renders correctly in bugzilla so that you can see what the
> compiler sees :)

Automatic line wrapping didn't help, so here's the relevant part again:

"Element must be of type 'IAdaptable', is " + receiver == null
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Null comparison always yields false: this expression cannot be null
Comment 2 Dani Megert CLA 2012-01-23 06:35:13 EST
That's a nice one.

Fixed in master: 423f052c415eff05a9d05be3cf02e69b1d938ec6