Bug 522377 - [null] String.format(""...) shows warning
Summary: [null] String.format(""...) shows warning
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.9 RC1   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords: test
Depends on:
Blocks:
 
Reported: 2017-09-15 12:48 EDT by Frank Benoit CLA
Modified: 2018-08-30 00:18 EDT (History)
3 users (show)

See Also:


Attachments
Editor-warning (14.70 KB, image/png)
2017-09-15 12:48 EDT, Frank Benoit CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Benoit CLA 2017-09-15 12:48:34 EDT
Created attachment 270230 [details]
Editor-warning

I have this since long time, String.format calls do give Null warnings.
They are only shown in the Java editor, but not in the package explorer.

return String.format("que%03d", var );

Could it be problem because of the variadic args?

The String.eaa:
format
 (Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
 (Ljava/lang/String;[Ljava/lang/Object;)L1java/lang/String;
Comment 1 Frank Benoit CLA 2017-09-15 13:00:52 EDT
Hm, same i can so for this code:
@NonNull String s = Long.toString(1L);

And there is the Long.eea:
class java/lang/Long
toString
 (J)Ljava/lang/String;
 (J)L1java/lang/String;
Comment 2 Eclipse Genie CLA 2018-08-26 09:41:50 EDT
New Gerrit change created: https://git.eclipse.org/r/128081
Comment 4 Stephan Herrmann CLA 2018-08-27 05:20:31 EDT
(In reply to Eclipse Genie from comment #3)
> Gerrit change https://git.eclipse.org/r/128081 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=628c525dc15e377d367b0f86e05d1476d7245a6e

I released a regression test, demonstrating that this works fine for me.

Feel free to re-open, if you can provide a test that still fails on Photon or newer.
Comment 5 Manoj N Palat CLA 2018-08-30 00:18:03 EDT
Verified for Eclipse 4.9 RC1 with Build id: I20180827-2000
(worksforme)