1
1
package restx ;
2
2
3
- import com .google .common .base .*;
3
+ import com .google .common .base .Optional ;
4
+ import com .google .common .base .Predicate ;
5
+ import com .google .common .base .Stopwatch ;
6
+ import com .google .common .base .Supplier ;
7
+ import com .google .common .base .Suppliers ;
8
+ import com .google .common .base .Throwables ;
4
9
import com .google .common .collect .ImmutableSet ;
5
10
import com .google .common .eventbus .EventBus ;
6
11
import com .google .common .eventbus .Subscribe ;
13
18
import restx .classloader .HotReloadingClassLoader ;
14
19
import restx .common .RestxConfig ;
15
20
import restx .common .metrics .api .MetricRegistry ;
16
- import restx .factory .*;
21
+ import restx .factory .Factory ;
22
+ import restx .factory .Name ;
23
+ import restx .factory .NamedComponent ;
24
+ import restx .factory .SingletonFactoryMachine ;
25
+ import restx .factory .Warehouse ;
17
26
import restx .http .HttpStatus ;
18
27
import restx .security .RestxSessionCookieFilter ;
19
28
import restx .server .WebServer ;
@@ -578,7 +587,7 @@ private boolean useHotCompile() {
578
587
logger .info ("can't enable hot compile: restx.app.package is not set.\n " +
579
588
"Run your app with -Drestx.app.package=<app.base.package> to enable hot compile." );
580
589
return false ;
581
- } else if (!hasToolsJar ()) {
590
+ } else if (!hasSystemJavaCompiler ()) {
582
591
logger .info ("can't enable hot compile: tools.jar is not in classpath.\n " +
583
592
"Run your app with a JDK rather than a JRE to enable hot compile." );
584
593
return false ;
@@ -590,7 +599,7 @@ private boolean useHotCompile() {
590
599
&& !getMode ().equals (RestxContext .Modes .PROD )
591
600
&& !getMode ().equals (RestxContext .Modes .TEST )
592
601
&& appSettings .appPackage ().isPresent ()
593
- && hasToolsJar ();
602
+ && hasSystemJavaCompiler ();
594
603
}
595
604
}
596
605
@@ -602,13 +611,8 @@ private String getMode(RestxRequest restxRequest) {
602
611
return restxRequest .getHeader ("RestxMode" ).or (getMode ());
603
612
}
604
613
605
- private boolean hasToolsJar () {
606
- try {
607
- Class .forName ("javax.tools.ToolProvider" );
608
- return true ;
609
- } catch (Exception e ) {
610
- return false ;
611
- }
614
+ private boolean hasSystemJavaCompiler () {
615
+ return Apps .hasSystemJavaCompiler ();
612
616
}
613
617
614
618
private boolean useAutoCompile () {
0 commit comments