Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordwagelaar2015-04-17 10:19:12 -0400
committerdwagelaar2015-04-17 10:19:12 -0400
commit39bb5596538473be89cdbd85b27656552a36d0b9 (patch)
tree3da9f850b2d22cd8a18c3d8c2176efb3a8305543 /plugins/org.eclipse.m2m.atl.emftvm
parent5adb24e3269ee2a77496b2f79bf587edec7a3c27 (diff)
downloadorg.eclipse.atl-39bb5596538473be89cdbd85b27656552a36d0b9.tar.gz
org.eclipse.atl-39bb5596538473be89cdbd85b27656552a36d0b9.tar.xz
org.eclipse.atl-39bb5596538473be89cdbd85b27656552a36d0b9.zip
EMFTVM fixes for ATL non-regression tests.
Diffstat (limited to 'plugins/org.eclipse.m2m.atl.emftvm')
-rw-r--r--plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ExecEnvImpl.java2
-rw-r--r--plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java28
-rw-r--r--plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/OCLOperations.java16
3 files changed, 45 insertions, 1 deletions
diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ExecEnvImpl.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ExecEnvImpl.java
index eff95be5..d0cb408a 100644
--- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ExecEnvImpl.java
+++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/impl/ExecEnvImpl.java
@@ -1610,7 +1610,7 @@ public class ExecEnvImpl extends EObjectImpl implements ExecEnv {
for (String modelName : re.getModels()) {
final Model model = models.get(modelName);
if (model == null) {
- throw new IllegalArgumentException(String.format("Model %s not found", modelName));
+ throw new IllegalArgumentException(String.format("Model %s not found for %s", modelName, re));
}
eModels.add(model);
}
diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java
index 8365df2d..0a290f6c 100644
--- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java
+++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java
@@ -39,6 +39,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
@@ -2427,6 +2428,33 @@ public final class EMFTVMUtil {
}
// overwrite with current value to prevent aliasing problems
registry.put(nsURI, p);
+ } else if (object instanceof EDataType) {
+ adaptDataType((EDataType) object);
+ }
+ }
+ }
+
+ /**
+ * Adapts the given {@link EDataType} if necessary.
+ * @param dt the {@link EDataType} to adapt
+ */
+ private static void adaptDataType(final EDataType dt) {
+ String icn = dt.getInstanceClassName();
+ if (icn == null) {
+ final String tname = dt.getName();
+ if (tname.equals("Boolean")) { //$NON-NLS-1$
+ icn = "boolean"; //$NON-NLS-1$
+ } else if (tname.equals("Double") || tname.equals("Real")) { //$NON-NLS-1$ //$NON-NLS-2$
+ icn = "java.lang.Double"; //$NON-NLS-1$
+ } else if (tname.equals("Float")) { //$NON-NLS-1$
+ icn = "java.lang.Float"; //$NON-NLS-1$
+ } else if (tname.equals("Integer")) { //$NON-NLS-1$
+ icn = "java.lang.Integer"; //$NON-NLS-1$
+ } else if (tname.equals("String")) { //$NON-NLS-1$
+ icn = "java.lang.String"; //$NON-NLS-1$
+ }
+ if (icn != null) {
+ dt.setInstanceClassName(icn);
}
}
}
diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/OCLOperations.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/OCLOperations.java
index 085644ce..ad0a142a 100644
--- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/OCLOperations.java
+++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/OCLOperations.java
@@ -1024,6 +1024,14 @@ public final class OCLOperations {
}
});
createOperation(false, "-", Types.REAL_TYPE, Types.REAL_TYPE,
+ new String[][][]{},
+ new NativeCodeBlock() {
+ @Override
+ public Object execute(final StackFrame frame) {
+ return -(Double)frame.getLocal(0, 0);
+ }
+ });
+ createOperation(false, "-", Types.REAL_TYPE, Types.REAL_TYPE,
new String[][][]{{{"r"}, Types.REAL_TYPE}},
new NativeCodeBlock() {
@Override
@@ -1226,6 +1234,14 @@ public final class OCLOperations {
return (Integer)frame.getLocal(0, 0) + (Integer)frame.getLocal(0, 1);
}
});
+ createOperation(false, "-", Types.INTEGER_TYPE, Types.INTEGER_TYPE,
+ new String[][][]{},
+ new NativeCodeBlock() {
+ @Override
+ public Object execute(final StackFrame frame) {
+ return -(Integer)frame.getLocal(0, 0);
+ }
+ });
createOperation(false, "-", Types.INTEGER_TYPE, Types.REAL_TYPE,
new String[][][]{{{"r"}, Types.REAL_TYPE}},
new NativeCodeBlock() {

Back to the top