mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8324048: (fc) Make FileKey fields final
Reviewed-by: djelinski, alanb, jpai
This commit is contained in:
parent
a461369f16
commit
23dc3b0246
4 changed files with 43 additions and 56 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -33,15 +33,18 @@ import java.io.IOException;
|
|||
*/
|
||||
public class FileKey {
|
||||
|
||||
private long st_dev; // ID of device
|
||||
private long st_ino; // Inode number
|
||||
private final long st_dev; // ID of device
|
||||
private final long st_ino; // Inode number
|
||||
|
||||
private FileKey() { }
|
||||
private FileKey(long st_dev, long st_ino) {
|
||||
this.st_dev = st_dev;
|
||||
this.st_ino = st_ino;
|
||||
}
|
||||
|
||||
public static FileKey create(FileDescriptor fd) throws IOException {
|
||||
FileKey fk = new FileKey();
|
||||
fk.init(fd);
|
||||
return fk;
|
||||
long finfo[] = new long[2];
|
||||
init(fd, finfo);
|
||||
return new FileKey(finfo[0], finfo[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,10 +62,10 @@ public class FileKey {
|
|||
&& (this.st_ino == other.st_ino);
|
||||
}
|
||||
|
||||
private native void init(FileDescriptor fd) throws IOException;
|
||||
private static native void initIDs();
|
||||
private static native void init(FileDescriptor fd, long[] finfo)
|
||||
throws IOException;
|
||||
|
||||
static {
|
||||
initIDs();
|
||||
IOUtil.load();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue