Skip to content

Make TooManyParameters analyzer ignore methods that have apps framework HttpMethod annotations. #4901

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

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 @@ -253,4 +253,79 @@ public ImmutableList<TestParameters.TestParametersValues> provideValues(Context
""")
.doTest();
}

@Test
public void testHttpMethods() {
compilationHelper
.setArgs(ImmutableList.of("-XepOpt:" + TOO_MANY_PARAMETERS_FLAG_NAME + "=3"))
.addSourceLines(
"HttpMethod.java",
"""
package com.google.apps.framework.request;

public final class HttpMethod {
public @interface All {}

public @interface Head {}

public @interface Get {}

public @interface Post {}

public @interface Put {}

public @interface Patch {}

public @interface Delete {}

public @interface Options {}
}
""")
.addSourceLines(
"SomeAction.java",
"""
public final class SomeAction {
@com.google.apps.framework.request.HttpMethod.All
public Object executeAll(int a, int b, int c, int d, int e) {
return new Object();
}

@com.google.apps.framework.request.HttpMethod.Head
public Object executeHead(int a, int b, int c, int d, int e) {
return new Object();
}

@com.google.apps.framework.request.HttpMethod.Get
public Object executeGet(int a, int b, int c, int d, int e) {
return new Object();
}

@com.google.apps.framework.request.HttpMethod.Post
public Object executePost(int a, int b, int c, int d, int e) {
return new Object();
}

@com.google.apps.framework.request.HttpMethod.Put
public Object executePut(int a, int b, int c, int d, int e) {
return new Object();
}

@com.google.apps.framework.request.HttpMethod.Patch
public Object executePatch(int a, int b, int c, int d, int e) {
return new Object();
}

@com.google.apps.framework.request.HttpMethod.Delete
public Object executeDelete(int a, int b, int c, int d, int e) {
return new Object();
}

@com.google.apps.framework.request.HttpMethod.Options
public Object executeOptions(int a, int b, int c, int d, int e) {
return new Object();
}
}
""")
.doTest();
}
}
Loading