Confusing error message for inner non-public service provider
    Alex Buckley 
    alex.buckley at oracle.com
       
    Thu Feb  9 23:07:40 UTC 2017
    
    
  
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 give an error, but the clause "cannot be accessed from 
outside package" should be dropped (it's not relevant to ServiceLoader).
> some other position here: error: Outer.ServiceImpl is not public in
> com.example.internal; cannot be accessed from outside package
It's not correct to give an error at all. The JLS (acting on behalf of 
ServiceLoader) is not interested in the class Outer.ServiceImpl being 
"accessible" by some arbitrary client. All the JLS wants is for the 
class to be 'public'.
> without mentioning in any case anything about visibility right?
Correct. All the types we're discussing are in the same module so they 
(and their packages) are all visible to each other; package visibility 
is irrelevant to this example.
Alex
    
    
More information about the jigsaw-dev
mailing list