Bug 143516 - [reconcile] compiler thinks certain methods are missing
Summary: [reconcile] compiler thinks certain methods are missing
Status: RESOLVED DUPLICATE of bug 91709
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.2.1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-24 12:34 EDT by Jon Barrilleaux CLA
Modified: 2006-06-19 11:54 EDT (History)
0 users

See Also:


Attachments
Base family class (1.67 KB, application/octet-stream)
2006-05-24 12:38 EDT, Jon Barrilleaux CLA
no flags Details
Concrete family class (1.40 KB, application/octet-stream)
2006-05-24 12:40 EDT, Jon Barrilleaux CLA
no flags Details
Concrete family class (take 2) (1.16 KB, application/octet-stream)
2006-05-24 13:23 EDT, Jon Barrilleaux CLA
no flags Details
Base and concrete family classes using the generic self-type pattern (2.71 KB, application/zip)
2006-05-24 17:10 EDT, Jon Barrilleaux CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Barrilleaux CLA 2006-05-24 12:34:41 EDT
I am trying to implement a generic self-type pattern for a family of nested classes. It appears as though certain methods cannot be overridden because the compiler thinks they are not present in a type (compiler error), yet the Eclipse hierarchy view shows the method to be present in that type.

The specific circumstance is in trying to create a "wrapper" class, Family.Unmod, for the type Family, with all of the type methods being forwarded to the wrapper "target" object, of type Family.

In the attached sample code the compiler errors appear in the Family.Unmod.setFamily() and Family.Unmod.doFamily() methods.  Perhaps I am overlooking something obvious, but I've tried coming at this from several different directions and it just seems that either the compiler is broken (methid should be accessible for use) or Eclipse is broken (method should not appear in hierarchy view as accessible for use).  Also, it seems odd that the problem only occurs for methods that take a self-type argument, not for the method with no argument.
Comment 1 Jon Barrilleaux CLA 2006-05-24 12:38:02 EDT
Created attachment 42439 [details]
Base family class

This is the base class for a family of related types used for generic self-type extension and concrete type implementation.
Comment 2 Jon Barrilleaux CLA 2006-05-24 12:40:37 EDT
Created attachment 42443 [details]
Concrete family class

This is the concrete class for a family of related types used for concrete type implementation.  Note that this is the file that contains the apparent compiler errors, in Family.Unmod.setFamily() and Family.Unmod.doFamily().
Comment 3 Jon Barrilleaux CLA 2006-05-24 12:45:42 EDT
A minor correction to my original description.  I said "overridden", but it should read......

  It appears as though certain methods cannot be *accessed* because...
Comment 4 Jon Barrilleaux CLA 2006-05-24 13:23:16 EDT
Created attachment 42458 [details]
Concrete family class (take 2)

In this version the Family.Unmod simply extends FamilyBase.Unmod from the base family class.  Unfortunately, there is a compiler error when trying to use super(), even when Eclipse generates the constructor.  I tried casting the target object to various other types just to see if super() could be satisfied, but I couldn't satisfy it.

Is this a bug (compiler, or Eclipse constrictor generator)?  Perhaps this is related to the other problems (can't access certain methods) when trying to implement the generic self-type pattern.
Comment 5 Olivier Thomann CLA 2006-05-24 15:30:29 EDT
Could you please provide a complete test case?
Your test case refers to the package gumbo2.... that is not included.
Thanks.
Also specify what build you are using.
Comment 6 Jon Barrilleaux CLA 2006-05-24 16:40:27 EDT
It is a BIG package.  I'll try to simplify the test case and then repost it.
Comment 7 Jon Barrilleaux CLA 2006-05-24 17:10:46 EDT
Created attachment 42497 [details]
Base and concrete family classes using the generic self-type pattern

Complete standalone test case.  Family.java includes both flavors of wrappers, UnmodA and UnmodB, that I previously reported as having compile errors.  Refer to the notes in the code.
Comment 8 Jon Barrilleaux CLA 2006-05-24 17:17:28 EDT
I am using Eclipse Version: 3.2.0
Build id: I20060519-1206

Which I believe is RC4.
Comment 9 Olivier Thomann CLA 2006-05-25 13:46:50 EDT
Your test case compiles fine with the upcoming RC6 build.
I tried it with I20060519-0010 and I had no compile errors.
Could you please check your test case with a more recent build?
Thanks.
Comment 10 Jon Barrilleaux CLA 2006-05-25 14:35:14 EDT
I just did a clean install with RC5, I20060519-1206 (which is the same version I was previously using, and is the latest stable release available on the eclipse website).  I am still seeing compile errors.

Did you actually open up the Family.java file to see the errors where I noted them in the code comments?  I am only seeing the compile errors when I look in the file itself.  The error indicator is not propagating to the tab or explorer view (perhaps this in itself is a bug).


(In reply to comment #9)
> Your test case compiles fine with the upcoming RC6 build.
> I tried it with I20060519-0010 and I had no compile errors.
> Could you please check your test case with a more recent build?
> Thanks.
> 

Comment 11 Olivier Thomann CLA 2006-05-25 14:53:53 EDT
Problem still exists in latest.
It occurs only in the editor. The compilation itself works fine.
Comment 12 Olivier Thomann CLA 2006-05-25 15:00:50 EDT
This is certainly not a blocker since it doesn't prevent you from compiling the classes.
Setting severity as normal.
Jérôme,
The problem seems to be related to the usage of '$' sign as a type variable name.
If I rename all the '$' into 'T' it seems to work.
I'll try to simplify the test case and validate that the problem comes from the usage of the '$' sign.
Comment 13 Olivier Thomann CLA 2006-05-25 15:52:35 EDT
The problem in reconciling comes from the usage of the $ sign.

Here is a small test case:

public interface Base<$> {
	public $ foo($ t);
}

public class B<$ extends Base<$>> {
	$ _t;
	public $ foo($ t) {
		return _t.foo(t);
	}
}

Save them in two different files.
Then go to the class B and edit it. foo in _t.foo(t); will be underlined as having an error even if it compiles fine.

Having them in the same file doesn't report any error in reconciling.
Hope this test case will help to isolate the issue.
Renaming all '$' to 'T' fixes it.
Comment 14 Jon Barrilleaux CLA 2006-05-25 16:44:10 EDT
I tried the workaround (renaming $) and it works for me.

So, there seems to be two bugs:

1) Although unorthodox, $ should be a valid type name in all contexts.

2) It seems that if any error is detected in a file (whether that error is correctly detected or not) it should be propagated to the rest of eclipse (as indicated in tabs and the explorer tree).

BTW: I decided to use $ instead something more normal since the whole concept of generic self-type is so bizzare and twisted, and must be handled with kid gloves.  I wanted to make sure that it stood out from any "normal" type.
Comment 15 Jerome Lanneluc CLA 2006-06-19 11:54:37 EDT

*** This bug has been marked as a duplicate of 91709 ***