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:
47
build.gradle
47
build.gradle
@@ -30,6 +30,7 @@ configure(allprojects) { project ->
|
||||
ext.tiles3Version = "3.0.3"
|
||||
ext.tomcatVersion = "8.0.5"
|
||||
ext.xstreamVersion = "1.4.7"
|
||||
ext.snifferVersion = "1.11"
|
||||
|
||||
ext.gradleScriptDir = "${rootProject.projectDir}/gradle"
|
||||
|
||||
@@ -38,6 +39,11 @@ configure(allprojects) { project ->
|
||||
apply plugin: "test-source-set-dependencies"
|
||||
apply from: "${gradleScriptDir}/ide.gradle"
|
||||
|
||||
configurations {
|
||||
sniffer
|
||||
javaApiSignature
|
||||
}
|
||||
|
||||
compileJava.options*.compilerArgs = [
|
||||
"-Xlint:serial", "-Xlint:varargs", "-Xlint:cast", "-Xlint:classfile",
|
||||
"-Xlint:dep-ann", "-Xlint:divzero", "-Xlint:empty", "-Xlint:finally",
|
||||
@@ -89,6 +95,47 @@ configure(allprojects) { project ->
|
||||
exclude group:'org.hamcrest', module:'hamcrest-core'
|
||||
}
|
||||
testCompile("org.hamcrest:hamcrest-all:1.3")
|
||||
testCompile("org.mockito:mockito-core:1.9.5")
|
||||
|
||||
sniffer("org.codehaus.mojo:animal-sniffer-ant-tasks:${snifferVersion}")
|
||||
javaApiSignature("org.codehaus.mojo.signature:java16:1.1@signature") // As from Java6_18
|
||||
}
|
||||
|
||||
task copyJavaApiSignature(type: Copy) {
|
||||
ext.to = file("$buildDir/javaApiSignature/")
|
||||
description "Copy the resolved Animal Sniffer signature dependency artifact to a known location and name"
|
||||
from configurations.javaApiSignature
|
||||
into to
|
||||
rename '.*signature', 'javaApi.signature'
|
||||
}
|
||||
|
||||
task sniff {
|
||||
group = "Verification"
|
||||
description = "Checks the Java API signatures"
|
||||
|
||||
dependsOn compileJava
|
||||
dependsOn copyJavaApiSignature
|
||||
|
||||
inputs.dir sourceSets.main.output.classesDir
|
||||
inputs.dir copyJavaApiSignature.to
|
||||
outputs.upToDateWhen { true }
|
||||
|
||||
doLast {
|
||||
ant.taskdef(
|
||||
name: 'animalSniffer',
|
||||
classname: 'org.codehaus.mojo.animal_sniffer.ant.CheckSignatureTask',
|
||||
classpath: configurations.sniffer.asPath
|
||||
)
|
||||
|
||||
ant.animalSniffer(
|
||||
signature: "$buildDir/javaApiSignature/javaApi.signature",
|
||||
classpath: sourceSets.main.compileClasspath.asPath) {
|
||||
path(path: sourceSets.main.output.classesDir)
|
||||
annotation(className: "org.springframework.core.UsesJava7")
|
||||
annotation(className: "org.springframework.core.UsesJava8")
|
||||
annotation(className: "org.springframework.core.UsesSunHttpServer")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext.javadocLinks = [
|
||||
|
||||
@@ -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,8 @@ package org.springframework.beans.propertyeditors;
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.time.ZoneId;
|
||||
|
||||
import org.springframework.core.UsesJava8;
|
||||
|
||||
/**
|
||||
* Editor for {@code java.time.ZoneId}, translating zone ID Strings into {@code ZoneId}
|
||||
* objects. Exposes the {@code TimeZone} ID as a text representation.
|
||||
@@ -28,6 +30,7 @@ import java.time.ZoneId;
|
||||
* @see java.time.ZoneId
|
||||
* @see TimeZoneEditor
|
||||
*/
|
||||
@UsesJava8
|
||||
public class ZoneIdEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.lang.reflect.Parameter;
|
||||
* @since 4.0
|
||||
* @see java.lang.reflect.Parameter#getName()
|
||||
*/
|
||||
@UsesJava8
|
||||
public class StandardReflectionParameterNameDiscoverer implements ParameterNameDiscoverer {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.core;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Indicate that the annotated element uses Java7 specific constructs
|
||||
* and therefore requires a Java7 environment.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@Retention(java.lang.annotation.RetentionPolicy.CLASS)
|
||||
@Documented
|
||||
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE})
|
||||
public @interface UsesJava7 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.core;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Indicate that the annotated element uses Java8 specific constructs
|
||||
* and therefore requires a Java8 environment.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 4.1
|
||||
*/
|
||||
@Retention(java.lang.annotation.RetentionPolicy.CLASS)
|
||||
@Documented
|
||||
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE})
|
||||
public @interface UsesJava8 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.core;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Indicate that the annotated element uses the Http Server available in
|
||||
* {@code com.sun.*} classes, which is only available on a Sun/Oracle JVM.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 4.1
|
||||
*/
|
||||
@Retention(java.lang.annotation.RetentionPolicy.CLASS)
|
||||
@Documented
|
||||
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE})
|
||||
public @interface UsesSunHttpServer {
|
||||
|
||||
}
|
||||
@@ -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.core.convert.support;
|
||||
import java.time.ZoneId;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.springframework.core.UsesJava8;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
/**
|
||||
@@ -34,6 +35,7 @@ import org.springframework.core.convert.converter.Converter;
|
||||
* @since 4.0
|
||||
* @see TimeZone#getTimeZone(java.time.ZoneId)
|
||||
*/
|
||||
@UsesJava8
|
||||
final class ZoneIdToTimeZoneConverter implements Converter<ZoneId, TimeZone> {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.ZonedDateTime;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import org.springframework.core.UsesJava8;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
/**
|
||||
@@ -35,6 +36,7 @@ import org.springframework.core.convert.converter.Converter;
|
||||
* @since 4.0.1
|
||||
* @see java.util.GregorianCalendar#from(java.time.ZonedDateTime)
|
||||
*/
|
||||
@UsesJava8
|
||||
final class ZonedDateTimeToCalendarConverter implements Converter<ZonedDateTime, Calendar> {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.nio.file.OpenOption;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.springframework.core.UsesJava8;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -39,6 +40,7 @@ import org.springframework.util.Assert;
|
||||
* @since 4.0
|
||||
* @see java.nio.file.Path
|
||||
*/
|
||||
@UsesJava8
|
||||
public class PathResource extends AbstractResource implements WritableResource {
|
||||
|
||||
private final Path path;
|
||||
|
||||
@@ -22,6 +22,7 @@ import javax.sql.rowset.CachedRowSet;
|
||||
import javax.sql.rowset.RowSetFactory;
|
||||
import javax.sql.rowset.RowSetProvider;
|
||||
|
||||
import org.springframework.core.UsesJava7;
|
||||
import org.springframework.core.JdkVersion;
|
||||
import org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet;
|
||||
import org.springframework.jdbc.support.rowset.SqlRowSet;
|
||||
@@ -109,6 +110,7 @@ public class SqlRowSetResultSetExtractor implements ResultSetExtractor<SqlRowSet
|
||||
/**
|
||||
* Inner class to avoid a hard dependency on JDBC 4.1 RowSetProvider class.
|
||||
*/
|
||||
@UsesJava7
|
||||
private static class StandardCachedRowSetFactory implements CachedRowSetFactory {
|
||||
|
||||
private final RowSetFactory rowSetFactory;
|
||||
|
||||
@@ -34,6 +34,7 @@ import javax.sql.DataSource;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.core.UsesJava7;
|
||||
import org.springframework.jdbc.CannotGetJdbcConnectionException;
|
||||
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||
import org.springframework.util.ClassUtils;
|
||||
@@ -134,6 +135,7 @@ public abstract class JdbcUtils {
|
||||
* @return the value object
|
||||
* @throws SQLException if thrown by the JDBC API
|
||||
*/
|
||||
@UsesJava7 // guard use of JDBC 4.1 (safe with 1.6)
|
||||
public static Object getResultSetValue(ResultSet rs, int index, Class<?> requiredType) throws SQLException {
|
||||
if (requiredType == null) {
|
||||
return getResultSetValue(rs, index);
|
||||
|
||||
@@ -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.io.IOException;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import com.sun.net.httpserver.HttpHandler;
|
||||
|
||||
import org.springframework.core.UsesSunHttpServer;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
/**
|
||||
@@ -48,6 +49,7 @@ import org.springframework.util.FileCopyUtils;
|
||||
* and is effectively retired (in contrast to its sibling Hessian)
|
||||
*/
|
||||
@Deprecated
|
||||
@UsesSunHttpServer
|
||||
public class SimpleBurlapServiceExporter extends BurlapExporter implements HttpHandler {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.io.IOException;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import com.sun.net.httpserver.HttpHandler;
|
||||
|
||||
import org.springframework.core.UsesSunHttpServer;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
/**
|
||||
@@ -44,6 +45,7 @@ import org.springframework.util.FileCopyUtils;
|
||||
* @see org.springframework.remoting.caucho.HessianProxyFactoryBean
|
||||
* @see org.springframework.remoting.httpinvoker.SimpleHttpInvokerServiceExporter
|
||||
*/
|
||||
@UsesSunHttpServer
|
||||
public class SimpleHessianServiceExporter extends HessianExporter implements HttpHandler {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -25,6 +25,7 @@ import java.io.OutputStream;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import com.sun.net.httpserver.HttpHandler;
|
||||
|
||||
import org.springframework.core.UsesSunHttpServer;
|
||||
import org.springframework.remoting.rmi.RemoteInvocationSerializingExporter;
|
||||
import org.springframework.remoting.support.RemoteInvocation;
|
||||
import org.springframework.remoting.support.RemoteInvocationResult;
|
||||
@@ -51,6 +52,7 @@ import org.springframework.remoting.support.RemoteInvocationResult;
|
||||
* @see org.springframework.remoting.caucho.SimpleHessianServiceExporter
|
||||
* @see org.springframework.remoting.caucho.SimpleBurlapServiceExporter
|
||||
*/
|
||||
@UsesSunHttpServer
|
||||
public class SimpleHttpInvokerServiceExporter extends RemoteInvocationSerializingExporter
|
||||
implements HttpHandler {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -34,6 +34,7 @@ import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.core.UsesJava7;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
@@ -189,6 +190,7 @@ public abstract class AbstractJaxWsServiceExporter implements BeanFactoryAware,
|
||||
* @see Endpoint#create(Object)
|
||||
* @see Endpoint#create(String, Object)
|
||||
*/
|
||||
@UsesJava7 // Endpoint#create with WebServiceFeature[]
|
||||
protected Endpoint createEndpoint(Object bean) {
|
||||
if (this.endpointFeatures != null || this.webServiceFeatures != null) {
|
||||
WebServiceFeature[] endpointFeaturesToUse = this.endpointFeatures;
|
||||
|
||||
@@ -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 javax.xml.ws.Service;
|
||||
import javax.xml.ws.WebServiceFeature;
|
||||
import javax.xml.ws.handler.HandlerResolver;
|
||||
|
||||
import org.springframework.core.UsesJava7;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -146,6 +147,7 @@ public class LocalJaxWsServiceFactory {
|
||||
* @see #setServiceName
|
||||
* @see #setWsdlDocumentUrl
|
||||
*/
|
||||
@UsesJava7 // Service#create with WebServiceFeature[]
|
||||
public Service createJaxWsService() {
|
||||
Assert.notNull(this.serviceName, "No service name specified");
|
||||
Service service;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 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 com.sun.net.httpserver.HttpContext;
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.core.UsesSunHttpServer;
|
||||
|
||||
/**
|
||||
* Simple exporter for JAX-WS services, autodetecting annotated service beans
|
||||
@@ -46,6 +47,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
* @see javax.xml.ws.Endpoint#publish(Object)
|
||||
* @see SimpleJaxWsServiceExporter
|
||||
*/
|
||||
@UsesSunHttpServer
|
||||
public class SimpleHttpServerJaxWsServiceExporter extends AbstractJaxWsServiceExporter {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@@ -27,6 +27,7 @@ import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.core.UsesJava8;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.web.bind.support.WebDataBinderFactory;
|
||||
@@ -133,6 +134,7 @@ public class ServletRequestMethodArgumentResolver implements HandlerMethodArgume
|
||||
/**
|
||||
* Inner class to avoid a hard-coded dependency on Java 8's {@link java.time.ZoneId}.
|
||||
*/
|
||||
@UsesJava8
|
||||
private static class ZoneIdResolver {
|
||||
|
||||
public static Object resolveZoneId(HttpServletRequest request) {
|
||||
|
||||
@@ -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.
|
||||
@@ -33,6 +33,7 @@ import javax.websocket.Extension;
|
||||
import javax.websocket.HandshakeResponse;
|
||||
import javax.websocket.WebSocketContainer;
|
||||
|
||||
import org.springframework.core.UsesJava7;
|
||||
import org.springframework.core.task.AsyncListenableTaskExecutor;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -145,6 +146,7 @@ public class StandardWebSocketClient extends AbstractWebSocketClient {
|
||||
return result;
|
||||
}
|
||||
|
||||
@UsesJava7
|
||||
private InetAddress getLocalHost() {
|
||||
try {
|
||||
return InetAddress.getLocalHost();
|
||||
|
||||
Reference in New Issue
Block a user