comparison 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
comparison
equal deleted inserted replaced
21755:c052d68e7eac 21889:45083be8a812
446 */ 446 */
447 public String getName() { 447 public String getName() {
448 return props.getProperty(prefix + "name"); 448 return props.getProperty(prefix + "name");
449 } 449 }
450 450
451 /**
452 * Name of the language version.
453 *
454 * @return string specifying the language version
455 */
456 public String getVersion() {
457 return props.getProperty(prefix + "version");
458 }
459
460 /**
461 * Human readable string that identifies the language and version.
462 *
463 * @return string describing the specific language version
464 */
465 public String getShortName() {
466 return getName() + getVersion();
467 }
468
451 TruffleLanguage getImpl() { 469 TruffleLanguage getImpl() {
452 if (impl == null) { 470 if (impl == null) {
453 String n = props.getProperty(prefix + "className"); 471 String n = props.getProperty(prefix + "className");
454 try { 472 try {
455 Class<?> langClazz = Class.forName(n, true, loader()); 473 Class<?> langClazz = Class.forName(n, true, loader());
456 Constructor<?> constructor = langClazz.getConstructor(Env.class); 474 Constructor<?> constructor = langClazz.getConstructor(Env.class);
457 impl = SPI.attachEnv(TruffleVM.this, constructor, out, err, in); 475 impl = SPI.attachEnv(TruffleVM.this, constructor, out, err, in);
458 } catch (Exception ex) { 476 } catch (Exception ex) {
459 throw new IllegalStateException("Cannot initialize " + getName() + " language with implementation " + n, ex); 477 throw new IllegalStateException("Cannot initialize " + getShortName() + " language with implementation " + n, ex);
460 } 478 }
461 } 479 }
462 return impl; 480 return impl;
463 } 481 }
464 482
465 @Override 483 @Override
466 public String toString() { 484 public String toString() {
467 return "[" + getName() + " for " + getMimeTypes() + "]"; 485 return "[" + getShortName() + " for " + getMimeTypes() + "]";
468 } 486 }
469 } // end of Language 487 } // end of Language
470 488
471 private static class SPIAccessor extends Accessor { 489 private static class SPIAccessor extends Accessor {
472 @Override 490 @Override