Bug 264419 - Unresolved compilation problem when executing a code that compiles fine on Eclipse
Summary: Unresolved compilation problem when executing a code that compiles fine on Ec...
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M6   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-10 15:49 EST by Marcelo Paternostro CLA
Modified: 2009-03-09 13:27 EDT (History)
1 user (show)

See Also:


Attachments
Small project reproducing the scenario (2.74 KB, application/x-zip-compressed)
2009-02-11 11:27 EST, Marcelo Paternostro CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcelo Paternostro CLA 2009-02-10 15:49:56 EST
We are dealing with a library that has the following classes


   pack1
       public abstract Class1<T> implements Iterator<T>
           abstract Iterator getPendingChildren(T n); // package-protected

       public class Class2<T> extends Class1<T>
           @Override
           Iterator<? extends T> getPendingChildren(Object n) {...}


This code compiles fine (no errors and no warnings) on Eclipse (3.5 M5 on my machine) and during the PDE build (3.2.1) so it seems that Class2.getPendingChildren(Object) is indeed considered an override of Class1.getPendingChildren(T).

Then, inside a method on, say, pack2.Foo, there is a code like this


   Iterator<Bar> i = new Class2<Bar>() {
     //overide a method that is not getPendingChildren
   }


Again no problems, so everything looks good.

The problem happens when I run this code as a stand-alone application (I tried it with Sun and IBM JVMs, 5 and 6 versions). I get this exception


  Exception in thread "Thread-0" java.lang.Error: Unresolved compilation problem: 
  This class must implement the inherited abstract method Class2<Bar>.getPendingChildren(Bar), but cannot override it since it is not visible from new Class1(){}. Either make the type abstract or make the inherited method visible.


I think I understand the exception. What is puzzling me is why Eclipse is compiling the classes above (pack1.Class2 specially) without any problems.
Comment 1 Marcelo Paternostro CLA 2009-02-11 11:27:38 EST
Created attachment 125406 [details]
Small project reproducing the scenario
Comment 2 Marcelo Paternostro CLA 2009-02-11 11:27:55 EST
I've spent a few hours trying to reproduce the problem with a small example (attached here) using 3.5 M5. I couldn't.

On our actual scenario, even though we are using either 3.4 or 3.5 as development environment, the code is deployed on Eclipse 3.2.1 so that's what we have as the PDE target environment and also on our build machine. So I've imported the small example on 3.2.1 and got the compilation error there.

I think now the question is whether this an Eclipse 3.2 or a 3.5 issue. To be clear, if it is a 3.2 issue, I will NOT push for a fix (I am not even sure if that stream is still open).
Comment 3 Kent Johnson CLA 2009-02-18 14:39:53 EST
Marcelo, I wasn't able to reproduce on either 3.5M5 or 3.4.2.

I suspect this bug was fixed a while ago.
Comment 4 Marcelo Paternostro CLA 2009-02-18 15:32:24 EST
I agree... I tried this on the very same version and didn't get the problem.

Thank you for the time you spend on this.
Comment 5 Frederic Fusier CLA 2009-03-09 13:27:51 EDT
Verified by reporter