Skip to content

error-prone integration does not generate patches #5729

@vmax

Description

@vmax

Description of the problem / feature request:

Built-in error-prone cannot generate a patch to fix the problem it had found.

Feature requests: what underlying problem are you trying to solve with this feature?

Correct errors found by error-prone easier

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

$ cat > BUILD << EOF
java_binary(
name="main",
srcs=["Main.java"],
main_class='com.example.Main'
)
EOF

$ cat > Main.java << EOF
package com.example;

public class Main {
	public static void main(String[] args) {
		new Exception();
	}
}
EOF

$ touch WORKSPACE
$ bazel build --javacopt="-XepPatchChecks:DeadException -XepPatchLocation:`pwd`" //:main
INFO: Analysed target //:main (1 packages loaded).
INFO: Found 1 target...
ERROR: /Users/vmax/work/AppStory/tmptmp/BUILD:1:1: Building main.jar (1 source file) failed (Exit 1)
Main.java:5: error: [DeadException] Exception created but not thrown
		new Exception();
		^
    (see http://errorprone.info/bugpattern/DeadException)
  Did you mean 'throw new Exception();'?
Target //:main failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.265s, Critical Path: 0.08s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

$ ls -1 | grep -v bazel-
BUILD
Main.java
WORKSPACE

# I expect `error-prone.patch` to be there

What operating system are you running Bazel on?

macOS High Sierra 10.13.6

What's the output of bazel info release?

release 0.14.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)staleIssues or PRs that are stale (no activity for 30 days)team-Rules-JavaIssues for Java rulestype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions