Skip to content

Commit 24d7e75

Browse files
committed
This revision cleans up javalanglevels, primarily by replacing asm-3.1.jar with asm-all-5.0.1.jar.
It also relaxes some restrictions on the functional level but we really need a comprehensive revision relaxing the restrictions wherever possible.
1 parent 474a9ae commit 24d7e75

41 files changed

Lines changed: 744 additions & 696 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

drjava/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
*.jar
1+
drjava.jar
22
classes/
33

drjava/build.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
Compilation Targets
219219
******************* -->
220220

221-
<!-- The following target assumes that javac resolves a Java 8 compiler -->
221+
<!-- The following target assumes that javac resolves a Java 7 compiler -->
222222
<target name="compile" depends="generate-source, do-compile, copy-resources, unjar-libs"
223223
description="Compile all source files (after generating the source)">
224224
</target>
@@ -236,13 +236,13 @@
236236
</move>
237237

238238
<javac srcdir="src" destdir="classes/base" source="1.6" target="1.6"
239-
bootclasspath="${java8-runtime}" sourcepath="" includeAntRuntime="no"
239+
bootclasspath="${java7-runtime}" sourcepath="" includeAntRuntime="no"
240240
executable="javac" fork="yes" memoryMaximumSize="1024M"
241241
debug="on" optimize="off" deprecation="on" >
242242
<classpath>
243243
<!-- TODO: Remove this dependency on tools.jar by refactoring and moving all the dependent
244244
debugger code into the "platform" module -->
245-
<pathelement location="${java8-tools}" />
245+
<pathelement location="${java7-tools}" />
246246
<fileset refid="libs" />
247247
<pathelement location="lib/buildlib/junit.jar" />
248248
<pathelement location="lib/buildlib/netbeans-memory-leak-utils.jar" />

drjava/lib/ecj-3.6M7.jar

-1.61 MB
Binary file not shown.

drjava/lib/ecj-4.9.jar

1.54 MB
Binary file not shown.

drjava/lib/javalanglevels-base.jar

26.1 KB
Binary file not shown.

drjava/lib/platform.jar

20 Bytes
Binary file not shown.

drjava/lib/tools6.jar

