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 258155 - operators that are insterted in nested class erroneously use parent class instead of nested one
Summary: operators that are insterted in nested class erroneously use parent class ins...
Status: RESOLVED WORKSFORME
Alias: None
Product: cnd
Classification: Unclassified
Component: Navigation (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: Vladimir Kvashin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-26 11:34 UTC by Vladimir Kvashin
Modified: 2016-07-22 21:03 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Kvashin 2016-02-26 11:34:13 UTC
I had the following construct:

struct SimpleTest {  
  struct Point {
    int x; 
    int y;    
    // insert operators here
  };
};

When invoked "Insert code"  below the "int y", IDE generated the folloowing operators

    bool operator!=(const SimpleTest& right) const {
      bool result = !(*this == right); // Reuse equals operator
      return result;
    }

    bool operator==(const SimpleTest& right) const {
      bool result = false; // Compare right and *this here
      return result;
    }

It used SimpleTest where Point should be.

I guess the file was not saved at the moment I invoked "Insert code",
because next time, when I double checked that the file is saved, it generated correct operators:

    bool operator!=(const Point& right) const {
      bool result = !(*this == right); // Reuse equals operator
      return result;
    }
    bool operator==(const Point& right) const {
      bool result = false; // Compare right and *this here
      return result;
    }

I can not reproduce this quite stable.
But each several times I invoke this while modifying the file, it uses SimpleTest instead of Point
Comment 1 Vladimir Kvashin 2016-02-26 11:39:31 UTC
I noted that I can understand whether it understand context correct or not without adding operators: the list of possible insertions differ.
If it understands that I'm inside Point, 
then there "Constructor" in the list.
When it erroneously thinks that I'm in SimpleTest, there is no constructor.
Comment 2 Vladimir Kvashin 2016-07-22 21:03:52 UTC
I can not reproduce this any more.