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

Update to Java 16 #3602

Merged
merged 21 commits into from
Jul 19, 2022
Merged

Update to Java 16 #3602

merged 21 commits into from
Jul 19, 2022

Conversation

TheBusyBiscuit
Copy link
Member

Description

This PR updates Slimefun to Java 16.
This is a breaking update for any servers that run older versions of Java.
Please update your Java version immediately!

This PR is still in progress. There are a lot of advantages that come with the usage of Java 16 and it would be nice to take advantage of most if not all of them.

I compiled a list of relatively easy to implement patterns here:
https://sonarcloud.io/project/issues?resolved=false&rules=java%3AS5194%2Cjava%3AS6201%2Cjava%3AS6204%2Cjava%3AS6206&types=CODE_SMELL&id=Slimefun_Slimefun4

Anyone can contribute!
Feel free to PR to this branch with a few changes from the list above ❤️

The following newly available patterns are desirable:

"instanceof + cast"

  if (x instanceof String string) {
    string.something()
  }
  
  // instead of:

  if (o instanceof String) {
    String string = (String) o;
    string.something()
  }

switch expressions

  return switch (x) {
    case 1 -> 1;
    case 2 -> 2;
  }

  // instead of:

  switch (x) {
    case 1:
      return 1;
    case 2:
      return 2;
  }

and various other patterns, check the sonarcloud link for more details.
Of course any other sonarcloud issue is always up for grabs too!

Checklist

  • I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
  • I followed the existing code standards and didn't mess up the formatting.
  • I did my best to add documentation to any public classes or methods I added.
  • I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values
  • I added sufficient Unit Tests to cover my code.

@TheBusyBiscuit TheBusyBiscuit added the 🔧 Technical Thread This Issue is a technical Thread where developers can discuss technical changes to Slimefun. label Jul 2, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 2, 2022

Pro Tip!
You can help us label your Pull Requests by using the following branch naming convention next time you create a pull request. ❤️

Branch naming convention Label
feature/** 🎈 Feature
fix/** ✨ Fix
chore/** 🧹 Chores
api/** 🔧 API
performance/** 💡 Performance Optimization
compatibility/** 🤝 Compatibility

If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! 👀

@TheBusyBiscuit TheBusyBiscuit marked this pull request as ready for review July 3, 2022 10:02
@TheBusyBiscuit TheBusyBiscuit requested review from a team as code owners July 3, 2022 10:02
@Sefiraat
Copy link
Member

Sefiraat commented Jul 3, 2022

FYI, I am happy to do those stream changes noted in the sonar list but I can't be entirely sure when a collection is required as immutable or not. While I could go through and check every usage I feel that may be better served by those who know the code base far better than myself.

Sefiraat
Sefiraat previously approved these changes Jul 3, 2022
Copy link
Member

@Sefiraat Sefiraat left a comment

Choose a reason for hiding this comment

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

Just one comment on the Chest patterns but even then it's still fine. So LGTM

@TheBusyBiscuit
Copy link
Member Author

@WalshyDev Do you perhaps have time to give this a look? 👀

@TheBusyBot TheBusyBot added the ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved! label Jul 9, 2022
@TheBusyBiscuit TheBusyBiscuit removed the ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved! label Jul 9, 2022
@TheBusyBot TheBusyBot added the ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved! label Jul 14, 2022
@TheBusyBiscuit TheBusyBiscuit removed the ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved! label Jul 14, 2022
@sonarcloud
Copy link

sonarcloud bot commented Jul 14, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 16 Code Smells

16.8% 16.8% Coverage
4.7% 4.7% Duplication

Copy link
Member

@Sfiguz7 Sfiguz7 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@Sefiraat Sefiraat left a comment

Choose a reason for hiding this comment

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

👍

@TheBusyBiscuit TheBusyBiscuit merged commit 5d5decb into master Jul 19, 2022
@TheBusyBiscuit TheBusyBiscuit deleted the java16 branch July 19, 2022 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔧 Technical Thread This Issue is a technical Thread where developers can discuss technical changes to Slimefun.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants