Bug 61882 - Inconsistency between build errors and reconcile errors
Summary: Inconsistency between build errors and reconcile errors
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-12 08:12 EDT by Philipe Mulet CLA
Modified: 2004-05-18 15:04 EDT (History)
2 users (show)

See Also:


Attachments
3 plugins testcase (10.91 KB, application/octet-stream)
2004-05-12 08:13 EDT, Philipe Mulet CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2004-05-12 08:12:13 EDT
Build 20040506

Using the attached test case (3 projects with one indirectly referencing 
binary missing on classpath), the editor is not showing the same errors during 
reconcile as the builder does.
Comment 1 Philipe Mulet CLA 2004-05-12 08:13:51 EDT
Created attachment 10533 [details]
3 plugins testcase

Here was a simple test case that I am running.	3 plugins:
plugin3 defines SecretClass
plugin2 references SecretClass (extends it, implements has the same problem)
	tested method reference - works, but highlights entire expression.
	tested field reference - works exactly as desired.
plugin1 defines Main which references plugin2's class
Comment 2 Philipe Mulet CLA 2004-05-12 08:15:41 EDT
There are 2 problems:
- the build error is not correctly positionned on Dumbo reference.
- the reconciler doesn't show the Dumbo problem.

The offending reference is discovered too late for us to infer its proper 
location. It occurs during our referenced type recording process, where we 
walk superclasses... we don't know anymore what it corresponded to in the 
source.

I tracked it down, and realized we are too lazy when we resolve bindings (for 
once). 

If reference recording is turned off, then we may accept code which javac 
would reject, since we never populate the supertype hierarchy for all types 
for which a member is accessed if we find the member locally to this type, 
e.g. field access, method access, constructor access, member type access.

However, when we bookkeep references, we need to reach supertypes, and abort 
from there. I tweaked the reference recording for eagerly bookkeeping 
supertypes for these type of accesses, and proved getting the correct behavior 
then, but still it doesn't work when reference recording is turned off (e.g. 
when you are reconciling in editor, these errors do not show up, thus we are 
inconsistent in between build and edit time).

We need to have an efficient way to cause faulting-in the supertypes of 
certain types (all these appearing as receiver types). If you provide me with 
the suitable API, I'll insert the call where appropriate.

Comment 3 Kent Johnson CLA 2004-05-12 15:16:56 EDT
I released some changes in Scope to fault in the hierarchy of receiver types.
Comment 4 Philipe Mulet CLA 2004-05-12 18:38:42 EDT
When faulting in entire type hierarchies for member accesses, it works as 
expected: i.e. we abort at a point we are resolving a reference, and thus 
provide some useful source location in code.

We may still want to improve a little bit the error location, since we denote 
the entire member access, where we could only blame its receiver portion.
Comment 5 Philipe Mulet CLA 2004-05-13 06:54:01 EDT
Added regression tests: NegativeTest#test424-426.
Fixed.

Also entered bug 62070 for revisiting the reference recording post 3.0. I 
suspect we should actually be more lazy, and record less references. Need to 
investigate deeper. For now, consider this one fixed as we are now consistent 
in between editor and builder, plus we match javac behavior. I believe we can 
do a little better still if it doesn't break specs.
Comment 6 Olivier Thomann CLA 2004-05-18 15:04:24 EDT
Verified in 200405180816