Skip to content

Commit

Permalink
add annotation
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Crawford <steecraw@amazon.com>
  • Loading branch information
stephen-crawford committed Apr 20, 2023
1 parent 9a0ad21 commit 12b3928
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
32 changes: 32 additions & 0 deletions libs/common/src/main/java/org/opensearch/common/NotNull.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.common;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.annotation.Nonnull;
import javax.annotation.meta.TypeQualifierNickname;

/**
* The presence of this annotation on a method indicates that
* {@code null} will not be returned from that method.
*
* @opensearch.api
*/
@Documented
@TypeQualifierNickname
@Nonnull
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD })
public @interface NotNull {
}

2 changes: 2 additions & 0 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ dependencies {
api project(':libs:opensearch-secure-sm')
api project(':libs:opensearch-x-content')
api project(":libs:opensearch-geo")
implementation 'org.jetbrains:annotations:23.0.0'
implementation 'org.jetbrains:annotations:23.0.0'

compileOnly project(':libs:opensearch-plugin-classloader')
testRuntimeOnly project(':libs:opensearch-plugin-classloader')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.opensearch.plugins;

import org.opensearch.common.Nullable;
import org.opensearch.common.NotNull;
import org.opensearch.identity.Subject;

/**
Expand All @@ -21,6 +21,6 @@ public interface IdentityPlugin {
/**
* Get the current subject
* */
@Nullable
@NotNull
public Subject getSubject();
}

0 comments on commit 12b3928

Please sign in to comment.