Bug 50688 - Assignation to "this" accepted without error
Summary: Assignation to "this" accepted without error
Status: RESOLVED DUPLICATE of bug 46918
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1.2   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-27 11:35 EST by Jacques Bapst CLA
Modified: 2004-01-27 12:14 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jacques Bapst CLA 2004-01-27 11:35:39 EST
If, in an instance method, I assign the reference "this" to some value 
(including null) I receive no error (nor the compiler neither during the 
execution) and this assignation seems to have no effect.

"this" is a final variable and its value may not be changed.

In the debugger the line(s) seems to be skipped (no breakpoint possible).

Example :  public void f() {
             this=null;     // Suicide accepted
             this=new ...   // Also accepted
             ... 
           }
Comment 1 Olivier Thomann CLA 2004-01-27 11:41:25 EST
This is fixed in the 3.0 stream.
----------
1. ERROR in e:\temp\A.java (at line 3)
	this=null;     // Suicide accepted
	^^^^
The left-hand side of an assignment must be a variable
Comment 2 Olivier Thomann CLA 2004-01-27 11:48:14 EST
This is also fixed using the latest 2.1.3 build.
See 2.1.3 Stream Maintenance Build	M20040122	Thu, 22 Jan 2004 -- 08:00 (-0500)

on the download page.
Comment 3 Philipe Mulet CLA 2004-01-27 12:14:39 EST

*** This bug has been marked as a duplicate of 46918 ***