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 271062 - AssertionError: WHITESPACE
Summary: AssertionError: WHITESPACE
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: Dev
Hardware: All All
: P2 normal (vote)
Assignee: junichi11
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-08 23:10 UTC by twifty
Modified: 2017-07-20 17:52 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 229215


Attachments
stacktrace (16.05 KB, text/plain)
2017-07-08 23:10 UTC, twifty
Details

Note You need to log in before you can comment on or make changes to this bug.
Description twifty 2017-07-08 23:10:52 UTC
Build: NetBeans IDE Dev (Build 201706120001)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.101-b13, Java(TM) SE Runtime Environment, 1.8.0_101-b13
OS: Linux

User Comments:
GUEST: Triggered when auto complete function list was shown while editing a string in a PHP file

twifty: I'm getting this exception almost every time the autocomplete window pops ups.

Looking at the stack trace, I see it's happening while parsing code. Can somebody look at the trace and tell me what I should be looking for in my code. From there I may be able to provide a reproducable case.




Stacktrace: 
java.lang.AssertionError: WHITESPACE
   at org.netbeans.modules.php.editor.indent.FormatVisitor.visitShortenedConditionalExpression(FormatVisitor.java:816)
   at org.netbeans.modules.php.editor.indent.FormatVisitor.visit(FormatVisitor.java:747)
   at org.netbeans.modules.php.editor.parser.astnodes.ConditionalExpression.accept(ConditionalExpression.java:167)
   at org.netbeans.modules.php.editor.parser.astnodes.visitors.DefaultVisitor.scan(DefaultVisitor.java:152)
   at org.netbeans.modules.php.editor.indent.FormatVisitor.scan(FormatVisitor.java:246)
   at org.netbeans.modules.php.editor.indent.FormatVisitor.addUnbreakalbeSequence(FormatVisitor.java:2257)
Comment 1 twifty 2017-07-08 23:10:54 UTC
Created attachment 164725 [details]
stacktrace
Comment 2 twifty 2017-07-08 23:59:22 UTC
With a lot of commenting out code, I found the culprit. To reproduce, add the following to a php class.


    public function testFailsOnExistingFile()
    {
        $tmp = new class(0, $a ? 1 : 2) {
            public function __construct($a, $b) {
            }
        };
        
        // <-- Start typing '$this' here
    }

So long as the anonymous class exists in the source, the autocomplete will throw the exception (it doesn't matter from which line).
Comment 3 Tomas Mysik 2017-07-09 06:53:29 UTC
Reporting of this error can be easily avoided by disabling assertions (which is the default in final versions of NetBeans so this error will not occur in NB 9.0 Final). Simply remove "-J-ea" from NB config file [1].

Thanks.
[1] <netbeans-directory>/etc/netbeans.conf
Comment 4 junichi11 2017-07-09 12:04:12 UTC
Thanks for reporting! I'll look at it.
Comment 5 twifty 2017-07-10 04:31:55 UTC
@junichi11, did you manage to reproduce the problem with the code I gave?
Comment 6 junichi11 2017-07-10 04:40:59 UTC
(In reply to twifty from comment #5)
> @junichi11, did you manage to reproduce the problem with the code I gave?

Yes, reproducible. Thanks for providing it. This is a formatter's problem. I've already fixed it in my local environment. I'll push my changes tonight since I cannot watch build machines now.
Comment 7 junichi11 2017-07-10 10:18:02 UTC
Fixed.

http://hg.netbeans.org/web-main/rev/b56505c2dfc3

Thanks.
Comment 8 Quality Engineering 2017-07-20 17:52:36 UTC
Integrated into 'main-silver', will be available in build *201707201608* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b56505c2dfc3
User: Junichi Yamamoto <junichi11@netbeans.org>
Log: #271062 - AssertionError: WHITESPACE