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.
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)
Created attachment 164725 [details] stacktrace
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).
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
Thanks for reporting! I'll look at it.
@junichi11, did you manage to reproduce the problem with the code I gave?
(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.
Fixed. http://hg.netbeans.org/web-main/rev/b56505c2dfc3 Thanks.
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