Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 380786

Summary: [compiler][null] missed "Potential Nullpointer Access" on mutable method argument
Product: [Eclipse Project] JDT Reporter: kurt <kurt2002>
Component: CoreAssignee: Stephan Herrmann <stephan.herrmann>
Status: CLOSED MOVED QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, kurt2002, stephan.herrmann
Version: 3.8   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
URL: https://github.com/eclipse-jdt/eclipse.jdt.core/pull/297
Whiteboard:

Description kurt CLA 2012-05-28 00:19:26 EDT
Build Identifier: Version: 3.8.0 Build id: I20120525-1400


In first method the PNA on s.split() is not reported (detected).
In second method it is detected.

public class PNA {
  void missedPNA(String s) {
    if (s != null)
      s = "1,2";
    final String[] sa = s.split(",");
    for (final String ss : sa)
      System.out.println(ss);
  }

  void detectedPNA(final String ps) {
    String s = ps;
    if (s != null)
      s = "1,2";
    final String[] sa = s.split(",");
    for (final String ss : sa)
      System.out.println(ss);
  }
}



Reproducible: Always
Comment 1 Ayushman Jain CLA 2012-05-28 01:12:29 EDT
The null status for s is unknown in the first method while it is pot. null in the second. Strange.
Should be fixed post-Juno since this is a pre-existing problem.
Comment 2 kurt CLA 2014-10-02 05:50:54 EDT
For your information - bug is still present in Eclipse 4.5M2:

  Version: Mars (4.5)
  Build id: I20140918-0330
Comment 3 Eclipse Genie CLA 2018-10-29 18:02:30 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Till Brychcy CLA 2018-10-30 03:49:04 EDT
Still happens on the master
Comment 5 Stephan Herrmann CLA 2020-06-10 03:33:46 EDT
.
Comment 6 Eclipse Genie CLA 2022-07-07 01:13:10 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 7 Stephan Herrmann CLA 2022-08-05 17:41:22 EDT
Continued in https://github.com/eclipse-jdt/eclipse.jdt.core/pull/297