diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2023-11-18 00:06:01 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-11-24 18:22:07 +0000 |
commit | ef901e9aea21c51de1ec26ff8265faf657326857 (patch) | |
tree | b22e391b53a929e3e8465c7428eee51422b9746c /org.eclipse.jgit.archive | |
parent | aab75dba7e63c88ddce92a75b2afa24cc97aeb04 (diff) | |
download | jgit-ef901e9aea21c51de1ec26ff8265faf657326857.tar.gz jgit-ef901e9aea21c51de1ec26ff8265faf657326857.zip |
Adapt to type parameter added in commons-compress 1.25.0
In 1.25.0 commons-compress added a generic type parameter to
ArchiveOutputStream to avoid unchecked/unconfirmed type casts in
subclasses.
Change-Id: Ib4c208fc1fb65f73ea57c5bf723fde71b0d6d9f7
Diffstat (limited to 'org.eclipse.jgit.archive')
5 files changed, 20 insertions, 15 deletions
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/BaseFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/BaseFormat.java index 25cd36817a..4757998a29 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/BaseFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/BaseFormat.java @@ -15,6 +15,7 @@ import java.io.IOException; import java.text.MessageFormat; import java.util.Map; +import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.ArchiveOutputStream; import org.eclipse.jgit.archive.internal.ArchiveText; import org.eclipse.jgit.util.StringUtils; @@ -42,7 +43,8 @@ public class BaseFormat { * @throws IOException * if an IO error occurred */ - protected ArchiveOutputStream applyFormatOptions(ArchiveOutputStream s, + protected ArchiveOutputStream<? extends ArchiveEntry> applyFormatOptions( + ArchiveOutputStream<? extends ArchiveEntry> s, Map<String, Object> o) throws IOException { for (Map.Entry<String, Object> p : o.entrySet()) { try { diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java index dfa60321b0..3db1124752 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java @@ -35,7 +35,7 @@ import org.eclipse.jgit.revwalk.RevCommit; * Unix TAR format (ustar + some PAX extensions). */ public final class TarFormat extends BaseFormat implements - ArchiveCommand.Format<ArchiveOutputStream> { + ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> { private static final List<String> SUFFIXES = Collections .unmodifiableList(Arrays.asList(".tar")); //$NON-NLS-1$ @@ -57,7 +57,7 @@ public final class TarFormat extends BaseFormat implements } @Override - public void putEntry(ArchiveOutputStream out, + public void putEntry(ArchiveOutputStream<TarArchiveEntry> out, ObjectId tree, String path, FileMode mode, ObjectLoader loader) throws IOException { if (mode == FileMode.SYMLINK) { diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/Tbz2Format.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/Tbz2Format.java index 26da431147..03a2305e2b 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/Tbz2Format.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/Tbz2Format.java @@ -17,6 +17,7 @@ import java.util.List; import java.util.Map; import org.apache.commons.compress.archivers.ArchiveOutputStream; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream; import org.eclipse.jgit.api.ArchiveCommand; import org.eclipse.jgit.lib.FileMode; @@ -26,12 +27,12 @@ import org.eclipse.jgit.lib.ObjectLoader; /** * bzip2-compressed tarball (tar.bz2) format. */ -public final class Tbz2Format extends BaseFormat implements - ArchiveCommand.Format<ArchiveOutputStream> { +public final class Tbz2Format extends BaseFormat + implements ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> { private static final List<String> SUFFIXES = Collections .unmodifiableList(Arrays.asList(".tar.bz2", ".tbz", ".tbz2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - private final ArchiveCommand.Format<ArchiveOutputStream> tarFormat = new TarFormat(); + private final ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> tarFormat = new TarFormat(); @Override public ArchiveOutputStream createArchiveOutputStream(OutputStream s) @@ -54,7 +55,7 @@ public final class Tbz2Format extends BaseFormat implements } @Override - public void putEntry(ArchiveOutputStream out, + public void putEntry(ArchiveOutputStream<TarArchiveEntry> out, ObjectId tree, String path, FileMode mode, ObjectLoader loader) throws IOException { tarFormat.putEntry(out, tree, path, mode, loader); diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TgzFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TgzFormat.java index d1ed035d0f..6ce9c1e748 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TgzFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TgzFormat.java @@ -17,6 +17,7 @@ import java.util.List; import java.util.Map; import org.apache.commons.compress.archivers.ArchiveOutputStream; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream; import org.apache.commons.compress.compressors.gzip.GzipParameters; import org.eclipse.jgit.api.ArchiveCommand; @@ -27,12 +28,12 @@ import org.eclipse.jgit.lib.ObjectLoader; /** * gzip-compressed tarball (tar.gz) format. */ -public final class TgzFormat extends BaseFormat implements - ArchiveCommand.Format<ArchiveOutputStream> { +public final class TgzFormat extends BaseFormat + implements ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> { private static final List<String> SUFFIXES = Collections .unmodifiableList(Arrays.asList(".tar.gz", ".tgz")); //$NON-NLS-1$ //$NON-NLS-2$ - private final ArchiveCommand.Format<ArchiveOutputStream> tarFormat = new TarFormat(); + private final ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> tarFormat = new TarFormat(); @Override public ArchiveOutputStream createArchiveOutputStream(OutputStream s) @@ -57,7 +58,7 @@ public final class TgzFormat extends BaseFormat implements } @Override - public void putEntry(ArchiveOutputStream out, + public void putEntry(ArchiveOutputStream<TarArchiveEntry> out, ObjectId tree, String path, FileMode mode, ObjectLoader loader) throws IOException { tarFormat.putEntry(out, tree, path, mode, loader); diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java index 42549de302..f51f904bc7 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java @@ -17,6 +17,7 @@ import java.util.List; import java.util.Map; import org.apache.commons.compress.archivers.ArchiveOutputStream; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream; import org.eclipse.jgit.api.ArchiveCommand; import org.eclipse.jgit.lib.FileMode; @@ -26,12 +27,12 @@ import org.eclipse.jgit.lib.ObjectLoader; /** * Xz-compressed tar (tar.xz) format. */ -public final class TxzFormat extends BaseFormat implements - ArchiveCommand.Format<ArchiveOutputStream> { +public final class TxzFormat extends BaseFormat + implements ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> { private static final List<String> SUFFIXES = Collections .unmodifiableList(Arrays.asList(".tar.xz", ".txz")); //$NON-NLS-1$ //$NON-NLS-2$ - private final ArchiveCommand.Format<ArchiveOutputStream> tarFormat = new TarFormat(); + private final ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> tarFormat = new TarFormat(); @Override public ArchiveOutputStream createArchiveOutputStream(OutputStream s) @@ -54,7 +55,7 @@ public final class TxzFormat extends BaseFormat implements } @Override - public void putEntry(ArchiveOutputStream out, + public void putEntry(ArchiveOutputStream<TarArchiveEntry> out, ObjectId tree, String path, FileMode mode, ObjectLoader loader) throws IOException { tarFormat.putEntry(out, tree, path, mode, loader); |