You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "kennknowles (via GitHub)" <gi...@apache.org> on 2023/04/27 16:44:26 UTC

[GitHub] [beam] kennknowles commented on a diff in pull request #26413: [20498] Remove SuppressWarnings nullness from SelectByteBuddyHelpers

kennknowles commented on code in PR #26413:
URL: https://github.com/apache/beam/pull/26413#discussion_r1179442083


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/SelectByteBuddyHelpers.java:
##########
@@ -174,10 +171,13 @@ static RowSelector createRowSelector(SchemaAndDescriptor schemaAndDescriptor) {
               .withParameters(Schema.class)
               .intercept(new SelectInstructionConstructor());
 
+      Optional<ClassLoader> rowClassLoader = Optional.ofNullable(Row.class.getClassLoader());
+      checkState(rowClassLoader.isPresent());

Review Comment:
   You can get the same effect as your code without going through `Optional` by using `org.apache.beam.sdk.util.Preconditions.checkStateNotNull`. Here and in the other locations.
   
   (I do prefer to use `Optional` in data structure design rather than null, because it is clearer and composes, but in this case it doesn't seem to add much)



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org