Reputation: 6023
I hate working with parametrics, they are open doors for bad code practices and mistakes. However people do use them often so I try to live with it.
I am struggling to solve this warning condition, however I have no idea how to properly fix this.
/**
* Enables incoming connections from any remote address and disables authentication (cross-origin access should be blocked
* when entering in production).
*
* @param serverResource
* @return
*/
private static Series<Header> configureRestForm(ServerResource serverResource) {
final Object responseHeaders = serverResource.getResponse().getAttributes().get("org.restlet.http.headers");
final Series<Header> headers;
if (responseHeaders instanceof Series<?>) {
headers = (Series<Header>) responseHeaders;
} else {
headers = new Series<Header>(Header.class);
serverResource.getResponse().getAttributes().put("org.restlet.http.headers", headers);
}
headers.add("Access-Control-Allow-Origin", "*");
headers.add("Access-Control-Allow-Methods", "GET, POST, PUT, OPTIONS");
headers.add("Access-Control-Allow-Headers", "Content-Type");
headers.add("Access-Control-Allow-Credentials", "false");
headers.add("Access-Control-Max-Age", "60");
return headers;
}
What should I do?
Thanks!
Upvotes: 0
Views: 299
Reputation: 2993
You can use @SuppressWarnings("unchecked")
annotation or try
change Eclipse preferences: Java->Compiler->Errors/Warnings->Generic types
and check the Ignore unavoidable generic type problems
check-box
Upvotes: 1