Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] Extending classes with generics

Thomas Hallgren a écrit :
> On 2010-01-04 22:54, Curtis Windatt wrote:
>> Recently a number of the query API were changed to use generics, this
>> causes some annoyances in PDE (as we are strictly 1.4), but up until
>> now I can work around them.  However, I have a problem extending a
>> class with generics, specifically MatchQuery
>>
>> IQuery query = new MatchQuery() {
>>                         public boolean isMatch(Object candidate) {
>>                                 if (candidate instanceof
>> IInstallableUnit) {
>>                                         if
>> (P2Utils.isBundle((IInstallableUnit) candidate)) {
>>                                                 return true;
>>                                         }
>>                                 }
>>                                 return false;
>>                         }
>>                 };
>>
>> The compiler complains that I need to extend the isMatch(T candidate)
>> instead, but I am unable to use generics in PDE.
>>
> I noticed that error too. It's a strange error though. It manifests
> itself as a marker but the code compiles just fine. IMO, this indicates
> a problem with the compiler since it shouldn't know about generics when
> compiling for 1.4.

I got the same problems when I use SAT4J source code (1.5) instead of
SAT4J libraries (1.4) in my workspace.

> Perhaps it's related to the 1.5 workspace compilation of the p2 bundles?
> If so, the marker will go away once we tweak the preference setting to
> get 1.4 binaries in the workspace.

I guess you are correct.

The problem is to "tweak" the preference settings. Why not supporting
directly jsr14 as a valid bytecode target?

	Daniel
-- 
             Daniel Le Berre mailto:leberre@xxxxxxxxxxxxxxxxxxx
             MCF,    CRIL-CNRS UMR 8188,    Universite d'Artois
             http://www.cril.univ-artois.fr/~leberre


Back to the top