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 155097

Summary: Step into for ternary operator
Product: debugger Reporter: Peter Pis <ppis>
Component: JavaAssignee: issues@debugger <issues>
Status: RESOLVED FIXED    
Severity: blocker CC: gholmer, ulfzibis
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Peter Pis 2008-12-10 08:57:54 UTC
Step into doesn't handle the TERNARY OPERATOR.

===
result = someCondition ? value1 : value2;
===

Solution:
Evaluate condition first and then to offer method calls for stepping based on the result.
Comment 1 Daniel Prusa 2009-03-24 13:16:41 UTC
*** Issue 157166 has been marked as a duplicate of this issue. ***
Comment 2 Daniel Prusa 2009-10-08 15:37:02 UTC
*** Issue 156311 has been marked as a duplicate of this issue. ***
Comment 3 Daniel Prusa 2009-10-08 15:38:43 UTC
A similar problem occurs in the case of conditional expressions, see the related report in issue 156311.
Comment 4 Daniel Prusa 2010-03-24 22:44:57 UTC
Fixed.
http://hg.netbeans.org/main/rev/60bdc4a1c32c

For a ternary operator:   Condition ? TrueExpr : FalseExpr
behavior has been changed in the following way:
- If Step Into is invoked at Condition and there is no method call to be executed (in Condition), Condition is evaluated. The selection mode is activated having the debugger stopped before the first method call in TrueExpr, resp. FalseExpr.
- If Condition contains a method call, it is not evaluated. The selection mode is displayed immediately. Method calls from both, TrueExpr and FalseExpr, are offered, however, they are highlighted in gray, meaning that it is not clear whether they will be reached or not. It is up to the user to decide if he wish to step into them directly. However, there is always possibility to step into a method call in Condition which of execution is guaranteed.
- Binary conditional operators || and && are handled using an analogous logic. In (LeftOperand || RightOperand), LeftOperand is treated like Condition and RightOperand like TrueExpr : FalseExpr part.
Comment 5 Quality Engineering 2010-04-02 05:01:42 UTC
Integrated into 'main-golden', will be available in build *201004020200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/60bdc4a1c32c
User: Daniel Prusa <dprusa@netbeans.org>
Log: #155097: Step into ternary and binary conditional operators fixed.