Commit e8978203 authored by hpi1's avatar hpi1

BDJ: fix setting File.fs in Java 8 (File.fs is declared final)

parent 8cea26ed
......@@ -29,6 +29,7 @@ package java.io;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URL;
......@@ -47,6 +48,11 @@ public abstract class BDFileSystem extends FileSystem {
filesystem = c.getDeclaredField("fs");
filesystem.setAccessible(true);
/* Java 8: remove "final" modifier from the field */
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(filesystem, filesystem.getModifiers() & ~Modifier.FINAL);
FileSystem fs = (FileSystem)filesystem.get(null);
if (fs instanceof BDFileSystemImpl) {
//System.err.print("FileSystem already wrapped");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment