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 196719

Summary: Renaming method thru refactoring removes arguments, when arguments are annotated
Product: java Reporter: tnleeuw <tnleeuw>
Component: SourceAssignee: Jan Lahoda <jlahoda>
Status: VERIFIED FIXED    
Severity: normal CC: juhrik, mmirilovic
Priority: P1 Keywords: REGRESSION
Version: 7.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description tnleeuw 2011-03-15 10:13:16 UTC
Product Version = NetBeans IDE Dev (Build 201103130400)
Operating System = Windows Vista version 6.0 running on x86
Java; VM; Vendor = 1.6.0_24
Runtime = Java HotSpot(TM) Client VM 19.1-b02

The methods in my SpringFramekwork Controllers are annotated. In a refactoring excersize I'm renaming some of those methods, using the rename-refactoring (put cursor on method name, hit ctrl-r).

Before refactoring the method signature is as follows:

    @RequestMapping(value="/something", method= RequestMethod.POST)
    public String listDataImportDefs(@RequestParam(required=false) Environment environment, Model model) {
        // ... Body omitted
    }

After the renaming, the method signature is:

    @RequestMapping(value="/something", method= RequestMethod.POST)
    public String listDataImportDef(@RequestParam(required=false) {
        // ... Body omitted
    }

Which is clearly incorrect - even syntactically it's incorrect.
Comment 1 Jan Becicka 2011-03-17 11:00:25 UTC
reproducible with any annotation with parameters:
    void a(@SuppressWarnings("a") int b, int c) {
    }

Looks like generator issue
Comment 2 Jan Lahoda 2011-03-18 14:40:51 UTC
Thanks for the report, this should fix the problem in trunk:
http://hg.netbeans.org/jet-main/rev/2c3be4b84202
("when searching for closing ')' of method's parameters list, start at the end position of the last parameter.")

Jara, if you will agree, I would like to integrate to release70 on Monday. Thanks.
Comment 3 Dusan Balek 2011-03-18 16:33:18 UTC
The patch seems fine to me.
Comment 4 Jaromir Uhrik 2011-03-19 08:04:46 UTC
Verified in the latest jet-main build and heven't found any problem. I agree with integration in 7.0.
Comment 5 Quality Engineering 2011-03-19 09:42:58 UTC
Integrated into 'main-golden', will be available in build *201103190400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/2c3be4b84202
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #196719: when searching for closing ')' of method's parameters list, start at the end position of the last parameter.
Comment 6 tnleeuw 2011-03-21 10:04:05 UTC
The defect is fixed for me -- in build 201103190400, I can no longer reproduce this problem.
Comment 7 Jan Lahoda 2011-03-21 10:11:53 UTC
Thanks.

Transplated to release70:
http://hg.netbeans.org/releases/rev/8474830046ac
Comment 8 Jaromir Uhrik 2011-03-24 09:32:47 UTC
Verified in the following 7.0 build:
Product Version: NetBeans IDE 7.0 RC1 (Build 201103240000)
Java: 1.6.0_24; Java HotSpot(TM) Client VM 19.1-b02
System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)