File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
src/main/java/org/msgpack Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 2222import java .util .List ;
2323
2424import org .msgpack .template .TemplateRegistry ;
25+ import org .msgpack .util .android .DalvikVmChecker ;
2526
2627public class TemplateBuilderChain {
2728
2829 private static boolean enableDynamicCodeGeneration () {
29- try {
30- return !System .getProperty ("java.vm.name" ).equals ("Dalvik" );
31- } catch (Exception e ) {
32- return true ;
33- }
30+ return !DalvikVmChecker .isDalvikVm ();
3431 }
3532
3633 protected List <TemplateBuilder > templateBuilders ;
Original file line number Diff line number Diff line change 1+ package org .msgpack .util .android ;
2+
3+ public final class DalvikVmChecker {
4+ private static final boolean isDalvikVm ;
5+ static {
6+ boolean isIt = false ;
7+ try {
8+ isIt = System .getProperty ("java.vm.name" ).equals ("Dalvik" );
9+ } finally {
10+ isDalvikVm = isIt ;
11+ }
12+ }
13+
14+ public static boolean isDalvikVm () {
15+ return isDalvikVm ;
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments