dromara / dromara/easy-query

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

Open
#222 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
777
Forks
78
PR merge metrics
No merged PRs in 30d

Description

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

- `com.easy.query.core.annotation.Nullable`

```java
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`

```java
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 "";
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in the sql-core module with com.easy.query.core.annotation.Nullable and com.easy.query.core.annotation.NotNull, then inspect the module dependency configuration for JSR-305. Confirm how the annotations should expose JSR-305 metadata and verify that common IDEs recognize the nullability markers; the change is done when both annotations provide the requested IDE-readable semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, developer-experience
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.