Skip to content

Commit 77b08b2

Browse files
author
rcartwright
committed
This revision fixes a bug in checking for redundant files in LanguageLevelConverter.java and streamlines the implementation of that checking.
The following file was modified: M src/edu/rice/cs/javalanglevels/LanguageLevelConverter.java git-svn-id: file:///tmp/test-svn/trunk@4954 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent e1389dd commit 77b08b2

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

javalanglevels/src/edu/rice/cs/javalanglevels/LanguageLevelConverter.java

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -139,26 +139,16 @@ of illegal constructs (e.g. public and constructors). */
139139
for (File f : files) {
140140

141141
try {
142+
if (filesNotToCheck.contains(f)) continue; // Detects equal files; earlier code versions claimed it failed
143+
// Check for a null file
142144
BufferedReader tempBr = new BufferedReader(new FileReader(f));
143145
String firstLine = tempBr.readLine();
144-
if (firstLine == null) continue;
145146
tempBr.close();
147+
if (firstLine == null) continue;
146148

147-
/* If the file has the correct suffix, then parse it. Ignore files in filesNotToCheck. contains on
148-
* filesNotToCheck failed to return desired result. So it is done manually, matching AbsolutePath. */
149-
// boolean foundFile = false;
150-
151-
for (File fntc: files) {
152-
if (fntc.getAbsolutePath().equals(f.getAbsolutePath())) {
153-
// foundFile = true;
154-
break;
155-
}
156-
}
157-
158-
if (_isLanguageLevelFile(f) /* && ! foundFile*/) {
149+
if (_isLanguageLevelFile(f)) {
159150
System.out.flush();
160151
SourceFile sf;
161-
// File f = files[ind];
162152
JExprParser jep = new JExprParser(f);
163153
try {
164154
sf = jep.SourceFile();
@@ -177,7 +167,7 @@ of illegal constructs (e.g. public and constructors). */
177167
continue;
178168
}
179169

180-
//Now create a LanguageLevelVisitor to do the first pass over the file.
170+
// Now create a LanguageLevelVisitor to do the first pass over the file.
181171
LanguageLevelVisitor llv = null;
182172
if (isElementaryFile(f)) {
183173
llv =

0 commit comments

Comments
 (0)