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 106408 - Wrong Assignment to itself warning
Summary: Wrong Assignment to itself warning
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Petr Hrebejk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-12 17:36 UTC by ehucka
Modified: 2007-09-25 07:36 UTC (History)
3 users (show)

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 ehucka 2007-06-12 17:36:16 UTC
Product Version: NetBeans IDE Dev (Build 070612) Java: 1.6.0_02-ea; Java HotSpot(TM) Client VM 1.6.0_02-ea-b02 System:
Linux version 2.6.16-1.2122_FC5 running on i386; UTF-8; en_US (nb)

Example:

class Bean {
 String name;
 public Bean clone() {
  Bean ret = new Bean();
  ret.name = name;
  return ret;
 }
}

The line "ret.name = name;" is annotated by warning 'Assignment To Itself'.
Comment 1 Sergey Petrov 2007-06-13 11:26:45 UTC
the same in
    public Point locationSuggested(Widget widget, Point originalLocation, Point suggestedLocation) {
        suggestedLocation.x=originalLocation.x;//<-- warning
Comment 2 Petr Hrebejk 2007-06-13 12:27:03 UTC
Yes it will probably have many duplicates. The test is currently done by element (which is per type) and thus does not
take the variables in member selects into account.
Comment 3 Petr Hrebejk 2007-07-11 09:23:03 UTC
Checking in AssignmentToItself.java;
/cvs/java/hints/src/org/netbeans/modules/java/hints/AssignmentToItself.java,v  <--  AssignmentToItself.java
new revision: 1.5; previous revision: 1.4
done
Comment 4 ehucka 2007-07-11 12:31:18 UTC
verified
Comment 5 Jan Lahoda 2007-07-27 09:45:12 UTC
*** Issue 110495 has been marked as a duplicate of this issue. ***
Comment 6 athompson 2007-08-07 14:46:24 UTC
this is still present as of the 6 august build
Comment 7 Petr Hrebejk 2007-08-27 15:25:38 UTC
Checking in AssignmentToItself.java;
/cvs/java/hints/src/org/netbeans/modules/java/hints/AssignmentToItself.java,v  <--  AssignmentToItself.java
new revision: 1.6; previous revision: 1.5
done
Comment 8 athompson 2007-08-30 15:17:11 UTC
yup. can we turn the option back on again by default?
Comment 9 ehucka 2007-09-25 07:36:42 UTC
it works for me