* build/generator/gen_base.py
(TargetJavaClasses.add_dependencies): Reverse check for valid filename to
fail early and avoid an extra level of indentation.  No functional change.
@@ -972,7 +972,9 @@ class TargetJavaClasses(TargetJava):
sources.extend(_collect_paths(self.sources, p))
for src, reldir in sources:
- if src[-5:] == '.java':
+ if src[-5:] != '.java':
+ raise GenError('ERROR: unknown file extension on "' + src + '"')
+
objname = src[:-5] + self.objext
# As .class files are likely not generated into the same
@@ -988,8 +990,6 @@ class TargetJavaClasses(TargetJava):
break
else:
raise GenError('Unable to find Java package root in path "%s"' % objname)
- else:
- raise GenError('ERROR: unknown file extension on "' + src + '"')
ofile = ObjectFile(objname, self.compile_cmd, self.when)
sfile = SourceFile(src, reldir)
