Community
Participate
Working Groups
When there are two statements on the same line, e.g. int dummy=0; while ( a < 5 ) { the marking of the current execution line is often wrong. Here is a sample: public class StepBad { public static void main( String[] args ) { int a = 1; int dummy=0; while ( a < 5 ) { a = a + 1; if ( a < 5 ) { System.out.println("still less that 5"); } else { System.out.println("now at 5"); } } } } When stepping you will go into both the "then" and the "else" portions of the if statement each time around the while loop (except the last time around the loop). This problem does not occur if the class is compiled with JDK 1.3.1. javap -k on the Eclipse generated code looks like this: Line numbers for method void main(java.lang.String[]) line 5: 0 line 6: 2 line 6: 4 line 7: 7 line 8: 10 line 9: 15 line 11: 26 line 14: 39 javap -k on the JDK 1.3.1 generated code looks like this: Line numbers for method void main(java.lang.String[]) line 5: 0 line 6: 2 line 7: 7 line 8: 11 line 9: 16 line 11: 27 line 6: 35 line 14: 40
Created attachment 1940 [details] Test case to show stepping problem.
I need to understand why we don't add the line 6: 34 at the end of the method. This is why the stepping isn't optimal when the condition of the while loop is executed.
Fixed and released in 2.1 stream.
Verified.