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 97501

Summary: Anonymous inner class members and its childs cannot be modified
Product: java Reporter: _ deva <deva>
Component: SourceAssignee: Pavel Flaska <pflaska>
Status: RESOLVED FIXED    
Severity: blocker CC: sandipchitale
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 90451    

Description _ deva 2007-03-08 19:41:52 UTC
Any attempt to modify anonymous class members like method rename, or 
addition/deletion of statements to member methods fails

If you look into CasualDiff.treesMatch(), in case of JCTree.CLASSDEF, its 
members are not matched deeply and hence the diffs are empty in the above 
mentioned scenarios. Following the pattern used in CasualDiff- I think it is 
necessary to provide matchClass(), matchMethod(), matchVariable() 
implementation and call them appropriately in order to fix this bug
Comment 1 Pavel Flaska 2007-03-08 21:26:51 UTC
Do you have current trunk sources? Recently I fixed similar issue, see #96364.
-- If you have anonymous class, perhaps 'case JCTree.NEWCLASS' is used. 
Comment 2 _ deva 2007-03-08 21:35:04 UTC
Fix to #96364 addresses only the modification to NewClassTree's body class. 
(For example, when you add a method) It doesn't work if you want to add a 
statement to the member method.
Comment 3 Pavel Flaska 2007-03-08 22:47:15 UTC
Okay, now I see your point.  List of members are matched as the same, but there
are changes inside the members. Thanks, I'll try to address the issue next week.
Comment 4 Pavel Flaska 2007-03-12 08:49:40 UTC
Reproducible testcase added.

Checking in test/unit/src/org/netbeans/api/java/source/gen/AnonymousClassTest.java;
/cvs/java/source/test/unit/src/org/netbeans/api/java/source/gen/AnonymousClassTest.java,v
 <--  AnonymousClassTest.java
new revision: 1.2; previous revision: 1.1
done
Comment 5 Pavel Flaska 2007-03-12 09:18:14 UTC
Hopefully fixed. Please, verify.

Checking in src/org/netbeans/modules/java/source/save/CasualDiff.java;
/cvs/java/source/src/org/netbeans/modules/java/source/save/CasualDiff.java,v 
<--  CasualDiff.java
new revision: 1.84; previous revision: 1.83
done
Comment 6 _ deva 2007-03-14 00:38:38 UTC
Thanks, I have verified that your fix addresses the VWP issue which is to add 
a statement to a method in an anonymous inner class.