It could be nice if sponge can support nio2 !
Exemple: Use this:
@Inject
public Path configDir;
Instead of this:
@Inject
public File configDir;
Or why not support io (File) and nio (Path) ?
Sorry for my bad english. I am french
It could be nice if sponge can support nio2 !
Exemple: Use this:
@Inject
public Path configDir;
Instead of this:
@Inject
public File configDir;
Or why not support io (File) and nio (Path) ?
Sorry for my bad english. I am french
What would be the advantages of supporting nio2? Also, afaik the initial plan was backwards compatibility to the version minecraft is on. That would be Java 6. Nio2 was introduced in Java 7.
It’s not easily possible because we compile with JDK6 and therefore can’t reference Path
in the Sponge code. We would either need a lot of reflection or a different hack (as well as still making it work on JDK6) to make that work. As long Sponge is still using JDK6 this will probably not be easily possible.
However, there is nothing preventing you from easily converting File
-> Path
using toPath()
, for example:
@Plugin
public class MyPlugin {
public Path configDir;
@Inject
public MyPlugin(File configDir) {
this.configDir = configDir.toPath();
}
}
I saw SpongeAPI will support Java8, so I can ask again, Will Sponge support nio2 ? (natively) =3
Yes; most likely as soon the implementations will be updated for the Java 8 changes. I see nothing speaking against supporting this.
Added in https://github.com/SpongePowered/SpongeCommon/commit/17097fd95ac8239fbcf1d97b0a223d6c61ad84e0
I saw that ^^ thank