Skip to content

Commit

Permalink
Add a regression test for #781
Browse files Browse the repository at this point in the history
The default policy may results in compilation units being lowered before
Error Prone sees them. (context: b/36444786, b/36098770, b/27686620)

RELNOTES: N/A

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172897895
  • Loading branch information
cushon committed Oct 25, 2017
1 parent 226d791 commit 5642136
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,39 @@ public void negative() {
"}")
.doTest();
}

@Test
public void issue781() {
testHelper
.addSourceLines(
"a/Baz.java",
"package a.b;",
"import a.AbstractFoo;",
"class Baz extends AbstractFoo {",
" @Override",
" protected String getFoo() {",
" return \"foo\";",
" }",
"}")
.addSourceLines(
"a/AbstractFoo.java",
"package a;",
"import java.util.function.Function;",
"class Bar {",
" private final Function<String, String> args;",
" public Bar(Function<String, String> args) {",
" this.args = args;",
" }",
"}",
"public abstract class AbstractFoo {",
" protected abstract String getFoo();",
" private String getCommandArguments(String parameters) {",
" return null;",
" }",
" public AbstractFoo() {",
" new Bar(this::getCommandArguments);",
" }",
"}")
.doTest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public class CompilationTestHelper {
"UTF-8",
// print stack traces for completion failures
"-XDdev",
"-XDsave-parameter-names");
"-XDsave-parameter-names",
"-XDcompilePolicy=simple");

private final DiagnosticTestHelper diagnosticHelper;
private final BaseErrorProneCompiler compiler;
Expand Down

0 comments on commit 5642136

Please sign in to comment.