Integrate animal sniffer

Animal sniffer provides tools to assist verifying that classes
compiled with a newer JDK are compatible with an older JDK.

This integratesthe latest version of the tool (1.11) that
permits the use of custom annotations. Added @UsesJava7,
@UsesJava8 and @UsesSunHttpServer and annotated the few places
where we rely on a specific environment.

The verification process can be invoked by running the 'sniff'
task.

Issue: SPR-11604

polishing
This commit is contained in:
Stephane Nicoll
2014-01-16 16:11:13 +01:00
parent e84f61bb9d
commit bd85c916eb
30 changed files with 247 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@@ -24,6 +24,7 @@ import java.util.TimeZone;
import org.springframework.context.i18n.LocaleContext;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.context.i18n.TimeZoneAwareLocaleContext;
import org.springframework.core.UsesJava8;
/**
* A context that holds user-specific <code>java.time</code> (JSR-310) settings
@@ -34,6 +35,7 @@ import org.springframework.context.i18n.TimeZoneAwareLocaleContext;
* @since 4.0
* @see DateTimeContextHolder
*/
@UsesJava8
public class DateTimeContext {
private Chronology chronology;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@@ -19,6 +19,7 @@ package org.springframework.format.datetime.standard;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import org.springframework.core.UsesJava8;
import org.springframework.core.NamedThreadLocal;
/**
@@ -27,6 +28,7 @@ import org.springframework.core.NamedThreadLocal;
* @author Juergen Hoeller
* @since 4.0
*/
@UsesJava8
public final class DateTimeContextHolder {
private static final ThreadLocal<DateTimeContext> dateTimeContextHolder =

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@@ -26,6 +26,7 @@ import java.time.chrono.ChronoZonedDateTime;
import java.util.Calendar;
import java.util.GregorianCalendar;
import org.springframework.core.UsesJava8;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.converter.ConverterRegistry;
import org.springframework.format.datetime.DateFormatterRegistrar;
@@ -42,6 +43,7 @@ import org.springframework.format.datetime.DateFormatterRegistrar;
* @author Juergen Hoeller
* @since 4.0.1
*/
@UsesJava8
final class DateTimeConverters {
/**
@@ -83,7 +85,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class LocalDateTimeToLocalDateConverter implements Converter<LocalDateTime, LocalDate> {
@Override
@@ -92,7 +94,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class LocalDateTimeToLocalTimeConverter implements Converter<LocalDateTime, LocalTime> {
@Override
@@ -101,7 +103,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class ZonedDateTimeToLocalDateConverter implements Converter<ZonedDateTime, LocalDate> {
@Override
@@ -110,7 +112,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class ZonedDateTimeToLocalTimeConverter implements Converter<ZonedDateTime, LocalTime> {
@Override
@@ -119,7 +121,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class ZonedDateTimeToLocalDateTimeConverter implements Converter<ZonedDateTime, LocalDateTime> {
@Override
@@ -128,7 +130,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class ZonedDateTimeToOffsetDateTimeConverter implements Converter<ZonedDateTime, OffsetDateTime> {
@Override
@@ -137,7 +139,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class ZonedDateTimeToInstantConverter implements Converter<ZonedDateTime, Instant> {
@Override
@@ -147,6 +149,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class OffsetDateTimeToLocalDateConverter implements Converter<OffsetDateTime, LocalDate> {
@Override
@@ -155,7 +158,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class OffsetDateTimeToLocalTimeConverter implements Converter<OffsetDateTime, LocalTime> {
@Override
@@ -164,7 +167,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class OffsetDateTimeToLocalDateTimeConverter implements Converter<OffsetDateTime, LocalDateTime> {
@Override
@@ -173,7 +176,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class OffsetDateTimeToZonedDateTimeConverter implements Converter<OffsetDateTime, ZonedDateTime> {
@Override
@@ -182,7 +185,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class OffsetDateTimeToInstantConverter implements Converter<OffsetDateTime, Instant> {
@Override
@@ -191,7 +194,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class CalendarToZonedDateTimeConverter implements Converter<Calendar, ZonedDateTime> {
@Override
@@ -200,7 +203,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class CalendarToOffsetDateTimeConverter implements Converter<Calendar, OffsetDateTime> {
@Override
@@ -209,7 +212,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class CalendarToLocalDateConverter implements Converter<Calendar, LocalDate> {
@Override
@@ -218,7 +221,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class CalendarToLocalTimeConverter implements Converter<Calendar, LocalTime> {
@Override
@@ -227,7 +230,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class CalendarToLocalDateTimeConverter implements Converter<Calendar, LocalDateTime> {
@Override
@@ -236,7 +239,7 @@ final class DateTimeConverters {
}
}
@UsesJava8
private static class CalendarToInstantConverter implements Converter<Calendar, Instant> {
@Override
@@ -247,6 +250,7 @@ final class DateTimeConverters {
}
@UsesJava8
private static class LongToInstantConverter implements Converter<Long, Instant> {
@Override
@@ -256,6 +260,7 @@ final class DateTimeConverters {
}
@UsesJava8
private static class InstantToLongConverter implements Converter<Instant, Long> {
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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,6 +20,7 @@ import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.TimeZone;
import org.springframework.core.UsesJava8;
import org.springframework.format.annotation.DateTimeFormat.ISO;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -42,6 +43,7 @@ import org.springframework.util.StringUtils;
* @see #setDateTimeStyle
* @see DateTimeFormatterFactoryBean
*/
@UsesJava8
public class DateTimeFormatterFactory {
private String pattern;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@@ -28,6 +28,7 @@ import java.time.format.FormatStyle;
import java.util.HashMap;
import java.util.Map;
import org.springframework.core.UsesJava8;
import org.springframework.format.FormatterRegistrar;
import org.springframework.format.FormatterRegistry;
import org.springframework.format.annotation.DateTimeFormat.ISO;
@@ -46,6 +47,7 @@ import org.springframework.format.annotation.DateTimeFormat.ISO;
* @see org.springframework.format.datetime.DateFormatterRegistrar
* @see org.springframework.format.datetime.joda.DateTimeFormatterFactoryBean
*/
@UsesJava8
public class DateTimeFormatterRegistrar implements FormatterRegistrar {
private static enum Type {DATE, TIME, DATE_TIME}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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,6 +20,7 @@ import java.text.ParseException;
import java.time.Instant;
import java.util.Locale;
import org.springframework.core.UsesJava8;
import org.springframework.format.Formatter;
/**
@@ -31,6 +32,7 @@ import org.springframework.format.Formatter;
* @since 4.0
* @see java.time.Instant#parse
*/
@UsesJava8
public class InstantFormatter implements Formatter<Instant> {
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@@ -27,6 +27,7 @@ import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.util.Locale;
import org.springframework.core.UsesJava8;
import org.springframework.format.Parser;
/**
@@ -43,6 +44,7 @@ import org.springframework.format.Parser;
* @see java.time.OffsetDateTime#parse(CharSequence, java.time.format.DateTimeFormatter)
* @see java.time.OffsetTime#parse(CharSequence, java.time.format.DateTimeFormatter)
*/
@UsesJava8
public final class TemporalAccessorParser implements Parser<TemporalAccessor> {
private final Class<? extends TemporalAccessor> temporalAccessorType;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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,6 +20,7 @@ import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.util.Locale;
import org.springframework.core.UsesJava8;
import org.springframework.format.Printer;
/**
@@ -31,6 +32,7 @@ import org.springframework.format.Printer;
* @see DateTimeContextHolder#getFormatter
* @see java.time.format.DateTimeFormatter#format(java.time.temporal.TemporalAccessor)
*/
@UsesJava8
public final class TemporalAccessorPrinter implements Printer<TemporalAccessor> {
private final DateTimeFormatter formatter;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@@ -33,6 +33,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.UsesSunHttpServer;
/**
* {@link org.springframework.beans.factory.FactoryBean} that creates a simple
@@ -51,6 +52,7 @@ import org.springframework.beans.factory.InitializingBean;
* @see #setPort
* @see #setContexts
*/
@UsesSunHttpServer
public class SimpleHttpServerFactoryBean implements FactoryBean<HttpServer>, InitializingBean, DisposableBean {
protected final Log logger = LogFactory.getLog(getClass());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@@ -22,6 +22,7 @@ import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.UsesJava7;
/**
* A Spring {@link FactoryBean} that builds and exposes a preconfigured {@link ForkJoinPool}.
@@ -37,6 +38,7 @@ import org.springframework.beans.factory.InitializingBean;
* @author Juergen Hoeller
* @since 3.1
*/
@UsesJava7
public class ForkJoinPoolFactoryBean implements FactoryBean<ForkJoinPool>, InitializingBean, DisposableBean {
private boolean commonPool = false;