Commit 3bfa889b authored by Lionel Seinturier's avatar Lionel Seinturier

More fixes for services and references with generic types (reported by Philippe.)

parent 047a9bca
......@@ -48,28 +48,7 @@
<mixin>org.ow2.frascati.tinfi:frascati-tinfi-mixins:${project.version}:sources</mixin>
<mixin>org.objectweb.fractal.julia:julia-mixins:${julia.version}:sources</mixin>
</mixins>
<components>
<component>
<interfaceTypes>
<interfaceType>
<name>i</name>
<signature>example.proxyparameters.I</signature>
<isClient>false</isClient>
<isOptional>false</isOptional>
<isCollection>false</isCollection>
</interfaceType>
<interfaceType>
<name>if</name>
<signature>example.proxyparameters.ImplementationFactory</signature>
<isClient>false</isClient>
<isOptional>false</isOptional>
<isCollection>false</isCollection>
</interfaceType>
</interfaceTypes>
<controllerDesc>scaPrimitive</controllerDesc>
<contentDesc>example.proxyparameters.CImpl</contentDesc>
</component>
</components>
<adls><adl>example.proxyparameters.C</adl></adls>
<modules>
<module>org.ow2.frascati.tinfi:frascati-tinfi-oo:${project.version}</module>
<module>org.objectweb.fractal.juliac:juliac-jdt:${juliac.version}</module>
......
......@@ -9,7 +9,9 @@ import java.util.Set;
public class CImpl<WW extends Runnable & Comparable<? super WW>,
KK extends Serializable,
ZZ>
implements I<WW,KK,ZZ>, ImplementationFactory<Implementation> {
implements
I<WW,KK,ZZ>, ImplementationFactory<Implementation>,
MetamodelProcessor<EPackage> {
public CImpl() throws Throwable {}
......@@ -42,4 +44,6 @@ implements I<WW,KK,ZZ>, ImplementationFactory<Implementation> {
public ArrayList<?> sub() { return null; }
public void createImplementation(Implementation implementation) {}
public EPackage getEPackage() { return null; }
}
package example.proxyparameters;
import org.osoa.sca.annotations.Service;
/**
* @author Philippe Merle <philippe.merle@inria.fr>
* @since 1.3
*/
@Service
public interface MetamodelProcessor<PackageType extends EPackage> {
public PackageType getEPackage();
}
interface EPackage {}
......@@ -7,8 +7,19 @@
<!-- debuging purpose. -->
<definition name="example.proxyparameters.C" >
<interface name="r" signature="example.proxyparameters.I" role="server" />
<interface name="if" signature="example.proxyparameters.ImplementationFactory" role="server" />
<content class="example.proxyparameters.CImpl" />
<controller desc="scaPrimitive" />
<interface name="r" signature="example.proxyparameters.I" role="server" contingency="optional" />
<interface name="if" signature="example.proxyparameters.ImplementationFactory" role="server" contingency="optional" />
<interface name="mp" signature="example.proxyparameters.MetamodelProcessor" role="server" contingency="optional" />
<component name="sub">
<interface name="r" signature="example.proxyparameters.I" role="server" contingency="optional" />
<interface name="if" signature="example.proxyparameters.ImplementationFactory" role="server" contingency="optional" />
<interface name="mp" signature="example.proxyparameters.MetamodelProcessor" role="server" contingency="optional" />
<content class="example.proxyparameters.CImpl" />
<controller desc="scaPrimitive" />
</component>
<controller desc="scaComposite" />
</definition>
......@@ -24,6 +24,7 @@
package org.ow2.frascati.tinfi.opt.oo;
import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.Utils;
import org.objectweb.fractal.juliac.proxy.InterceptorSourceCodeGenerator;
import org.objectweb.fractal.juliac.ucf.UnifiedClass;
import org.objectweb.fractal.juliac.ucf.UnifiedMethod;
......@@ -56,7 +57,20 @@ extends org.objectweb.fractal.juliac.proxy.InterceptorClassGenerator {
StringBuffer sb = new StringBuffer();
sb.append(TinfiComponentInterceptor.class.getName());
sb.append('<');
sb.append(it.getFcItfSignature());
String signature = it.getFcItfSignature();
sb.append(signature);
/*
* Add type parameters if any.
*/
UnifiedClass proxycl = jc.create(signature);
String[] tpnames = proxycl.getTypeParameterNames();
if( tpnames.length != 0 ) {
String s = Utils.getTypeParameterNamesSignature(tpnames);
sb.append(s);
}
sb.append('>');
return sb.toString();
}
......
......@@ -24,6 +24,7 @@
package org.ow2.frascati.tinfi.opt.oo;
import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.Utils;
import org.objectweb.fractal.juliac.proxy.InterceptorSourceCodeGenerator;
import org.objectweb.fractal.juliac.ucf.UnifiedClass;
import org.objectweb.fractal.juliac.ucf.UnifiedMethod;
......@@ -51,7 +52,20 @@ extends org.objectweb.fractal.juliac.proxy.InterceptorClassGenerator {
StringBuffer sb = new StringBuffer();
sb.append(TinfiComponentInterceptor.class.getName());
sb.append('<');
sb.append(it.getFcItfSignature());
String signature = it.getFcItfSignature();
sb.append(signature);
/*
* Add type parameters if any.
*/
UnifiedClass proxycl = jc.create(signature);
String[] tpnames = proxycl.getTypeParameterNames();
if( tpnames.length != 0 ) {
String s = Utils.getTypeParameterNamesSignature(tpnames);
sb.append(s);
}
sb.append('>');
return sb.toString();
}
......
......@@ -275,12 +275,19 @@ public abstract class TinfiComponentInterceptor<T> implements Interceptor {
* @since 1.1.1
*/
protected T pushFcAndGet(
String serviceName, Class<T> businessInterface, T service ) {
String serviceName, Class<?> businessInterface, T service ) {
/*
* The change from Class<T> to Class<?> in the 2nd parameter and the
* cast to (Class<T>) below have been introduced in r2328 following a
* bug report by Philippe. The purpose of the change is to obtain
* generated interceptors which are compilable with respect to generics.
*/
// Push a new request context
SCAContentController cc = getFcSCAContentCtrlItf();
RequestContext rc =
new RequestContextImpl<T>(serviceName,businessInterface,service);
new RequestContextImpl<T>(serviceName,(Class<T>)businessInterface,service);
cc.pushRequestContext(rc);
// Get a new content instance
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment