tycho: Multiple `--add-exports` options fail with JDK 17

Passing multiple --add-exports to the tycho-compiler fails on JDK 17 (but works on JDK 11, related to https://github.com/eclipse/tycho/commit/c53c47ffe3e39f7d3ceb7f89f6712b33d2a25662). This error can be observed when running the modified test project compiler.extraExports (#618 ), it contains

     <compilerArgs>
         <arg>--add-exports</arg>
         <arg>java.desktop/com.sun.imageio.plugins.gif=ALL-UNNAMED</arg>
         <arg>--add-exports</arg>
         <arg>java.desktop/com.sun.imageio.plugins.png=ALL-UNNAMED</arg>
      </compilerArgs>

and a class that has a property of a type from package com.sun.imageio.plugins.png.

The second --add-exports is ignored (but only on JDK 17, not on JDK 11). This can be circumvented by inserting any option between the two --add-exports options.

I observed this problem while trying to build the OpenJDK Mission Control on JDK 17.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 28 (21 by maintainers)

Most upvoted comments

I changed my PR accordingly (and hopefully it works)

Isn’t the expectation that it fails? 😉