This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 243790 - Lack of warning
Summary: Lack of warning
Status: RESOLVED INCOMPLETE
Alias: None
Product: cnd
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: issues@cnd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-12 21:29 UTC by henri127
Modified: 2014-04-19 09:40 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description henri127 2014-04-12 21:29:33 UTC
Product Version = NetBeans IDE 8.0 (Build 201403101706)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.8.0
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.0-b70

String str = ".....some String.....";
int random = radom_value;

the line: str +=  random_value;

does not give a warning possibility. It is adding an integer, which in java will be converted to a String to the str value, but in C has much different meaning when str is a pointer.
Comment 1 petrk 2014-04-17 17:19:07 UTC
Is this a bug on C++ or Java?
Comment 2 henri127 2014-04-18 23:07:18 UTC
A notice when converting c/c++ code to Java. It is not an error, but that holds true for all warnings.
Comment 3 petrk 2014-04-19 08:12:28 UTC
I mean where do you expect to see a warning? In Java code or in C/C++ code? 
Anyway, I suppose that such warning would be quite weird - any c/c++ programmer knows that char* is a pointer and adding integer to it just moves the pointer (as well as that adding it to the std::string converts integer to char and appends the string). On the contrary, anyone who used to write in Java knows that adding integer to a String actually appends string with an integer value. Those things are part of a language or well known behavior of classes from standard libraries.
Comment 4 henri127 2014-04-19 09:40:21 UTC
I do not think it is weird, because when one uses warnings to look for potentially wrong code, and the translation from c to Java would mean that this line should be adjusted, it is a correct warning. Why should this warning be different from others? The warning should be available for Java coding, as this error would occur when converting c code to Java.
Of course do those who use just a single language know about the difference, but is that not the same for all the other warnings?