Browse Source
This commit expands the detection of optional parameters for Actuator Endpoints. Before this commit, JSpecify's `@Nullable` annotation was not detected. See gh-46854 Signed-off-by: wonyongg <111210881+wonyongg@users.noreply.github.com>pull/46914/head
5 changed files with 124 additions and 2 deletions
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
/* |
||||
* Copyright 2012-present 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.boot.configurationsample.endpoint; |
||||
|
||||
import org.springframework.boot.configurationsample.Endpoint; |
||||
import org.springframework.boot.configurationsample.ReadOperation; |
||||
import org.jspecify.annotations.Nullable; |
||||
|
||||
/** |
||||
* An endpoint with @Nullable parameter to test. |
||||
* |
||||
* @author Wonyong Hwang |
||||
*/ |
||||
@Endpoint(id = "nullable") |
||||
public class NullableParameterEndpoint { |
||||
|
||||
@ReadOperation |
||||
public String invoke(@Nullable String parameter) { |
||||
return "test with " + parameter; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
/* |
||||
* Copyright 2012-present 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.boot.configurationsample.endpoint; |
||||
|
||||
import org.springframework.boot.configurationsample.Endpoint; |
||||
import org.springframework.boot.configurationsample.ReadOperation; |
||||
import org.springframework.boot.configurationsample.OptionalParameter; |
||||
|
||||
/** |
||||
* An endpoint with @OptionalParameter to compare with @Nullable behavior. |
||||
* |
||||
* @author Wonyong Hwang |
||||
*/ |
||||
@Endpoint(id = "optional") |
||||
public class OptionalParameterEndpoint { |
||||
|
||||
@ReadOperation |
||||
public String invoke(@OptionalParameter String parameter) { |
||||
return "test with " + parameter; |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue