This discussion is archived
1 Reply Latest reply: Jun 19, 2011 6:40 PM by 869899 RSS

javax.tools.JavaCompiler

863823 Newbie
Currently Being Moderated
Is a call to:
javax.tools.ToolProvider.getSystemJavaCompiler.run()
thread-safe? Is this platform-dependent? The documentation is silent about this (as usual when it comes to thread-safety).

(Apologies if this is the wrong forum; cannot find one for javax.tools.)

MC
  • 1. Re: javax.tools.JavaCompiler
    869899 Newbie
    Currently Being Moderated
    This is a Lazily loaded static object.
    The call to getSystemJavaCompiler() is also static and just uses that standard Class.newInstance() method to return a completely new instance of the compilerClass.
    There is nothing not thread safe about this, but if you keep and share that new instance later it won't be.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points