diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotation.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotation.java index 698b218829..d95d46ea04 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotation.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotation.java @@ -63,6 +63,7 @@ public final class RequestMappingAnnotation extends BugChecker implements Method AT_LEAST_ONE, anyOf( isType(ANN_PACKAGE_PREFIX + "PathVariable"), + isType(ANN_PACKAGE_PREFIX + "RequestAttribute"), isType(ANN_PACKAGE_PREFIX + "RequestBody"), isType(ANN_PACKAGE_PREFIX + "RequestHeader"), isType(ANN_PACKAGE_PREFIX + "RequestParam"))), diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotationTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotationTest.java index 0f38eafa03..bf34c7bee2 100644 --- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotationTest.java +++ b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotationTest.java @@ -25,6 +25,7 @@ void identification() { "import org.springframework.web.bind.annotation.PathVariable;", "import org.springframework.web.bind.annotation.PostMapping;", "import org.springframework.web.bind.annotation.PutMapping;", + "import org.springframework.web.bind.annotation.RequestAttribute;", "import org.springframework.web.bind.annotation.RequestBody;", "import org.springframework.web.bind.annotation.RequestHeader;", "import org.springframework.web.bind.annotation.RequestMapping;", @@ -47,12 +48,15 @@ void identification() { " A properPathVariable(@PathVariable String param);", "", " @PatchMapping", - " A properRequestBody(@RequestBody String body);", + " A properRequestAttribute(@RequestAttribute String attribute);", "", " @PostMapping", - " A properRequestHeader(@RequestHeader String header);", + " A properRequestBody(@RequestBody String body);", "", " @PutMapping", + " A properRequestHeader(@RequestHeader String header);", + "", + " @RequestMapping", " A properRequestParam(@RequestParam String param);", "", " @RequestMapping",