Bug 190904 - method()method() watch evaluated incorrectly
method()method() watch evaluated incorrectly
Status: STARTED
Product: java
Classification: Unclassified
Component: Source
7.0
All All
: P3 (vote)
: 7.4
Assigned To: Svata Dedic
issues@java
721-reviewed
: API, API_REVIEW_FAST
Depends on:
Blocks: 192493 237805
  Show dependency treegraph
 
Reported: 2010-10-11 13:14 UTC by Jan Stola
Modified: 2013-10-30 11:41 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
:


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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo