Commit 29950ab7 authored by Lionel Seinturier's avatar Lionel Seinturier

Refactor UClass into GenericClassHelper.

parent 86d1fa22
...@@ -25,8 +25,8 @@ package org.ow2.frascati.tinfi.opt.oo; ...@@ -25,8 +25,8 @@ package org.ow2.frascati.tinfi.opt.oo;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.objectweb.fractal.juliac.UClass;
import org.objectweb.fractal.juliac.commons.lang.ClassHelper; import org.objectweb.fractal.juliac.commons.lang.ClassHelper;
import org.objectweb.fractal.juliac.commons.lang.GenericClassHelper;
import org.objectweb.fractal.juliac.visit.BlockSourceCodeVisitor; import org.objectweb.fractal.juliac.visit.BlockSourceCodeVisitor;
import org.objectweb.fractal.juliac.visit.ClassSourceCodeVisitor; import org.objectweb.fractal.juliac.visit.ClassSourceCodeVisitor;
...@@ -55,7 +55,8 @@ extends org.objectweb.fractal.juliac.proxy.InterceptorClassGenerator { ...@@ -55,7 +55,8 @@ extends org.objectweb.fractal.juliac.proxy.InterceptorClassGenerator {
public void generateProxyMethodBodyDelegatingCode( public void generateProxyMethodBodyDelegatingCode(
BlockSourceCodeVisitor mv, Method proxym ) { BlockSourceCodeVisitor mv, Method proxym ) {
String rtypename = UClass.getGenericReturnType(proxym,proxycl); GenericClassHelper gc = GenericClassHelper.get(proxycl);
String rtypename = gc.getGenericReturnType(proxym);
if( rtypename.equals("void") ) { if( rtypename.equals("void") ) {
mv.visitln(" ijp.proceed();"); mv.visitln(" ijp.proceed();");
......
...@@ -29,8 +29,8 @@ import java.lang.reflect.Modifier; ...@@ -29,8 +29,8 @@ import java.lang.reflect.Modifier;
import org.objectweb.fractal.api.Interface; import org.objectweb.fractal.api.Interface;
import org.objectweb.fractal.api.type.InterfaceType; import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.juliac.UClass;
import org.objectweb.fractal.juliac.commons.lang.ClassHelper; import org.objectweb.fractal.juliac.commons.lang.ClassHelper;
import org.objectweb.fractal.juliac.commons.lang.GenericClassHelper;
import org.objectweb.fractal.juliac.commons.lang.reflect.MethodHelper; import org.objectweb.fractal.juliac.commons.lang.reflect.MethodHelper;
import org.objectweb.fractal.juliac.desc.MembraneDesc; import org.objectweb.fractal.juliac.desc.MembraneDesc;
import org.objectweb.fractal.juliac.proxy.AbstractInterceptorSourceCodeGenerator; import org.objectweb.fractal.juliac.proxy.AbstractInterceptorSourceCodeGenerator;
...@@ -102,7 +102,7 @@ extends AbstractInterceptorSourceCodeGenerator { ...@@ -102,7 +102,7 @@ extends AbstractInterceptorSourceCodeGenerator {
bv.visitln(" METHODS = new java.lang.reflect.Method[]{"); bv.visitln(" METHODS = new java.lang.reflect.Method[]{");
// Iterate on methods // Iterate on methods
UClass uc = UClass.get(proxycl); GenericClassHelper uc = GenericClassHelper.get(proxycl);
String proxyclname = uc.toString(proxycl); String proxyclname = uc.toString(proxycl);
for (int i = 0; i < proxymethods.length; i++) { for (int i = 0; i < proxymethods.length; i++) {
...@@ -304,7 +304,8 @@ extends AbstractInterceptorSourceCodeGenerator { ...@@ -304,7 +304,8 @@ extends AbstractInterceptorSourceCodeGenerator {
*/ */
String proxymname = proxym.getName(); String proxymname = proxym.getName();
Class<?>[] ptypes = proxym.getParameterTypes(); Class<?>[] ptypes = proxym.getParameterTypes();
String rtypename = UClass.getGenericReturnType(proxym,proxycl); GenericClassHelper gc = GenericClassHelper.get(proxycl);
String rtypename = gc.getGenericReturnType(proxym);
String[] tpnames = MethodHelper.getTypeParameterNames(proxym); String[] tpnames = MethodHelper.getTypeParameterNames(proxym);
mv.visitln(" if( handlers.size() == 0 ) {"); mv.visitln(" if( handlers.size() == 0 ) {");
......
...@@ -33,9 +33,9 @@ import org.objectweb.fractal.api.Component; ...@@ -33,9 +33,9 @@ import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.api.type.InterfaceType; import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.julia.ComponentInterface; import org.objectweb.fractal.julia.ComponentInterface;
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.SourceCodeGeneratorItf; import org.objectweb.fractal.juliac.api.SourceCodeGeneratorItf;
import org.objectweb.fractal.juliac.commons.lang.ClassHelper; import org.objectweb.fractal.juliac.commons.lang.ClassHelper;
import org.objectweb.fractal.juliac.commons.lang.GenericClassHelper;
import org.objectweb.fractal.juliac.commons.lang.annotation.AnnotationHelper; import org.objectweb.fractal.juliac.commons.lang.annotation.AnnotationHelper;
import org.objectweb.fractal.juliac.commons.lang.reflect.AnnotatedElementHelper; import org.objectweb.fractal.juliac.commons.lang.reflect.AnnotatedElementHelper;
import org.objectweb.fractal.juliac.desc.MembraneDesc; import org.objectweb.fractal.juliac.desc.MembraneDesc;
...@@ -208,7 +208,7 @@ extends AbstractProxyClassGenerator { ...@@ -208,7 +208,7 @@ extends AbstractProxyClassGenerator {
if( oneWayMeth != null ) { if( oneWayMeth != null ) {
Class<?> rtype = proxym.getReturnType(); Class<?> rtype = proxym.getReturnType();
if( ! rtype.getName().equals("void") ) { if( ! rtype.getName().equals("void") ) {
UClass<?> uc = UClass.get(proxycl); GenericClassHelper uc = GenericClassHelper.get(proxycl);
final String msg = final String msg =
"@OneWay annotated method "+proxym.toString()+" in "+ "@OneWay annotated method "+proxym.toString()+" in "+
uc.toString(proxycl)+" should return void"; uc.toString(proxycl)+" should return void";
......
...@@ -40,12 +40,12 @@ import org.objectweb.fractal.fraclet.types.Constants; ...@@ -40,12 +40,12 @@ import org.objectweb.fractal.fraclet.types.Constants;
import org.objectweb.fractal.julia.type.BasicComponentType; import org.objectweb.fractal.julia.type.BasicComponentType;
import org.objectweb.fractal.julia.type.BasicInterfaceType; import org.objectweb.fractal.julia.type.BasicInterfaceType;
import org.objectweb.fractal.juliac.Juliac; import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.UClass;
import org.objectweb.fractal.juliac.api.ADLParserSupportItf; import org.objectweb.fractal.juliac.api.ADLParserSupportItf;
import org.objectweb.fractal.juliac.api.MembraneLoaderItf; import org.objectweb.fractal.juliac.api.MembraneLoaderItf;
import org.objectweb.fractal.juliac.api.RuntimeClassNotFoundException; import org.objectweb.fractal.juliac.api.RuntimeClassNotFoundException;
import org.objectweb.fractal.juliac.api.SourceCodeGeneratorItf; import org.objectweb.fractal.juliac.api.SourceCodeGeneratorItf;
import org.objectweb.fractal.juliac.commons.lang.ClassHelper; import org.objectweb.fractal.juliac.commons.lang.ClassHelper;
import org.objectweb.fractal.juliac.commons.lang.GenericClassHelper;
import org.objectweb.fractal.juliac.commons.lang.reflect.FieldHelper; import org.objectweb.fractal.juliac.commons.lang.reflect.FieldHelper;
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;
...@@ -230,7 +230,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf { ...@@ -230,7 +230,7 @@ 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 uc = UClass.get(rtype); GenericClassHelper uc = GenericClassHelper.get(rtype);
String gt = uc.toString(rtype); String gt = uc.toString(rtype);
String[] strs = gt.split("<"); String[] strs = gt.split("<");
if( strs.length != 2 ) { if( strs.length != 2 ) {
...@@ -306,7 +306,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf { ...@@ -306,7 +306,7 @@ 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); GenericClassHelper uc = GenericClassHelper.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(cl); mAnnot+" for class "+uc.toString(cl);
...@@ -315,7 +315,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf { ...@@ -315,7 +315,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf {
// Custom membrane specified with @Membrane(controllerDesc=...) // Custom membrane specified with @Membrane(controllerDesc=...)
if( ! controllerDesc.equals(Constants.class) ) { if( ! controllerDesc.equals(Constants.class) ) {
UClass uc = UClass.get(cl); GenericClassHelper uc = GenericClassHelper.get(cl);
Class<?> mdefcl = Class<?> mdefcl =
MembraneHelper.getMembraneDef(mAnnot,uc.toString(cl)); MembraneHelper.getMembraneDef(mAnnot,uc.toString(cl));
Membrane mdef = mdefcl.getAnnotation(Membrane.class); Membrane mdef = mdefcl.getAnnotation(Membrane.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