@@ -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
0 commit comments