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

Fix Google-internal common.collect tests under an Android emulator. #6652

Closed
wants to merge 1 commit into from

Conversation

copybara-service[bot]
Copy link
Contributor

@copybara-service copybara-service bot commented Jul 24, 2023

Fix Google-internal common.collect tests under an Android emulator.

The primary change comes as a followup to cl/543468006: Now that the Google-internal ImmutableTable declares methods with Java 8+ types in their signatures, we get a NoClassDefFoundError when performing reflection on the class under old Android emulators. We perform reflection only when (a) using NullPointerTester or (b) using serialization. So we (a) stop running NullPointerTester under an Android emulator (though we continue to run the same guava-android test under a JVM) and (b) specify a serialVersionUID so that serialization doesn't need to compute one. (Specifying serialVersionUID was our MO for a while. Perhaps we just got careless, and perhaps we should be more diligent. Alternatively, perhaps we should change the serialVersionUID every release or so so as to encourage people not to persist serialized data. I at least went to a tiny bit of effort to keep guava-jre and guava-android on different serialVersionUID values, though maybe that's more likely to cause needless trouble someday than to prevent it?)

The other change is to avoid running another GC test under an Android emulator. We'd originally done this for one copy of AbstractIteratorTester in cl/444929745, but for whatever reason, we didn't need it for the other copy until (I assume) cl/546307327 and its switch to a different emulator version.

RELNOTES=n/a

The primary change comes as a followup to cl/543468006: Now that the Google-internal `ImmutableTable` declares [methods with Java 8+ types in their signatures](#6567), we get a `NoClassDefFoundError` when performing reflection on the class under old Android emulators. We perform reflection only when (a) using `NullPointerTester` or (b) using serialization. So we (a) stop running `NullPointerTester` under an Android emulator (though we continue to run the same `guava-android` test under a JVM) and (b) specify a `serialVersionUID` so that serialization doesn't need to compute one. (Specifying `serialVersionUID` was our MO for a while. Perhaps we just got careless, and perhaps we should be more diligent. Alternatively, perhaps we should change the `serialVersionUID` every release or so so as to encourage people [not to persist serialized data](https://github.com/google/guava#important-warnings). I at least went to a tiny bit of effort to keep `guava-jre` and `guava-android` on different `serialVersionUID` values, though maybe that's more likely to cause needless trouble someday than to prevent it?)

The other change is to avoid running another GC test under an Android emulator. We'd originally done this for one copy of `AbstractIteratorTester` in cl/444929745, but for whatever reason, we didn't need it for the other copy until (I assume) cl/546307327 and its switch to a different emulator version.

RELNOTES=n/a
PiperOrigin-RevId: 550670580
@copybara-service copybara-service bot changed the title Fix common.collect tests under an Android emulator. Fix Google-internal common.collect tests under an Android emulator. Jul 25, 2023
@copybara-service copybara-service bot force-pushed the test_550670580 branch 2 times, most recently from b860d73 to 230b0cd Compare July 25, 2023 13:51
@copybara-service copybara-service bot closed this Jul 25, 2023
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.

None yet

1 participant