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

Add @Nullable annotations #43393

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

Shadow-Devil
Copy link
Contributor

Purpose

Adds @nullable annotations where null values are passed as arguments or assigned to variables.

Fixes #43386

Approach

Let IntelliJ generate the @nullable annotations based on its static analysis

Samples

Provide high-level details about the samples related to this feature.

Remarks

List any other known issues, related PRs, TODO items, or any other notes related to the PR.

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@gimantha
Copy link
Contributor

gimantha commented Nov 5, 2024

@Shadow-Devil Shall we check on the build failures in github actions?

@Shadow-Devil
Copy link
Contributor Author

Some libraries fail because of Spotbugs errors. They are using methods that are now annotated with @Nullable and they dont check it.

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 70.90909% with 48 lines in your changes missing coverage. Please review.

Project coverage is 77.56%. Comparing base (2f3cada) to head (7981b28).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...rc/main/java/io/ballerina/projects/BalaWriter.java 12.50% 6 Missing and 1 partial ⚠️
.../java/org/ballerinalang/toml/model/Dependency.java 25.00% 6 Missing ⚠️
...allerina/compiler/api/impl/ExpectedTypeFinder.java 20.00% 0 Missing and 4 partials ⚠️
...rc/main/java/io/ballerina/cli/cmd/CommandUtil.java 66.66% 3 Missing ⚠️
...internal/repositories/RemotePackageRepository.java 0.00% 3 Missing ⚠️
...o/ballerina/cli/task/CreateTestExecutableTask.java 0.00% 1 Missing and 1 partial ⚠️
...rc/main/java/io/ballerina/cli/utils/TestUtils.java 0.00% 1 Missing and 1 partial ⚠️
...l/type/builders/BallerinaSingletonTypeBuilder.java 0.00% 1 Missing and 1 partial ⚠️
...main/java/io/ballerina/projects/ModuleContext.java 66.66% 1 Missing and 1 partial ⚠️
...o/ballerina/projects/internal/BlendedManifest.java 60.00% 0 Missing and 2 partials ⚠️
... and 12 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #43393      +/-   ##
============================================
- Coverage     77.56%   77.56%   -0.01%     
+ Complexity    58736    58733       -3     
============================================
  Files          3447     3447              
  Lines        219658   219665       +7     
  Branches      28916    28914       -2     
============================================
- Hits         170382   170375       -7     
- Misses        39886    39899      +13     
- Partials       9390     9391       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Shadow-Devil
Copy link
Contributor Author

@gimantha required pipeline went through but some std libs will require some adjustments since they use methods that are now annotated with @Nullable so spotbugs complaints

Shadow-Devil and others added 5 commits November 13, 2024 17:00
# Conflicts:
#	bvm/ballerina-profiler/src/main/java/module-info.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/api/Runtime.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/api/async/StrandMetadata.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/api/concurrent/StrandMetadata.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/api/creators/ValueCreator.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/api/utils/JsonUtils.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/BalRuntime.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/launch/LaunchUtils.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/scheduling/AsyncUtils.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/scheduling/Scheduler.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/scheduling/Strand.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/scheduling/WDChannels.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/scheduling/WorkerDataChannel.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/types/BFunctionType.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/types/BIntersectionType.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/types/BNullType.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/types/BObjectType.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/AbstractArrayValue.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/ArrayValueImpl.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/AttributeMapValueImpl.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/DecimalValue.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/ErrorValue.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/FPValue.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/FutureValue.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/MapValueImpl.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/StreamValue.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/TableValueImpl.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/TupleValueImpl.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/ValueCreator.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlSequence.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/values/XmlValue.java
#	bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/transactions/TransactionResourceManager.java
#	bvm/ballerina-runtime/src/main/java/module-info.java
#	compiler/ballerina-lang/src/main/java/io/ballerina/projects/ModuleContext.java
#	compiler/ballerina-lang/src/main/java/io/ballerina/projects/Package.java
#	compiler/ballerina-lang/src/main/java/io/ballerina/projects/PackageConfig.java
#	compiler/ballerina-lang/src/main/java/io/ballerina/projects/PackageContext.java
#	compiler/ballerina-lang/src/main/java/io/ballerina/projects/PackageManifest.java
#	compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/ManifestBuilder.java
#	compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/ModuleData.java
#	compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/PackageData.java
#	compiler/ballerina-lang/src/main/java/io/ballerina/projects/internal/ProjectFiles.java
#	compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/JvmTerminatorGen.java
#	compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/FrameClassGen.java
#	compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MethodGen.java
#	compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/methodgen/MethodGenUtils.java
#	compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/model/BIRTerminator.java
#	langlib/lang.__internal/src/main/java/org/ballerinalang/langlib/internal/WorkerChannels.java
#	langlib/lang.map/src/main/java/org/ballerinalang/langlib/map/Next.java
#	langlib/lang.value/src/main/java/org/ballerinalang/langlib/value/FromJsonDecimalString.java
#	langlib/lang.value/src/main/java/org/ballerinalang/langlib/value/FromJsonFloatString.java
#	langlib/lang.value/src/main/java/org/ballerinalang/langlib/value/FromJsonString.java
#	langlib/lang.xml/src/main/java/org/ballerinalang/langlib/xml/Map.java
#	langlib/lang.xml/src/main/java/org/ballerinalang/langlib/xml/Next.java
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.

[Improvement]: Add jetbrains annotations to the classpath dependencies for @NotNull and @Nullable annotations
2 participants