Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test demonstrating a bug in the Inliner. #4562

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,35 @@ public void paramCast_b308614050() {
.doTest();
}

@Test
public void b365094947() {
refactoringTestHelper
.addInputLines(
"Caller.java",
"import static java.nio.charset.StandardCharsets.UTF_8;",
"import com.google.common.io.Files;",
"import java.io.File;",
"public final class Caller {",
" public void doTest(File file, String text) throws Exception {",
" Files.write(text, file, UTF_8);",
" }",
"}")
.addOutputLines(
"Caller.java",
"import static java.nio.charset.StandardCharsets.UTF_8;",
"import com.google.common.io.Files;",
"import java.io.File;",
"public final class Caller {",
" public void doTest(File file, String text) throws Exception {",
// TODO(b/365094947): this is a bug; it clearly does not compile. It should be:
// Files.asCharSink(file, UTF_8).write(text);
" Files.asCharSink(to, charset).write(from);",
" }",
"}")
.allowBreakingChanges()
.doTest();
}

private BugCheckerRefactoringTestHelper bugCheckerWithPrefixFlag(String prefix) {
return BugCheckerRefactoringTestHelper.newInstance(Inliner.class, getClass())
.setArgs("-XepOpt:" + PREFIX_FLAG + "=" + prefix);
Expand Down
Loading