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 246239

Summary: Parameter incorrectly reported as unused
Product: javascript Reporter: RobertJohnson
Component: EditorAssignee: Petr Pisl <ppisl>
Status: RESOLVED FIXED    
Severity: normal CC: terje7601
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: Javascript function parameter marked as unused
js function source file showing unused parameter warning

Description RobertJohnson 2014-08-04 11:16:16 UTC
Created attachment 148518 [details]
Javascript function parameter marked as unused

In the attached screen shot, the function parameter is used on line 4, then reassigned on line 5.

As a result the parameter is underlined as 'unused' incorrectly.
Comment 1 RobertJohnson 2014-08-04 11:17:57 UTC
Created attachment 148519 [details]
js function source file showing unused parameter warning
Comment 2 Vladimir Riha 2014-08-04 11:32:16 UTC
reproducible

Product Version: NetBeans IDE 8.0.1 RC1 (Build 201408031330)
Java: 1.8.0_11; Java HotSpot(TM) 64-Bit Server VM 25.11-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_11-b12
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 3 Petr Pisl 2014-08-04 12:52:44 UTC
The problem is that the param has the same name as the private variable.
Comment 4 RobertJohnson 2014-08-04 13:11:45 UTC
It's not very good code, but maybe there should be a parameter redefinition warning instead?
Comment 5 Roman Svitanic 2015-07-28 13:47:21 UTC
*** Bug 253676 has been marked as a duplicate of this bug. ***
Comment 6 Petr Pisl 2016-08-08 20:33:06 UTC
The first case work correctly in dev build, but this simple case doesn't work:

function UnusedParameter(ctl)
{
    console.log(ctl);
    var ctl = 20;
    console.log(ctl);
}
Comment 7 Quality Engineering 2016-08-10 01:54:25 UTC
Integrated into 'main-silver', will be available in build *201608100002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/c915cd0f7ba8
User: Petr Pisl <ppisl@netbeans.org>
Log: #246239 - Parameter incorrectly reported as unused

Adding test for the first case
Comment 8 dusty 2017-12-18 16:56:45 UTC
This seems fixed in 8.2