Exemplo n.º 1
0
 public ContextImpl(
     @NotNull JavaCompiler compiler,
     @NotNull DiagnosticOutputConsumer outConsumer,
     @NotNull OutputFileConsumer sink,
     CanceledStatus canceledStatus,
     boolean canUseOptimizedmanager) {
   myOutConsumer = outConsumer;
   myOutputFileSink = sink;
   myCanceledStatus = canceledStatus;
   StandardJavaFileManager stdManager = null;
   if (canUseOptimizedmanager) {
     final Class<StandardJavaFileManager> optimizedManagerClass =
         ClasspathBootstrap.getOptimizedFileManagerClass();
     if (optimizedManagerClass != null) {
       try {
         stdManager = optimizedManagerClass.newInstance();
       } catch (Throwable e) {
         if (SystemInfo.isWindows) {
           System.err.println(
               "Failed to load JPS optimized file manager for javac: " + e.getMessage());
         }
       }
     }
   }
   if (stdManager != null) {
     myStdManager = stdManager;
   } else {
     myStdManager = compiler.getStandardFileManager(outConsumer, Locale.US, null);
   }
 }
Exemplo n.º 2
0
 /**
  * Get an instance of an ability by alias
  *
  * @param alias the alias of an ability
  * @return a new Ability object, or null
  */
 public static Ability getAbility(String alias) {
   try {
     Class<? extends Ability> cls = abilities.get(alias.toLowerCase().replaceAll("[-_.]", ""));
     return cls.newInstance();
   } catch (Exception e) {
     return null;
   }
 }