Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] 3.1M4 build error



Covariance refers to the ability to narrow the return type of a method when
overriding it:

public class X {
  public Object foo() { return new X(); }
}
public class Y extends X {
  public Y foo() { return new Y(); }
}

Then when compiling:

class Z {
   {   new Y().foo();   }
}

The invocation of Y.foo() is targeting:  "#foo()Y"  (and not
"#foo()Object"). However, a 1.4 compiler is not expecting such subtleties,
hence the problems you are seeing.
If manually changing the offending project compliance to 1.5, you can
compile your code clear. But do not intend to run it on a 1.4 VM in the
end. The generated binaries are tagged as working on 1.4; but there are
direct references to 1.5 specific constructs which have no equivalent in
true 1.4 libraries (for instance, there would be not "#foo()Y" method in a
real 1.4 library).



                                                                           
             Andrew Gaydenko                                               
             <a@xxxxxxxxx>                                                 
             Sent by:                                                   To 
             eclipse-dev-admin         eclipse-dev@xxxxxxxxxxx             
             @eclipse.org                                               cc 
                                                                           
                                                                   Subject 
             01/09/2005 01:03          Re: [eclipse-dev] 3.1M4 build error 
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
                eclipse-dev                                                
                                                                           
                                                                           




Philippe,

I do not understand the (English) term "covariance" in the current context.
Will you be so kind to find a minute to decrypt it? Thanks!

======= On Sunday 09 January 2005 02:28, Philippe P Mulet wrote: =======

FYI: this isn't real javac, but the javac Ant task using our Eclipse Java
compiler.

I believe you are seeing the effect of covariant return types in 1.5
libraries; which affects 1.4 compilers.
Basically 1.5 libraries using covariance are not suitable for 1.4 compilers
(i.e. covariance affects method descriptors,
which are then fooling 1.4 compilers). You should feed the 1.4 compiler
with a 1.4 class library.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Philippe, you are right. As I have mentioned, one of the aim is to have a
single (1.5) jdk. But the problem is I can not understand the reason of the
error messages. I have looked at the classes-under-consideration-code
(FeatureWriter, XMLWriter, IPDEBuildConstants) and at the PrintWriter
javadoc
and have not found anything criminal. So, I can suggest, it is javac error.
OTOH, it is not very probable. I'm in confusion :-(


======= On Saturday 08 January 2005 23:46, Philippe P Mulet wrote: =======

Eclipse is meant to be compiled against JRE 1.4 libraries; you seem to be
compiling against 1.5 libraries.
...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hi,

Have tried to get answer at the news group, the thread:

http://www.eclipse.org/newsportal/article.php?group=eclipse.platform&id=%3Ccr3hu5%24qnq%241%40www.eclipse.org%3E




without any success.

The problem is: I'm trying to build the 3.1M4 (linux, gtk, sun jdk
1.5.0.01).
The errors take place:

////////////////////////////////////////////
...
[javac] 1. ERROR in /x/kit/eclipse/build-3.1
M4/plugins/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/FeatureWriter.java


 (at line 23)
    [javac]     public class FeatureWriter extends XMLWriter implements
IPDEBuildConstants {
    [javac]                  ^^^^^^^^^^^^^
    [javac] The return type is incompatible with Writer.append(char),
PrintWriter.append(char)
    [javac] ----------
    [javac] 2. ERROR in /x/kit/eclipse/build-3.1
M4/plugins/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/FeatureWriter.java


 (at line 23)
    [javac]     public class FeatureWriter extends XMLWriter implements
IPDEBuildConstants {
    [javac]                  ^^^^^^^^^^^^^
    [javac] The return type is incompatible with
Writer.append(CharSequence, int, int), PrintWriter.append(CharSequence,
int, int)
    [javac] ----------
    [javac] 3. ERROR in /x/kit/eclipse/build-3.1
M4/plugins/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/FeatureWriter.java


 (at line 23)
    [javac]     public class FeatureWriter extends XMLWriter implements
IPDEBuildConstants {
    [javac]                  ^^^^^^^^^^^^^
    [javac] The return type is incompatible with
Writer.append(CharSequence), PrintWriter.append(CharSequence)
    [javac] ----------
    [javac] 3 problems (3 errors)

BUILD FAILED
...
////////////////////////////////////////////

What are my steps to resolve the problem? One of the aim is to have a
single (1.5) jdk.
Thanks!
Andrew
_______________________________________________
eclipse-dev mailing list
eclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
http://dev.eclipse.org/mailman/listinfo/eclipse-dev




Back to the top