Compilation error due to overloaded method with unavailable parameter type

Alan Bateman Alan.Bateman at oracle.com
Tue May 31 17:59:03 UTC 2016


On 31/05/2016 18:27, Gunnar Morling wrote:
> Hi,
>
> I'm trying to compile some code with Jigsaw / Build 120 which is using the
> FEST Assert library [1]. For that purpose I copied that library to my
> module directory and added a dependency to my module-info.java.
>
> One class of FEST Assert I'm using, Assertions, contains several overloaded
> assertThat() methods, one of them [2]
> expecting java.awt.image.BufferedImage as a parameter. My code does *not*
> invoke that overloaded variant though, but rather the one taking List<?> as
> a parameter.
>
> Still I'm getting the following error:
>
>     class file for java.awt.image.BufferedImage not found
>
> I can make the error go away by adding "requires java.desktop" to
> module-info.java. But that seems not right, given I'm not using
> BufferedImage in my module at all.
>
> Is this a bug in Jigsaw? Or do I actually need that requires clause in
> order for overload resolution to work correctly?
>
Just to establish the environment. Is fest-assert an automatic module on 
the module path? If so then it is assumed to only require java.base. 
Does your module compile if you compile with `-addmods java.desktop`?

-Alan




More information about the jigsaw-dev mailing list