| Summary: | wrong "redundant null check" warning after synchronized | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Jonathan Amir <jonathan_amir> |
| Component: | Core | Assignee: | Ayushman Jain <amj87.iitr> |
| Status: | VERIFIED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | Olivier_Thomann, srikanth_sankaran |
| Version: | 3.7 | ||
| Target Milestone: | 3.7 M5 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
My apologies, I had a mistake in the code sample. Verified for 3.7 M5 using build id: I20110124-1800 |
Build Identifier: 20100218-1602 Eclipse issues a warning about a redundant null check for the following code, at line 5: public static X getX (String name) { X x = map.get(name); if (x == null) { synchronized (x) { if (x == null) { // wrong warning x = new X(); map.put(name, x); } } } return x; } Reproducible: Always