Commit bc1e382b authored by Lionel Seinturier's avatar Lionel Seinturier

Bug fix for array types.

Cosmetic.
parent 11532eb8
...@@ -222,7 +222,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -222,7 +222,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
String adlFileName = adl.replace('.','/')+".composite"; String adlFileName = adl.replace('.','/')+".composite";
URL url = loader.getResource(adlFileName); URL url = loader.getResource(adlFileName);
if( url == null ) { if( url == null ) {
String msg = "Can not load "+adlFileName; final String msg = "Cannot load "+adlFileName;
throw new IOException(msg); throw new IOException(msg);
} }
...@@ -231,9 +231,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -231,9 +231,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
uri = url.toURI(); uri = url.toURI();
} }
catch (URISyntaxException e) { catch (URISyntaxException e) {
IOException ioe = new IOException(); throw new IOException(e);
ioe.initCause(e);
throw ioe;
} }
ResourceSet resourceSet = new ResourceSetImpl(); ResourceSet resourceSet = new ResourceSetImpl();
...@@ -390,7 +388,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -390,7 +388,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
String namespaceURI = qname.getNamespaceURI(); String namespaceURI = qname.getNamespaceURI();
String localpart = qname.getLocalPart(); String localpart = qname.getLocalPart();
if( ! localpart.endsWith(".composite") ) { if( ! localpart.endsWith(".composite") ) {
String msg = final String msg =
"Unexpected name (local part should end with .composite "+ "Unexpected name (local part should end with .composite "+
qname+" in implementation.composite for subcomponent "+ qname+" in implementation.composite for subcomponent "+
sub.getName()+" in composite "+compositeName; sub.getName()+" in composite "+compositeName;
...@@ -403,7 +401,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -403,7 +401,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
cdesc = parse(adl,null); cdesc = parse(adl,null);
} }
else { else {
String msg = final String msg =
"Unsupported implementation type "+ "Unsupported implementation type "+
implementation.getClass().getName()+" for subcomponent "+ implementation.getClass().getName()+" for subcomponent "+
sub.getName()+" in composite "+compositeName; sub.getName()+" in composite "+compositeName;
...@@ -422,7 +420,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -422,7 +420,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
String promote = service.getPromote(); String promote = service.getPromote();
String[] promotes = Util.splitAroundFirstSplash(promote); String[] promotes = Util.splitAroundFirstSplash(promote);
if( promotes.length != 2 ) { if( promotes.length != 2 ) {
String msg = final String msg =
"Illegal service promotion "+promote+" in composite "+ "Illegal service promotion "+promote+" in composite "+
compositeName; compositeName;
throw new IOException(msg); throw new IOException(msg);
...@@ -430,7 +428,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -430,7 +428,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
ComponentDesc target = subcdescs.get(promotes[0]); ComponentDesc target = subcdescs.get(promotes[0]);
if( target == null ) { if( target == null ) {
String msg = final String msg =
"No such target component "+promotes[0]+ "No such target component "+promotes[0]+
" in service promotion "+promote+" in composite "+compositeName; " in service promotion "+promote+" in composite "+compositeName;
throw new IOException(msg); throw new IOException(msg);
...@@ -450,7 +448,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -450,7 +448,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
for (String pr : promotes) { for (String pr : promotes) {
String[] prs = Util.splitAroundFirstSplash(pr); String[] prs = Util.splitAroundFirstSplash(pr);
if( prs.length != 2 ) { if( prs.length != 2 ) {
String msg = final String msg =
"Illegal reference promotion "+promote+" in composite "+ "Illegal reference promotion "+promote+" in composite "+
compositeName; compositeName;
throw new IOException(msg); throw new IOException(msg);
...@@ -458,7 +456,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -458,7 +456,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
ComponentDesc src = subcdescs.get(prs[0]); ComponentDesc src = subcdescs.get(prs[0]);
if( src == null ) { if( src == null ) {
String msg = final String msg =
"No such source component "+prs[0]+ "No such source component "+prs[0]+
" in reference promotion "+promote+" in composite "+ " in reference promotion "+promote+" in composite "+
compositeName; compositeName;
...@@ -476,12 +474,12 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -476,12 +474,12 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
String source = wire.getSource(); String source = wire.getSource();
String[] sources = Util.splitAroundFirstSplash(source); String[] sources = Util.splitAroundFirstSplash(source);
if( sources.length != 2 ) { if( sources.length != 2 ) {
String msg = "Illegal source '"+source+"' in wire "+wire; final String msg = "Illegal source '"+source+"' in wire "+wire;
throw new IOException(msg); throw new IOException(msg);
} }
ComponentDesc clt = subcdescs.get(sources[0]); ComponentDesc clt = subcdescs.get(sources[0]);
if( clt == null ) { if( clt == null ) {
String msg = final String msg =
"No such source component '"+sources[0]+"' in wire "+wire; "No such source component '"+sources[0]+"' in wire "+wire;
throw new IOException(msg); throw new IOException(msg);
} }
...@@ -491,13 +489,13 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -491,13 +489,13 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
cltItf = cltct.getFcInterfaceType(sources[1]); cltItf = cltct.getFcInterfaceType(sources[1]);
} }
catch( NoSuchInterfaceException nsie ) { catch( NoSuchInterfaceException nsie ) {
String msg = final String msg =
"No such source component interface '"+sources[1]+"' in wire "+ "No such source component interface '"+sources[1]+"' in wire "+
wire; wire;
throw new IOException(msg); throw new IOException(msg);
} }
if( ! cltItf.isFcClientItf() ) { if( ! cltItf.isFcClientItf() ) {
String msg = sources[1]+" is not a client interface in wire "+wire; final String msg = sources[1]+" is not a client interface in wire "+wire;
throw new IOException(msg); throw new IOException(msg);
} }
...@@ -505,12 +503,12 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -505,12 +503,12 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
String target = wire.getTarget(); String target = wire.getTarget();
String[] targets = Util.splitAroundFirstSplash(target); String[] targets = Util.splitAroundFirstSplash(target);
if( targets.length != 2 ) { if( targets.length != 2 ) {
String msg = "Illegal target '"+target+"' in wire "+wire; final String msg = "Illegal target '"+target+"' in wire "+wire;
throw new IOException(msg); throw new IOException(msg);
} }
ComponentDesc srv = subcdescs.get(targets[0]); ComponentDesc srv = subcdescs.get(targets[0]);
if( srv == null ) { if( srv == null ) {
String msg = final String msg =
"No such target component '"+targets[0]+"' in wire "+wire; "No such target component '"+targets[0]+"' in wire "+wire;
throw new IOException(msg); throw new IOException(msg);
} }
...@@ -518,7 +516,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -518,7 +516,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
ComponentType srvct = srv.getCT(); ComponentType srvct = srv.getCT();
InterfaceType srvItf = srvct.getFcInterfaceType(targets[1]); InterfaceType srvItf = srvct.getFcInterfaceType(targets[1]);
if( srvItf.isFcClientItf() ) { if( srvItf.isFcClientItf() ) {
String msg = final String msg =
targets[1]+" is not a server interface in wire "+wire; targets[1]+" is not a server interface in wire "+wire;
throw new IOException(msg); throw new IOException(msg);
} }
...@@ -580,14 +578,14 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -580,14 +578,14 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
String[] targs = Util.splitAroundFirstSplash(targ); String[] targs = Util.splitAroundFirstSplash(targ);
if( targs.length != 2 ) { if( targs.length != 2 ) {
String msg = final String msg =
"Illegal reference "+target+" in composite "+ "Illegal reference "+target+" in composite "+
compositeName; compositeName;
throw new IOException(msg); throw new IOException(msg);
} }
ComponentDesc srv = subcdescs.get(targs[0]); ComponentDesc srv = subcdescs.get(targs[0]);
if( srv == null ) { if( srv == null ) {
String msg = final String msg =
"No such target component "+targs[0]+ "No such target component "+targs[0]+
" in reference "+target+" in composite "+ " in reference "+target+" in composite "+
compositeName; compositeName;
...@@ -629,7 +627,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -629,7 +627,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
if( typeqname != null ) { if( typeqname != null ) {
String ns = typeqname.getNamespaceURI(); String ns = typeqname.getNamespaceURI();
if( ! ns.equals("http://frascati.ow2.org/xmlns/java") ) { if( ! ns.equals("http://frascati.ow2.org/xmlns/java") ) {
String msg = "Unsupported namespace URI: "+ns; final String msg = "Unsupported namespace URI: "+ns;
throw new IllegalArgumentException(msg); throw new IllegalArgumentException(msg);
} }
type = typeqname.getLocalPart(); type = typeqname.getLocalPart();
...@@ -745,9 +743,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -745,9 +743,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
return ct; return ct;
} }
catch (InstantiationException e) { catch (InstantiationException e) {
IOException ioe = new IOException(); throw new IOException(e);
ioe.initCause(e);
throw ioe;
} }
} }
...@@ -770,7 +766,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf { ...@@ -770,7 +766,7 @@ public class EMFParserSupportImpl implements ADLParserSupportItf {
throws IllegalArgumentException { throws IllegalArgumentException {
if( ! cardinalities.containsKey(mult) ) { if( ! cardinalities.containsKey(mult) ) {
String msg = "Unsupported interface multiplicity: "+mult; final String msg = "Unsupported interface multiplicity: "+mult;
throw new IllegalArgumentException(msg); throw new IllegalArgumentException(msg);
} }
......
...@@ -26,7 +26,7 @@ package org.ow2.frascati.tinfi.emf; ...@@ -26,7 +26,7 @@ package org.ow2.frascati.tinfi.emf;
/** /**
* Utility class. * Utility class.
* *
* @author seinturi <Lionel.Seinturier@univ-lille1.fr> * @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 1.4.5 * @since 1.4.5
*/ */
public class Util { public class Util {
......
...@@ -30,6 +30,7 @@ import org.objectweb.fractal.api.Interface; ...@@ -30,6 +30,7 @@ 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.Juliac; import org.objectweb.fractal.juliac.Juliac;
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.proxy.AbstractInterceptorSourceCodeGenerator; import org.objectweb.fractal.juliac.proxy.AbstractInterceptorSourceCodeGenerator;
import org.objectweb.fractal.juliac.ucf.UCMethod; import org.objectweb.fractal.juliac.ucf.UCMethod;
import org.objectweb.fractal.juliac.ucf.UClass; import org.objectweb.fractal.juliac.ucf.UClass;
...@@ -114,7 +115,7 @@ extends AbstractInterceptorSourceCodeGenerator { ...@@ -114,7 +115,7 @@ extends AbstractInterceptorSourceCodeGenerator {
bv.visit(proxymname); bv.visit(proxymname);
bv.visit("\""); bv.visit("\"");
for (Class<?> paramtype : paramtypes) { for (Class<?> paramtype : paramtypes) {
String paramtypename = paramtype.getName(); String paramtypename = ClassHelper.getName(paramtype);
bv.visit(","); bv.visit(",");
bv.visit(paramtypename); bv.visit(paramtypename);
bv.visit(".class"); bv.visit(".class");
......
...@@ -72,7 +72,7 @@ extends AbstractInterceptorSourceCodeGenerator { ...@@ -72,7 +72,7 @@ extends AbstractInterceptorSourceCodeGenerator {
@Override @Override
public void setMergeable( boolean mergeable ) { public void setMergeable( boolean mergeable ) {
if(mergeable) { if(mergeable) {
String msg = "This generator can not generate mergeable code"; final String msg = "This generator cannot generate mergeable code";
throw new IllegalArgumentException(msg); throw new IllegalArgumentException(msg);
} }
} }
......
...@@ -52,7 +52,6 @@ import org.objectweb.fractal.api.type.InterfaceType; ...@@ -52,7 +52,6 @@ import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.fraclet.types.Contingency; import org.objectweb.fractal.fraclet.types.Contingency;
import org.objectweb.fractal.julia.InitializationContext; import org.objectweb.fractal.julia.InitializationContext;
import org.objectweb.fractal.juliac.Juliac; import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.api.JuliacRuntimeException;
import org.objectweb.fractal.juliac.api.TypeGeneratorItf; import org.objectweb.fractal.juliac.api.TypeGeneratorItf;
import org.objectweb.fractal.juliac.conf.Constants; import org.objectweb.fractal.juliac.conf.Constants;
import org.objectweb.fractal.juliac.conf.JuliacConfig; import org.objectweb.fractal.juliac.conf.JuliacConfig;
...@@ -108,30 +107,8 @@ extends ClassGenerator { ...@@ -108,30 +107,8 @@ extends ClassGenerator {
throws IllegalContentClassMetaData { throws IllegalContentClassMetaData {
JuliacConfig jconf = jc.getJuliacConfig(); JuliacConfig jconf = jc.getJuliacConfig();
ClassLoader classloader = jconf.getClassLoader();
/* Class<?> cl = jconf.load(contentClassName);
* TODO Deal with UnifiedClass instead of Class<?>
* UnifiedClass uc = jc.create(contentClassName);
*
* ContentClassMetaData should be based on UnifiedClass instead of
* Class<?>. ContentClassMetaData should be moved to this package once
* tinfi-runtime will be free of reflection.
*/
Class<?> cl = null;
try {
cl = classloader.loadClass(contentClassName);
}
catch (ClassNotFoundException cnfe) {
/*
* jc.create(contentClassName) throws also
* JuliacRuntimeException(ClassNotFoundException) if the class can
* not be found. We implement the same behavior here as the class
* loading will be replaced by jc.create(contentClassName) in the
* future.
*/
throw new JuliacRuntimeException(cnfe);
}
ContentClassMetaData ccmd = ContentClassMetaData.get(cl); ContentClassMetaData ccmd = ContentClassMetaData.get(cl);
TypeGeneratorItf scacccg = null; TypeGeneratorItf scacccg = null;
...@@ -147,7 +124,7 @@ extends ClassGenerator { ...@@ -147,7 +124,7 @@ extends ClassGenerator {
jc,contentClassName,ccmd); jc,contentClassName,ccmd);
} }
else { else {
String msg = "Unsupported scope: "+ccmd.scope; final String msg = "Unsupported scope: "+ccmd.scope;
throw new IllegalArgumentException(msg); throw new IllegalArgumentException(msg);
} }
...@@ -1219,6 +1196,8 @@ extends ClassGenerator { ...@@ -1219,6 +1196,8 @@ extends ClassGenerator {
/** /**
* Return <code>true</code> if the specified modifier allows to statically * Return <code>true</code> if the specified modifier allows to statically
* access methods and fields in the specified declaring class. * access methods and fields in the specified declaring class.
*
* TODO move to ClassHelper
*/ */
private boolean isAccessibleWithStaticInvocation( int mod, Class<?> dc ) { private boolean isAccessibleWithStaticInvocation( int mod, Class<?> dc ) {
...@@ -1373,7 +1352,7 @@ extends ClassGenerator { ...@@ -1373,7 +1352,7 @@ extends ClassGenerator {
* required parameter or Fraclet style with a contingency * required parameter or Fraclet style with a contingency
* parameter. * parameter.
*/ */
String msg = final String msg =
"required or contingency parameter expected on annotation "+ "required or contingency parameter expected on annotation "+
annot; annot;
throw new TinfiRuntimeException(msg); throw new TinfiRuntimeException(msg);
......
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