Skip to content

Use NIO in the YAMLProcessor class - #3715

Merged
SirYwell merged 1 commit into
mainfrom
fix/yamlprocessor-nio
Nov 4, 2026
Merged

SirYwell merged 1 commit into
mainfrom
fix/yamlprocessor-nio

Conversation

@MattBDev

@MattBDev MattBDev commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Cherry picked EngineHub/WorldEdit#2802.
"Use NIO in the YAMLProcessor class"
THIS SHOULD BE AN EASY APPROVE
This restores compatibility with WorldGuard, which now calls the Path constructors of YAMLProcessor and fails with NoSuchMethodError on FAWE.

Differences from the upstream commit:

  • The verification/ API change list does not exist in FAWE, so that part is dropped.
  • WorldEditPlugin applies .toPath() to FAWE's worldedit-config.yml line instead of upstream's config.yml line.

Submitter Checklist

  • Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
  • Ensure that the pull request title represents the desired changelog entry.
  • New public fields and methods are annotated with @since TODO. (The new Path constructors are upstream API and are kept as upstream has them.)
  • I read and followed the contribution guidelines.

* Use NIO in the YAMLProcessor class

* Update worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java

Co-authored-by: Octavia Togami <octavia.togami@gmail.com>

* Update worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java

Co-authored-by: Octavia Togami <octavia.togami@gmail.com>

* Fix logger not existing

* Fix checkstyle

---------

Co-authored-by: Octavia Togami <octavia.togami@gmail.com>
(cherry picked from commit 5f543fdb779e982f92084934ea8f4af3d1c740e1)
@MattBDev
MattBDev requested a review from a team as a code owner November 4, 2026 03:26
@MattBDev MattBDev added the upstream Issues related to upstream API compatibility—missing implementations or regressions label Nov 4, 2026
Copilot AI balanced review requested due to automatic review settings November 4, 2026 03:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🟡 Changes recommended

The change replaces the protected File file field with a Path path field in YAMLProcessor, which is a binary-incompatible API break for external subclasses/plugins and directly conflicts with the stated compatibility goal unless a deprecated alias is retained.

1 open issue
What changed in this PR

This pull request cherry-picks upstream WorldEdit changes to migrate YAMLProcessor from java.io.File-based I/O to NIO (Path/Files) and adds Path constructors, restoring runtime compatibility with integrations (e.g., WorldGuard) that now call YAMLProcessor(Path, ...).

Changes:

  • Add Path-accepting constructors to YAMLProcessor and switch internal read/write operations to java.nio.file.Files streams.
  • Update Bukkit bootstrap/config initialization to pass .toPath() for worldedit-config.yml.
  • Update WEPIF permissions configuration loading to use Path/Files APIs.

Review notes (unresolved):

  • Critical: Changing protected File file to Path path is binary-incompatible for external subclasses/plugins accessing YAMLProcessor#file (risk of NoSuchFieldError). Consider keeping a deprecated protected File file alias derived from path to preserve compatibility.
  • Moderate: save() creates an OutputStreamWriter that is not closed/flushed; this can truncate output while still returning true. Use try-with-resources for the writer.
  • Nit: save() directory creation/logging should also consider SecurityException, and use parameterized logging instead of string concatenation.
File Summary
worldedit-core/​src/​main/​java/​com/​sk89q/​util/​yaml/​YAMLProcessor.java Adds Path constructors and migrates YAML read/write and directory creation to NIO (Path/Files).
worldedit-bukkit/​src/​main/​java/​com/​sk89q/​worldedit/​bukkit/​WorldEditPlugin.java Passes a Path (.toPath()) into YAMLProcessor for Bukkit config initialization (worldedit-config.yml).
worldedit-bukkit/​src/​main/​java/​com/​sk89q/​wepif/​PermissionsResolverManager.java Converts WEPIF config handling from File to Path/Files and constructs YAMLProcessor with a Path.

Review effort: Balanced

@SirYwell SirYwell changed the title Use NIO in the YAMLProcessor class (#2802) Use NIO in the YAMLProcessor class Nov 4, 2026
@SirYwell
SirYwell merged commit 0e0dcc7 into main Nov 4, 2026
6 checks passed
@SirYwell
SirYwell deleted the fix/yamlprocessor-nio branch November 4, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream Issues related to upstream API compatibility—missing implementations or regressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants