diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/vm/TruffleVM.java @ 21889:45083be8a812

Truffle: add a version string to the information provided with Language registration
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Fri, 05 Jun 2015 18:05:13 -0700
parents 2f9e4d984d16
children 894f82515e38
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/vm/TruffleVM.java	Fri Jun 05 23:05:16 2015 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/vm/TruffleVM.java	Fri Jun 05 18:05:13 2015 -0700
@@ -448,6 +448,24 @@
             return props.getProperty(prefix + "name");
         }
 
+        /**
+         * Name of the language version.
+         *
+         * @return string specifying the language version
+         */
+        public String getVersion() {
+            return props.getProperty(prefix + "version");
+        }
+
+        /**
+         * Human readable string that identifies the language and version.
+         *
+         * @return string describing the specific language version
+         */
+        public String getShortName() {
+            return getName() + getVersion();
+        }
+
         TruffleLanguage getImpl() {
             if (impl == null) {
                 String n = props.getProperty(prefix + "className");
@@ -456,7 +474,7 @@
                     Constructor<?> constructor = langClazz.getConstructor(Env.class);
                     impl = SPI.attachEnv(TruffleVM.this, constructor, out, err, in);
                 } catch (Exception ex) {
-                    throw new IllegalStateException("Cannot initialize " + getName() + " language with implementation " + n, ex);
+                    throw new IllegalStateException("Cannot initialize " + getShortName() + " language with implementation " + n, ex);
                 }
             }
             return impl;
@@ -464,7 +482,7 @@
 
         @Override
         public String toString() {
-            return "[" + getName() + " for " + getMimeTypes() + "]";
+            return "[" + getShortName() + " for " + getMimeTypes() + "]";
         }
     } // end of Language