-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Considering support @OptionalArg
to mark a Optional argument instead of using Optional<?>
.
#305
Comments
Optinal<?>
.Optinal<?>
.
Optinal<?>
.@Nullable
to to mark a Optinal argument instead of using Optinal<?>
.
@Nullable
to to mark a Optinal argument instead of using Optinal<?>
.@Nullable
to to mark a Optional argument instead of using Optinal<?>
.
@Nullable
to to mark a Optional argument instead of using Optinal<?>
.@Nullable
to to mark a Optional argument instead of using Optional<?>
.
@Nullable
to to mark a Optional argument instead of using Optional<?>
.@Nullable
to mark a Optional argument instead of using Optional<?>
.
@CarmJos, org.jetbrains.annotations.Nullable is annotated with RetentionPolicy.CLASS |
How about @checkerframework.checker.nullness.qual.Nullable ? |
Or just provide a "@NullableArg"? |
I enjoy it, I will implement this feature. |
There is also an option to add attribute |
Well, that's great enough. Thanks a lot! |
I asked LiteCommands community about this feature on discord I got another way (from @P3ridot) that would be more consistent with the current API: |
Followed by this, Maybe we can support a new annotation called '@OptionalArg'. |
Another main reason why I personally do not recommend adding new parameters to
If using the
|
It is also a good solution. This gives me some food for thought... |
From my view the |
|
@Nullable
to mark a Optional argument instead of using Optional<?>
.@OptionalArg
to mark a Optional argument instead of using Optional<?>
.
I have viewed another issues (#310 ) contained a |
I think there is a certain functional overlap between |
This is just an example. I wish that |
You are actually right, After much discussion and research, I have decided to write arguments for:
|
If you add flag @Arg(optional = true) Player target |
|
In this example, I use an English arg name. But in reality, the name is often filled in Chinese to prompt the user. Which means I must use this name, instead of filling it in the parameters of the method. |
Unfortunately, in some cases it will be annoying :/ |
Yeah, so please think about non-English developers, it will be very disastrous if they can only use |
Lines 62 to 66 in b7ecb16
I think this part should be abstracted so that developers can customize it, including |
This is another argument for I was thinking about implementing two ideas at once, but it probably won't be good for the API... So we're left with |
* Add nullable arguments * Replace nullable to optional
It seems right, there's only |
* Add nullable arguments * Replace nullable to optional * Add OptionalArg annotation * Update programmatic API * Update nullable argument api for programmatic API.
Using
org.jetbrains.annotations.Nullable
instead of usingOptinal<?>
in function's arguments will avoid many issues while also complying with general Java development specifications.Otherwise,
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
is always needed, and will still influence code factors' score.The text was updated successfully, but these errors were encountered: