Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] Problem with tycho-compiler-plugin with implementing a supertype method

Hi,

 

I have made my plug-in projects in Eclipse and converted to Maven/Tycho projects. In Eclipse everything compiles:

Source of Class:

public class RemoteServiceAdminImpl implements RemoteServiceAdmin {

@Override

                public Collection<ExportRegistration> exportService(ServiceReference reference, Map<String, Object> properties) {

                ***

}

}

It compiles in Eclipse with JDK 1.6 and JDK 1.7.

The Interface RemoteServiceAdmin is imported from a local repository which contains the bundle osgi.enterprise_4.2.0.v201108120515.jar

 

When I try with maven clean install from my parent project with configuration

 

<plugin>

                <artifactId>maven-compiler-plugin</artifactId>

                <version>2.3.2</version>

                <configuration>

                               <source>1.6</source>

                               <target>1.6</target>

                </configuration>

</plugin>

<plugin>

Or with configuration source and target 1.7, it cannot compile.

 

I get this error message from tycho-compiler:

 

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.15.0:compile (default-compile) on project ***: Compilation failure: Compilation failure:

[ERROR] ***/RemoteServiceAdminImpl.java:[39,0]

[ERROR] public class RemoteServiceAdminImpl implements RemoteServiceAdmin {

[ERROR] ^^^^^^^^^^^^^^^^^^^^^^

[ERROR] The type RemoteServiceAdminImpl must implement the inherited abstract method RemoteServiceAdmin.exportService(ServiceReference, Map<String,?>)

[ERROR] ***/RemoteServiceAdminImpl.java:[60,0]

[ERROR] public Collection<ExportRegistration> exportService(ServiceReference reference, Map<String, Object> properties) {

[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[ERROR] Name clash: The method exportService(ServiceReference, Map<String,Object>) of type RemoteServiceAdminImpl has the same erasure as exportService(ServiceReference, Map<String,?>) of type RemoteServiceAdmin but does not override it

[ERROR] ***/RemoteServiceAdminImpl.java:[60,0]

[ERROR] public Collection<ExportRegistration> exportService(ServiceReference reference, Map<String, Object> properties) {

[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[ERROR] The method exportService(ServiceReference, Map<String,Object>) of type RemoteServiceAdminImpl must override or implement a supertype method

[ERROR] 3 problems (3 errors)

[ERROR] -> [Help 1]

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.15.0:compile (default-compile) on project ***: Compilation failure

                at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)

                at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

                at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

                at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)

                at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)

                at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)

                at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)

                at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)

                at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)

                at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)

                at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)

                at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at java.lang.reflect.Method.invoke(Method.java:601)

                at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)

                at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)

                at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)

                at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

Caused by: copied.org.apache.maven.plugin.CompilationFailureException: Compilation failure

                at copied.org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:418)

                at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.execute(AbstractOsgiCompilerMojo.java:179)

                at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)

                at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)

                ... 19 more

 

If I change in Eclipse the implementation of the method (public Collection<ExportRegistration> exportService(ServiceReference reference, Map<String, Object> properties) to public Collection<ExportRegistration> exportService(ServiceReference reference, Map<String, ?> properties), Eclipse gives me an error: The method must override or implement a supertype class method.

What is the problem with this or what configuration can solve this?

 

Thanks,

Regards,

Mattias

 


Back to the top