# 已过时的 API

## 目录

- 已过时的类
- 已过时的注释类型
- 已过时的字段
- 已过时的方法
- 已过时的构造器

- 已过时的类
  类和说明
  org.springframework.util.comparator.CompoundComparator as of Spring Framework 5.0, in favor of the standard JDK 8 `Comparator.thenComparing(Comparator)`
  org.springframework.util.comparator.InvertibleComparator as of Spring Framework 5.0, in favor of the standard JDK 8 `Comparator.reversed()`

- 已过时的注释类型
  注释类型和说明
  org.springframework.lang.UsesJava7 as of 5.0 since the framework is based on Java 8+ now
  org.springframework.lang.UsesJava8 as of 5.0 since the framework is based on Java 8+ now

- 已过时的字段
  字段和说明
  org.springframework.util.ReflectionUtils.NON_BRIDGED_METHODS as of 5.0.11, in favor of a custom `ReflectionUtils.MethodFilter`

- 已过时的方法
  方法和说明
  org.springframework.core.codec.StringDecoder.allMimeTypes(boolean) as of Spring 5.0.4, in favor of `StringDecoder.allMimeTypes()` or `StringDecoder.allMimeTypes(List, boolean)`
  org.springframework.util.Assert.doesNotContain(String, String) as of 4.3.7, in favor of `Assert.doesNotContain(String, String, String)`
  org.springframework.core.MethodParameter.forMethodOrConstructor(Object, int) as of 5.0, in favor of `MethodParameter.forExecutable(java.lang.reflect.Executable, int)`
  org.springframework.core.codec.Encoder.getContentLength(T, MimeType) this method was added so `EncoderHttpMessageWriter` can set the content-length header. However after further improvements as of 5.0.7, it is no longer needed, and not used.
  org.springframework.util.ObjectUtils.hashCode(boolean) as of Spring Framework 5.0, in favor of the native JDK 8 variant
  org.springframework.util.ObjectUtils.hashCode(double) as of Spring Framework 5.0, in favor of the native JDK 8 variant
  org.springframework.util.ObjectUtils.hashCode(float) as of Spring Framework 5.0, in favor of the native JDK 8 variant
  org.springframework.util.ObjectUtils.hashCode(long) as of Spring Framework 5.0, in favor of the native JDK 8 variant
  org.springframework.util.Assert.hasLength(String) as of 4.3.7, in favor of `Assert.hasLength(String, String)`
  org.springframework.util.Assert.hasText(String) as of 4.3.7, in favor of `Assert.hasText(String, String)`
  org.springframework.util.ReflectionUtils.invokeJdbcMethod(Method, Object) as of 5.0.11, in favor of custom SQLException handling
  org.springframework.util.ReflectionUtils.invokeJdbcMethod(Method, Object, Object...) as of 5.0.11, in favor of custom SQLException handling
  org.springframework.util.Assert.isNull(Object) as of 4.3.7, in favor of `Assert.isNull(Object, String)`
  org.springframework.util.Assert.isTrue(boolean) as of 4.3.7, in favor of `Assert.isTrue(boolean, String)`
  org.springframework.util.StringUtils.mergeStringArrays(String[], String[]) as of 4.3.15, in favor of manual merging via `LinkedHashSet` (with every entry included at most once, even entries within the first array)
  org.springframework.asm.ClassWriter.newHandle(int, String, String, String) this method is superseded by `ClassWriter.newHandle(int, String, String, String, boolean)`.
  org.springframework.util.Assert.noNullElements(Object[]) as of 4.3.7, in favor of `Assert.noNullElements(Object[], String)`
  org.springframework.util.Assert.notEmpty(Collection<?>) as of 4.3.7, in favor of `Assert.notEmpty(Collection, String)`
  org.springframework.util.Assert.notEmpty(Map<?, ?>) as of 4.3.7, in favor of `Assert.notEmpty(Map, String)`
  org.springframework.util.Assert.notEmpty(Object[]) as of 4.3.7, in favor of `Assert.notEmpty(Object[], String)`
  org.springframework.util.Assert.notNull(Object) as of 4.3.7, in favor of `Assert.notNull(Object, String)`
  org.springframework.core.io.buffer.DataBufferUtils.read(AsynchronousFileChannel, DataBufferFactory, int) as of Spring 5.0.3, in favor of `DataBufferUtils.readAsynchronousFileChannel(Callable, DataBufferFactory, int)`, to be removed in Spring 5.1
  org.springframework.core.io.buffer.DataBufferUtils.read(AsynchronousFileChannel, long, DataBufferFactory, int) as of Spring 5.0.3, in favor of `DataBufferUtils.readAsynchronousFileChannel(Callable, long, DataBufferFactory, int)`, to be removed in Spring 5.1
  org.springframework.core.io.buffer.DataBufferUtils.read(InputStream, DataBufferFactory, int) as of Spring 5.0.3, in favor of `DataBufferUtils.readInputStream(Callable, DataBufferFactory, int)`, to be removed in Spring 5.1
  org.springframework.core.io.buffer.DataBufferUtils.read(ReadableByteChannel, DataBufferFactory, int) as of Spring 5.0.3, in favor of `DataBufferUtils.readByteChannel(Callable, DataBufferFactory, int)`, to be removed in Spring 5.1
  org.springframework.util.Assert.state(boolean) as of 4.3.7, in favor of `Assert.state(boolean, String)`
  org.springframework.core.codec.StringDecoder.textPlainOnly(boolean) as of Spring 5.0.4, in favor of `StringDecoder.textPlainOnly()` or `StringDecoder.textPlainOnly(List, boolean)`
  org.springframework.util.StringUtils.toLanguageTag(Locale) as of 5.0.4, in favor of `Locale.toLanguageTag()`
  org.springframework.asm.MethodVisitor.visitMethodInsn(int, String, String, String)

- 已过时的构造器
  构造器和说明
  org.springframework.core.io.ClassPathResource(String, ClassLoader, Class<?>) as of 4.3.13, in favor of selective use of `ClassPathResource.ClassPathResource(String, ClassLoader)` vs `ClassPathResource.ClassPathResource(String, Class)`
  org.springframework.asm.Handle(int, String, String, String) this constructor has been superseded by `Handle.Handle(int, String, String, String, boolean)`.