Update Animal Sniffer and related annotations for Java 8 baseline
Closes gh-6981
This commit is contained in:
@@ -42,8 +42,6 @@ import java.util.jar.Manifest;
|
||||
import java.util.zip.CRC32;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
import org.springframework.lang.UsesJava7;
|
||||
|
||||
/**
|
||||
* Writes JAR content, ensuring valid directory entries are always create and duplicate
|
||||
* items are ignored.
|
||||
@@ -88,7 +86,6 @@ public class JarWriter {
|
||||
this.jarOutput = new JarOutputStream(fileOutputStream);
|
||||
}
|
||||
|
||||
@UsesJava7
|
||||
private void setExecutableFilePermission(File file) {
|
||||
try {
|
||||
Path path = file.toPath();
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
import org.springframework.boot.loader.tools.JarWriter.EntryTransformer;
|
||||
import org.springframework.lang.UsesJava8;
|
||||
|
||||
/**
|
||||
* Utility class that can be used to repackage an archive so that it can be executed using
|
||||
@@ -353,51 +352,21 @@ public class Repackager {
|
||||
}
|
||||
renamedEntry.setCompressedSize(entry.getCompressedSize());
|
||||
renamedEntry.setCrc(entry.getCrc());
|
||||
setCreationTimeIfPossible(entry, renamedEntry);
|
||||
if (entry.getCreationTime() != null) {
|
||||
renamedEntry.setCreationTime(entry.getCreationTime());
|
||||
}
|
||||
if (entry.getExtra() != null) {
|
||||
renamedEntry.setExtra(entry.getExtra());
|
||||
}
|
||||
setLastAccessTimeIfPossible(entry, renamedEntry);
|
||||
setLastModifiedTimeIfPossible(entry, renamedEntry);
|
||||
if (entry.getLastAccessTime() != null) {
|
||||
renamedEntry.setLastAccessTime(entry.getLastAccessTime());
|
||||
}
|
||||
if (entry.getLastModifiedTime() != null) {
|
||||
renamedEntry.setLastModifiedTime(entry.getLastModifiedTime());
|
||||
}
|
||||
return renamedEntry;
|
||||
}
|
||||
|
||||
@UsesJava8
|
||||
private void setCreationTimeIfPossible(JarEntry source, JarEntry target) {
|
||||
try {
|
||||
if (source.getCreationTime() != null) {
|
||||
target.setCreationTime(source.getCreationTime());
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
// Not running on Java 8. Continue.
|
||||
}
|
||||
}
|
||||
|
||||
@UsesJava8
|
||||
private void setLastAccessTimeIfPossible(JarEntry source, JarEntry target) {
|
||||
try {
|
||||
if (source.getLastAccessTime() != null) {
|
||||
target.setLastAccessTime(source.getLastAccessTime());
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
// Not running on Java 8. Continue.
|
||||
}
|
||||
}
|
||||
|
||||
@UsesJava8
|
||||
private void setLastModifiedTimeIfPossible(JarEntry source, JarEntry target) {
|
||||
try {
|
||||
if (source.getLastModifiedTime() != null) {
|
||||
target.setLastModifiedTime(source.getLastModifiedTime());
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
// Not running on Java 8. Continue.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user