Mail Archive Home | fractal-commits List | August 2008 Index
| <-- Date Index --> | <-- Thread Index --> |
Bug fix when there is no <components>.
--- trunk/juliac/compiler/src/main/java/org/objectweb/fractal/juliac/Utils.java 2008-08-26 20:05:16 UTC (rev 8398)
+++ trunk/juliac/compiler/src/main/java/org/objectweb/fractal/juliac/Utils.java 2008-08-27 08:17:29 UTC (rev 8399)
@@ -341,4 +341,35 @@
}
return f;
}
+
+ /**
+ * Returns a copy of the specified string, with leading and trailing blank
+ * characters (whitespace, tab and newline) omitted.
+ */
+ public static String trimHeadingAndTrailingBlanks( String src ) {
+
+ /*
+ * i is the index of the first non blank character.
+ */
+ int i = -1;
+ char c;
+ do {
+ i++;
+ c = src.charAt(i);
+ }
+ while( c==' ' || c=='\t' || c=='\n' );
+
+ /*
+ * j is the index of the first non blank character from the end of src.
+ */
+ int j = src.length();
+ do {
+ j--;
+ c = src.charAt(j);
+ }
+ while( c==' ' || c=='\t' || c=='\n' );
+
+ String trim = src.substring(i,j+1);
+ return trim;
+ }
}
--- trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/Component.java 2008-08-26 20:05:16 UTC (rev 8398)
+++ trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/Component.java 2008-08-27 08:17:29 UTC (rev 8399)
@@ -44,22 +44,35 @@
*
* @parameter
*/
- public List<InterfaceType> interfaceTypes;
+ private List<InterfaceType> interfaceTypes;
/**
* The controller descriptor.
*
* @parameter
*/
- public String controllerDesc;
+ private String controllerDesc;
/**
* The content descriptor.
*
* @parameter
*/
- public String contentDesc;
+ private String contentDesc;
+
+ // ---------------------------------------------------------------------
+ // Getters
+ // ---------------------------------------------------------------------
+
+ public String getControllerDesc() {
+ return Utils.trimHeadingAndTrailingBlanks(controllerDesc);
+ }
+
+ public String getContentDesc() {
+ return Utils.trimHeadingAndTrailingBlanks(contentDesc);
+ }
+
/**
* Return the Fractal component type corresponding to the data stored in the
* current instance.
--- trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/InterfaceType.java 2008-08-26 20:05:16 UTC (rev 8398)
+++ trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/InterfaceType.java 2008-08-27 08:17:29 UTC (rev 8399)
@@ -39,41 +39,43 @@
*
* @parameter
*/
- public String name;
+ private String name;
/**
* The interface signature.
*
* @parameter
*/
- public String signature;
+ private String signature;
/**
* true if the interface is client.
*
* @parameter
*/
- public boolean isClient;
+ private boolean isClient;
/**
* true if the interface is optional.
*
* @parameter
*/
- public boolean isOptional;
+ private boolean isOptional;
/**
* true if the interface is collection.
*
* @parameter
*/
- public boolean isCollection;
+ private boolean isCollection;
/**
* Return the Fractal interface type corresponding to the data stored in the
* current instance.
*/
public org.objectweb.fractal.api.type.InterfaceType toFractalInterfaceType() {
+ String name = Utils.trimHeadingAndTrailingBlanks(this.name);
+ String signature = Utils.trimHeadingAndTrailingBlanks(this.signature);
org.objectweb.fractal.api.type.InterfaceType it =
new BasicInterfaceType(name,signature,isClient,isOptional,isCollection);
return it;
--- trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/JuliacMojo.java 2008-08-26 20:05:16 UTC (rev 8398)
+++ trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/JuliacMojo.java 2008-08-27 08:17:29 UTC (rev 8399)
@@ -262,7 +262,7 @@
String name = sysarg.getKey();
String value = sysarg.getValue();
- value = trimHeadingAndTrailingBlanks(value);
+ value = Utils.trimHeadingAndTrailingBlanks(value);
/*
* Save the original value of the property in origsysars (for
@@ -294,7 +294,7 @@
for (Map.Entry<String,String> entry : igs.entrySet()) {
String asmcg = entry.getKey();
String scg = entry.getValue();
- scg = trimHeadingAndTrailingBlanks(scg);
+ scg = Utils.trimHeadingAndTrailingBlanks(scg);
igs.put(asmcg,scg);
}
@@ -471,10 +471,14 @@
/*
* Code generation for components.
*/
- for (Component component : components) {
- Juliac.reportInfo(component+"...");
- Type type = component.toFractalComponentType();
- jc.generate( type, component.controllerDesc, component.contentDesc );
+ if( components != null ) {
+ for (Component component : components) {
+ Juliac.reportInfo(component+"...");
+ Type type = component.toFractalComponentType();
+ String controllerDesc = component.getControllerDesc();
+ String contentDesc = component.getContentDesc();
+ jc.generate( type, controllerDesc, contentDesc );
+ }
}
/*
@@ -584,39 +588,8 @@
String[] srcs = new String[src.size()];
for (int i = 0; i < src.size(); i++) {
String s = src.get(i);
- srcs[i] = trimHeadingAndTrailingBlanks(s);
+ srcs[i] = Utils.trimHeadingAndTrailingBlanks(s);
}
return srcs;
}
-
- /**
- * Returns a copy of the specified string, with leading and trailing blank
- * characters (whitespace, tab and newline) omitted.
- */
- private static String trimHeadingAndTrailingBlanks( String src ) {
-
- /*
- * i is the index of the first non blank character.
- */
- int i = -1;
- char c;
- do {
- i++;
- c = src.charAt(i);
- }
- while( c==' ' || c=='\t' || c=='\n' );
-
- /*
- * j is the index of the first non blank character from the end of src.
- */
- int j = src.length();
- do {
- j--;
- c = src.charAt(j);
- }
- while( c==' ' || c=='\t' || c=='\n' );
-
- String trim = src.substring(i,j+1);
- return trim;
- }
}
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.