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