[fedora-java] New build failure
Deepak Bhole
dbhole at redhat.com
Thu Feb 19 22:53:39 UTC 2009
* Orion Poplawski <orion at cora.nwra.com> [2009-02-19 12:36]:
> gridengine 6.2-5 built fine on F-10 back in November
> (http://koji.fedoraproject.org/koji/buildinfo?buildID=70140) but now fails
> (http://koji.fedoraproject.org/koji/taskinfo?taskID=1140261)
>
> Error is:
>
> [java] compile.test:
> [java] [mkdir] Created dir:
> /builddir/build/BUILD/gridengine/source/CLASSES/test
> [java] [javac] Compiling 18 source files to
> /builddir/build/BUILD/gridengine/source/CLASSES/test
> [java] [javac]
> /builddir/build/BUILD/gridengine/source/libs/jdrmaa/test/DrmaaSuite.java:25:
> incompatible types
> [java] [javac] found : junit.framework.TestSuite
> [java] [javac] required: Test
> [java] [javac] return suite;
> [java] [javac] ^
> [java] [javac] 1 error
>
>
> The junit versions seems to be the same (3.8.2-4.4.fc10), but java is newer
> (1.6.0.0-2b12 -> 1.6.0.0-9.b14).
>
Took a bit of digging, but found the problem. The issue is that wrong
classes are being seen by the compiler.
junit.framework.TestSuite implements the interface junit.framework.Test.
This worked before with the code below because the only "Test" seen by
the compiler before was from junit.framework.*.
However, F10 now has rhino 1.7, which has a "Test" class as well (with
no package hierarchy). Rhino ends up in the classpath during compile,
and the compiler chooses it's Test class, which is not the interface
implemented by junit.framework.TestSuite. This is why it is best
practice to import full paths rather than .* . The correct fix here is to
patch DrmaaSuite.java to remove the junit.framework.* import and add:
import junit.framework.TestSuite;
import junit.framework.TestCase;
import junit.framework.Test;
Alternatively, you can also patch it for a not-so-perfect fix: change
'public static Test suite ()' to 'public static junit.framework.Test suite ()'
Cheers,
Deepak
> Source is:
>
> import junit.framework.*;
>
> /**
> *
> * @author dan.templeton at sun.com
> */
> public class DrmaaSuite extends TestCase {
>
> public DrmaaSuite (java.lang.String testName) {
> super (testName);
> }
>
> /** suite method automatically generated by JUnit module */
> public static Test suite () {
> TestSuite suite = new TestSuite ("DrmaaSuite");
> suite.addTest (org.ggf.drmaa.DrmaaSuite.suite ());
> suite.addTest (com.sun.grid.drmaa.DrmaaSuite.suite ());
> return suite;
> }
> }
>
>
> Help?
>
> --
> Orion Poplawski
> Technical Manager 303-415-9701 x222
> NWRA/CoRA Division FAX: 303-415-9702
> 3380 Mitchell Lane orion at cora.nwra.com
> Boulder, CO 80301 http://www.cora.nwra.com
>
> --
> fedora-devel-java-list mailing list
> fedora-devel-java-list at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-devel-java-list
More information about the fedora-devel-java-list
mailing list