maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Evans <>
Subject RE: Compilation Error -Incompatible Types
Date Thu, 26 Nov 2015 21:15:37 GMT
I think the original question noted two different classes along the lines of  and

These are different classes.

... I cannot find the original post and I can't be sure so sorry if this is a red herring.

One of Eclipse's useful features is to allow you to pick a missing class to import (as a "quick

I have sometimes made the mistake of picking the wrong class from the list offered. 

If I pick java.awt.List instead of java.util.List things go wrong downstream quickly and the
mistake is pretty easy to find.

If I pick a super or subclass of the one I should have chosen, the cause might not appear
so quickly.  The Primavera Integration API, for example, provides ample opportunity to make
this kind of error - where a "family" of classes can live in different jars.

Of the classes listed in the original post, which one should you be using? I would go back
to my source and check whether the import is correct.  As others have alluded to, the fact
that it "works" in Eclipse doesn’t necessarily mean it's "correct". 



-----Original Message-----
From: [] On Behalf Of Curtis Rueden
Sent: 26 November 2015 20:28
To: Maven Users List <>
Subject: Re: Compilation Error -Incompatible Types

Hi Adrien,

> most of the time differences between eclipse and command line 
> compilation are due to scopes problems.

I agree that Eclipse's handling of scopes is a common reason for code which works in Eclipse,
but actually fails on the CLI.

However, there are also significant differences in the compilers themselves, which I have
encountered quite frequently. In particular, Eclipse tends to be laxer about complex generics
expressions than javac is.


On Thu, Nov 26, 2015 at 9:06 AM, Adrien Rivard <>

> I'm not sure this is the case here, but most of the time differences 
> between eclipse and command line compilation are due to scopes problems.
> Eclipse is merging various scopes (test/compile ..) when compiling 
> while command line is enforcing strict separation.
> Have a look at the scopes of the libraries of both problematics objects.
> On Thu, Nov 26, 2015 at 3:54 PM, Jörg Schaible <>
> wrote:
> > pradeepkumar wrote:
> >
> > > I have tried compile form console , even i am facing the same 
> > > error
> from
> > > command prompt.
> >
> > That simply means your code is not Java compliant. It does not 
> > matter
> that
> > the Eclipse compiler has no problem.
> >
> > Cheers,
> > Jörg
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail:
> > For additional commands, e-mail:
> >
> >
> --
> Adrien Rivard
View raw message