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 190904 - method()method() watch evaluated incorrectly
Summary: method()method() watch evaluated incorrectly
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks: 192493 237805
  Show dependency tree
 
Reported: 2010-10-11 13:14 UTC by Jan Stola
Modified: 2016-07-07 07:17 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Proposed API change. (8.63 KB, patch)
2010-11-18 16:41 UTC, Jan Lahoda
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Stola 2010-10-11 13:14:25 UTC
I tried to create a watch that would show the second parent of my Swing component, i.e., I tried to create watch 'getParent().getParent()'. Unfortunately, I made a typo and entered 'getParent()getParent()'. Surprisingly, the debugger didn't complain about invalid syntax of this watch. It evaluated the watch as if it was just 'getParent()' which was confusing.
Comment 1 Martin Entlicher 2010-10-26 06:49:21 UTC
Not a bug of debugger.

org.​netbeans.​api.​java.​source.​TreeUtilities.parseStatement(
                    "{\n getParent()getParent();\n}",
                    SourcePositions[]);

returns following Tree:

"{
    getParent();
    getParent();
}"

There are two statements trees and no error.

org.​netbeans.​api.​java.​source.​TreeUtilities.parseExpression(
                    "getParent()getParent()",
                    SourcePositions[])

returns following Tree:
(JCTree$JCMethodInvocation) "getParent()"

There is only one method invocation and no error.
Comment 2 Jan Lahoda 2010-10-26 14:39:38 UTC
Two possible solutions:
1. parse* could return ErrorTree if the content was parsed with error.
2. parse* methods could be extended to also return list of errors found during parsing, so the user could get better feedback that simply "parse error".

What would be better for the debugger?
Comment 3 Martin Entlicher 2010-10-26 14:49:19 UTC
We currently check for Tree.Kind.ERRONEOUS so the (1) would fix it.
(2) Would be certainly valuable, if it's feasible to implement, we can provide such more detailed message to the user.
Thanks.
Comment 4 Quality Engineering 2010-11-17 07:10:08 UTC
Integrated into 'main-golden', will be available in build *201011170001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b8d1bf85ff31
User: Jan Lahoda <jlahoda@netbeans.org>
Log: Updating the nb-javac library (for bugs #191963, #190904)
Comment 5 Jan Lahoda 2010-11-18 16:41:38 UTC
Created attachment 103075 [details]
Proposed API change.
Comment 6 Jan Lahoda 2010-11-18 16:44:23 UTC
I would like to add new variants of the parse{Statement,Expression,StaticBlock,VariableInitializer} which can return parse errors - please see the attached text. Please review, thanks.
Comment 7 Martin Entlicher 2010-11-25 17:02:07 UTC
For me the change is fine. Thanks.

Javadoc says that methods return:
"@return parsed {@link StatementTree} or null?"
Do they return null iff there's an error (errors.size() > 0)?
Comment 8 Marian Mirilovic 2012-10-22 20:11:25 UTC
Honza, 
what is the status of this issue ? 

It looks like you were waiting for FAST API review initiated 2 years ago ...
Comment 9 Svata Dedic 2013-08-08 09:15:30 UTC
Seems still valid in 7.4
Comment 10 Jaroslav Tulach 2014-11-05 12:20:59 UTC
This is an open API review. Can you finish it or close it?
Comment 11 Martin Balin 2016-07-07 07:17:03 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss