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 271900 - Erroneous Errors
Summary: Erroneous Errors
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: issues@cnd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-10 18:09 UTC by aschwarz1309
Modified: 2017-12-10 22:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (61.66 KB, text/plain)
2017-12-10 18:09 UTC, aschwarz1309
Details
this fragment has not errors. bug in other line in this file (97.35 KB, image/png)
2017-12-10 22:18 UTC, soldatov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aschwarz1309 2017-12-10 18:09:36 UTC
Product Version = NetBeans IDE 8.2 (Build 201705191307)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.8.0_111
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.111-b14

Reproducibility: Happens every time

STEPS:
  * View a C++ function

ACTUAL:
  * view successful with errors

EXPECTED:
 no errors

In the following code fragment, every line except lines ending with a '}', the return statement and the function prototype are marked with an error. Globally, i.e., in this function and others, 'size' is treated as unidentified in any context, e.g., vector.size(), string.size(), or my own creation, const ... size.

The underlying issue is that erroneous errors in C++ code have persisted. Some releases are better than others, but the error messages are always there. The code compiles successfully, and by inspection, the errors are not correct. As you can see below, variables are marked as "Unable to resolve" in their definition.

The error message are more than just annoying. Their voluminous nature  hides legitimate issues. Is there anything that can be done to remove these errors? 

<code>
bool MinimalSolver::weight1() {
   const long size = partition.size();    // [1] error
   for(long ndx = 0; ndx < numKeywords; ndx++) {  //  [2]  error
      long sum = 0;                             // [3] error
      const string& part = ref[ndx].part; [4] error
      for(long j = 0; j < size; j++) {  //  [5] error
         sum += (size - j)*((part[j] - ' ') * (part[j] - ' ')); // [6] error
      }
      ref[ndx].weight = (double)sum; // [7] error
   }
   return true;
}; // bool MinimalSolver::weight1()

</code>

Detected errors
[1] Unexpected token ;
[1] Unable to resolve identifier size'
[1] Unable to resolve template based identifier size

[2] Unable to resolve identifier ndx.
[2] Unable to resolve identifier numKeywords

[3] Unable to resolve identifier sum.

[4] Unable to resolve part.
[4] Unable to resolve ref.
[4] Unable to resolve ndx.

[5] Unable to resolve j.
[5] Unable to resolve size.

[6] Unable to resolve sum. 
[6] Unable to resolve size.
[6] Unable to resolve j.
[6] Unable to resolve part.

[7] Unable to resolve ref.
Comment 1 aschwarz1309 2017-12-10 18:09:40 UTC
Created attachment 165549 [details]
IDE log
Comment 2 soldatov 2017-12-10 22:18:43 UTC
Created attachment 165551 [details]
this fragment has not errors. bug in other line in this file
Comment 3 soldatov 2017-12-10 22:45:35 UTC
You forgot '//' in '[4] error'  line. But it is not a your original problem.

Main error in you test case is 'Unexpected token ;' It is critical error. C++ parser failed and can't parse code below, therefore you see a lot of "Unable to resolve" messages. Can you attach your "bad" file.