Project: mule
Issue MULE-9153: Add support for interfaces as parameters of an @Operation
When using interfaces as parameters of an operation, it fails to generate the Extension module giving a missleading wrong error message. Whe should add the support to have interfaces as parameters. {code:java} //Pojo code public class SimplePojo { @Parameter private String someField; public String getSomeField() { return someField; } public void setSomeField(String someField) { this.someField = someField; } } //Interface code public interface MyInterface { String getSomeMessage(String orignal); } //@Operations code public class ExtensionOperations {	@Operation	public SimplePojo pojoOperation(SimplePojo pojo) {	return pojo;	}	@Operation	public void interfaceOperation(MyInterface callback){	} } {code} Current error log: {code} org.mule.extension.api.exception.IllegalModelDefinitionException: Extension 'first' defines a operation of name 'operation' which contains a parameter of complex type 'class org.mule.module.extension.firstextension.SimplePojo'. However, operation of name 'interfaceOperation' defines a parameter of the same name but type 'org.mule.module.extension.firstextension.MyInterface'. Complex parameter of different types cannot have the same name. org.mule.module.extension.internal.introspection.validation.NameClashModelValidator$ValidationDelegate.lambda$validateTopLevelParameters$37(NameClashModelValidator.java:137) org.mule.module.extension.internal.introspection.validation.NameClashModelValidator$ValidationDelegate$$Lambda$26/490407158.accept(Unknown Source) java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) java.util.Iterator.forEachRemaining(Iterator.java:116) java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) org.mule.module.extension.internal.introspection.validation.NameClashModelValidator$ValidationDelegate.validateTopLevelParameters(NameClashModelValidator.java:121) org.mule.module.extension.internal.introspection.validation.NameClashModelValidator$ValidationDelegate.validate(NameClashModelValidator.java:107) org.mule.module.extension.internal.introspection.validation.NameClashModelValidator$ValidationDelegate.lambda$validate$33(NameClashModelValidator.java:77) org.mule.module.extension.internal.introspection.validation.NameClashModelValidator$ValidationDelegate$$Lambda$27/1920186116.accept(Unknown Source) java.util.Iterator.forEachRemaining(Iterator.java:116) java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) org.mule.module.extension.internal.introspection.validation.NameClashModelValidator$ValidationDelegate.validate(NameClashModelValidator.java:77) org.mule.module.extension.internal.introspection.validation.NameClashModelValidator$ValidationDelegate.access$000(NameClashModelValidator.java:52) org.mule.module.extension.internal.introspection.validation.NameClashModelValidator.validate(NameClashModelValidator.java:49) org.mule.module.extension.internal.introspection.DefaultExtensionFactory.lambda$createFrom$39(DefaultExtensionFactory.java:105) org.mule.module.extension.internal.introspection.DefaultExtensionFactory$$Lambda$18/1393913553.accept(Unknown Source) java.lang.Iterable.forEach(Iterable.java:75) org.mule.module.extension.internal.introspection.DefaultExtensionFactory.createFrom(DefaultExtensionFactory.java:105) org.mule.module.extension.internal.introspection.DefaultExtensionFactory.createFrom(DefaultExtensionFactory.java:94) org.mule.module.extension.studio.internal.capability.studio.editor.StudioEditorGeneratorTest.testGeneration(StudioEditorGeneratorTest.java:63) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:497) org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) {code}
Story points: 2