Skip to content
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

[BEAM-8917] jsr305 dependency declaration for Nullable class #10324

Merged
merged 4 commits into from
Dec 12, 2019

Conversation

suztomo
Copy link
Contributor

@suztomo suztomo commented Dec 9, 2019

https://issues.apache.org/jira/projects/BEAM/issues/BEAM-8917

The Maven artifact org.apache.beam:beam-sdks-java-core, which contains org.apache.beam.sdk.schemas.FieldValueTypeInformation, should declare the dependency to com.google.code.findbugs:jsr305. The class needs Nullable class at runtime:

        .setNullable(field.isAnnotationPresent(Nullable.class))

Example project to produce an issue: https:/suztomo/beam-java-sdk-missing-nullable .


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- Build Status --- --- Build Status
Java Build Status Build Status Build Status Build Status
Build Status
Build Status
Build Status Build Status Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
--- Build Status
Build Status
Build Status
Build Status
--- --- Build Status
XLang --- --- --- Build Status --- --- ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status
Build Status
Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

@@ -69,6 +69,7 @@ dependencies {
compile library.java.protobuf_java
compile library.java.commons_compress
compile library.java.commons_lang3
compile library.java.jsr305
Copy link
Member

@iemejia iemejia Dec 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot do this a compile time dependency due to the license (LGPL) of findbugs/spotbugs. So far I think we have gotten around it because of the scope.

// spotbugs-annotations artifact is licensed under LGPL and cannot be included in the
// Apache Beam distribution, but may be relied on during build.
// See: https://www.apache.org/legal/resolved.html#prohibited
"com.github.spotbugs:spotbugs-annotations:3.1.12",

CC: @kennknowles who probably knows more of the details.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For extra ref the licenses we cannot include in Apache Software Foundations (ASF) projects is known as the Category X dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good info thanks! We probably still would need to go with spotbugs anyway to be consistent with the previous upgrade, but maybe it is worth to focus on the big issue that's on https://issues.apache.org/jira/browse/BEAM-8858

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can wait for BEAM-8858 cleared.

What is "the previous upgrade" you're referring?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add it to the list of compileOnlyAnnotationDeps where you see spotbugs-annotations?

I am actually sort of surprised this works, since spotbugs operates on bytecode, not during compilation. I guess the annotations are retained and inspected in a way that does not require having the annotation library present. I have heard that any annotation with a class name (insensitive) of "nullable" will work, for example.

Noting in yet another place that spotbugs nullability analysis appears to be nonfunctional anyhow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In findbugsproject/findbugs#128 (comment), iloveeclipse confirmed that JSR305 has BSD license and was unexpectedly uploaded to Maven Central with a wrong license.

I moved the JSR305 explanation closer to spotbugs-annotations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that it is not a compileOnlyAnnotation anymore because it is used to resolve nullability of Schema based fields per 788ce61#diff-504e2e0131eda09163b086becec92f3cR91 so it is needed at runtime too, or am I misreading this?

Copy link
Contributor Author

@suztomo suztomo Dec 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iemejia That explanation is correct.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. The LGPL annotations are spotbugs-annotations which have things like SuppresFBWarnings and a few other utility annotations. jsr305 is fine. The landscape of these annotations and what they do is actually quite strange, incomplete, and also changed.

@suztomo
Copy link
Contributor Author

suztomo commented Dec 9, 2019

Run Java PreCommit

@suztomo
Copy link
Contributor Author

suztomo commented Dec 9, 2019

Run Python PreCommit

@suztomo
Copy link
Contributor Author

suztomo commented Dec 9, 2019

Run Java PreCommit

@suztomo
Copy link
Contributor Author

suztomo commented Dec 9, 2019

Run Python PreCommit

@suztomo
Copy link
Contributor Author

suztomo commented Dec 9, 2019

Run BigQueryIO Streaming Performance Test Java

@suztomo
Copy link
Contributor Author

suztomo commented Dec 9, 2019

Run Python PreCommit

@suztomo
Copy link
Contributor Author

suztomo commented Dec 9, 2019

Run Dataflow ValidatesRunner

@suztomo
Copy link
Contributor Author

suztomo commented Dec 10, 2019

Run Python PreCommit

@suztomo
Copy link
Contributor Author

suztomo commented Dec 10, 2019

Run Dataflow ValidatesRunner

@suztomo
Copy link
Contributor Author

suztomo commented Dec 10, 2019

Run Dataflow ValidatesRunner

@suztomo
Copy link
Contributor Author

suztomo commented Dec 10, 2019

Run Python PreCommit

@suztomo
Copy link
Contributor Author

suztomo commented Dec 10, 2019

Run Java PostCommit

Copy link
Contributor Author

@suztomo suztomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kennknowles PTAL.

@@ -69,6 +69,7 @@ dependencies {
compile library.java.protobuf_java
compile library.java.commons_compress
compile library.java.commons_lang3
compile library.java.jsr305
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In findbugsproject/findbugs#128 (comment), iloveeclipse confirmed that JSR305 has BSD license and was unexpectedly uploaded to Maven Central with a wrong license.

I moved the JSR305 explanation closer to spotbugs-annotations.

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run CommunityMetrics PreCommit

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run Dataflow ValidatesRunner

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run Java PostCommit

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run Java HadoopFormatIO Performance Test

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run BigQueryIO Streaming Performance Test Java

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run Spark ValidatesRunner

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run SQL Postcommit

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Dataflow Runner Nexmark Tests

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run Java Flink PortableValidatesRunner Batch

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run Java Flink PortableValidatesRunner Streaming

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Direct Runner Nexmark Tests

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run Java Spark PortableValidatesRunner Batch

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run Spark ValidatesRunner

2 similar comments
@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run Spark ValidatesRunner

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Run Spark ValidatesRunner

@suztomo
Copy link
Contributor Author

suztomo commented Dec 11, 2019

Apache Spark Runner ValidatesRunner Tests don't succeed probably because of PR 10151

@suztomo
Copy link
Contributor Author

suztomo commented Dec 12, 2019

Run Spark ValidatesRunner

@suztomo
Copy link
Contributor Author

suztomo commented Dec 12, 2019

@iemejia @kennknowles All checks passed. Does this look good?

@kennknowles kennknowles merged commit 160beb9 into apache:master Dec 12, 2019
@suztomo
Copy link
Contributor Author

suztomo commented Dec 12, 2019

Kenn, Thank you.

@suztomo suztomo deleted the nullable branch December 12, 2019 20:17
iemejia pushed a commit to iemejia/beam that referenced this pull request Dec 12, 2019
…10324)

The Maven artifact org.apache.beam:beam-sdks-java-core, which contains org.apache.beam.sdk.schemas.FieldValueTypeInformation, should declare the dependency to com.google.code.findbugs:jsr305. The class needs Nullable class at runtime.
iemejia pushed a commit to iemejia/beam that referenced this pull request Dec 12, 2019
…10324)

