Skip to content

Commit 458e0a2

Browse files
committed
This small update includes patches to unit tests that perform compilation to accommodate changes to javac (!!) since Java 6.
It also makes the java 8 compiler in the installed java 8 JDK distro the preferred compiler instead of the javax.tools compiler. The imports to JPDADebugger were changed to accommodate changes to the API in the Java libraries since Java 6 (!!). Changes to be committed: modified: ../config/OptionConstants.java modified: ../model/DefaultGlobalModel.java modified: ../model/GlobalEventNotifier.java modified: ../model/GlobalModelOtherTest.java modified: ../model/compiler/DefaultCompilerModel.java modified: ../model/debug/jpda/JPDADebugger.java modified: MainFrame.java
1 parent 9a56765 commit 458e0a2

File tree

7 files changed

+18
-16
lines changed

7 files changed

+18
-16
lines changed

drjava/src/edu/rice/cs/drjava/config/OptionConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public interface OptionConstants {
129129

130130
/** Whether to display all versions of the compilers (even if they have the same major version). */
131131
public static final BooleanOption DISPLAY_ALL_COMPILER_VERSIONS =
132-
new BooleanOption("all.compiler.versions", Boolean.FALSE);
132+
new BooleanOption("all.compiler.versions", Boolean.TRUE);
133133

134134

135135
/* ---------- Color Options ---------- */

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,9 @@ public void activeCompilerChanged() {
179179
/* CONSTRUCTORS */
180180
/** Constructs a new GlobalModel. Creates a new MainJVM and starts its Interpreter JVM. */
181181
public DefaultGlobalModel() {
182-
Iterable<? extends JDKToolsLibrary> tools = findLibraries(); // findLibraries should be called findTools
182+
Iterable<? extends JDKToolsLibrary> tools = findTools(); // findTools should be called findTools
183183
LinkedList<CompilerInterface> compilers = new LinkedList<CompilerInterface>();
184184

185-
// TODO: should this be done a different way?
186-
JavaxToolsCompiler javaxCompiler = new JavaxToolsCompiler();
187-
compilers.add(javaxCompiler);
188-
189185
/* Note: the only debugger used in DrJava is JPDADebugger in the DrJava code base which relies
190186
* on machinery provided by the tools.jar library included in every Java JDK (up through JDK 8). A copy of the
191187
* tools.jar library from Java 8 Open JDK is included in the drjava.jar file.
@@ -322,7 +318,7 @@ private LibraryKey getLibraryKey(int priority, JDKToolsLibrary lib) {
322318
}
323319

324320
/** Fills the results Map with available tools.jar files located within found JDK distributions. */
325-
private Iterable<JDKToolsLibrary> findLibraries() {
321+
private Iterable<JDKToolsLibrary> findTools() {
326322
// Order to return: config setting, runtime (if different version), from search (if different versions)
327323

328324
// map is sorted by version, lowest-to-highest
@@ -372,7 +368,7 @@ private Iterable<JDKToolsLibrary> findLibraries() {
372368
JDKToolsLibrary.msg("Adding default library: " + defaultLibrary);
373369

374370
Iterable<JDKToolsLibrary> libraries = IterUtil.reverse(results.values());
375-
JDKToolsLibrary.msg("findLibraries() returning libraries: " + libraries);
371+
JDKToolsLibrary.msg("findTools() returning libraries: " + libraries);
376372
return libraries;
377373
}
378374

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,14 +477,14 @@ public void compileBeforeJUnit(final CompilerListener cl, List<OpenDefinitionsDo
477477
finally { _lock.endRead(); }
478478
}
479479

480-
/** Called after JUnit is started by the GlobalModel. */
480+
/** Called after JUnit is started by the GlobalModel. Propogates the call to all GlobalModelListeners. */
481481
public void junitStarted() {
482482
_lock.startRead();
483483
try { for (GlobalModelListener l : _listeners) { l.junitStarted(); } }
484484
finally { _lock.endRead(); }
485485
}
486486

487-
/** Called when testing specific list of classes. */
487+
/** Called when testing specific list of classes. Propogates the call to all GlobalModelListeners. */
488488
public void junitClassesStarted() {
489489
_lock.startRead();
490490
try { for (GlobalModelListener l : _listeners) { l.junitClassesStarted(); } }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
public final class GlobalModelOtherTest extends GlobalModelTestCase implements OptionConstants {
5353

5454
// _log can be inherited from GlobalModelTestCase
55-
Log _log = new Log("GlobalModelOtherTest.txt", false);
55+
Log _log = new Log("GlobalModelOtherTest.txt", true);
5656

5757
private static final String FOO_CLASS =
5858
"package bar;\n" +

drjava/src/edu/rice/cs/drjava/model/compiler/DefaultCompilerModel.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
public class DefaultCompilerModel implements CompilerModel {
6868

6969
/** for logging debug info */
70-
private static final Log _log = new edu.rice.cs.util.Log("DefaultCompilerModel.txt", false);
70+
private static final Log _log = new edu.rice.cs.util.Log("DefaultCompilerModel.txt", true);
7171

7272
/** The available compilers */
7373
private final List<CompilerInterface> _compilers;
@@ -103,10 +103,16 @@ public DefaultCompilerModel(GlobalModel m, Iterable<? extends CompilerInterface>
103103

104104
for (CompilerInterface i : compilers) { _compilers.add(i); compilerNames.add(i.getName());}
105105

106+
// TODO: should this be done a different way?
107+
JavaxToolsCompiler javaxCompiler = new JavaxToolsCompiler();
108+
_compilers.add(javaxCompiler);
109+
106110
OptionConstants.COMPILER_PREFERENCE_CONTROL.setList(compilerNames); // populates the compiler list for preference panel
107111

108112
String dCompName = DrJava.getConfig().getSetting(OptionConstants.DEFAULT_COMPILER_PREFERENCE);
109113

114+
// Utilities.show("dCompName = " + dCompName);
115+
110116
if (_compilers.size() > 0) {
111117
if (! dCompName.equals(OptionConstants.COMPILER_PREFERENCE_CONTROL.NO_PREFERENCE) &&
112118
compilerNames.contains(dCompName))

drjava/src/edu/rice/cs/drjava/model/debug/jpda/JPDADebugger.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,9 @@ public static boolean isJavaIdentifier(String s) {
496496
}
497497

498498
/** Adds a watch on the given field or variable.
499-
* @param field the name of the field we will watch
500-
* @throws DebugException if something goes wrong
501-
*/
499+
* @param field the name of the field we will watch
500+
* @throws DebugException if something goes wrong
501+
*/
502502
public /* synchronized */ void addWatch(String field) throws DebugException {
503503
// _ensureReady();
504504
assert EventQueue.isDispatchThread();

drjava/src/edu/rice/cs/drjava/ui/MainFrame.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1874,7 +1874,7 @@ public Set<JavaAPIListEntry> getJavaAPISet() {
18741874
private void generateJavaAPISet() {
18751875
// should NOT be called in the event thread
18761876
// otherwise the processing frame will not work correctly and the event thread will block
1877-
// assert (!EventQueue.isDispatchThread()); // Why is this commented out???
1877+
assert (!EventQueue.isDispatchThread());
18781878
if (_javaAPISet.size() == 0) {
18791879
final ProcessingDialog pd =
18801880
new ProcessingDialog(this, "Java API Classes", "Loading, please wait.", false);

0 commit comments

Comments
 (0)