In case of module-info file declares provides statement with broken service interface (interface is not public,interface is not reachable), compiler returns two errors:
One is expected:
Inter is not public in pack; cannot be accessed from outside package
And one confusing error:
the service implementation does not have a default constructor: <any>
There is no reason of second error, because in fact implementation has a default constructor.
-----------------------------------
Minimal test case:
Directory layout:
mod01/module-info.java
mod01/pack/Implem.java
Code:
module-info.java:
module mod01{
provides pack.Inter with pack.Implem;
}
Implem.java:
package pack;
public class Implem implements Inter{}
interface Inter{}
This bug is reproduced both on Windows and Linux with jigsaw build 103.
One is expected:
Inter is not public in pack; cannot be accessed from outside package
And one confusing error:
the service implementation does not have a default constructor: <any>
There is no reason of second error, because in fact implementation has a default constructor.
-----------------------------------
Minimal test case:
Directory layout:
mod01/module-info.java
mod01/pack/Implem.java
Code:
module-info.java:
module mod01{
provides pack.Inter with pack.Implem;
}
Implem.java:
package pack;
public class Implem implements Inter{}
interface Inter{}
This bug is reproduced both on Windows and Linux with jigsaw build 103.
- duplicates
-
JDK-8152062 obscure error message for bad 'provides'
-
- Closed
-