RefasterRuleCompiler silently ignores compilation errors in refaster templates
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
### What version of Error Prone are you using?
2.1.0
### Does this issue reproduce with the latest release?
Unclear -- the current [documentation](https://errorprone.info/docs/refaster#running-the-refaster-refactoring) recommends the old version, and the API seems to be different on the latest version.
### What did you do?
1. Create a Refaster template with a compilation error:
```java
import com.google.errorprone.refaster.annotation.AfterTemplate;
import com.google.errorprone.refaster.annotation.BeforeTemplate;
public class InvalidRefasterTemplate {
@BeforeTemplate
void foo(boolean bool) {
this code is invalid and should not compile
}
@AfterTemplate
void bar(boolean bool) {
}
}
```
1. Follow the instructions [here](https://errorprone.info/docs/refaster#running-the-refaster-refactoring) to try to compile the Refaster template:
```bash
$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
$ java -Xbootclasspath/p:error_prone_refaster-2.1.0.jar:javac-9-dev-r4023-3.jar com.google.errorprone.refaster.RefasterRuleCompiler InvalidRefasterTemplate.java --out my-refaster-rule.refaster
```
### What did you expect to see?
I expected Refaster to output an error since the given refaster template is invalid.
### What did you see instead?
The `java` process silently exited with exit code 0. No output file was produced.
In the above example the compilation error is obvious, but this issue can make it difficult to debug more subtle compilation problems because the compiler provides no indication that there was an error.
Contributor guide
Assessment
This issue has not been assessed yet.