Repository navigation
Tests for loops over arrays - #982
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #982 +/- ##
=========================================
Coverage 85.90% 85.90%
Complexity 2066 2066
=========================================
Files 83 83
Lines 6854 6854
Branches 1320 1320
=========================================
Hits 5888 5888
Misses 550 550
Partials 416 416 ☔ View full report in Codecov by Sentry. |
| " }", | ||
| " }", | ||
| " for (String s : fizz) {", | ||
| " // BUG: Diagnostic contains: dereferenced expression s is @Nullable", |
There was a problem hiding this comment.
Interesting... wonder how we are representing the access paths here. Might be a bit much to ask (basically, you need NullAway to remember "we checked all elements of this array and they are all @NonNull, therefore..."
There was a problem hiding this comment.
Ah, maybe we should clarify this test. It's a bit confusing due to the multiple loops in the same method. This was just meant to test that if the array contents are @Nullable, the loop variable should be treated as @Nullable (which it currently isn't; that why the test is ignored). I wasn't thinking about using reasoning from the previous loop to avoid warning on the second warning.
@armughan11 when you work on #983, please rewrite this test to reorder the loops, to avoid this confusion
This MR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [org.tukaani:xz](https://tukaani.org/xz/java.html) ([source](https://github.com/tukaani-project/xz-java)) | compile | minor | `1.9` -> `1.10` | | [org.eclipse:yasson](https://projects.eclipse.org/projects/ee4j.yasson) ([source](https://github.com/eclipse-ee4j/yasson)) | compile | patch | `3.0.3` -> `3.0.4` | | [org.eclipse.parsson:parsson](https://github.com/eclipse-ee4j/parsson) | compile | patch | `1.1.6` -> `1.1.7` | | [com.uber.nullaway:nullaway](https://github.com/uber/NullAway) | | patch | `0.11.0` -> `0.11.1` | | [io.hosuaby:inject-resources-junit-jupiter](https://github.com/hosuaby/inject-resources) | test | patch | `0.3.3` -> `0.3.5` | | [org.codehaus.mojo:exec-maven-plugin](https://www.mojohaus.org/exec-maven-plugin) ([source](https://github.com/mojohaus/exec-maven-plugin)) | build | minor | `3.3.0` -> `3.4.0` | --- ### Release Notes <details> <summary>tukaani-project/xz-java</summary> ### [`v1.10`](https://github.com/tukaani-project/xz-java/releases/tag/v1.10): XZ for Java 1.10 [Compare Source](tukaani-project/xz-java@v1.9...v1.10) </details> <details> <summary>eclipse-ee4j/yasson</summary> ### [`v3.0.4`](eclipse-ee4j/yasson@3.0.3...3.0.4) [Compare Source](eclipse-ee4j/yasson@3.0.3...3.0.4) </details> <details> <summary>eclipse-ee4j/parsson</summary> ### [`v1.1.7`](eclipse-ee4j/parsson@1.1.6...1.1.7) [Compare Source](eclipse-ee4j/parsson@1.1.6...1.1.7) </details> <details> <summary>uber/NullAway</summary> ### [`v0.11.1`](https://github.com/uber/NullAway/blob/HEAD/CHANGELOG.md#Version-0111) [Compare Source](apache/nullaway@v0.11.0...v0.11.1) - Fix issue 1008 ([#​1009](apache/nullaway#1009)) - JSpecify: read upper bound annotations from bytecode and add tests ([#​1004](apache/nullaway#1004)) - Fix crash with suggested suppressions in JSpecify mode ([#​1001](apache/nullaway#1001)) - Update to JSpecify 1.0 and use JSpecify annotations in NullAway code ([#​1000](apache/nullaway#1000)) - Expose [@​EnsuresNonNull](https://github.com/EnsuresNonNull) and [@​RequiresNonNull](https://github.com/RequiresNonNull) in annotations package ([#​999](apache/nullaway#999)) - Don't report initializer warnings on [@​NullUnmarked](https://github.com/NullUnmarked) constructors / methods ([#​997](apache/nullaway#997)) - Strip annotations from MethodSymbol strings ([#​993](apache/nullaway#993)) - JSpecify: fix crashes where declared parameter / return types were raw ([#​989](apache/nullaway#989)) - JSpecify: Handle [@​nullable](https://github.com/nullable) elements for enhanced-for-loops on arrays ([#​986](apache/nullaway#986)) - Features/944 tidy stream nullability propagator ([#​985](apache/nullaway#985)) - Tests for loops over arrays ([#​982](apache/nullaway#982)) - Bug fixes for array subtyping at returns / parameter passing ([#​980](apache/nullaway#980)) - JSpecify: Handle [@​nonnull](https://github.com/nonnull) elements in [@​nullable](https://github.com/nullable) content arrays ([#​963](apache/nullaway#963)) - Don't report [@​nullable](https://github.com/nullable) type argument errors for unmarked classes ([#​958](apache/nullaway#958)) - External Library Models: Adding support for Nullable upper bounds of Generic Type parameters ([#​949](apache/nullaway#949)) - Refactoring / code cleanups: - Test on JDK 22 ([#​992](apache/nullaway#992)) - Add test case for [@​nullable](https://github.com/nullable) Void with override in JSpecify mode ([#​990](apache/nullaway#990)) - Enable UnnecessaryFinal and PreferredInterfaceType EP checks ([#​991](apache/nullaway#991)) - Add missing [@​test](https://github.com/test) annotation ([#​988](apache/nullaway#988)) - Fix typo in variable name ([#​987](apache/nullaway#987)) - Remove AbstractConfig class ([#​974](apache/nullaway#974)) - Fix Javadoc for MethodRef ([#​973](apache/nullaway#973)) - Refactored data clumps with the help of LLMs (research project) ([#​960](apache/nullaway#960)) - Build / CI tooling maintenance: - Various cleanups enabled by bumping minimum Java and Error Prone versions ([#​962](apache/nullaway#962)) - Disable publishing of snapshot builds from CI ([#​967](apache/nullaway#967)) - Update Gradle action usage in CI workflow ([#​969](apache/nullaway#969)) - Update Gradle config to always compile Java code using JDK 17 ([#​971](apache/nullaway#971)) - Update JavaParser to 3.26.0 ([#​970](apache/nullaway#970)) - Reenable JMH benchmarking in a safer manner ([#​975](apache/nullaway#975)) - Updated JMH Benchmark Comment Action ([#​976](apache/nullaway#976)) - Update to Gradle 8.8 ([#​981](apache/nullaway#981)) - Update to Error Prone 2.28.0 ([#​984](apache/nullaway#984)) - Update to Gradle 8.9 ([#​998](apache/nullaway#998)) - Update to WALA 1.6.6 ([#​1003](apache/nullaway#1003)) </details> <details> <summary>hosuaby/inject-resources</summary> ### [`v0.3.5`](hosuaby/inject-resources@v0.3.4...v0.3.5) [Compare Source](hosuaby/inject-resources@v0.3.4...v0.3.5) ### [`v0.3.4`](hosuaby/inject-resources@v0.3.3...v0.3.4) [Compare Source](hosuaby/inject-resources@v0.3.3...v0.3.4) </details> <details> <summary>mojohaus/exec-maven-plugin</summary> ### [`v3.4.0`](https://github.com/mojohaus/exec-maven-plugin/releases/tag/3.4.0) [Compare Source](mojohaus/exec-maven-plugin@3.3.0...3.4.0) <!-- Optional: add a release summary here --> #### 🚀 New features and improvements - Allow `<includePluginDependencies>` to be specified for the exec:exec goal ([#​432](mojohaus/exec-maven-plugin#432)) [@​sebthom](https://github.com/sebthom) #### 🐛 Bug Fixes - Do not get UPPERCASE env vars ([#​427](mojohaus/exec-maven-plugin#427)) [@​wheezil](https://github.com/wheezil) #### 📦 Dependency updates - Bump org.codehaus.mojo:mojo-parent from 82 to 84 ([#​434](mojohaus/exec-maven-plugin#434)) [@​dependabot](https://github.com/dependabot) - Bump org.codehaus.plexus:plexus-xml from 3.0.0 to 3.0.1 ([#​431](mojohaus/exec-maven-plugin#431)) [@​dependabot](https://github.com/dependabot) #### 👻 Maintenance - Remove Log4j 1.2.x from ITs ([#​437](mojohaus/exec-maven-plugin#437)) [@​slawekjaranowski](https://github.com/slawekjaranowski) #### 🔧 Build - Use Maven 3.9.7 and 4.0.0-beta-3 ([#​433](mojohaus/exec-maven-plugin#433)) [@​slawekjaranowski](https://github.com/slawekjaranowski) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox. 👻 **Immortal**: This MR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->
We handle a loop with an index variable correctly, but not a for-each loop over an array, which needs to be fixed in a follow-up (see #983)