RFR: 8204256: improve jlink error message to report unsupported class file format [v2]

Ian Graves igraves at openjdk.java.net
Thu Oct 1 19:19:18 UTC 2020


On Thu, 1 Oct 2020 06:53:04 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>>> Alternatively we could change the existing exception message path and modify it so it's in line with the simpler
>>> solution as well? That makes sense to me, anyway.
>> 
>> Sounds reasonable to me.
>
> Add a cause may work but it should probably be predicted on isLinkPhase as otherwise it will leak through to usages of
> the ModuleFinder API.

So after some thought and discussion offline, I've pushed a pretty different change that slims all of this down to
simply printing an exception stack trace to the log/stdout when a FindException is thrown. This isn't the same way as
the other error, but I believe for reasons given elsewhere that this is okay.

This exception is thrown when we're looking into module that is newer than the current runtime's supported module
versions. This should never be supported and is unique from the existing case where we don't link modules that are
older versions than the runtime's supported version. This leaves that code path alone.

Since the FindException is a broad exception and can be thrown for a variety of reasons, printing the stack trace
should provide visibility into what the problem is while keeping any kind of coupling in jlink to that exception to a
minimum.

-------------

PR: https://git.openjdk.java.net/jdk/pull/409


More information about the core-libs-dev mailing list