Search code examples
javaeclipseosgiequinox

Type IQuery does not take parameters Error in org.eclipse.equinox.p2.query and org.eclipse.equinox.p2.metadata


I am using Eclipse Equinox dependencies in my implementation and when I try to compile in Java 7 I get the following error. For Java 6 it's working perfectly.

import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.query.IQuery;


public void checkInstallableUnits(){
    IQuery<IInstallableUnit> query = null; 
}

I am using the following dependency:

<dependency>
    <groupId>org.eclipse.equinox</groupId>
    <artifactId>org.eclipse.equinox.p2.metadata</artifactId>
    <version>2.1.0.v20110510</version>
</dependency>

Solution

  • This probably has to do with compiling against classfiles built with the undocumented javac option "-target jsr14". Such class files work fine with javac 1.6 which recognized the generics information. However javac 1.7 does not and sees the classes only a "raw" view. You either need to keep using javac 1.6 or get updated jar files which are not compiled with "-target jsr14".