Bug 90679 - Wrong compiler error: "The return type is incompatible with...."
Summary: Wrong compiler error: "The return type is incompatible with...."
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-07 13:40 EDT by MD CLA
Modified: 2006-03-27 06:47 EST (History)
0 users

See Also:


Attachments
Zip file that contains a class hierachy similar to the one that does not complie ( but unable to reproduce problem ) (2.79 KB, application/octet-stream)
2005-04-07 13:42 EDT, MD CLA
no flags Details
java class fixed to remove the static modifier and the extra parameter (606 bytes, text/plain)
2005-04-09 00:50 EDT, MD CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description MD CLA 2005-04-07 13:40:09 EDT
I am attempting to move a legacy project from JBuilderX to Eclipse 3.x. I have
created the project and Eclipse now reports the above errors:
"The return type is incompatible with..."

The project compiles with jdk 1.4.2_06, netbeand 4.0 and JBuilderX. The method
in question is returning an array of a static nested class which has been
declared in an abstract base class. The method itself is declared as an abstract
method in the same base class.

I have tried to use Eclipse 3.0, with the same results. The entire project is
version-controlled. When i checkout the files and do a "Source->Organize Import"
operation on each file, the errors go away. But the organize import really does
nothing, because there were no import wildcards and no unused imports to begin with.

I have attempted to recreate a test case but it compiles in eclipse. However, it
may help you track the issue down. The test case has a similar hierarchy as the
one in the project. The project hierarchy is much deeper. Also, the base classes
implement a bunch interfaces.

Let me know what i can do to help resolve this.
Comment 1 MD CLA 2005-04-07 13:42:00 EDT
Created attachment 19656 [details]
Zip file that contains a class hierachy similar to the one that does not complie ( but unable to reproduce problem )

Zip file
Comment 2 MD CLA 2005-04-07 14:12:47 EDT
The odd thing is that only a select few classe dont compile. There are other
non-abstract classes derived eventuall from the same base class, in the same as
well as different packages, that implement the same abstract method and do compile.

I did an F4 on the abstract base class and noticed all the classes that fail to
compile are derived 3 levels or more from the base class.
Comment 3 Philipe Mulet CLA 2005-04-07 18:35:52 EDT
Could you give a try to Eclipse 3.1m6 and see whether you reproduce this issue ?
Comment 4 MD CLA 2005-04-07 22:53:18 EDT
I have done that with similar results:
Eclipse Platform

Version: 3.1.0
Build id: I20050401-1645

Comment 5 Kent Johnson CLA 2005-04-08 08:17:38 EDT
Are there any instance or static methods in the hierarchy with the same 
name/parameters as the static method?
Comment 6 MD CLA 2005-04-09 00:48:57 EDT
Whoops,

I was trying out different things and forgot to undo my changes.
DerivedAbstractClass.getLegalTypes is not static and should have only one
boolean parameter. There are not static methods in the hierarchy.

I am attaching the corrected java file.
Comment 7 MD CLA 2005-04-09 00:50:05 EDT
Created attachment 19710 [details]
java class fixed to remove the static modifier and the extra parameter
Comment 8 Kent Johnson CLA 2005-04-26 16:31:05 EDT
Can you please reattach the complete testcase.

The current attachments include 3 different methods that do not override each 
other.

Also please add comments where the errors are occuring in your code.
Comment 9 Kent Johnson CLA 2005-05-10 12:03:21 EDT
Please reopen with the complete testcase & indicate where you are seeing the 
errors.
Comment 10 Philipe Mulet CLA 2006-03-27 06:41:35 EST
reopening
Comment 11 Philipe Mulet CLA 2006-03-27 06:42:24 EST
Not enough data to assess bug. Also many changes occurred in this area since then.
Comment 12 Philipe Mulet CLA 2006-03-27 06:47:29 EST
oops, did mean to close as worksforme
Comment 13 Philipe Mulet CLA 2006-03-27 06:47:49 EST
worksforme