Commit 1aacddce authored by Lionel Seinturier's avatar Lionel Seinturier

Use Class<?> instead of UClass as often as possible.

parent cf904d59
......@@ -30,7 +30,6 @@ import java.util.Map;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.julia.type.BasicInterfaceType;
import org.objectweb.fractal.juliac.UClass;
import org.objectweb.fractal.juliac.api.JuliacModuleItf;
import org.objectweb.fractal.juliac.api.MembraneLoaderItf;
import org.objectweb.fractal.juliac.api.TypeGeneratorItf;
......@@ -205,10 +204,10 @@ extends org.objectweb.fractal.juliac.opt.comp.FCCompCtrlSourceCodeGenerator {
// ServiceReference and input interface implementations for callbacks
String signature = it.getFcItfSignature();
UClass cl = jc.create(signature);
Class<?> cl = jc.create(signature);
Annotation annot =
ClassHelper.getAnnotation(
cl.cl,
cl,
"org.oasisopen.sca.annotation.Callback",
"org.osoa.sca.annotations.Callback");
if( annot != null ) {
......
......@@ -30,7 +30,6 @@ import java.lang.reflect.Modifier;
import org.oasisopen.sca.ServiceReference;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.UClass;
import org.objectweb.fractal.juliac.api.TypeGeneratorItf;
import org.objectweb.fractal.juliac.desc.MembraneDesc;
import org.objectweb.fractal.juliac.helper.ClassHelper;
......@@ -77,8 +76,8 @@ extends ServerInterfaceClassGenerator {
/*
* Add type parameters if any.
*/
UClass proxycl = jc.create(it.getFcItfSignature());
String[] tpnames = ClassHelper.getTypeParameterNames(proxycl.cl);
Class<?> proxycl = jc.create(it.getFcItfSignature());
String[] tpnames = ClassHelper.getTypeParameterNames(proxycl);
if( tpnames.length != 0 ) {
String s = ClassHelper.getTypeParameterNamesSignature(tpnames);
name += s;
......
......@@ -29,7 +29,6 @@ import java.lang.annotation.Annotation;
import org.oasisopen.sca.annotation.Callback;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.julia.type.BasicInterfaceType;
import org.objectweb.fractal.juliac.UClass;
import org.objectweb.fractal.juliac.api.TypeGeneratorItf;
import org.objectweb.fractal.juliac.conf.JuliacConfig;
import org.objectweb.fractal.juliac.conf.JulietLoader;
......@@ -190,10 +189,10 @@ extends org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator {
// ServiceReference and input interface implementations for callbacks
String signature = it.getFcItfSignature();
UClass cl = jc.create(signature);
Class<?> cl = jc.create(signature);
Annotation annot =
ClassHelper.getAnnotation(
cl.cl,
cl,
Callback.class.getName(),
"org.osoa.sca.annotations.Callback");
if( annot != null ) {
......
......@@ -25,7 +25,6 @@ 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.UClass;
import org.objectweb.fractal.juliac.desc.MembraneDesc;
import org.objectweb.fractal.juliac.helper.ClassHelper;
import org.objectweb.fractal.juliac.proxy.AbstractInterceptorSourceCodeGenerator;
......@@ -90,8 +89,8 @@ extends AbstractInterceptorSourceCodeGenerator {
/*
* Add type parameters if any.
*/
UClass proxycl = jc.create(signature);
String[] tpnames = ClassHelper.getTypeParameterNames(proxycl.cl);
Class<?> proxycl = jc.create(signature);
String[] tpnames = ClassHelper.getTypeParameterNames(proxycl);
if( tpnames.length != 0 ) {
String s = ClassHelper.getTypeParameterNamesSignature(tpnames);
sb.append(s);
......
......@@ -26,7 +26,6 @@ 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.UClass;
import org.objectweb.fractal.juliac.desc.MembraneDesc;
import org.objectweb.fractal.juliac.helper.ClassHelper;
import org.objectweb.fractal.juliac.proxy.InterfaceImplementationClassGenerator;
......@@ -71,8 +70,8 @@ extends InterfaceImplementationClassGenerator {
*/
String signature = it.getFcItfSignature();
sb.append(signature);
UClass proxycl = jc.create(signature);
String[] tpnames = ClassHelper.getTypeParameterNames(proxycl.cl);
Class<?> proxycl = jc.create(signature);
String[] tpnames = ClassHelper.getTypeParameterNames(proxycl);
if( tpnames.length != 0 ) {
String s = ClassHelper.getTypeParameterNamesSignature(tpnames);
sb.append(s);
......
......@@ -103,8 +103,8 @@ extends AbstractProxyClassGenerator {
*/
String signature = it.getFcItfSignature();
sb.append(signature);
UClass proxycl = jc.create(signature);
String[] tpnames = ClassHelper.getTypeParameterNames(proxycl.cl);
Class<?> proxycl = jc.create(signature);
String[] tpnames = ClassHelper.getTypeParameterNames(proxycl);
if( tpnames.length != 0 ) {
String s = ClassHelper.getTypeParameterNamesSignature(tpnames);
sb.append(s);
......@@ -122,8 +122,8 @@ extends AbstractProxyClassGenerator {
* if any.
*/
String signature = it.getFcItfSignature();
UClass proxycl = jc.create(signature);
String[] tpnames = ClassHelper.getTypeParameterNames(proxycl.cl);
Class<?> proxycl = jc.create(signature);
String[] tpnames = ClassHelper.getTypeParameterNames(proxycl);
if( tpnames.length != 0 ) {
String s = ClassHelper.getTypeParameterNamesSignature(tpnames);
signature += s;
......
......@@ -32,7 +32,6 @@ import org.objectweb.fractal.julia.InitializationContext;
import org.objectweb.fractal.julia.factory.ChainedInstantiationException;
import org.objectweb.fractal.julia.loader.Initializable;
import org.objectweb.fractal.julia.loader.Tree;
import org.objectweb.fractal.juliac.UClass;
import org.objectweb.fractal.juliac.api.TypeGeneratorItf;
import org.objectweb.fractal.juliac.desc.ControllerDesc;
import org.objectweb.fractal.juliac.helper.TreeHelper;
......@@ -75,8 +74,8 @@ extends org.ow2.frascati.tinfi.opt.oo.InitializerOOCtrlClassGenerator {
for (ControllerDesc ctrlDesc : ctrlDescs) {
String ctrlImplName = ctrlDesc.getImplName();
UClass uc = jc.create(ctrlImplName);
if( SCAExtendedContentController.class.isAssignableFrom(uc.cl) ) {
Class<?> cl = jc.create(ctrlImplName);
if( SCAExtendedContentController.class.isAssignableFrom(cl) ) {
// SCA Content Controller
String contentClassName = (String) contentDesc;
TypeGeneratorItf cg = null;
......@@ -89,7 +88,7 @@ extends org.ow2.frascati.tinfi.opt.oo.InitializerOOCtrlClassGenerator {
ctrlImplName = cg.getTargetTypeName();
}
mv.visitln(" ic.controllers.add(ctrl = new "+ctrlImplName+"());");
if( Initializable.class.isAssignableFrom(uc.cl) ) {
if( Initializable.class.isAssignableFrom(cl) ) {
Tree tree = ctrlDesc.getTree();
if( tree != null ) {
mv.visitln(" "+Tree.class.getName()+" tree = "+TreeHelper.javaify(tree)+';');
......@@ -101,7 +100,7 @@ extends org.ow2.frascati.tinfi.opt.oo.InitializerOOCtrlClassGenerator {
mv.visitln(" }");
}
}
if( Component.class.isAssignableFrom(uc.cl) ) {
if( Component.class.isAssignableFrom(cl) ) {
mv.visitln(" "+Component.class.getName()+" compctrl = ("+Component.class.getName()+")ctrl;");
}
}
......
......@@ -155,7 +155,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf {
/*
* adl contains the name of the SCA annotated component implementation.
*/
UClass uc = jc.create(adl);
Class<?> cl = jc.create(adl);
/*
* Retrieve provided services declared by the @Service annotation.
......@@ -169,7 +169,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf {
* TODO support @Component from the Fractal Fraclet API
*/
Map<String,Class<?>> servicemap = new HashMap<String,Class<?>>();
Service serviceannot = ClassHelper.getAnnotation(uc.cl,Service.class);
Service serviceannot = ClassHelper.getAnnotation(cl,Service.class);
if( serviceannot != null ) {
// Service types and names
......@@ -200,7 +200,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf {
Map<String,Class<?>> refmap = new HashMap<String,Class<?>>();
Map<String,Boolean> refcontingencymap = new HashMap<String,Boolean>();
Map<String,Boolean> refcardinalitymap = new HashMap<String,Boolean>();
Field[] fields = ClassHelper.getAllFields(uc.cl);
Field[] fields = ClassHelper.getAllFields(cl);
fields = FieldHelper.removeOverriden(fields);
for (Field field : fields) {
......@@ -230,8 +230,8 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf {
* Extract generic to retrieve the type of the reference.
*/
Class<?> rtype = field.getType();
UClass uc2 = UClass.get(rtype);
String gt = uc2.toString(uc2.cl);
UClass uc = UClass.get(rtype);
String gt = uc.toString(rtype);
String[] strs = gt.split("<");
if( strs.length != 2 ) {
final String msg =
......@@ -241,7 +241,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf {
}
String reftypename =
strs[1].substring(0,strs[1].length()-1); // remove trailing >
reftype = jc.create(reftypename).cl;
reftype = jc.create(reftypename);
}
else {
reftype = fieldtype;
......@@ -297,7 +297,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf {
* If none of them apply, the scaPrimitive value is taken by default.
*/
String controller = "scaPrimitive";
Membrane mAnnot = ClassHelper.getAnnotation(uc.cl,Membrane.class);
Membrane mAnnot = ClassHelper.getAnnotation(cl,Membrane.class);
if( mAnnot != null ) {
controller = mAnnot.controller();
......@@ -306,22 +306,24 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf {
// Consistency check
if( controller.equals(Constants.EMPTY) &&
controllerDesc.equals(Constants.class) ) {
UClass uc = UClass.get(cl);
final String msg =
"Both controller and controllerDesc cannot be null in "+
mAnnot+" for class "+uc.toString(uc.cl);
mAnnot+" for class "+uc.toString(cl);
throw new IOException(msg);
}
// Custom membrane specified with @Membrane(controllerDesc=...)
if( ! controllerDesc.equals(Constants.class) ) {
Class<?> cl =
MembraneHelper.getMembraneDef(mAnnot,uc.toString(uc.cl));
Membrane mdef = cl.getAnnotation(Membrane.class);
UClass uc = UClass.get(cl);
Class<?> mdefcl =
MembraneHelper.getMembraneDef(mAnnot,uc.toString(cl));
Membrane mdef = mdefcl.getAnnotation(Membrane.class);
controller = mdef.desc();
JuliacConfig jconf = jc.getJuliacConfig();
List<JulietLoader> mloaders = jconf.lookup(JulietLoader.class);
for( MembraneLoaderItf mloader : mloaders ) {
mloader.put(controller,cl);
mloader.put(controller,mdefcl);
}
}
// Otherwise controller is not empty and we just need to proceed
......@@ -333,7 +335,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf {
* descripors. Used by Easy* from Petals Link.
*/
PolicySets psAnnot =
ClassHelper.getAnnotation(uc.cl,PolicySets.class);
ClassHelper.getAnnotation(cl,PolicySets.class);
if( psAnnot != null ) {
final String prefix = "frascati:";
String[] strs = psAnnot.value();
......
......@@ -35,7 +35,6 @@ import org.oasisopen.sca.annotation.Property;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Scope;
import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.UClass;
import org.objectweb.fractal.juliac.api.JuliacRuntimeException;
import org.objectweb.fractal.juliac.desc.AttributeDesc;
import org.objectweb.fractal.juliac.desc.ComponentDesc;
......@@ -132,12 +131,12 @@ public class SCAUltraMerge extends AbstractUltraMerge {
CtField<?> ctfield = umfield.getCtField();
CtTypeReference<?> tref = ctfield.getType();
String qname = tref.getQualifiedName();
UClass umclass = jc.create(qname);
Class<?> umclass = jc.create(qname);
/*
* Fields of type List hold references for collection references.
*/
boolean b = !( List.class.isAssignableFrom(umclass.cl) );
boolean b = !( List.class.isAssignableFrom(umclass) );
return b;
}
......@@ -147,12 +146,12 @@ public class SCAUltraMerge extends AbstractUltraMerge {
CtField<?> ctfield = umfield.getCtField();
CtTypeReference<?> tref = ctfield.getType();
String qname = tref.getQualifiedName();
UClass umclass = jc.create(qname);
Class<?> umclass = jc.create(qname);
/*
* Fields of type List hold references for collection references.
*/
boolean b = List.class.isAssignableFrom(umclass.cl);
boolean b = List.class.isAssignableFrom(umclass);
return b;
}
......@@ -252,8 +251,8 @@ public class SCAUltraMerge extends AbstractUltraMerge {
CtClass<?> ctclass = umclass.getCtClass();
String umclassname = ctclass.getQualifiedName();
UClass uc = jc.create(umclassname);
Scope scope = uc.cl.getAnnotation(Scope.class);
Class<?> cl = jc.create(umclassname);
Scope scope = cl.getAnnotation(Scope.class);
if ( scope != null ) {
/*
......
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