How Can I Suggest New Methods for java.util.Paths?

0
10
Asked By CuriousCoder92 On

I'm really interested in adding some convenience methods to the `java.util.Paths` class, specifically `currentDirectory()` and `home()`. For instance, I'd love to use them like this: `Paths.currentDirectory().resolve("target");` and `Paths.home().resolve(".m2", "repository");`. Right now, the `Paths` class only has a single method, `get()`. What would be the best way to propose these additions to the Java developers?

4 Answers

Answered By DevGuruX On

You can actually get the current directory using `Path.of(".")`, which works well for most situations! So that might be a simpler option for what you're trying to achieve. It's a handy way without having to wait for new methods to be added.

Answered By JavaNinja77 On

It's worth noting that the `Path` interface isn't too flexible since different implementations can't work together the way we hope. The `Paths` class is pretty much just a helper. If you want these methods to be added, proposing a JEP could be your best bet. Just make sure you lay out all the requirements and potential benefits for it to be taken seriously.

Answered By PathExplorer On

You should definitely consider sending your proposal to the correct mailing lists like the Core-Libs Dev Mailing List. It's more effective than trying to create a JEP for something like this, which might not even be included in the release notes. Just express the issues you're facing and discuss existing solutions first.

Answered By CodeJunkie21 On

Paths actually isn't deprecated, just considered less favorable in some cases. Don't listen to the noise; you're on the right track wanting to suggest improvements. Just be persistent with your thoughts on existing solutions too!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.