Remove code deprecated for removal in 2.x

Closes gh-29482
This commit is contained in:
Andy Wilkinson
2022-01-19 14:04:44 +00:00
parent 1fa541d4de
commit de3b9a4910
84 changed files with 134 additions and 6385 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -58,19 +58,6 @@ public abstract class Launcher {
launch(args, launchClass, classLoader);
}
/**
* Create a classloader for the specified archives.
* @param archives the archives
* @return the classloader
* @throws Exception if the classloader cannot be created
* @deprecated since 2.3.0 for removal in 2.5.0 in favor of
* {@link #createClassLoader(Iterator)}
*/
@Deprecated
protected ClassLoader createClassLoader(List<Archive> archives) throws Exception {
return createClassLoader(archives.iterator());
}
/**
* Create a classloader for the specified archives.
* @param archives the archives
@@ -132,21 +119,7 @@ public abstract class Launcher {
* @throws Exception if the class path archives cannot be obtained
* @since 2.3.0
*/
protected Iterator<Archive> getClassPathArchivesIterator() throws Exception {
return getClassPathArchives().iterator();
}
/**
* Returns the archives that will be used to construct the class path.
* @return the class path archives
* @throws Exception if the class path archives cannot be obtained
* @deprecated since 2.3.0 for removal in 2.5.0 in favor of implementing
* {@link #getClassPathArchivesIterator()}.
*/
@Deprecated
protected List<Archive> getClassPathArchives() throws Exception {
throw new IllegalStateException("Unexpected call to getClassPathArchives()");
}
protected abstract Iterator<Archive> getClassPathArchivesIterator() throws Exception;
protected final Archive createArchive() throws Exception {
ProtectionDomain protectionDomain = getClass().getProtectionDomain();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,11 +20,6 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.function.Consumer;
import java.util.jar.Manifest;
import org.springframework.boot.loader.Launcher;
@@ -62,67 +57,7 @@ public interface Archive extends Iterable<Archive.Entry>, AutoCloseable {
* @throws IOException on IO error
* @since 2.3.0
*/
default Iterator<Archive> getNestedArchives(EntryFilter searchFilter, EntryFilter includeFilter)
throws IOException {
EntryFilter combinedFilter = (entry) -> (searchFilter == null || searchFilter.matches(entry))
&& (includeFilter == null || includeFilter.matches(entry));
List<Archive> nestedArchives = getNestedArchives(combinedFilter);
return nestedArchives.iterator();
}
/**
* Returns nested {@link Archive}s for entries that match the specified filter.
* @param filter the filter used to limit entries
* @return nested archives
* @throws IOException if nested archives cannot be read
* @deprecated since 2.3.0 for removal in 2.5.0 in favor of
* {@link #getNestedArchives(EntryFilter, EntryFilter)}
*/
@Deprecated
default List<Archive> getNestedArchives(EntryFilter filter) throws IOException {
throw new IllegalStateException("Unexpected call to getNestedArchives(filter)");
}
/**
* Return a new iterator for the archive entries.
* @deprecated since 2.3.0 for removal in 2.5.0 in favor of using
* {@link org.springframework.boot.loader.jar.JarFile} to access entries and
* {@link #getNestedArchives(EntryFilter, EntryFilter)} for accessing nested archives.
* @see java.lang.Iterable#iterator()
*/
@Deprecated
@Override
Iterator<Entry> iterator();
/**
* Performs the given action for each element of the {@code Iterable} until all
* elements have been processed or the action throws an exception.
* @deprecated since 2.3.0 for removal in 2.5.0 in favor of using
* {@link org.springframework.boot.loader.jar.JarFile} to access entries and
* {@link #getNestedArchives(EntryFilter, EntryFilter)} for accessing nested archives.
* @see Iterable#forEach
*/
@Deprecated
@Override
default void forEach(Consumer<? super Entry> action) {
Objects.requireNonNull(action);
for (Entry entry : this) {
action.accept(entry);
}
}
/**
* Creates a {@link Spliterator} over the elements described by this {@code Iterable}.
* @deprecated since 2.3.0 for removal in 2.5.0 in favor of using
* {@link org.springframework.boot.loader.jar.JarFile} to access entries and
* {@link #getNestedArchives(EntryFilter, EntryFilter)} for accessing nested archives.
* @see Iterable#spliterator
*/
@Deprecated
@Override
default Spliterator<Entry> spliterator() {
return Spliterators.spliteratorUnknownSize(iterator(), 0);
}
Iterator<Archive> getNestedArchives(EntryFilter searchFilter, EntryFilter includeFilter) throws IOException;
/**
* Return if the archive is exploded (already unpacked).