-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
JUnit5 5.4.0 broke Android support #1800
Comments
I remember that late change in line db8b3d4#diff-6620c2fff8288084514a095acc4cb5a8R36 ... used another in-line regular expression before. |
The constant is available since Java 1.7, though. Copied from
|
Reading the documention again...
... |
@matejdro Does Android support |
Yes, the constant itself is available. Unfortunately it appears Android folks forgot to update validation code, so this constant is still not allowed to be passed into
Just checked and Android 9.0 (latest one at the moment) throws syntax error when I try to create |
Thanks for checking @matejdro -- mh, maybe we have to resort to only look for non-Unicode control chars on Android. Perhaps we'll enhance the Marked for @junit-team discussion. |
...or guard the compilation of the patterns in |
@matejdro @mannodermaus With 30ab9f4 applied Android support should be fixed. Can you please double-check on your systems using latest SNAPSHOT of JUnit 5? https://oss.sonatype.org/content/repositories/snapshots/org/junit/ |
`java.util.regex.Pattern.UNICODE_CHARACTER_CLASS` isn't supported on all runtime platforms, like Android. This commit guards the compilation of the regex pattern by catching `IllegalArgumentException` -- and falling back to match only ASCII control characters. Note: according to https://developer.android.com/reference/java/util/regex/Pattern.html#UNICODE_CHARACTER_CLASS the Unicode mode is always enabled on Android. Thus all of the characters that Unicode refers to as 'control characters' are still matched on Android. Fixes #1800
I've cherry-picked 30ab9f4 to the |
The way this is usually checked by multi-platform libraries is through a reflective class lookup for |
I've just checked and Thanks a lot. |
Thanks for the heads-up, @mannodermaus and @matejdro! Regarding The fix for Android will be released soon with version |
Indeed, @Test
fun testOsCurrent() {
val currentOs = OS.values().first { it.isCurrentOs }
Log.i("AndroidLog", "Current OS: $currentOs")
Log.i("AndroidLog", "os.name: ${System.getProperty("os.name")}")
Log.i("AndroidLog", "java.vm.name: ${System.getProperty("java.vm.name")}")
}
If we wanted to stay with system property lookups, |
Agreed. Please open a new ticket if you want to follow up on Android OS detection. |
JUnit 5.4.0 started crashing on Android due to unsupported UNICODE_CHARACTER_CLASS flag in Pattern.
Steps to reproduce
Android 9.0 (Google Play) x86_64
image./gradlew :sample:connectedExperimentalDebugAndroidTest
from the root of checked out repoIt looks like UNICODE_CHARACTER_CLASS was added to StringUtils in JUnit 5.4.0. This flag is not supported on Android (not even on the latest devices) and causes crash whenever
StringUtils
class is initialized.The text was updated successfully, but these errors were encountered: