You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/07/16 04:10:35 UTC
[GitHub] [beam] kennknowles commented on a change in pull request #12271: [BEAM-10496] Improve nullability analysis for :sdks:java:core
kennknowles commented on a change in pull request #12271:
URL: https://github.com/apache/beam/pull/12271#discussion_r455494897
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptionsFactory.java
##########
@@ -609,24 +604,34 @@ public static void printHelp(PrintStream out, Class<? extends PipelineOptions> i
getRequiredGroupNamesToProperties(propertyNamesToGetters);
out.format("%s:%n", currentIface.getName());
- prettyPrintDescription(out, currentIface.getAnnotation(Description.class));
+ Description ifaceDescription = currentIface.getAnnotation(Description.class);
+ if (ifaceDescription != null && ifaceDescription.value() != null) {
+ prettyPrintDescription(out, ifaceDescription);
+ }
out.println();
List<String> lists = Lists.newArrayList(propertyNamesToGetters.keySet());
lists.sort(String.CASE_INSENSITIVE_ORDER);
for (String propertyName : lists) {
Method method = propertyNamesToGetters.get(propertyName);
+ assert method != null
+ : "@AssumeAssertion(nullness): method name previously extracted from iface";
Review comment:
I asked the checkerframework folks for a better solution and they gave it: `@KeyFor` annotation.
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/util/common/ReflectHelpers.java
##########
@@ -74,16 +74,12 @@ public String apply(@Nonnull Method input) {
@Override
public String apply(@Nonnull Method input) {
return String.format(
- "%s#%s", CLASS_NAME.apply(input.getDeclaringClass()), METHOD_FORMATTER.apply(input));
+ "%s#%s",
+ ((Function<Class<?>, String>) Class::getName).apply(input.getDeclaringClass()),
Review comment:
Done.
----------------------------------------------------------------
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