From 29950ab7172709dc01c5de74b4873e2a72b53e91 Mon Sep 17 00:00:00 2001 From: Lionel Seinturier Date: Sun, 22 Jan 2017 15:36:16 +0000 Subject: [PATCH] Refactor UClass into GenericClassHelper. --- .../frascati/tinfi/opt/oo/InterceptorClassGenerator.java | 5 +++-- .../opt/oo/SCAIntentInterceptorSourceCodeGenerator.java | 7 ++++--- .../tinfi/opt/oo/ServiceReferenceClassGenerator.java | 4 ++-- .../frascati/tinfi/tinfilet/TinfiParserSupportImpl.java | 8 ++++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/opt/oo/InterceptorClassGenerator.java b/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/opt/oo/InterceptorClassGenerator.java index bb91b1e49..713f50fc8 100644 --- a/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/opt/oo/InterceptorClassGenerator.java +++ b/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/opt/oo/InterceptorClassGenerator.java @@ -25,8 +25,8 @@ package org.ow2.frascati.tinfi.opt.oo; 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.GenericClassHelper; import org.objectweb.fractal.juliac.visit.BlockSourceCodeVisitor; import org.objectweb.fractal.juliac.visit.ClassSourceCodeVisitor; @@ -55,7 +55,8 @@ extends org.objectweb.fractal.juliac.proxy.InterceptorClassGenerator { public void generateProxyMethodBodyDelegatingCode( BlockSourceCodeVisitor mv, Method proxym ) { - String rtypename = UClass.getGenericReturnType(proxym,proxycl); + GenericClassHelper gc = GenericClassHelper.get(proxycl); + String rtypename = gc.getGenericReturnType(proxym); if( rtypename.equals("void") ) { mv.visitln(" ijp.proceed();"); diff --git a/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/opt/oo/SCAIntentInterceptorSourceCodeGenerator.java b/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/opt/oo/SCAIntentInterceptorSourceCodeGenerator.java index 3f26b07ff..b54bd5ea6 100644 --- a/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/opt/oo/SCAIntentInterceptorSourceCodeGenerator.java +++ b/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/opt/oo/SCAIntentInterceptorSourceCodeGenerator.java @@ -29,8 +29,8 @@ import java.lang.reflect.Modifier; import org.objectweb.fractal.api.Interface; 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.GenericClassHelper; import org.objectweb.fractal.juliac.commons.lang.reflect.MethodHelper; import org.objectweb.fractal.juliac.desc.MembraneDesc; import org.objectweb.fractal.juliac.proxy.AbstractInterceptorSourceCodeGenerator; @@ -102,7 +102,7 @@ extends AbstractInterceptorSourceCodeGenerator { bv.visitln(" METHODS = new java.lang.reflect.Method[]{"); // Iterate on methods - UClass uc = UClass.get(proxycl); + GenericClassHelper uc = GenericClassHelper.get(proxycl); String proxyclname = uc.toString(proxycl); for (int i = 0; i < proxymethods.length; i++) { @@ -304,7 +304,8 @@ extends AbstractInterceptorSourceCodeGenerator { */ String proxymname = proxym.getName(); 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); mv.visitln(" if( handlers.size() == 0 ) {"); diff --git a/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/opt/oo/ServiceReferenceClassGenerator.java b/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/opt/oo/ServiceReferenceClassGenerator.java index 0e3fe8f94..7d90f28c8 100644 --- a/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/opt/oo/ServiceReferenceClassGenerator.java +++ b/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/opt/oo/ServiceReferenceClassGenerator.java @@ -33,9 +33,9 @@ import org.objectweb.fractal.api.Component; import org.objectweb.fractal.api.type.InterfaceType; import org.objectweb.fractal.julia.ComponentInterface; 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.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.reflect.AnnotatedElementHelper; import org.objectweb.fractal.juliac.desc.MembraneDesc; @@ -208,7 +208,7 @@ extends AbstractProxyClassGenerator { if( oneWayMeth != null ) { Class rtype = proxym.getReturnType(); if( ! rtype.getName().equals("void") ) { - UClass uc = UClass.get(proxycl); + GenericClassHelper uc = GenericClassHelper.get(proxycl); final String msg = "@OneWay annotated method "+proxym.toString()+" in "+ uc.toString(proxycl)+" should return void"; diff --git a/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/tinfilet/TinfiParserSupportImpl.java b/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/tinfilet/TinfiParserSupportImpl.java index 9972c2550..e4bfe1373 100644 --- a/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/tinfilet/TinfiParserSupportImpl.java +++ b/tinfi/module/opt-oo/core/src/main/java/org/ow2/frascati/tinfi/tinfilet/TinfiParserSupportImpl.java @@ -40,12 +40,12 @@ import org.objectweb.fractal.fraclet.types.Constants; import org.objectweb.fractal.julia.type.BasicComponentType; import org.objectweb.fractal.julia.type.BasicInterfaceType; 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.MembraneLoaderItf; import org.objectweb.fractal.juliac.api.RuntimeClassNotFoundException; import org.objectweb.fractal.juliac.api.SourceCodeGeneratorItf; 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.conf.JuliacConfig; import org.objectweb.fractal.juliac.conf.JulietLoader; @@ -230,7 +230,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf { * Extract generic to retrieve the type of the reference. */ Class rtype = field.getType(); - UClass uc = UClass.get(rtype); + GenericClassHelper uc = GenericClassHelper.get(rtype); String gt = uc.toString(rtype); String[] strs = gt.split("<"); if( strs.length != 2 ) { @@ -306,7 +306,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf { // Consistency check if( controller.equals(Constants.EMPTY) && controllerDesc.equals(Constants.class) ) { - UClass uc = UClass.get(cl); + GenericClassHelper uc = GenericClassHelper.get(cl); final String msg = "Both controller and controllerDesc cannot be null in "+ mAnnot+" for class "+uc.toString(cl); @@ -315,7 +315,7 @@ public class TinfiParserSupportImpl implements ADLParserSupportItf { // Custom membrane specified with @Membrane(controllerDesc=...) if( ! controllerDesc.equals(Constants.class) ) { - UClass uc = UClass.get(cl); + GenericClassHelper uc = GenericClassHelper.get(cl); Class mdefcl = MembraneHelper.getMembraneDef(mAnnot,uc.toString(cl)); Membrane mdef = mdefcl.getAnnotation(Membrane.class); -- GitLab