Re: Confusing error message for inner non-public service provider

2017-02-13 Thread Jonathan Gibbons
Peter, The circumstances of the analysis of service providers are very different to the normal JLS rules regarding visibility and accessibility of named items. I know that we have some cleanup to do, for javac to "catch up" with the latest updates to JLS, especially with regards to the

Re: Confusing error message for inner non-public service provider

2017-02-13 Thread Peter Levart
Hi, Just wanted to note that the confusing javac error message is not specific to services and service providers. Take the following example: src/moda/module-info.java: module moda { exports pkga; } src/moda/pkga/Outer.java: package pkga; class Outer { public static class

Re: Confusing error message for inner non-public service provider

2017-02-09 Thread Alex Buckley
// Rewording and resending to avoid confusion. On 2/9/2017 4:21 PM, Jonathan Gibbons wrote: On 2/9/17 3:07 PM, Alex Buckley wrote: All the JLS wants is for the class to be 'public'. Does that just apply locally to the declaration of the class itself, or does it also indirectly apply to any

Re: Confusing error message for inner non-public service provider

2017-02-09 Thread Alex Buckley
On 2/9/2017 4:21 PM, Jonathan Gibbons wrote: On 2/9/17 3:07 PM, Alex Buckley wrote: All the JLS wants is for the class to be 'public'. Does that just apply locally to the declaration of the class itself, or does it also indirectly apply to any enclosing classes, in the case of a nested class?

Re: Confusing error message for inner non-public service provider

2017-02-09 Thread Jonathan Gibbons
On 2/9/17 3:07 PM, Alex Buckley wrote: All the JLS wants is for the class to be 'public'. Alex: Does that just apply locally to the declaration of the class itself, or does it also indirectly apply to any enclosing classes, in the case of a nested class? -- Jon

Re: Confusing error message for inner non-public service provider

2017-02-09 Thread Vicente Romero
Hi Alex, Thanks for your answer, Vicente On 02/09/2017 06:07 PM, Alex Buckley wrote: On 2/9/2017 2:49 PM, Vicente Romero wrote: Just to double check, the right javac behavior in this case should be to issue similar errors in both cases like: some position here: error: ServiceImpl is not

Re: Confusing error message for inner non-public service provider

2017-02-09 Thread Alex Buckley
On 2/9/2017 2:49 PM, Vicente Romero wrote: Just to double check, the right javac behavior in this case should be to issue similar errors in both cases like: some position here: error: ServiceImpl is not public in com.example.internal; cannot be accessed from outside package It's correct to

Re: Confusing error message for inner non-public service provider

2017-02-09 Thread Vicente Romero
Hi Alex, Just to double check, the right javac behavior in this case should be to issue similar errors in both cases like: some position here: error: ServiceImpl is not public in com.example.internal; cannot be accessed from outside package some other position here: error: Outer.ServiceImpl

Re: Confusing error message for inner non-public service provider

2017-02-07 Thread Alex Buckley
On 2/7/2017 1:11 AM, Gunnar Morling wrote: --- package com.example; public interface SomeService { public void foo(); } --- package com.example.internal; class Outer { public static class ServiceImpl implements com.example.SomeService {

Re: Confusing error message for inner non-public service provider

2017-02-07 Thread Gunnar Morling
Hi Alex, Yes, I meant a nested class and default access, sorry for not being precise with the terms. These are the concerned types: --- package com.example; public interface SomeService { public void foo(); } --- package com.example.internal; class Outer {

Re: Confusing error message for inner non-public service provider

2017-02-06 Thread Alex Buckley
On 2/6/2017 1:33 PM, Gunnar Morling wrote: I have a service provider which is a public static inner class of an outer class with default visibility. I think you mean public static _nested_ class, since an inner class isn't static by definition. Also I think you mean default (package)

Confusing error message for inner non-public service provider

2017-02-06 Thread Gunnar Morling
Hi, I have a service provider which is a public static inner class of an outer class with default visibility. As per the ServiceLoader docs, service providers must be public classes, so this provider is rightfully rejected by javac when referenced in module-info.java. But the error message is