The Maven artifact org.apache.beam:beam-sdks-java-core, which contains org.apache.beam.sdk.schemas.FieldValueTypeInformation, should declare the dependency to com.google.code.findbugs:jsr305. The class needs Nullable class at runtime.
udim added a commit that referenced this pull request Dec 13, 2019
@iemejia
Copy link
Member

iemejia commented Dec 13, 2019

Just double checked with today's SNAPSHOTs after the merge and the pom of core is not modified, however the deps look good in master, not sure if the change was applied before the SNAPSHOT generation, but still to double check.
https://repository.apache.org/content/repositories/snapshots/org/apache/beam/beam-sdks-java-core/2.19.0-SNAPSHOT/beam-sdks-java-core-2.19.0-20191213.072102-9.pom

@suztomo
Copy link
Contributor Author

suztomo commented Dec 13, 2019

Investigating that. I see the same problem in my local installation. /Users/suztomo/.m2/repository//org/apache/beam/beam-sdks-java-core/2.19.0-SNAPSHOT/beam-sdks-java-core-2.19.0-SNAPSHOT.pom does not have jsr305.

@suztomo
Copy link
Contributor Author

suztomo commented Dec 13, 2019

PR to fix this #10382

Ardagan added a commit that referenced this pull request Dec 17, 2019
[release-2.17.0][BEAM-8917][BEAM-8967] jsr305 dependency declaration for Nullable class (#10324)
@suztomo
Copy link
Contributor Author

suztomo commented Dec 18, 2019

dpcollins-google pushed a commit to dpcollins-google/beam that referenced this pull request Dec 20, 2019
…10324)

The Maven artifact org.apache.beam:beam-sdks-java-core, which contains org.apache.beam.sdk.schemas.FieldValueTypeInformation, should declare the dependency to com.google.code.findbugs:jsr305. The class needs Nullable class at runtime.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants