Consistent HttpMethod identity comparisons

This commit is contained in:
Juergen Hoeller
2018-02-18 22:01:22 +01:00
parent d1e9161ca6
commit 0de36d2883
17 changed files with 69 additions and 100 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,6 @@ import org.springframework.web.server.ServerWebInputException;
import org.springframework.web.server.UnsupportedMediaTypeStatusException;
import org.springframework.web.util.pattern.PathPattern;
/**
* Abstract base class for classes for which {@link RequestMappingInfo} defines
* the mapping between a request and a handler method.
@@ -358,7 +357,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
private static Set<HttpMethod> initAllowedHttpMethods(Set<HttpMethod> declaredMethods) {
if (declaredMethods.isEmpty()) {
return EnumSet.allOf(HttpMethod.class).stream()
.filter(method -> !method.equals(HttpMethod.TRACE))
.filter(method -> method != HttpMethod.TRACE)
.collect(Collectors.toSet());
}
else {