Ejemplo n.º 1
0
 protected Class<?> compile(String code) {
   String javaCode = compileToJavaCode(code);
   try {
     Class<?> clazz = javaCompiler.compileToClass("foo.Test", javaCode);
     return clazz;
   } catch (Exception e) {
     throw new RuntimeException("Java compilation failed. Java code was : \n" + javaCode, e);
   }
 }
Ejemplo n.º 2
0
 public void setUp() {
   javaCompiler.clearClassPath();
   javaCompiler.addClassPathOfClass(getClass());
   javaCompiler.addClassPathOfClass(AbstractXbaseEvaluationTest.class);
   javaCompiler.addClassPathOfClass(Functions.class);
   javaCompiler.addClassPathOfClass(StringConcatenation.class);
   javaCompiler.addClassPathOfClass(javax.inject.Provider.class);
   javaCompiler.addClassPathOfClass(Provider.class);
   javaCompiler.addClassPathOfClass(Supplier.class);
   javaCompiler.addClassPathOfClass(Notifier.class);
   javaCompiler.addClassPathOfClass(EcorePackage.class);
   javaCompiler.addClassPathOfClass(XbasePackage.class);
   javaCompiler.addClassPathOfClass(Xtend2Package.class);
   javaCompiler.addClassPathOfClass(Check.class);
 }