-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support alternate JavaCompilers (such as ECJ) in CompilationRule
ECJ expects all JavaFileObjects to be Files, so the rule no longer uses Compilation.compile() but instead directly uses the JavaCompiler, and processes a class rather than compiling a dummy (in-memory) source.
- Loading branch information
Showing
3 changed files
with
92 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/test/java/com/google/testing/compile/EclipseCompilationRuleTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.google.testing.compile; | ||
|
||
import javax.tools.JavaCompiler; | ||
|
||
import org.eclipse.jdt.internal.compiler.tool.EclipseCompiler; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.JUnit4; | ||
|
||
import com.google.common.base.Supplier; | ||
|
||
@RunWith(JUnit4.class) | ||
public class EclipseCompilationRuleTest extends CompilationRuleTest { | ||
{ | ||
compilationRule = new CompilationRule(new Supplier<JavaCompiler>() { | ||
@Override | ||
public JavaCompiler get() { | ||
return new EclipseCompiler(); | ||
} | ||
}); | ||
} | ||
} |