Thanks for the answer.
I'll file the bug.
But I'm not sure what behavior is expected in this case.
As I understand, this error occurs because fileManager, which is
StandardJavaFileManager,
is declared in jdk.compiler.
So, what should we expect?
Thanks,
Konstantin.
On 23/08/2016 15:45, Konstantin Barzilovich wrote:
Hello,
Could you please explain, how to use getServiceLoader method of
javax.tools.JavaFileManager interface.
Should location parameter point to location of class or location of
module, which provides implementation?
Is it possible to use this method from unnamed module?
I tried this way:
Path path = Paths.get("/Projects/Test/service.jar");
fileManager.setLocationFromPaths(StandardLocation.CLASS_PATH,
Arrays.asList(path));
ServiceLoader<ServiceExample> loader =
fileManager.getServiceLoader(StandardLocation.CLASS_PATH,
ServiceExample.class);
In this example we have service.jar with both service interface
ServiceExample and service implementation ServiceImpl inside.
In addition, we have META-INF/services/package.ServiceExample file,
which contains "package.ServiceImpl".
fileManager is StandardJavaFileManager obtained by
getStandardFileManager method of JavaCompiler.
But this example fails:
java.util.ServiceConfigurationError: package.ServiceExample: use not
declared in module jdk.compiler
Can you create a bug for the SCE as that should not be thrown.
-Alan