static {
     try {
         File tmp = File.createTempFile("lock", null);
         try (FileStream fs = new FileStream(tmp.getPath(), cli.System.IO.FileMode.wrap(cli.System.IO.FileMode.Create))) {
             try {
                 if (false) throw new cli.System.IO.IOException();
                 fs.Unlock(0, 1);
             } catch (cli.System.IO.IOException x) {
                 msg = x.get_Message();
             }
         }
         tmp.delete();
     } catch (Throwable _) {
     }
 }
 @cli.System.Security.SecuritySafeCriticalAttribute.Annotation
 void release(FileDescriptor fd, long pos, long size) throws IOException {
     FileStream fs = (FileStream)fd.getStream();
     if (WINDOWS)
     {
         int ERROR_NOT_LOCKED = 158;
         OVERLAPPED o = new OVERLAPPED();
         o.OffsetLow = (int)pos;
         o.OffsetHigh = (int)(pos >> 32);
         int result = UnlockFileEx(fs.get_SafeFileHandle(), 0, (int)size, (int)(size >> 32), o);
         if (result == 0 && Marshal.GetLastWin32Error() != ERROR_NOT_LOCKED)
         {
             throw new IOException("Release failed");
         }
     }
     else
     {
         try
         {
             if (false) throw new cli.System.ArgumentOutOfRangeException();
             if (false) throw new cli.System.IO.IOException();
             if (false) throw new cli.System.ObjectDisposedException("");
             fs.Unlock(pos, size);
         }
         catch (cli.System.IO.IOException x)
         {
             if (!NotLockedHack.isErrorNotLocked(x))
             {
                 throw new IOException(x.getMessage());
             }
         }
         catch (cli.System.ArgumentOutOfRangeException
             | cli.System.ObjectDisposedException x)
         {
             throw new IOException(x.getMessage());
         }
     }
 }
 static boolean isErrorNotLocked(cli.System.IO.IOException x) {
     return x.get_Message().equals(msg);
 }