Bug 129584 - Java model gives different results
Summary: Java model gives different results
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M1   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 149853 (view as bug list)
Depends on:
Blocks: 149853
  Show dependency tree
 
Reported: 2006-02-27 10:23 EST by Dani Megert CLA
Modified: 2007-10-30 14:17 EDT (History)
5 users (show)

See Also:


Attachments
Proposed fix (22.32 KB, patch)
2006-07-17 07:33 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2006-02-27 10:23:54 EST
I20060221-0800

1. add the following source (which has a compile error):
package test;

public class Test {
    public void testMethod() {
        class NamedInnerClass {
        }
        NamedInnerClas
    }
}

2. close the editor
   ==> inner class is not shown in testMethod() in Package Explorer 
3. open the editor
   ==> inner class is not shown in testMethod() in Package Explorer and Outline 
       view
4. type into the editor
   ==> inner class appears in Package Explorer and Outline view
5. close editor
   ==> class again gone

I assume the reason for this is that on the first reconcile the model thinks it is consistent and hence only reports the problems since force problem detection is true. Once the cu is changed the inner class is reported. In the end the difference is probably caused because statements recovery is enabled on reconcile.
Comment 1 Jerome Lanneluc CLA 2006-07-11 12:15:00 EDT
That's correct, the statement recovery is enabled in the reconciler thread (see JavaReconcilingStategy#reconcile(...)) and it is not when opening a regular ICompilationUnit (through either openWhenClosed(...) or becomeWorkingCopy(...)).

David any idea why statement recovery is not enabled in the latter case ?
Or should we not report local elements during reconcile during recovery ?
Comment 2 Jerome Lanneluc CLA 2006-07-13 05:34:38 EDT
Talking with David, it appears that even with statement recovery off, it is possible to add an internal option to the SourceElementParser that will recover headers.

Reassigning to David to make the change.
Comment 3 David Audel CLA 2006-07-17 07:33:17 EDT
Created attachment 46369 [details]
Proposed fix

Add an internal option to the parser to enable the recovery of all headers in methods body.
Comment 4 David Audel CLA 2006-07-17 07:38:45 EDT
Released for 3.3M1

Test added
  LocalElementTests#testLocalType5()
Comment 5 Jerome Lanneluc CLA 2006-07-18 07:24:11 EDT
*** Bug 149853 has been marked as a duplicate of this bug. ***
Comment 6 Frederic Fusier CLA 2006-08-04 10:24:54 EDT
Verified for 3.3 M1 using build I20060804-0010.
Comment 7 Jerome Lanneluc CLA 2007-10-30 14:17:02 EDT
*** Bug 208013 has been marked as a duplicate of this bug. ***