Skip to content

Commit bd123d0

Browse files
author
mgricken
committed
Simplified the 'treat major versions from different
vendors separately' logic from the previous version. Updated ConcJUnit library to a "no dependencies" version to prevent clashes with plt.jar. Updated plt.jar and dynamicjava-base.jar. M plt/src/edu/rice/cs/plt/reflect/JavaVersion.java M eclipse/lib/plt.jar M dynamicjava/lib/plt.jar M drjava/lib/javalanglevels-base.jar AM drjava/lib/concutest-junit-4.7-withrt-nodep.jar AM drjava/lib/buildlib/concutest-junit-4.7-withrt-nodep.jar AM drjava/lib/buildlib/concjunitrt.jar D drjava/lib/buildlib/concutest-junit-4.7-withrt.jar M drjava/lib/dynamicjava-base.jar M drjava/lib/plt.jar D drjava/lib/concutest-junit-4.7-withrt.jar M drjava/src/edu/rice/cs/drjava/model/DefaultGlobalModel.java M drjava/src/edu/rice/cs/drjava/model/repl/newjvm/InterpreterJVM.java M drjava/build.xml M javalanglevels/lib/plt.jar git-svn-id: file:///tmp/test-svn/trunk@5121 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent ed10699 commit bd123d0

File tree

13 files changed

+28
-51
lines changed

13 files changed

+28
-51
lines changed

drjava/build.xml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,10 +1371,15 @@
13711371
<if>
13721372
<istrue value="${use-concjunit}" />
13731373
<then>
1374-
<property name="junit-jar-1" location="lib/buildlib/concutest-junit-4.7-withrt.jar" />
1374+
<property name="junit-jar-1" location="lib/buildlib/concutest-junit-4.7-withrt-nodep.jar" />
13751375
<available property="junit-jar" value="${junit-jar-1}" file="${junit-jar-1}" />
13761376

1377-
<fail message="Can't find concutest-junit-4.7-withrt.jar in the lib/buildlib directory" unless="junit-jar" />
1377+
<fail message="Can't find concutest-junit-4.7-withrt-nodep.jar in the lib/buildlib directory" unless="junit-jar" />
1378+
1379+
<property name="concjunitrt-jar-1" location="lib/buildlib/concjunitrt.jar" />
1380+
<available property="concjunitrt-jar" value="${concjunitrt-jar-1}" file="${concjunitrt-jar-1}" />
1381+
1382+
<fail message="Can't find concjunitrt.jar in the lib/buildlib directory" unless="concjunitrt-jar" />
13781383

13791384
<property name="rt-concjunit-jar-1" location="rt.concjunit.jar" />
13801385

@@ -1384,7 +1389,7 @@
13841389
</not>
13851390
<then>
13861391
<echo message="Instrumenting Java runtime (no changes made to original), java=${test-jvm}" />
1387-
<java jar="${junit-jar}" jvm="${test-jvm}" fork="yes" inputstring="Y"/>
1392+
<java jar="${concjunitrt-jar}" jvm="${test-jvm}" fork="yes" inputstring="Y"/>
13881393
</then>
13891394
<else>
13901395
<echo message="${rt-concjunit-jar-1} already exists, not instrumenting." />
595 KB
Binary file not shown.
901 KB
Binary file not shown.
901 KB
Binary file not shown.

drjava/lib/dynamicjava-base.jar

13.8 KB
Binary file not shown.

drjava/lib/javalanglevels-base.jar

-196 Bytes
Binary file not shown.

drjava/lib/plt.jar

66 Bytes
Binary file not shown.

