Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Export Multiple Interfaces #1

Open
set321go opened this issue Aug 30, 2015 · 1 comment
Open

Cannot Export Multiple Interfaces #1

set321go opened this issue Aug 30, 2015 · 1 comment

Comments

@set321go
Copy link

When I wish to export multiple services

@ServiceExport(interfaces = {SystemReadyState.class, ManagedService.class})
public class MyClass implements SystemReadyState, ManagedService {}

The generated code is incorrect and only contains one interface

@Named
@EagerSingleton
public class SystemReadyStatePeaberryServiceExport {

@Inject
Export<SystemReadyState> service;

}

@Named
public class SystemReadyStatePeaberryExportModule extends AbstractModule {

    @Override
    protected void configure() {
            install(Peaberry.osgiModule());

        Map<String, Object> attributes = new HashMap<>();
            attributes.put("service.pid", SystemReadyVetoRegistry.class.getName());

        bind(export(SystemReadyState.class)).toProvider(service(SystemReadyVetoRegistry.class)
            .attributes(attributes)
            .export());
    }
}

Attempts to fix this have failed so far because the implementation relies on an exception being throw and thus we can never proceed past the first annotation to be processed. https://github.com/elasticpath/peaberry-code-generator/blob/master/src/main/java/org/eclipse/sisu/contrib/peaberry/ServiceExportAnnotationProcessor.java L80

@cjbooms
Copy link
Contributor

cjbooms commented Sep 3, 2015

I've created a PR with a unit test to trigger this. You can simply debug through with your IDE to figure things out. Once you know out what the Peaberry code should look like it should be super easy to modify the velocity templates to do the rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants