← 返回首页
Using --release compiler option vs -source and -target · Issue #34 · scijava/pom-scijava-base · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Using --release compiler option vs -source and -target #34

New issue
New issue

Description

I ran into a problem with building BigVolumeViewer with JDK 11 (and Maven).

pietzsch@mycroft:~/workspace/bigdataviewer/bigvolumeviewer-core (master)$ mvn clean install # 1 [15:22:38] [INFO] Scanning for projects... [INFO] [INFO] ----------------------< sc.fiji:bigvolumeviewer >----------------------- [INFO] Building BigVolumeViewer 0.3.2-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- ... [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ bigvolumeviewer --- [INFO] Compiling 103 source files to /Users/pietzsch/workspace/bigdataviewer/bigvolumeviewer-core/target/classes [INFO] /Users/pietzsch/workspace/bigdataviewer/bigvolumeviewer-core/src/main/java/bvv/vistools/BvvFunctions.java: Some input files use or override a deprecated API. [INFO] /Users/pietzsch/workspace/bigdataviewer/bigvolumeviewer-core/src/main/java/bvv/vistools/BvvFunctions.java: Recompile with -Xlint:deprecation for details. [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /Users/pietzsch/workspace/bigdataviewer/bigvolumeviewer-core/src/main/java/bvv/core/blocks/ByteUtils.java:[36,16] package sun.misc does not exist [ERROR] /Users/pietzsch/workspace/bigdataviewer/bigvolumeviewer-core/src/main/java/bvv/core/blocks/ByteUtils.java:[41,30] cannot find symbol symbol: class Unsafe location: class bvv.core.blocks.ByteUtils [INFO] 2 errors [INFO] ------------------------------------------------------------- ...

This can be traced back to the maven-compiler-plugin configuring javac with --release 8.

The problem is that --release 8 works slightly different that the old-style -source 1.8 -target 1.8.
See https://bugs.openjdk.org/browse/JDK-8214165, https://bugs.openjdk.org/browse/JDK-8206937, https://mail.openjdk.org/pipermail/compiler-dev/2018-January/011583.html.
The spec for --release N is to provide access to the public documented API for JDK N. The sun.misc package is not public documented API.

Ironically, if we were targeting Java 11, there would be no problem. --release 11 would work, because there is the jdk.unsupported module ...

Anyway... I think this can be traced to

pom-scijava-base/pom.xml

Lines 2107 to 2125 in 8920b4f

<profile>
<id>java-9</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<properties>
<maven.compiler.release>${scijava.jvm.version}</maven.compiler.release>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
</configuration>
</plugin>
</plugins>
</build>
</profile>

where the <maven.compiler.release> property is set.

The only way I found to fix that in BigVolumeViewer's pom.xml is bigdataviewer/bigvolumeviewer-core@ffaf291
https://github.com/bigdataviewer/bigvolumeviewer-core/blob/ffaf291987da4ea3e4ca9796a700b43c5209c8be/pom.xml#L83-L95

It would be nicer to address this higher up, but I don't know how pom-scijava-base should be changed exactly, and what side effects would be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Footer

      © 2026 GitHub, Inc.