Open ogregoire opened 2 years ago
I noticed that the method is new since Java 10. So I guess that a multi-release JAR must be created.
I worked a bit on it and found that it's possible to create such multi-release jar with the following changes:
JimfsFileStore.java
to jimfs/src/main/java10/com/google/common/jimfs/
.@Override
public long getBlockSize() throws IOException {
return disk.blockSize();
}
Add the following configuration to jimfs/pom.xml
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile-java-7</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</execution>
<execution>
<id>compile-java-10</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>10</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java10</compileSourceRoot>
</compileSourceRoots>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</plugin>
My only issue was with the tests, hence why I didn't provide a full-blown PR: I don't know how to make tests for a Multi-release project.
The following test case fails for some reason.
I'm explicitly setting the block size, but I get an
IOException
when the test case is run:I would expect the store to return the block size instead.