Skip to content

Commit 11d6d5c

Browse files
committed
In this revision, DrScala is reasonably reliable and stable. All tests up to
(but not including) GlobalModelIOTest pass. The primary glitch is a false distinction between interpreterReplaced and interpreterReady events. The following files were modified, added, or deleted: modified: drjava/src/edu/rice/cs/drjava/model/AbstractGlobalModel.java modified: drjava/src/edu/rice/cs/drjava/model/DefaultGlobalModel.java modified: drjava/src/edu/rice/cs/drjava/model/GlobalModelCompileSuccessOptionsTest.java modified: drjava/src/edu/rice/cs/drjava/model/GlobalModelIOTest.java modified: drjava/src/edu/rice/cs/drjava/model/GlobalModelJUnitTest.java modified: drjava/src/edu/rice/cs/drjava/model/GlobalModelTestCase.java modified: drjava/src/edu/rice/cs/drjava/model/compiler/DefaultCompilerModel.java modified: drjava/src/edu/rice/cs/drjava/model/repl/DefaultInteractionsModel.java modified: drjava/src/edu/rice/cs/drjava/model/repl/InteractionsListener.java modified: drjava/src/edu/rice/cs/drjava/model/repl/InteractionsModel.java modified: drjava/src/edu/rice/cs/drjava/model/repl/InteractionsModelTest.java modified: drjava/src/edu/rice/cs/drjava/model/repl/RMIInteractionsModel.java modified: drjava/src/edu/rice/cs/drjava/project/XMLProjectFileParserTest.java
1 parent 0077771 commit 11d6d5c

13 files changed

+233
-186
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
*/
161161
public class AbstractGlobalModel implements SingleDisplayModel, OptionConstants, DocumentIterator {
162162

163-
public static final Log _log = DrScala._log;
163+
public static final Log _log = new Log("GlobalModel.txt", false);
164164

165165
/** A document cache that manages how many unmodified documents are open at once. */
166166
protected DocumentCache _cache;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,6 @@ public void resetInteractions(File wd) {
410410
File workDir = _interactionsModel.getWorkingDirectory();
411411

412412
if (wd == null) wd = workDir;
413-
414-
/* This optimization is not working. Commented out for now. */
415413

416414
if ((wd == workDir) && _mainJVM.classPathUnchanged()) {
417415
_log.log("Attempting to reset interpreter in resetInteractions");
@@ -434,6 +432,7 @@ public void resetInteractions(File wd) {
434432
else {
435433
_log.log("reset interpreter failed, forcing a hard reset");
436434
hardResetInteractions(wd);
435+
_interactionsModel._notifyInterpreterReady(); // _notifyInterpreterReady invokes the event thread
437436
}
438437

439438
final InteractionsDocument iDoc = _interactionsModel.getDocument();

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public final class GlobalModelCompileSuccessOptionsTest extends GlobalModelCompi
5858
* NOTE: this is the DrScala conversion of a legacy DrJava test. All top level classes in Scala are public.
5959
*/
6060
public void testCompileReferenceToNonPublicClass() throws BadLocationException, IOException, InterruptedException {
61-
_log.log("Starting testCompileReferenceToNonPublicClass()");
61+
_log.log("+++Starting testCompileReferenceToNonPublicClass()");
6262
OpenDefinitionsDocument doc = setupDocument(FOO_NON_PUBLIC_CLASS_TEXT);
6363
OpenDefinitionsDocument doc2 = setupDocument(FOO2_REFERENCES_NON_PUBLIC_CLASS_TEXT);
6464
final File file = tempFile();
@@ -68,13 +68,16 @@ public void testCompileReferenceToNonPublicClass() throws BadLocationException,
6868
CompileShouldSucceedListener listener = new CompileShouldSucceedListener();
6969
_model.addListener(listener);
7070
listener.compile(doc);
71+
_log.log("doc compiled");
7172
if (_model.getCompilerModel().getNumErrors() > 0) { fail("compile failed: " + getCompilerErrorString()); }
7273
listener.checkCompileOccurred();
7374
_model.removeListener(listener);
75+
_log.log("listener removed");
7476

7577
CompileShouldSucceedListener listener2 = new CompileShouldSucceedListener();
7678
_model.addListener(listener2);
7779
listener2.compile(doc2);
80+
_log.log("doc2 compiled");
7881
if (_model.getCompilerModel().getNumErrors() > 0) { fail("compile failed: " + getCompilerErrorString()); }
7982
listener2.checkCompileOccurred();
8083
_model.removeListener(listener2);
@@ -88,7 +91,7 @@ public void testCompileReferenceToNonPublicClass() throws BadLocationException,
8891
File compiled2 = classForScala(file, "DrScalaTestFoo2");
8992
assertTrue(_name() + "Class file should exist after compile", compiled.exists());
9093
assertTrue(_name() + "Class file should exist after compile", compiled2.exists());
91-
_log.log("Ending testCompileReferenceToNonPublicClass()");
94+
_log.log("+++Ending testCompileReferenceToNonPublicClass()");
9295
}
9396

9497
/** Tests compiling a file with generics works with generic compilers.
@@ -98,7 +101,7 @@ public void testCompileReferenceToNonPublicClass() throws BadLocationException,
98101
* is -- the lib directory -- but how can we get a URL for that?)
99102
*/
100103
public void testCompileWithGenerics()throws BadLocationException, IOException, InterruptedException {
101-
_log.log("Starting testCompileWithGenerics()");
104+
_log.log("+++Starting testCompileWithGenerics()");
102105
// Only run this test if using a compiler with generics
103106
if (_isGenericCompiler()) {
104107

@@ -121,13 +124,13 @@ public void testCompileWithGenerics()throws BadLocationException, IOException, I
121124
// Make sure .class exists
122125
File compiled = classForScala(file, "DrScalaTestFooGenerics");
123126
assertTrue(_name() + " FooGenerics Class file doesn't exist after compile", compiled.exists());
124-
_log.log("Ending testCompileWithGenerics()");
127+
_log.log("+++Ending testCompileWithGenerics()");
125128
}
126129
}
127130

128131
/** Confirms that calling compileAll with different source roots succeeds. */
129132
public void testCompileAllDifferentSourceRoots() throws BadLocationException, IOException, InterruptedException {
130-
_log.log("Starting testCompileAllDifferentSourceRoots");
133+
_log.log("+++Starting testCompileAllDifferentSourceRoots");
131134
// System.err.println("testCompileAllDifferentSourceRoots() compiler =" + _name());
132135
File aDir = new File(_tempDir, "a");
133136
File bDir = new File(_tempDir, "b");
@@ -163,6 +166,6 @@ public void testCompileAllDifferentSourceRoots() throws BadLocationException, IO
163166
// File compiled2 = classForScala(file2, "DrSclaTestFoo");
164167
// assertTrue(_name() + "Foo Class file doesn't exist after compile", ! compiled2.exists());
165168
_model.removeListener(listener);
166-
_log.log("Ending testCompileAllDifferentSourceRoots");
169+
_log.log("+++Ending testCompileAllDifferentSourceRoots");
167170
}
168171
}

0 commit comments

Comments
 (0)