Commit b7c28a27 authored by Lionel Seinturier's avatar Lionel Seinturier
Browse files

More bug fixes for services and references with generic types.

parent 3e3c8a92
Tinfi 1.3
---------
* fix for services and references with generic types (reported by Philippe)
Tinfi 1.2.1
-----------
* support property re-injection (requested by Christophe)
......
......@@ -5,13 +5,10 @@ mixins/
opt/oo/
* release Juliac 2.2.4 and use it to include the fix brought by r10555
* fix service reference class and SCA interceptor class generation for generic
interfaces. Two such cases have been identified:
* by Philippe: see ImplementationFactory in
examples/fractal-adl/advanced/foobar-cases/proxyparameters
* with components from the BF which provide interfaces which are generic, e.g.
o.o.f.bf.BindingFactoryPlugin. The mismatch occurs since the generated proxy
classes define also generic parameters, e.g. when
extending ServiceReference<B>.
interfaces with components from the BF which provide interfaces which are
generic, e.g. o.o.f.bf.BindingFactoryPlugin. The mismatch occurs since the
generated proxy classes define also generic parameters, e.g. when extending
ServiceReference<B>. Check whether this bug has been fixed or not by r2312.
* generate per content class SCA content controller implementations
runtime/oo-dyn/
......
package example.proxyparameters;
public class CImpl
implements
I
, ImplementationFactory<Implementation>
{
public void foo1( Param.Inner pi ) {}
public byte[] foo2( Object o ) { return null; }
public void foo3() {}
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
public class CImpl<WW extends Runnable & Comparable<? super WW>,
KK extends Serializable,
ZZ>
implements I<WW,KK,ZZ>, ImplementationFactory<Implementation> {
public CImpl() throws Throwable {}
public void createImplementation( Implementation implementation ) {
public void foo1(Param.Inner pi) {}
public byte[] foo2(Object o) { return null; }
public void foo3() {}
I<WW,KK,ZZ> impl;
public <B,
R extends J<B>,
E extends Throwable,
V extends Serializable & Comparable<V>,
T extends Comparable<? super T>>
R cast( B target, V[] param) throws E, Throwable {
if (target == null) {
@SuppressWarnings("unchecked")
E e = (E) new Exception();
throw e;
}
impl.cast(target, param);
return null;
}
public <B> B[] cast(Collection<B> c, List<Integer> l, Set<?> s) {
return null;
}
public Object[] bar( J.Inner ji ) { return null; }
public ArrayList<?> sub() { return null; }
public void createImplementation(Implementation implementation) {}
}
package example.proxyparameters;
public interface I {
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
public interface I< W extends Runnable & Comparable<? super W>,
K extends Serializable,
Z >
extends Sub {
public void foo1( Param.Inner pi );
public byte[] foo2( Object o ) throws Exception, NullPointerException;
public void foo3() throws Throwable;
public <B,
R extends J<B>,
E extends Throwable,
V extends Serializable & Comparable<V>,
T extends Comparable<? super T>
>
R cast( B target, V[] param ) throws E, Throwable;
public <B> B[] cast( Collection<B> c, List<Integer> l, Set<?> s );
public Object[] bar( J.Inner ji );
public ArrayList<?> sub();
}
package example.proxyparameters;
public interface J<B> {
interface Inner {}
}
package example.proxyparameters;
import java.util.List;
public interface Sub {
public List<?> sub();
}
......@@ -26,6 +26,7 @@ package org.ow2.frascati.tinfi.opt.oo;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.Utils;
import org.objectweb.fractal.juliac.desc.MembraneDesc;
import org.objectweb.fractal.juliac.proxy.AbstractInterceptorSourceCodeGenerator;
import org.objectweb.fractal.juliac.ucf.UnifiedClass;
......@@ -101,6 +102,11 @@ extends AbstractInterceptorSourceCodeGenerator {
*/
mv.visit (" ");
mv.visit (it.getFcItfSignature());
String[] tpnames = proxycl.getTypeParameterNames();
if( tpnames.length != 0 ) {
String s = Utils.getTypeParameterNamesSignature(tpnames);
mv.visit(s);
}
mv.visit (" impl = pushFcAndGet(\"");
mv.visit (it.getFcItfName());
mv.visitln("\","+it.getFcItfSignature()+".class,this);");
......
......@@ -26,6 +26,7 @@ package org.ow2.frascati.tinfi.opt.oo;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.Utils;
import org.objectweb.fractal.juliac.desc.MembraneDesc;
import org.objectweb.fractal.juliac.proxy.InterfaceImplementationClassGenerator;
import org.objectweb.fractal.juliac.ucf.UnifiedClass;
......@@ -60,10 +61,23 @@ extends InterfaceImplementationClassGenerator {
@Override
public String getSuperClassName() {
StringBuffer sb = new StringBuffer();
sb.append(TinfiComponentInterface.class.getName());
sb.append('<');
sb.append(it.getFcItfSignature());
/*
* Add type parameters if any.
*/
String signature = it.getFcItfSignature();
sb.append(signature);
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();
}
......
......@@ -93,19 +93,35 @@ extends AbstractProxyClassGenerator {
@Override
public String getSuperClassName() {
String superClassName =
ServiceReferenceImpl.class.getName()+"<"+it.getFcItfSignature()+">";
return superClassName;
StringBuffer sb = new StringBuffer();
sb.append(ServiceReferenceImpl.class.getName());
sb.append('<');
/*
* Add type parameters if any.
*/
String signature = it.getFcItfSignature();
sb.append(signature);
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();
}
@Override
public String[] getImplementedInterfaceNames() {
String signature = it.getFcItfSignature();
/*
* Add type parameters if any.
* Create the signature of the proxy interface with generic parameters
* if any.
*/
String signature = it.getFcItfSignature();
UnifiedClass proxycl = jc.create(signature);
String[] tpnames = proxycl.getTypeParameterNames();
if( tpnames.length != 0 ) {
......@@ -122,7 +138,16 @@ extends AbstractProxyClassGenerator {
super.generateConstructors(cv,proxycl);
String signature = it.getFcItfSignature();
/*
* Create the signature of the proxy interface with generic parameters
* if any.
*/
String signature = it.getFcItfSignature();
String[] tpnames = proxycl.getTypeParameterNames();
if( tpnames.length != 0 ) {
String s = Utils.getTypeParameterNamesSignature(tpnames);
signature += s;
}
// public constructor(Class<B>,B)
String[] parameters =
......@@ -142,7 +167,17 @@ extends AbstractProxyClassGenerator {
super.generateProxyMethodBodyBeforeCode(mv,proxycl,proxym);
String signature = it.getFcItfSignature();
/*
* Create the signature of the proxy interface with generic parameters
* if any.
*/
String signature = it.getFcItfSignature();
String[] tpnames = proxycl.getTypeParameterNames();
if( tpnames.length != 0 ) {
String s = Utils.getTypeParameterNamesSignature(tpnames);
signature += s;
}
conversationalItf = proxycl.getAnnotation(Conversational.class);
oneWayMeth = proxym.getAnnotation(OneWay.class);
......
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