You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by GitBox <gi...@apache.org> on 2020/12/06 01:34:24 UTC
[GitHub] [poi] MariusVolkhart opened a new pull request #203: Prototype nullability annotations
MariusVolkhart opened a new pull request #203:
URL: https://github.com/apache/poi/pull/203
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[GitHub] [poi] pjfanning commented on a change in pull request #203: Prototype nullability annotations
Posted by GitBox <gi...@apache.org>.
pjfanning commented on a change in pull request #203:
URL: https://github.com/apache/poi/pull/203#discussion_r537047512
##########
File path: src/java/org/apache/poi/common/usermodel/fonts/FontGroup.java
##########
@@ -42,10 +44,14 @@ Licensed to the Apache Software Foundation (ASF) under one or more
COMPLEX_SCRIPT
;
-
public static class FontGroupRange {
private int len;
- private FontGroup fontGroup;
+ private final FontGroup fontGroup;
+
+ public FontGroupRange(FontGroup fontGroup) {
Review comment:
https://github.com/apache/poi/commit/10652e33feb2ee164437ae265f98d8443a94aa19 -- I've removed the stray import in a 2nd commit
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[GitHub] [poi] MariusVolkhart commented on a change in pull request #203: Prototype nullability annotations
Posted by GitBox <gi...@apache.org>.
MariusVolkhart commented on a change in pull request #203:
URL: https://github.com/apache/poi/pull/203#discussion_r536930125
##########
File path: src/java/org/apache/poi/common/usermodel/fonts/FontGroup.java
##########
@@ -42,10 +44,14 @@ Licensed to the Apache Software Foundation (ASF) under one or more
COMPLEX_SCRIPT
;
-
public static class FontGroupRange {
private int len;
- private FontGroup fontGroup;
+ private final FontGroup fontGroup;
+
+ public FontGroupRange(FontGroup fontGroup) {
Review comment:
Adding a constructor here avoids needing to add `@Nullable` to the `fontGroup` field. I imagine this pattern would arise several times.
##########
File path: src/java/org/apache/poi/common/usermodel/fonts/package-info.java
##########
@@ -0,0 +1,4 @@
+@NonNullApi
Review comment:
Mark every return value and parameter as being or needing to be non-null unless annotated otherwise. I don't know if this is desired or feasible, but it's what most projects choose as the base. "non-null by default, explicitly nullable via `@Nullable`.
##########
File path: src/java/org/apache/poi/common/usermodel/fonts/FontGroup.java
##########
@@ -110,7 +116,7 @@ public FontGroup getFontGroup( ) {
* @param runText the text which font groups are to be analyzed
* @return the FontGroup
*/
- public static List<FontGroupRange> getFontGroupRanges(final String runText) {
+ public static List<FontGroupRange> getFontGroupRanges(@Nullable final String runText) {
Review comment:
I think the intent is for people to provide a non-null value. However, the function can handle `null` since it has an explicit null check. Leaving the `@Nullable` off and having the null check triggers an Intellij inspection. I figure adding `@Nullable` is probably an OK choice to 1. resolve the inspection 2. allow tools using the nullness annotations to not complain about passing something that _might_ be null.
I think a lot of parameters will end up being marked as `@Nullable`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[GitHub] [poi] MariusVolkhart commented on a change in pull request #203: Prototype nullability annotations
Posted by GitBox <gi...@apache.org>.
MariusVolkhart commented on a change in pull request #203:
URL: https://github.com/apache/poi/pull/203#discussion_r536930760
##########
File path: src/java/org/apache/poi/common/usermodel/fonts/package-info.java
##########
@@ -0,0 +1,4 @@
+@NonNullApi
Review comment:
Marks every return value and parameter as being or needing to be non-null unless annotated otherwise. I don't know if this is desired or feasible, but it's what most projects choose as the base. "non-null by default, explicitly nullable via `@Nullable`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[GitHub] [poi] MariusVolkhart closed pull request #203: Prototype nullability annotations
Posted by GitBox <gi...@apache.org>.
MariusVolkhart closed pull request #203:
URL: https://github.com/apache/poi/pull/203
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[GitHub] [poi] pjfanning commented on a change in pull request #203: Prototype nullability annotations
Posted by GitBox <gi...@apache.org>.
pjfanning commented on a change in pull request #203:
URL: https://github.com/apache/poi/pull/203#discussion_r537045639
##########
File path: src/java/org/apache/poi/common/usermodel/fonts/FontGroup.java
##########
@@ -42,10 +44,14 @@ Licensed to the Apache Software Foundation (ASF) under one or more
COMPLEX_SCRIPT
;
-
public static class FontGroupRange {
private int len;
- private FontGroup fontGroup;
+ private final FontGroup fontGroup;
+
+ public FontGroupRange(FontGroup fontGroup) {
Review comment:
I think it is safe to change this class now - because the 2 members are private so setting them is not really feasible from 3rd party code.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org