javac - Compile in Java 6, run in 7 - how to specify useLegacyMergeSort? -
i'm wondering if compile in java 6, runs program on java 7, java 6 or 7 version of arrays.sort used?
it's important because new mergesort throws illegalargumentexception, , old 1 doesn't (see comparison method violates general contract! java 7 only)
now, it's possible compile in java 7 using arrays.uselegacymergesort, flag isn't available java 6 - , want compatible on mac os snow leopard (which uses 6).
for reason (see http://madbean.com/2006/target14/) -target compiler flag doesn't seem produce compatible code, we'd rather compile in java 6.
any suggestions?
try set system property
java -djava.util.arrays.uselegacymergesort=true ...
note it's not arrays public api src
/** * old merge sort implementation can selected (for * compatibility broken comparators) using system property. * cannot static boolean in enclosing class due * circular dependencies. removed in future release. */ static final class legacymergesort { private static final boolean userrequested = java.security.accesscontroller.doprivileged( new sun.security.action.getbooleanaction( "java.util.arrays.uselegacymergesort")).booleanvalue(); }
Comments
Post a Comment