|
| 1 | +/* |
| 2 | + * Copyright 2002-2024 the original author or authors. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package org.springframework.lang; |
| 18 | + |
| 19 | +import java.lang.annotation.Documented; |
| 20 | +import java.lang.annotation.ElementType; |
| 21 | +import java.lang.annotation.Target; |
| 22 | + |
| 23 | +/** |
| 24 | + * Specifies that the method return value must be used. |
| 25 | + * |
| 26 | + * <p>Inspired from {@code org.jetbrains.annotations.CheckReturnValue}, this variant |
| 27 | + * has been introduce in the {@code org.springframework.lang} package to avoid |
| 28 | + * requiring an extra dependency, while still following similar semantics. |
| 29 | + * |
| 30 | + * <p>This annotation should not be used if the return value of the method |
| 31 | + * provides only <i>additional</i> information. For example, the main purpose |
| 32 | + * of {@link java.util.Collection#add(Object)} is to modify the collection |
| 33 | + * and the return value is only interesting when adding an element to a set, |
| 34 | + * to see if the set already contained that element before. |
| 35 | + * |
| 36 | + * @author Sebastien Deleuze |
| 37 | + * @since 6.2 |
| 38 | + */ |
| 39 | +@Documented |
| 40 | +@Target(ElementType.METHOD) |
| 41 | +public @interface CheckReturnValue { |
| 42 | +} |
0 commit comments