6.43 MB
Binary file not shown.

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

Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -539,14 +539,16 @@ public boolean accept(File dir, String name) {
539539
if (bootClassPath == null) { llOpts = new Options(getActiveCompiler().version(), classPath); }
540540
else { llOpts = new Options(getActiveCompiler().version(), classPath, bootClassPath); }
541541

542-
// NOTE: the following workaround ("_testFileSort(files)" instead of simply "files") may no longer be necessary.
543-
/* Perform the conversion incorporating the following Bug Workaround: Forward references can generate spurious
542+
// NOTE: the workaround "_testFileSort(files)" instead of simply "files") may no longer be necessary.
543+
544+
/* Perform the LL conversion incorporating the following workaround: Forward references can generate spurious
544545
* conversion errors in some cases. This problem can be mitigated by compiling JUnit test files (with names
545546
* containing the substring "Test") last.
546547
*/
547548
Map<File,Set<String>> sourceToTopLevelClassMap = new HashMap<File,Set<String>>();
548549
Pair<LinkedList<JExprParseException>, LinkedList<Pair<String, JExpressionIF>>> llErrors =
549550
llc.convert(_testFileSort(files).toArray(new File[0]), llOpts, sourceToTopLevelClassMap);
551+
550552
/* Add any errors encountered in conversion to the compilation error log. */
551553
errors.addAll(_parseExceptions2CompilerErrors(llErrors.getFirst()));
552554
errors.addAll(_visitorErrors2CompilerErrors(llErrors.getSecond()));
@@ -635,64 +637,64 @@ else if (_compilers.contains(compiler)) {
635637
// _compilers.add(compiler);
636638
// }
637639

638-
/** Delete the .class files that match the following pattern:
639-
* XXX.dj? --> XXX.class
640-
* XXX$*.class
641-
* @param sourceToTopLevelClassMap a map from directories to classes in them
642-
*/
643-
public void smartDeleteClassFiles(Map<File,Set<String>> sourceToTopLevelClassMap) {
644-
final File buildDir = _model.getBuildDirectory();
645-
final File sourceDir = _model.getProjectRoot();
646-
// Accessing the disk is the most costly part; therefore, we want to scan each directory only once.
647-
// We create a map from parent directory to class names in that directory.
648-
// Then we scan the files in each directory and delete files that match the class names listed for it.
649-
// dirToClassNameMap: key=parent directory, value=set of classes in this directory
650-
Map<File,Set<String>> dirToClassNameMap = new HashMap<File,Set<String>>();
651-
for(Map.Entry<File,Set<String>> e: sourceToTopLevelClassMap.entrySet()) {
652-
try {
653-
File dir = e.getKey().getParentFile();
654-
if (buildDir != null && buildDir != FileOps.NULL_FILE &&
655-
sourceDir != null && sourceDir != FileOps.NULL_FILE) {
656-
// build directory set
657-
String rel = edu.rice.cs.util.FileOps.stringMakeRelativeTo(dir,sourceDir);
658-
dir = new File(buildDir,rel);
659-
}
660-
Set<String> classNames = dirToClassNameMap.get(dir);
661-
if (classNames == null) classNames = new HashSet<String>();
662-
classNames.addAll(e.getValue());
663-
dirToClassNameMap.put(dir,classNames);
664-
// System.out.println(e.getKey() + " --> " + dir);
665-
// for(String name: e.getValue()) {
666-
// System.out.println("\t" + name);
640+
// /** Delete the .class files that match the following pattern:
641+
// * XXX.dj? --> XXX.class
642+
// * XXX$*.class
643+
// * @param sourceToTopLevelClassMap a map from directories to classes in them
644+
// */
645+
// public void smartDeleteClassFiles(Map<File,Set<String>> sourceToTopLevelClassMap) {
646+
// final File buildDir = _model.getBuildDirectory();
647+
// final File sourceDir = _model.getProjectRoot();
648+
// // Accessing the disk is the most costly part; therefore, we want to scan each directory only once.
649+
// // We create a map from parent directory to class names in that directory.
650+
// // Then we scan the files in each directory and delete files that match the class names listed for it.
651+
// // dirToClassNameMap: key=parent directory, value=set of classes in this directory
652+
// Map<File,Set<String>> dirToClassNameMap = new HashMap<File,Set<String>>();
653+
// for(Map.Entry<File,Set<String>> e: sourceToTopLevelClassMap.entrySet()) {
654+
// try {
655+
// File dir = e.getKey().getParentFile();
656+
// if (buildDir != null && buildDir != FileOps.NULL_FILE &&
657+
// sourceDir != null && sourceDir != FileOps.NULL_FILE) {
658+
// // build directory set
659+
// String rel = edu.rice.cs.util.FileOps.stringMakeRelativeTo(dir,sourceDir);
660+
// dir = new File(buildDir,rel);
661+
// }
662+
// Set<String> classNames = dirToClassNameMap.get(dir);
663+
// if (classNames == null) classNames = new HashSet<String>();
664+
// classNames.addAll(e.getValue());
665+
// dirToClassNameMap.put(dir,classNames);
666+
//// System.out.println(e.getKey() + " --> " + dir);
667+
//// for(String name: e.getValue()) {
668+
//// System.out.println("\t" + name);
669+
//// }
670+
// }
671+
// catch(IOException ioe) { /* we'll fail to delete this, but that's better than deleting something we shouldn't */ }
672+
// }
673+
// // Now that we have a map from parent directories to the class names that should be deleted
674+
// // in them, we scan the files in each directory, then check if the names match the class names.
675+
// for(final Map.Entry<File,Set<String>> e: dirToClassNameMap.entrySet()) {
676+
//// System.out.println("Processing dir: " + e.getKey());
677+
//// System.out.println("\t" + java.util.Arrays.toString(e.getValue().toArray(new String[0])));
678+
// e.getKey().listFiles(new java.io.FilenameFilter() {
679+
// public boolean accept(File dir, String name) {
680+
//// System.out.println("\t" + name);
681+
// int endPos = name.lastIndexOf(".class");
682+
// if (endPos < 0) return false; // can't be a class file
683+
// int dollarPos = name.indexOf('$');
684+
// if ((dollarPos >= 0) && (dollarPos < endPos)) endPos = dollarPos;
685+
// // class name goes to the .class or the first $, whichever comes first
686+
// Set<String> classNames = e.getValue();
687+
// if (classNames.contains(name.substring(0,endPos))) {
688+
// // this is a class file that is generated from a .dj? file
689+
// new File(dir, name).delete();
690+
// // don't need to return true, we're deleting the file here already
691+
//// System.out.println("\t\tDeleted");
667692
// }
668-
}
669-
catch(IOException ioe) { /* we'll fail to delete this, but that's better than deleting something we shouldn't */ }
670-
}
671-
// Now that we have a map from parent directories to the class names that should be deleted
672-
// in them, we scan the files in each directory, then check if the names match the class names.
673-
for(final Map.Entry<File,Set<String>> e: dirToClassNameMap.entrySet()) {
674-
// System.out.println("Processing dir: " + e.getKey());
675-
// System.out.println("\t" + java.util.Arrays.toString(e.getValue().toArray(new String[0])));
676-
e.getKey().listFiles(new java.io.FilenameFilter() {
677-
public boolean accept(File dir, String name) {
678-
// System.out.println("\t" + name);
679-
int endPos = name.lastIndexOf(".class");
680-
if (endPos < 0) return false; // can't be a class file
681-
int dollarPos = name.indexOf('$');
682-
if ((dollarPos >= 0) && (dollarPos < endPos)) endPos = dollarPos;
683-
// class name goes to the .class or the first $, whichever comes first
684-
Set<String> classNames = e.getValue();
685-
if (classNames.contains(name.substring(0,endPos))) {
686-
// this is a class file that is generated from a .dj? file
687-
new File(dir, name).delete();
688-
// don't need to return true, we're deleting the file here already
689-
// System.out.println("\t\tDeleted");
690-
}
691-
return false;
692-
}
693-
});
694-
}
695-
}
693+
// return false;
694+
// }
695+
// });
696+
// }
697+
// }
696698

697699
/** returns the LanguageLevelStackTraceMapper
698700
* @return the LanguageLevelStackTraceMapper

drjava/src/edu/rice/cs/drjava/model/repl/DefaultInteractionsModel.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ public void run() {
128128
});
129129
}
130130

131+
/** Any extra action to perform (beyond notifying listeners) when the interpreter won't start.
132+
* @param e The Exception indicating the interpreter won't start
133+
*/
131134
protected void _interpreterWontStart(final Exception e) {
132135
Utilities.invokeLater(new Runnable() {
133136
public void run() {

drjava/src/edu/rice/cs/drjava/model/repl/InteractionsModel.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -766,15 +766,17 @@ public void interpreterWontStart(Exception e) {
766766
* @param t The Throwable thrown by System.exit
767767
*/
768768
protected abstract void _interpreterResetFailed(Throwable t);
769+
770+
/** Any extra action to perform (beyond notifying listeners) when the interpreter won't start.
771+
* @param e The Exception indicating the interpreter won't start
772+
*/
773+
protected abstract void _interpreterWontStart(final Exception e);
769774

770775
/** Notifies listeners that the interpreter reset failed. (Subclasses must maintain listeners.)
771776
* @param t Throwable explaining why the reset failed.
772777
*/
773778
protected abstract void _notifyInterpreterResetFailed(Throwable t);
774779

775-
/** Action to perform when the interpreter won't start. */
776-
protected abstract void _interpreterWontStart(Exception e);
777-
778780
public String getBanner() { return _banner; }
779781

780782
public String getStartUpBanner() { return getBanner(_workingDirectory); }

0 commit comments

Comments
 (0)