drjava/src/edu/rice/cs/drjava/model/DefaultGlobalModel.java

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -237,32 +237,13 @@ public DefaultGlobalModel() {
237237
// Lightweight parsing has been disabled until we have something that is beneficial and works better in the background.
238238
// _parsingControl = new DefaultLightWeightParsingControl(this);
239239
}
240-
241-
// get a library from the map of maps
242-
private static JDKToolsLibrary getLib(Map<JavaVersion.VendorType, Map<JavaVersion.FullVersion, JDKToolsLibrary>> map,
243-
JavaVersion.VendorType vendor,
244-
JavaVersion.FullVersion v) {
245-
if (map.get(vendor)==null) return null;
246-
else return map.get(vendor).get(v);
247-
}
248-
249-
// add a library to the map of maps
250-
private static void putLib(Map<JavaVersion.VendorType, Map<JavaVersion.FullVersion, JDKToolsLibrary>> map,
251-
JavaVersion.VendorType vendor,
252-
JavaVersion.FullVersion v,
253-
JDKToolsLibrary lib) {
254-
Map<JavaVersion.FullVersion, JDKToolsLibrary> m = map.get(vendor);
255-
if (m==null) {
256-
m = new TreeMap<JavaVersion.FullVersion, JDKToolsLibrary>();
257-
map.put(vendor, m);
258-
}
259-
m.put(v, lib);
260-
}
261-
262-
private static JavaVersion.FullVersion fvOnly(JavaVersion.FullVersion tVersion) {
240+
241+
// makes the version coarser, if desired: if DISPLAY_ALL_COMPILER_VERSIONS is disabled, then only
242+
// the major version and the vendor will be considered
243+
private static JavaVersion.FullVersion coarsenVersion(JavaVersion.FullVersion tVersion) {
263244
BooleanOption displayAllOption = edu.rice.cs.drjava.config.OptionConstants.DISPLAY_ALL_COMPILER_VERSIONS;
264245
if (!DrJava.getConfig().getSetting(displayAllOption).booleanValue()) {
265-
tVersion = tVersion.majorVersion().fullVersion();
246+
tVersion = tVersion.onlyMajorVersionAndVendor();
266247
}
267248
return tVersion;
268249
}
@@ -274,18 +255,14 @@ private Iterable<JDKToolsLibrary> findLibraries() {
274255
// almost always be true, it seems like more trouble than it is worth
275256

276257
// map is sorted by version, lowest-to-highest
277-
Map<JavaVersion.VendorType, Map<JavaVersion.FullVersion, JDKToolsLibrary>> results =
278-
new TreeMap<JavaVersion.VendorType, Map<JavaVersion.FullVersion, JDKToolsLibrary>>();
258+
Map<JavaVersion.FullVersion, JDKToolsLibrary> results = new TreeMap<JavaVersion.FullVersion, JDKToolsLibrary>();
279259

280260
File configTools = DrJava.getConfig().getSetting(JAVAC_LOCATION);
281261
if (configTools != FileOps.NULL_FILE) {
282262
JDKToolsLibrary fromConfig = JarJDKToolsLibrary.makeFromFile(configTools, this);
283263
if (fromConfig.isValid()) {
284264
JarJDKToolsLibrary.msg("From config: "+fromConfig);
285-
putLib(results,
286-
fromConfig.version().vendor(),
287-
fvOnly(fromConfig.version()),
288-
fromConfig);
265+
results.put(coarsenVersion(fromConfig.version()), fromConfig);
289266
}
290267
else { JarJDKToolsLibrary.msg("From config: invalid "+fromConfig); }
291268
}
@@ -295,12 +272,9 @@ private Iterable<JDKToolsLibrary> findLibraries() {
295272

296273
JavaVersion.FullVersion runtimeVersion = fromRuntime.version();
297274
if (fromRuntime.isValid()) {
298-
if ((getLib(results, runtimeVersion.vendor(), fvOnly(runtimeVersion))==null)) {
275+
if (!results.containsKey(coarsenVersion(runtimeVersion))) {
299276
JarJDKToolsLibrary.msg("From runtime: "+fromRuntime);
300-
putLib(results,
301-
runtimeVersion.vendor(),
302-
fvOnly(runtimeVersion),
303-
fromRuntime);
277+
results.put(coarsenVersion(runtimeVersion), fromRuntime);
304278
}
305279
else { JarJDKToolsLibrary.msg("From runtime: duplicate "+fromRuntime); }
306280
}
@@ -309,21 +283,14 @@ private Iterable<JDKToolsLibrary> findLibraries() {
309283
Iterable<JarJDKToolsLibrary> fromSearch = JarJDKToolsLibrary.search(this);
310284
for (JDKToolsLibrary t : fromSearch) {
311285
JavaVersion.FullVersion tVersion = t.version();
312-
if (getLib(results, tVersion.vendor(), fvOnly(tVersion))==null) {
286+
if (!results.containsKey(coarsenVersion(tVersion))) {
313287
JarJDKToolsLibrary.msg("From search: "+t);
314-
putLib(results,
315-
tVersion.vendor(),
316-
fvOnly(tVersion),
317-
t);
288+
results.put(coarsenVersion(tVersion), t);
318289
}
319290
else { JarJDKToolsLibrary.msg("From search: duplicate "+t); }
320291
}
321292

322-
Iterable<JDKToolsLibrary> acc = IterUtil.empty();
323-
for(Map<JavaVersion.FullVersion, JDKToolsLibrary> vmap: results.values()) {
324-
acc = IterUtil.compose(acc, vmap.values());
325-
}
326-
return IterUtil.reverse(acc);
293+
return IterUtil.reverse(results.values());
327294
}
328295

329296
// public void junitAll() { _state.junitAll(); }

drjava/src/edu/rice/cs/drjava/model/repl/newjvm/InterpreterJVM.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public String getVariableType(String var, int... indices) {
278278
if (!_interpreterOptions.typeSystem().isArray(t)) { return "<error: value is not an array>"; }
279279
t = _interpreterOptions.typeSystem().arrayElementType(t);
280280
}
281-
return _interpreterOptions.typeSystem().userRepresentation(t);
281+
return _interpreterOptions.typeSystem().typePrinter().print(t);
282282
}
283283
}
284284

@@ -332,7 +332,7 @@ public void addInterpreter(String name, Object thisVal, Class<?> thisClass, Obje
332332
vars.add(new LocalVariable(localVarNames[i], varT, false));
333333
}
334334

335-
TypeContext ctx = new TopLevelContext(_interpreterLoader);
335+
TypeContext ctx = new ImportContext(_interpreterLoader, _interpreterOptions);
336336
if (pkg != null) { ctx = ctx.setPackage(pkg.getName()); }
337337
ctx = new ClassSignatureContext(ctx, c, _interpreterLoader);
338338
ctx = new ClassContext(ctx, c);

dynamicjava/lib/plt.jar

1.72 KB
Binary file not shown.

0 commit comments

Comments
 (0)