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 38734

Summary: Rename class doesn't find arrays of renamed class
Product: editor Reporter: ehucka <ehucka>
Component: RefactoringAssignee: Tomas Hurka <thurka>
Status: CLOSED FIXED    
Severity: blocker    
Priority: P1    
Version: 4.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: CCE's stacktrace.
Sources that can be used to test whether the issue is fixed.

Description ehucka 2004-01-14 12:33:38 UTC
Build 20040114

I've invoked rename of some class.
It didn't rewrite declaration of array of renamed
class.

Example:
 renamed class Bean
 
it didn't rename code like:

 public Bean[] beans;
Comment 1 ehucka 2004-01-16 10:02:45 UTC
It doesn't find some of the class'es occurencies as array, not all.

After rename of this class there are thrown ClassCastExceptions.
Comment 2 ehucka 2004-01-16 10:03:29 UTC
Created attachment 12929 [details]
CCE's stacktrace.
Comment 3 Jan Becicka 2004-02-03 10:34:36 UTC
This issue was fixed as a side effect of changes in javacore
(introduction of MultipartId)
Emane, please verify. Thanks.
Comment 4 ehucka 2004-02-05 12:57:46 UTC
I've found that in case of source e.g.:

return (Bean[])(ret.toArray(new Bean[] {}));

parser still doesn't find occurances of class Bean.
Comment 5 Jan Becicka 2004-02-05 13:48:39 UTC
The problem is, that parser cannot resolve MultipartId "Bean" in this
case. 
MultipartId.getParser().getSemanticInfo(token "Bean") returns null

Tomasi, can you take a look at it?
Thanks
Comment 6 Martin Matula 2004-03-09 09:19:36 UTC
This is still the case. I have investigated it a little bit and found 
out that the following types of usages of array can be found without 
problems (I was looking for usages of MethodInfo class):
MethodInfo[] methods = generateMethods();
protected abstract MethodInfo[] generateMethods() throws IOException;

But the following type of occurence cannot be found:
return (MethodInfo[]) methods.toArray(new MethodInfo[methods.size()]);

It seems like there is a problem only with expressions in return 
statement. Or maybe it is a problem with TypeCast and 
NewArrayExpression.
Attached are the sources I've tried it on. I tried to rename 
org.netbeans.lib.jmi.util.ClassFileGenerator.MethodInfo class. One of 
the usages that are not found is in AssociationGenerator class line 
105.
Comment 7 Martin Matula 2004-03-09 09:27:25 UTC
Created attachment 13888 [details]
Sources that can be used to test whether the issue is fixed.
Comment 8 Tomas Hurka 2004-03-09 14:56:36 UTC
Fixed in meta_2 branch.
Comment 9 Jan Becicka 2004-03-17 17:07:44 UTC
Tomas already fixed it
Comment 10 ehucka 2004-03-19 09:02:59 UTC
Verified in alpha build.