Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议 @Nullable @NotNull 注解支持 JSR-305 规范 #222

Open
bengbengbalabalabeng opened this issue Jun 1, 2024 · 1 comment
Open

Comments

@bengbengbalabalabeng
Copy link

模块:sql-core
涉及代码:@Nullable@NotNull
建议:支持 JSR-305 规范,这样可以让标记了以上注解的 API 在常用的 IDE 上有更好的可读性(如:idea 中对代码加重灰色提示可能出现的潜在问题)提升代码的健壮性。

  • com.easy.query.core.annotation.Nullable
package com.easy.query.core.annotation;

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;

// jsr-305 support
import javax.annotation.Nonnull;
import javax.annotation.meta.TypeQualifierNickname;
import javax.annotation.meta.When;
// jsr-305 support

/**
 * create time 2023/11/26 07:32
 * 文件说明
 *
 * @author xuejiaming
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
// jsr-305 support
@Nonnull(when=MAYBE)
@TypeQualifierNickname
// jsr-305 support
public @interface Nullable {
    String value() default "";
}
  • com.easy.query.core.annotation.NotNull
package com.easy.query.core.annotation;

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;

// jsr-305 support
import javax.annotation.Nonnull;
import javax.annotation.meta.TypeQualifierNickname;
// jsr-305 support


/**
 * create time 2023/11/26 07:32
 * 文件说明
 *
 * @author xuejiaming
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
// jsr-305 support
@Nonnull
@TypeQualifierNickname
// jsr-305 support
public @interface NotNull {
    String value() default "";
}
@xuejmnet
Copy link
Collaborator

xuejmnet commented Jun 1, 2024

@bengbengbalabalabeng 非常棒的建议后续会逐步增加

xuejmnet added a commit that referenced this issue Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants