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 NPE in switch case #1714

Merged
merged 1 commit into from
Jan 24, 2025
Merged

Conversation

laeubi
Copy link
Contributor

@laeubi laeubi commented Jan 24, 2025

No description provided.

Copy link
Contributor

Test Results

 1 755 files   1 755 suites   1h 28m 26s ⏱️
 4 170 tests  4 147 ✅  23 💤 0 ❌
13 107 runs  12 940 ✅ 167 💤 0 ❌

Results for commit cf64b15.

@laeubi laeubi merged commit dba97fe into eclipse-platform:master Jan 24, 2025
17 checks passed
nativeProxyProvider = switch (os) {
case Constants.OS_LINUX -> new ProxyProviderLinux();
case Constants.OS_WIN32 -> new ProxyProviderWin32();
default -> null;
Copy link
Contributor

Choose a reason for hiding this comment

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

@laeubi you could also just write ...case null, default -> null;. The switch can deal with null, if it's declared in the cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if its not only the case on Java 21,... but even System.getProperty("osgi.os", "") would be possible... so many options :-D

Copy link
Contributor

Choose a reason for hiding this comment

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

right, I sometimes forget that not everyone is on 21 yet. :)

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