Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
Verify if GraalVM is used

due to Nashorn being discontinued we are currently trying to change our (still Java 8) application (very big monolith) from Nashorn to GraalVM. Due to the application being used as library in multiple projects, instead of using the whole GraalVM runtime we decided to just adding the necessary jars to the class path (which seem to work so far).

To use GraalVM, I changed all occurrences of getEngineByName to graal.js as follow:

ScriptEngineManager sem = new ScriptEngineManager(null);
scriptEngine = sem.getEngineByName("graal.js");

Due to the application being very complex, understanding every aspect of the application is relatively difficult and I was wondering if there is a way of verifying what JavaScript engine is used with the prepared JavaScript string as input? My goal is to write a Unit test which verifies for every method which takes JavaScript as input, if GraalVM is really used.

What would be the best approach to achieve this?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

you can compare the class name of the script engine with com.oracle.truffle.js.scriptengine.GraalJSScriptEngine something like this:

ScriptEngine  scriptEngine = new ScriptEngineManager().getEngineByName("graal.js");
            String engineName = scriptEngine.getClass().getName();
            boolean isGraalJS = engineName.equals("com.oracle.truffle.js.scriptengine.GraalJSScriptEngine");
            System.out.println(isGraalJS);
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda