Bug 93486 - [compiler] Wrong compile errors reported
Summary: [compiler] Wrong compile errors reported
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 93607 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-05-03 03:59 EDT by Dani Megert CLA
Modified: 2019-12-05 14:58 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2005-05-03 03:59:19 EDT
N20050503-0010

After switching to N20050503-0010, importing all binary plug-ins and rebuilding
everything I get two compile errors which are wrong:

1) in org.eclipse.core.expressions:
   org.eclipse.core.internal.expressions.PropertyCache:
   even though there's a correct import: import java.util.Map.Entry;
   an error is reported where Entry is used:

	public PropertyCache(final int cacheSize) {
		// start with 100 elements but be able to grow until cacheSize
		fCache= new LinkedHashMap(100, 0.75f, true) {
			/** This class is not intended to be serialized. */
			private static final long serialVersionUID= 1L;
			protected boolean removeEldestEntry(Entry eldest) {
				return size() > cacheSize;
			}
		};
	}


2) in org.eclipse.jdt.ui:
   org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor
   same here: correct import: import org.eclipse.swt.events.SelectionListener;
   is not recognized and error is reported where SelectionListener is used:

	private SelectionListener getButtonListener(final IClasspathEntry entry, final
IPath containerPath, final IJavaProject jproject) {
		return new SelectionListener() {
			public void widgetSelected(SelectionEvent event) {
			...

WORKAROUND: fully qualify those types.
Comment 1 Philipe Mulet CLA 2005-05-03 06:58:12 EDT
On 1) I am seeing a visibility issue. Is it what you saw as well ?
Comment 2 Dani Megert CLA 2005-05-03 07:23:23 EDT
correct, the error is:
The type Entry is not visible	PropertyCache.java
org.eclipse.core.expressions/src/org/eclipse/core/internal/expressions	line 25
Comment 3 Philipe Mulet CLA 2005-05-03 07:29:58 EDT
Kent - this is a consequence of the getTypeOrPackage caching change. Problem is
that in check for ambiguous case, it shouldn't consider non visible foundType.
Please double check my change.
Comment 4 Philipe Mulet CLA 2005-05-03 07:33:02 EDT
Added LookupTest#test054.

Dani - problem comes from the fact that LinkedHashMap defines a private member
type named Entry, which we consider incorrectly.
Comment 5 Kent Johnson CLA 2005-05-03 10:01:08 EDT
We should only cache positive hits then, since error cases do not happen 
in 'good' code.
Comment 6 Philipe Mulet CLA 2005-05-03 10:14:57 EDT
Fix released to HEAD.
Comment 7 Philipe Mulet CLA 2005-05-03 10:16:32 EDT
Caching problem bindings is not the problem here. 
Comment 8 Kent Johnson CLA 2005-05-03 12:46:15 EDT
Changed the fix to remove caching of problem types.
Comment 9 Philipe Mulet CLA 2005-05-05 17:37:31 EDT
*** Bug 93607 has been marked as a duplicate of this bug. ***
Comment 10 Dani Megert CLA 2005-05-11 15:34:21 EDT
verified in I20050509-2010