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