Task #12099 (closed)
Bio-Formats JAI fork doesn't compile with Java 1.8.0
Reported by: | spli | Owned by: | rleigh |
---|---|---|---|
Priority: | blocker | Milestone: | 5.0.4 |
Component: | Bio-Formats | Version: | 5.0.0 |
Keywords: | n.a. | Cc: | java@… |
Resources: | n.a. | Referenced By: | n.a. |
References: | n.a. | Remaining Time: | n.a. |
Sprint: | n.a. |
Description
Using today's snoopycrimecop/merge/dev_5_0/latest
$ java -version java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode) $ echo $ICE_HOME /usr/local/Cellar/ice/3.5.1 $ ./build.py
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 Buildfile: /Users/simon/work/openmicroscopy.dev/build.xml check-ivy: :: Ivy 2.1.0 - 20090925235825 :: http://ant.apache.org/ivy/ :: :: loading settings :: file = /Users/simon/work/openmicroscopy.dev/etc/ivysettings.xml init-title: ----------=========== jai_imageio ===========---------- compile: Compiling 47 source files to /Users/simon/work/openmicroscopy.dev/components/bioformats/components/forks/jai/build/classes An exception has occurred in the compiler (1.8.0). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you. java.lang.AssertionError at com.sun.tools.javac.util.Assert.error(Assert.java:126) at com.sun.tools.javac.util.Assert.check(Assert.java:45) at com.sun.tools.javac.jvm.ClassWriter.writeCode(ClassWriter.java:1189) at com.sun.tools.javac.jvm.ClassWriter.writeMethod(ClassWriter.java:1110) at com.sun.tools.javac.jvm.ClassWriter.writeMethods(ClassWriter.java:1602) at com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1692) at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1620) at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:749) at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1570) at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1534) at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:904) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:863) at com.sun.tools.javac.main.Main.compile(Main.java:523) at com.sun.tools.javac.main.Main.compile(Main.java:381) at com.sun.tools.javac.main.Main.compile(Main.java:370) at com.sun.tools.javac.main.Main.compile(Main.java:361) at com.sun.tools.javac.Main.compile(Main.java:56) at com.sun.tools.javac.Main.main(Main.java:42) BUILD FAILED /Users/simon/work/openmicroscopy.dev/build.xml:187: The following error occurred while executing this line: /Users/simon/work/openmicroscopy.dev/components/antlib/resources/global.xml:434: The following error occurred while executing this line: /Users/simon/work/openmicroscopy.dev/components/bioformats/build.xml:252: The following error occurred while executing this line: /Users/simon/work/openmicroscopy.dev/components/bioformats/ant/toplevel.xml:196: The following error occurred while executing this line: /Users/simon/work/openmicroscopy.dev/components/bioformats/ant/java.xml:37: Compile failed; see the compiler error output for details. Total time: 3 seconds
A Java bug? Or are we doing something weird with bundled libraries?
Change History (19)
comment:1 Changed 10 years ago by spli
comment:2 Changed 10 years ago by rleigh
- Component changed from General to Bio-Formats
- Owner set to mlinkert
- Summary changed from OMERO doesn't compile with Java 1.8.0 to Bio-Formats JAI fork doesn't compile with Java 1.8.0
It's a javac bug rather than a jvm bug. I saw this a few months back testing a 1.8 prerelease and they still haven't fixed this. We need a reduced test case to file a proper bug report. This is a bioformats issue, so changing the component accordingly.
comment:3 Changed 10 years ago by rleigh
- Owner changed from mlinkert to rleigh
comment:4 Changed 10 years ago by rleigh
Offending source files in the jai component:
components/forks/jai/build/src/com/sun/media/imageioimpl/plugins/jpeg2000/J2KImageWriter.java components/forks/jai/build/src/jj2000/j2k/entropy/decoder/StdEntropyDecoder.java components/forks/jai/build/src/jj2000/j2k/entropy/encoder/EntropyCoder.java components/forks/jai/build/src/jj2000/j2k/entropy/encoder/StdEntropyCoder.java
comment:5 Changed 10 years ago by rleigh
This is possibly the offending code (in components/forks/jai/src/jj2000/j2k/entropy/encoder/StdEntropyCoder.java). If the entire lot is removed, it compiles. If either the content of the try *or* the catch blocks are commented out, it compiles. May be related to THREADS_PROP_NAME. Any ideas?
// Get the number of threads to use, or default to one try { try { nt = Integer.parseInt(System.getProperty(THREADS_PROP_NAME, DEF_THREADS_NUM)); } catch(SecurityException se) { // Use the default value. nt = Integer.parseInt(DEF_THREADS_NUM); } if (nt < 0) throw new NumberFormatException(); } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid number of threads "+ "for "+ "entropy coding in property "+ THREADS_PROP_NAME); }
comment:6 Changed 10 years ago by rleigh
Trying to minimise further to create a minimal testcase, but no joy so far. Deleting other parts of the source file do result in it compiling without aborting.
While getting javac fixed would be the ideal situation, is there any way to update jj2000? I've tried updating to the latest svn, but both it and jai look rather dead. Is there a current fork of either project which will build with a current javac? jj2000 is not buildable with any javac >= 1.5 without source modification.
comment:7 Changed 10 years ago by mlinkert
Updating from upstream isn't really an option; neither JAI nor JJ2000 are maintained. As long as this is a fairly isolated case, I think it's fine to make whatever functionally equivalent changes are needed to make this compile.
This looks like it's relevant:
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8027660
comment:8 Changed 10 years ago by spli
FYI this is still a problem for java 1.8.0_05
comment:9 Changed 10 years ago by rleigh
comment:10 Changed 10 years ago by jburel
same with java 1.8.0_11
comment:11 Changed 10 years ago by rleigh
With javac 1.8.0_11:
% find /home/rleigh/code/bioformats3/components/forks/jai/build/src -name '*.java' | while read src; do echo "Building $src"; javac '-d' '/home/rleigh/code/bioformats3/components/forks/jai/build/classes' '-classpath' '/home/rleigh/code/bioformats3/components/forks/jai/build/classes' '-sourcepath' '/home/rleigh/code/bioformats3/components/forks/jai/build/src' '-target' '1.7' '-encoding' 'UTF-8' '-g' '-source' '1.7' "$src" || echo "FAIL $src"; done % grep FAIL typescript FAIL /home/rleigh/code/bioformats3/components/forks/jai/build/src/com/sun/media/imageioimpl/plugins/jpeg2000/J2KImageWriter.java FAIL /home/rleigh/code/bioformats3/components/forks/jai/build/src/jj2000/j2k/codestream/reader/HeaderDecoder.java FAIL /home/rleigh/code/bioformats3/components/forks/jai/build/src/jj2000/j2k/entropy/decoder/StdEntropyDecoder.java FAIL /home/rleigh/code/bioformats3/components/forks/jai/build/src/jj2000/j2k/entropy/encoder/StdEntropyCoder.java FAIL /home/rleigh/code/bioformats3/components/forks/jai/build/src/jj2000/j2k/entropy/encoder/EntropyCoder.java
comment:12 Changed 10 years ago by rleigh
J2KImageWriter: can't reproduce in eclipse; may be actually in [Std]EntropyCoder?
HeaderDecoder?: may be fine; it's failing to output StdEntropyDecoder? at present
StdEntropyDecoder?: cleanuppass (whole thing the tens of locals :( maybe move into inner loops where possible)
StdEntropyCoder?: cleanuppass (whole thing the tens of locals :( maybe move into inner loops where possible)
EntropyCoder?: may be fine; it's failing to output StdEntropyCoder? at present
comment:13 Changed 10 years ago by rleigh
With a copy of jai_imageio.jar, the rest of the bioformats code builds fine with jdk8 and all the unit tests pass. If we can fix the above errors, it should be fine (i.e. there are no other similar errors to trip over).
comment:14 Changed 10 years ago by jamoore
- Milestone changed from Unscheduled to 5.1.0-m1
- Priority changed from major to blocker
comment:15 Changed 10 years ago by jamoore
- Milestone changed from 5.1.0-m1 to 5.0.4
Moving all Java8 issues to the clean 5.0.4 milestone
comment:16 Changed 10 years ago by omero
We're trying to support a copy of jj2000 here:
https://github.com/Unidata/jj2000
I (@dopplershift) recently managed to fix the java 8 build by tweaking cleanuppass() in StdEntropy?(Decoder|Coder).java. The problem is the (second) use of "break top_half;"
Certainly take those fixes. However, we'd love to collaborate with all interested in supporting the copy we've forked onto github.com. PRs are most definitely welcome and we're also happy to open up repository access.
comment:17 Changed 10 years ago by rleigh
Many thanks Ryan! To fix the immediate problem, I've picked your commit to fix the cleanuppass fault. We can certainly look at pushing any changes we've made to our fork to you etc., and hopefully be able to drop our fork entirely.
PR opened, https://github.com/openmicroscopy/bioformats/pull/1261
comment:18 Changed 10 years ago by rleigh
- Resolution set to fixed
- Status changed from new to closed
If this is a JVM bug does someone want to figure out the offending file(s) and file a report?