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 268332

Summary: CC problem for anonymous functions
Product: php Reporter: junichi11
Component: EditorAssignee: junichi11
Status: VERIFIED FIXED    
Severity: normal CC: amobilia, tmysik
Priority: P3    
Version: 8.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: screenshot

Description junichi11 2016-10-04 05:36:25 UTC
Created attachment 162326 [details]
screenshot

When anonymous functions are used, some LambdaFunctionDeclaration:**() are shown in a CC list.

<?php
$func1 = function(){echo "anonymous function1" . PHP_EOL;};

$func2 = function() {
    return function() {echo "anonymous function2" . PHP_EOL;};
};

my environments:
Product Version: NetBeans IDE 8.1 (Build 201510222201)
Java: 1.8.0_101; Java HotSpot(TM) 64-Bit Server VM 25.101-b13
Runtime: Java(TM) SE Runtime Environment 1.8.0_101-b13
System: Linux version 4.4.0-38-generic running on amd64; UTF-8;

Thanks.
Comment 1 Tomas Mysik 2016-10-04 05:55:06 UTC
Note: _Maybe_ it could be similar situation as with anonymous classes - they need to be filtered, see CodeUtils.isSyntheticTypeName() method (and its usages).

Thanks.
Comment 2 junichi11 2016-10-04 11:09:25 UTC
(In reply to Tomas Mysik from comment #1)
> Note: _Maybe_ it could be similar situation as with anonymous classes - they
> need to be filtered, see CodeUtils.isSyntheticTypeName() method (and its
> usages).

I'll try to look at it later.

Thanks!
Comment 3 Tomas Mysik 2016-10-04 11:51:14 UTC
Thanks! However I have no idea how exactly anonymous functions are implemented (not done by me).
Comment 4 junichi11 2016-10-12 01:39:28 UTC
Tomas, your advice was very helpful. Thanks a lot!
Comment 5 Tomas Mysik 2016-10-12 06:45:53 UTC
You are welcome, of course!
Comment 6 junichi11 2016-10-14 03:50:05 UTC
Fixed.

http://hg.netbeans.org/web-main/rev/84a5dff5a88c

Thanks.
Comment 7 Tomas Mysik 2016-10-14 06:33:27 UTC
The patch seems safe to me so marking it as a patch candidate.

Thanks Junichi!
Comment 8 Quality Engineering 2016-10-15 02:13:58 UTC
Integrated into 'main-silver', will be available in build *201610150002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/84a5dff5a88c
User: Junichi Yamamoto <junichi11@netbeans.org>
Log: #268332 - CC problem for anonymous functions
Comment 9 Tomas Mysik 2016-11-15 08:17:41 UTC
Verified.

Product Version: NetBeans IDE Dev (Build 20161110-5f9acf1b42b8)
Java: 1.8.0_111; Java HotSpot(TM) 64-Bit Server VM 25.111-b14
Runtime: Java(TM) SE Runtime Environment 1.8.0_111-b14
System: Linux version 4.8.0-27-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 10 Tomas Mysik 2016-12-03 14:09:01 UTC
Transplanted to the releases repo branch release82:

http://hg.netbeans.org/releases/rev/f1955b1c4d92

Thanks.
Comment 11 amobilia 2016-12-15 12:14:15 UTC
82patch1-verified