FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

This commit patches the JavaVersion class to accommodate Oracle Java … · DrJavaToDataCollector/drjava@a915713 · GitHub

Repository navigation

Commit a915713

Browse files
rcartwright
committed
This commit patches the JavaVersion class to accommodate Oracle Java 7 JVMs on the Mac. It also makes a small revision to build.xml to keep many unit test from inexplicably breaking on Java 7.
The following files were modified M src/edu/rice/cs/plt/reflect/JavaVersion.java M build.xml git-svn-id: file:///tmp/test-svn/trunk@5752 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent 1f3058b commit a915713

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎plt/build.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
description="Compile all source files">
148148
</target>
149149

150-
<target name="do-compile" depends="resolve-java5-runtime">
150+
<target name="do-compile" depends="resolve-java7-runtime">
151151

152152
<echo message="Compiling src directory to classes/base and classes/test with command 'javac'" />
153153

‎plt/src/edu/rice/cs/plt/reflect/JavaVersion.java‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,21 +158,24 @@ public static JavaVersion parseClassVersion(java.io.InputStream is) {
158158
}
159159
}
160160

161-
/**
162-
* Produce the {@code JavaVersion.FullVersion} corresponding to the given version string. Accepts
163-
* input of the form "1.6.0", "1.4.2_10", or "1.5.0_05-ea". The underscore may be replaced by a dot.
164-
* If the text cannot be parsed, a trivial version with major version UNRECOGNIZED is returned.
165-
* The location of the JDK, which may be null, will be stored in the version.
166-
*
167-
* @see <a href="http://java.sun.com/j2se/versioning_naming.html#">The Sun version specification</a>
168-
*/
161+
/** Produce the {@code JavaVersion.FullVersion} corresponding to the given version string. Accepts
162+
* input of the form "1.6.0", "1.4.2_10", or "1.5.0_05-ea". The underscore may be replaced by a dot.
163+
* If the text cannot be parsed, a trivial version with major version UNRECOGNIZED is returned.
164+
* The location of the JDK, which may be null, will be stored in the version.
165+
*
166+
* @see <a href="http://java.sun.com/j2se/versioning_naming.html#">The Sun version specification</a>
167+
*/
168+
// Why are underscores used as word separators in identifiers below?
169169
public static FullVersion parseFullVersion(String java_version,
170170
String java_runtime_name,
171171
String java_vm_vendor,
172172
File location) {
173173
VendorType vendor = VendorType.UNKNOWN;
174174
String vendorString = null;
175175

176+
/** Strip trailing ".jdk" off of java_version strings from post Java 6 Oracle JVMs for Mac OS X. */
177+
if (java_version.endsWith(".jdk")) java_version = java_version.substring(0, java_version.length() - 4);
178+
176179
if (vendor == VendorType.UNKNOWN) {
177180
if (java_runtime_name.toLowerCase().contains("openjdk")) {
178181
vendor = VendorType.OPENJDK;
@@ -194,7 +197,7 @@ else if (java_vm_vendor.toLowerCase().contains("sun") ||
194197
// if version doesn't start with "1." and has only one dot, prefix with "1."
195198
// example: 6.0 --> 1.6.0
196199
if ((!java_version.startsWith("1.")) && (java_version.replaceAll("[^\\.]","").length()==1)) {
197-
java_version = "1."+java_version;
200+
java_version = "1." + java_version;
198201
}
199202
int dash = java_version.indexOf('-');
200203
if (dash == -1) { number = java_version; typeString = null; }

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL