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 251354

Summary: "Return of Collection Field" should not be triggered when returning this.
Product: ide Reporter: supuhstar
Component: Exceptions ReporterAssignee: Tomas Hurka <thurka>
Status: NEW ---    
Severity: normal CC: supuhstar
Priority: P4    
Version: 8.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description supuhstar 2015-03-22 04:56:57 UTC
"Return of Collection Field" triggers when returning this. For example:

class MyChainingDictionary extends HashMap<CharSequence, Object> {
  public MyChainingDictionary put(CharSequence key, Object val) {
    super.put(key, val);
    return this;
  }
}

This should always be safe, because anything calling put will already have a reference to this object, anyway.