Skip to content

Commit

Permalink
Remove deprecated lastModified methods using long
Browse files Browse the repository at this point in the history
from
- FileUtils#lastModified
- FileUtils#setLastModified
- FS#getLastModifiedTime
- FS#lastModified
- FS#setLastModified
- FileTreeIterator.Entry#getEntryLastModified
- WorkingTreeIterator#getEntryLastModified
- WorkingTreeIterator.Entry#getEntryLastModified

Change-Id: I5073f05c32f8f626383a91048470c79332983121
  • Loading branch information
msohn committed Sep 3, 2024
1 parent 88053ee commit 8baef22
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,6 @@ public long getLength() {
return attributes.getLength();
}

@Override
@Deprecated
public long getLastModified() {
return attributes.getLastModifiedInstant().toEpochMilli();
}

/**
* @since 5.1.9
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,18 +619,6 @@ public long getEntryContentLength() throws IOException {
return canonLen;
}

/**
* Get the last modified time of this entry.
*
* @return last modified time of this file, in milliseconds since the epoch
* (Jan 1, 1970 UTC).
* @deprecated use {@link #getEntryLastModifiedInstant()} instead
*/
@Deprecated
public long getEntryLastModified() {
return current().getLastModified();
}

/**
* Get the last modified time of this entry.
*
Expand Down Expand Up @@ -1222,21 +1210,6 @@ public String toString() {
*/
public abstract long getLength();

/**
* Get the last modified time of this entry.
* <p>
* <b>Note: Efficient implementation required.</b>
* <p>
* The implementation of this method must be efficient. If a subclass
* needs to compute the value they should cache the reference within an
* instance member instead.
*
* @return time since the epoch (in ms) of the last change.
* @deprecated use {@link #getLastModifiedInstant()} instead
*/
@Deprecated
public abstract long getLastModified();

/**
* Get the last modified time of this entry.
* <p>
Expand Down
50 changes: 0 additions & 50 deletions org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
Original file line number Diff line number Diff line change
Expand Up @@ -1080,24 +1080,6 @@ private void detectSymlinkSupport() {
*/
public abstract boolean setExecute(File f, boolean canExec);

/**
* Get the last modified time of a file system object. If the OS/JRE support
* symbolic links, the modification time of the link is returned, rather
* than that of the link target.
*
* @param f
* a {@link java.io.File} object.
* @return last modified time of f
* @throws java.io.IOException
* if an IO error occurred
* @since 3.0
* @deprecated use {@link #lastModifiedInstant(Path)} instead
*/
@Deprecated
public long lastModified(File f) throws IOException {
return FileUtils.lastModified(f);
}

/**
* Get the last modified time of a file system object. If the OS/JRE support
* symbolic links, the modification time of the link is returned, rather
Expand Down Expand Up @@ -1126,25 +1108,6 @@ public Instant lastModifiedInstant(File f) {
return FileUtils.lastModifiedInstant(f.toPath());
}

/**
* Set the last modified time of a file system object.
* <p>
* For symlinks it sets the modified time of the link target.
*
* @param f
* a {@link java.io.File} object.
* @param time
* last modified time
* @throws java.io.IOException
* if an IO error occurred
* @since 3.0
* @deprecated use {@link #setLastModified(Path, Instant)} instead
*/
@Deprecated
public void setLastModified(File f, long time) throws IOException {
FileUtils.setLastModified(f, time);
}

/**
* Set the last modified time of a file system object.
* <p>
Expand Down Expand Up @@ -2425,19 +2388,6 @@ public long getCreationTime() {
return creationTime;
}

/**
* Get the time when the file was last modified in milliseconds since
* the epoch
*
* @return the time (milliseconds since 1970-01-01) when this object was
* last modified
* @deprecated use getLastModifiedInstant instead
*/
@Deprecated
public long getLastModifiedTime() {
return lastModifiedInstant.toEpochMilli();
}

/**
* Get the time when this object was last modified
*
Expand Down
33 changes: 0 additions & 33 deletions org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -770,24 +770,6 @@ static boolean isSymlink(File file) {
return Files.isSymbolicLink(file.toPath());
}

/**
* Get the lastModified attribute for a given file
*
* @param file
* the file
* @return lastModified attribute for given file, not following symbolic
* links
* @throws IOException
* if an IO error occurred
* @deprecated use {@link #lastModifiedInstant(Path)} instead which returns
* FileTime
*/
@Deprecated
static long lastModified(File file) throws IOException {
return Files.getLastModifiedTime(toPath(file), LinkOption.NOFOLLOW_LINKS)
.toMillis();
}

/**
* Get last modified timestamp of a file
*
Expand Down Expand Up @@ -827,21 +809,6 @@ static BasicFileAttributes fileAttributes(File file) throws IOException {
return Files.readAttributes(file.toPath(), BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
}

/**
* Set the last modified time of a file system object.
*
* @param file
* the file
* @param time
* last modified timestamp
* @throws IOException
* if an IO error occurred
*/
@Deprecated
static void setLastModified(File file, long time) throws IOException {
Files.setLastModifiedTime(toPath(file), FileTime.fromMillis(time));
}

/**
* Set the last modified time of a file system object.
*
Expand Down

0 comments on commit 8baef22

Please sign in to comment.