mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 08:11:25 +00:00
Compare commits
1 Commits
nkooij/tim
...
rossendrij
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13339421e5 |
@@ -7,6 +7,7 @@ import static com.google.errorprone.matchers.ChildMultiMatcher.MatchType.ALL;
|
||||
import static com.google.errorprone.matchers.ChildMultiMatcher.MatchType.AT_LEAST_ONE;
|
||||
import static com.google.errorprone.matchers.Matchers.annotations;
|
||||
import static com.google.errorprone.matchers.Matchers.anyOf;
|
||||
import static com.google.errorprone.matchers.Matchers.isPrimitiveOrBoxedPrimitiveType;
|
||||
import static com.google.errorprone.matchers.Matchers.isSameType;
|
||||
import static com.google.errorprone.matchers.Matchers.isType;
|
||||
import static com.google.errorprone.matchers.Matchers.methodHasParameters;
|
||||
@@ -19,6 +20,7 @@ import com.google.errorprone.bugpatterns.BugChecker;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.MethodTreeMatcher;
|
||||
import com.google.errorprone.matchers.Description;
|
||||
import com.google.errorprone.matchers.Matcher;
|
||||
import com.google.errorprone.util.ASTHelpers;
|
||||
import com.sun.source.tree.MethodTree;
|
||||
import com.sun.source.tree.Tree;
|
||||
|
||||
|
||||
@@ -129,4 +129,36 @@ final class RequestMappingAnnotationTest {
|
||||
"}")
|
||||
.doTest();
|
||||
}
|
||||
|
||||
// XXX:
|
||||
// https://tedblob.com/spring-boot-bind-request-parameters-to-object/#2-3-use-pojo-to-bind-multiple-parameters
|
||||
// https://stackoverflow.com/questions/33157785/in-java-is-there-any-way-to-tell-if-a-class-is-a-simple-java-class
|
||||
@Test
|
||||
void identificationIgnorePOJO() {
|
||||
compilationTestHelper
|
||||
.addSourceLines(
|
||||
"com/example/Person.java",
|
||||
"package com.example;",
|
||||
"",
|
||||
" public final class Person {",
|
||||
" final String name;",
|
||||
" final int age;",
|
||||
"",
|
||||
" Person(String name, int age) {",
|
||||
" this.name = name;",
|
||||
" this.age = age;",
|
||||
" }",
|
||||
" }")
|
||||
.addSourceLines(
|
||||
"com/example/A.java",
|
||||
"package com.example;",
|
||||
"",
|
||||
"import org.springframework.web.bind.annotation.GetMapping;",
|
||||
"",
|
||||
"class A {",
|
||||
" @GetMapping(\"foo\")",
|
||||
" public void pojoShouldNotBeFlagged(Person person) {}",
|
||||
"}")
|
||||
.doTest();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user