[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] Java5 Specific Tests


I am working with a non-Sun Java Virtual Machine. This VM is a Java 5 VM, but I noticed that it was not running the Java 5 specific tests in the AspectJ testing suite. This turned out to be because the some of the tests are specific to Java 5, and so will only run on a Java 5 VM. The test for whether the VM being used is a Java 5 VM or not is to use the System property "java.runtime.version" (or "java.vm.version" if the former is unavailable). This is done in the org.aspectj.util.LangUtil class. If this property starts with "1.5" the VM is deemed to be a Java 5 VM. Unfortunately in the case of the VM I am using the String returned by System.getProperty("java.runtime.version") contains a build date, and does not start with "1.5", so it is not recognised as a Java 5 VM.

Could this test be made more robust by queering the system property "java.version" as oppose to those used currently? This System property is defined by the Sun specification, so should always return the version of the java runtime being used. Eg the Sun Java5_04 Vm returns "1.5.0_04", while the one I am using returns "1.5.0".

Is there a reason why this property is not currently the one used?

David Knibb