Bug 525918 - [9] compile error when the service provider is an interface
Summary: [9] compile error when the service provider is an interface
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.8   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.8 M4   Edit
Assignee: Sasikanth Bharadwaj CLA
QA Contact: Sasikanth Bharadwaj CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-12 07:24 EDT by Kalyan Prasad Tatavarthi CLA
Modified: 2017-12-04 06:18 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kalyan Prasad Tatavarthi CLA 2017-10-12 07:24:56 EDT
Create a Java9 project
1) In the module-info.java file add

module test {
        requires java.sql;
	provides java.sql.Driver with myDriver;
}

There is an error reported on myDriver as it is not present.

2) create an interface myDriver which extends java.sql.Driver

A new error "Invalid service implementation, the type kpDriver is abstract" is reported on myDriver in module-info.java file.

As service provider can be an interface, this should not be an error.
Comment 1 Stephan Herrmann CLA 2017-10-12 08:11:23 EDT
@Sasi, you have all the checks re provider methods in place. AFAICS, IProblem.AbstractServiceImplementation should only ever be raised, when no provider method, but only a provider constructor is present.
Surprisingly, I cannot even find that in JLS (no mention of abstract classes), so we should probably double check with javac / Oracle.
Comment 2 Sasikanth Bharadwaj CLA 2017-10-24 05:04:46 EDT
I will check
Comment 3 Sasikanth Bharadwaj CLA 2017-10-30 05:09:38 EDT
Same behavior as javac 9.0.1. And no mention of abstract classes in JLS as Stephan said, although I remember seeing this in the lang-vm.html that was used as the stand in spec. Probably good to file a bug against javac and see what they have to say.
Comment 4 Stephan Herrmann CLA 2017-10-31 09:30:56 EDT
(In reply to Sasikanth Bharadwaj from comment #3)
> Same behavior as javac 9.0.1.

Can you be more specific on this? How does javac handle 
- abstract provider class?
- provider interface?
with details:
- if it has a public constructor but no provider method?
- if it has a provider method?
Comment 5 Sasikanth Bharadwaj CLA 2017-11-02 02:18:29 EDT
(In reply to comment #4)
> (In reply to Sasikanth Bharadwaj from comment #3)
> > Same behavior as javac 9.0.1.
> 
> Can you be more specific on this? How does javac handle
> - abstract provider class?
> - provider interface?
> with details:
> - if it has a public constructor but no provider method?
> - if it has a provider method?
Presence of a provider method does not trigger an error, whether the provider is an abstract class or interface, but having just the provider constructor triggers the error even if the provider is a subtype of the service interface. We need to adjust our behavior to accommodate the presence of the provider method but the other case I believe would stay an error and needs a spec update.
Comment 6 Eclipse Genie CLA 2017-11-07 04:35:23 EST
New Gerrit change created: https://git.eclipse.org/r/111103
Comment 7 Sasikanth Bharadwaj CLA 2017-11-09 06:32:23 EST
Released to master via http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=e60b3b2bd58993c93d460964babb98cd3ffd52da. We don't complain about abstract providers when provider method is present. I left the other case as is. Can be updated when we have new information
Comment 8 Manoj N Palat CLA 2017-12-04 06:18:20 EST
Verified for Eclipse Photon 4.8 M4 with Build id: I20171130-2100