You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/10/17 00:42:46 UTC
groovy git commit: trivial refactor - remove a little bit of
duplication
Repository: groovy
Updated Branches:
refs/heads/master 5a7e04e86 -> 57a68275e
trivial refactor - remove a little bit of duplication
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/57a68275
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/57a68275
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/57a68275
Branch: refs/heads/master
Commit: 57a68275e598662dad6b34473ed83cc00482bbba
Parents: 5a7e04e
Author: paulk <pa...@asert.com.au>
Authored: Tue Oct 17 10:42:38 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Tue Oct 17 10:42:38 2017 +1000
----------------------------------------------------------------------
.../tools/javac/JavaAwareCompilationUnit.java | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/57a68275/src/main/org/codehaus/groovy/tools/javac/JavaAwareCompilationUnit.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/tools/javac/JavaAwareCompilationUnit.java b/src/main/org/codehaus/groovy/tools/javac/JavaAwareCompilationUnit.java
index a872e32..96f5840 100644
--- a/src/main/org/codehaus/groovy/tools/javac/JavaAwareCompilationUnit.java
+++ b/src/main/org/codehaus/groovy/tools/javac/JavaAwareCompilationUnit.java
@@ -131,23 +131,23 @@ public class JavaAwareCompilationUnit extends CompilationUnit {
public void addSources(String[] paths) {
for (String path : paths) {
- File file = new File(path);
- if (file.getName().endsWith(".java"))
- addJavaSource(file);
- else
- addSource(file);
+ addJavaOrGroovySource(new File(path));
}
}
public void addSources(File[] files) {
for (File file : files) {
- if (file.getName().endsWith(".java"))
- addJavaSource(file);
- else
- addSource(file);
+ addJavaOrGroovySource(file);
}
}
+ private void addJavaOrGroovySource(File file) {
+ if (file.getName().endsWith(".java"))
+ addJavaSource(file);
+ else
+ addSource(file);
+ }
+
public JavaCompilerFactory getCompilerFactory() {
return compilerFactory;
}