From 8baef22711676bf853dfc24ef145122a335f4312 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Fri, 30 Aug 2024 21:59:53 +0200 Subject: Remove deprecated lastModified methods using long from - FileUtils#lastModified - FileUtils#setLastModified - FS#getLastModifiedTime - FS#lastModified - FS#setLastModified - FileTreeIterator.Entry#getEntryLastModified - WorkingTreeIterator#getEntryLastModified - WorkingTreeIterator.Entry#getEntryLastModified Change-Id: I5073f05c32f8f626383a91048470c79332983121 --- .../eclipse/jgit/treewalk/FileTreeIterator.java | 6 --- .../eclipse/jgit/treewalk/WorkingTreeIterator.java | 27 ------------ org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java | 50 ---------------------- .../src/org/eclipse/jgit/util/FileUtils.java | 33 -------------- 4 files changed, 116 deletions(-) (limited to 'org.eclipse.jgit/src') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java index 36fa72028e..0cac374844 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java @@ -371,12 +371,6 @@ public class FileTreeIterator extends WorkingTreeIterator { return attributes.getLength(); } - @Override - @Deprecated - public long getLastModified() { - return attributes.getLastModifiedInstant().toEpochMilli(); - } - /** * @since 5.1.9 */ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java index 95e9964192..f16d800f63 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java @@ -619,18 +619,6 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { 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. * @@ -1222,21 +1210,6 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { */ public abstract long getLength(); - /** - * Get the last modified time of this entry. - *

- * Note: Efficient implementation required. - *

- * 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. *

diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index 6933a6c567..4433dccc62 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -1080,24 +1080,6 @@ public abstract class FS { */ 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 @@ -1126,25 +1108,6 @@ public abstract class FS { return FileUtils.lastModifiedInstant(f.toPath()); } - /** - * Set the last modified time of a file system object. - *

- * 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. *

@@ -2425,19 +2388,6 @@ public abstract class FS { 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 * diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java index cab0e6a0a9..39c67f1b86 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java @@ -770,24 +770,6 @@ public class FileUtils { 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 * @@ -827,21 +809,6 @@ public class FileUtils { 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. * -- cgit v1.2.3