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

KTOR-7846 Fix running tests against JDK 8 #4502

Merged
merged 8 commits into from
Dec 4, 2024
Merged

KTOR-7846 Fix running tests against JDK 8 #4502

merged 8 commits into from
Dec 4, 2024

Conversation

osipxd
Copy link
Member

@osipxd osipxd commented Nov 25, 2024

Subsystem
Test Infrastructure

Motivation
KTOR-7846 Fix running tests against Java 8 on CI

Solution
Fix problems making tests incompatible with Java 8 and remove testJdk.coerceAtLeast(11) from tests toolchain configuration.

It is better to review commit-by-commit

@osipxd osipxd self-assigned this Nov 25, 2024
@osipxd osipxd marked this pull request as draft November 25, 2024 09:59
@osipxd osipxd force-pushed the osipxd/jdk-8-tests branch 3 times, most recently from 0cf9e9c to d146768 Compare November 25, 2024 15:10
* On Java 8 PropertyResourceBundle requires properties to be encoded in ISO-8859-1,
* while starting from Java 9 the default encoding is UTF-8.
*/
private fun String.fixJava8Encoding(): String = this.toByteArray(Charsets.ISO_8859_1).toString(Charsets.UTF_8)
Copy link
Member Author

Choose a reason for hiding this comment

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

Should this "fix" be applied inside i18n implementation? Or we assume that users know that bundles should be in a different encoding on Java 8?

Copy link
Member

@e5l e5l left a comment

Choose a reason for hiding this comment

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

Looks good!

// so we have to check the path is not empty to not get an `ArrayIndexOutOfBoundsException`
if (this.nameCount == 0) return normalized

return this.resolve(normalized)
Copy link
Member

Choose a reason for hiding this comment

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

it looks like we can drop this

* while starting from Java 9 the default encoding is UTF-8.
*/
private fun String.fixJava8Encoding(): String {
return if (System.getProperty("java.version").startsWith("1.8")) {
Copy link
Member

Choose a reason for hiding this comment

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

please consider extracting to the top level field

@osipxd osipxd force-pushed the osipxd/jdk-8-tests branch from 3537e41 to dc57d34 Compare December 4, 2024 15:40
@osipxd osipxd enabled auto-merge (squash) December 4, 2024 15:44
@osipxd osipxd force-pushed the osipxd/jdk-8-tests branch from dc57d34 to 67b7968 Compare December 4, 2024 17:25
@osipxd osipxd merged commit 9df87a0 into main Dec 4, 2024
13 of 14 checks passed
@osipxd osipxd deleted the osipxd/jdk-8-tests branch December 4, 2024 18:18
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.

2 participants