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 - Parameter incorrectly reported as unused
Summary: Parameter incorrectly reported as unused
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
: 253676 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-08-04 11:16 UTC by RobertJohnson
Modified: 2017-12-18 16:56 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Javascript function parameter marked as unused (6.29 KB, image/png)
2014-08-04 11:16 UTC, RobertJohnson
Details
js function source file showing unused parameter warning (151 bytes, application/javascript)
2014-08-04 11:17 UTC, RobertJohnson
Details

Note You need to log in before you can comment on or make changes to this bug.
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