Update Animal Sniffer and related annotations for Java 8 baseline
Closes gh-6981
This commit is contained in:
@@ -29,8 +29,6 @@ import org.springframework.boot.actuate.metrics.export.Exporter;
|
||||
import org.springframework.boot.actuate.metrics.export.MetricCopyExporter;
|
||||
import org.springframework.boot.actuate.metrics.repository.InMemoryMetricRepository;
|
||||
import org.springframework.boot.actuate.metrics.repository.MetricRepository;
|
||||
import org.springframework.boot.actuate.metrics.writer.DefaultCounterService;
|
||||
import org.springframework.boot.actuate.metrics.writer.DefaultGaugeService;
|
||||
import org.springframework.boot.actuate.metrics.writer.MetricWriter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnJava;
|
||||
@@ -81,32 +79,6 @@ import org.springframework.messaging.MessageChannel;
|
||||
public class MetricRepositoryAutoConfiguration {
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnJava(value = JavaVersion.EIGHT, range = Range.OLDER_THAN)
|
||||
@ConditionalOnMissingBean(GaugeService.class)
|
||||
static class LegacyMetricServicesConfiguration {
|
||||
|
||||
private final MetricWriter writer;
|
||||
|
||||
LegacyMetricServicesConfiguration(@ActuatorMetricWriter MetricWriter writer) {
|
||||
this.writer = writer;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(CounterService.class)
|
||||
public DefaultCounterService counterService() {
|
||||
return new DefaultCounterService(this.writer);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(GaugeService.class)
|
||||
public DefaultGaugeService gaugeService() {
|
||||
return new DefaultGaugeService(this.writer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnJava(JavaVersion.EIGHT)
|
||||
@ConditionalOnMissingBean(GaugeService.class)
|
||||
static class FastMetricServicesConfiguration {
|
||||
|
||||
|
||||
@@ -42,8 +42,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnJava;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnJava.JavaVersion;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration;
|
||||
@@ -53,7 +51,6 @@ import org.springframework.cache.CacheManager;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.integration.monitor.IntegrationMBeanExporter;
|
||||
import org.springframework.lang.UsesJava7;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link PublicMetrics}.
|
||||
@@ -141,8 +138,6 @@ public class PublicMetricsAutoConfiguration {
|
||||
@Configuration
|
||||
@ConditionalOnClass(IntegrationMBeanExporter.class)
|
||||
@ConditionalOnBean(IntegrationMBeanExporter.class)
|
||||
@ConditionalOnJava(JavaVersion.SEVEN)
|
||||
@UsesJava7
|
||||
static class IntegrationMetricsConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -38,7 +38,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.lang.UsesJava7;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StreamUtils;
|
||||
@@ -187,7 +186,6 @@ public class HeapdumpMvcEndpoint extends AbstractMvcEndpoint {
|
||||
* {@link HeapDumper} that uses {@code com.sun.management.HotSpotDiagnosticMXBean}
|
||||
* available on Oracle and OpenJDK to dump the heap to a file.
|
||||
*/
|
||||
@UsesJava7
|
||||
protected static class HotSpotDiagnosticMXBeanHeapDumper implements HeapDumper {
|
||||
|
||||
private Object diagnosticMXBean;
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.actuate.metrics.buffer;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.springframework.boot.actuate.metrics.CounterService;
|
||||
import org.springframework.lang.UsesJava8;
|
||||
|
||||
/**
|
||||
* Fast implementation of {@link CounterService} using {@link CounterBuffers}.
|
||||
@@ -27,7 +26,6 @@ import org.springframework.lang.UsesJava8;
|
||||
* @author Dave Syer
|
||||
* @since 1.3.0
|
||||
*/
|
||||
@UsesJava8
|
||||
public class BufferCounterService implements CounterService {
|
||||
|
||||
private final ConcurrentHashMap<String, String> names = new ConcurrentHashMap<String, String>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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,7 +19,6 @@ package org.springframework.boot.actuate.metrics.buffer;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.springframework.boot.actuate.metrics.GaugeService;
|
||||
import org.springframework.lang.UsesJava8;
|
||||
|
||||
/**
|
||||
* Fast implementation of {@link GaugeService} using {@link GaugeBuffers}.
|
||||
@@ -27,7 +26,6 @@ import org.springframework.lang.UsesJava8;
|
||||
* @author Dave Syer
|
||||
* @since 1.3.0
|
||||
*/
|
||||
@UsesJava8
|
||||
public class BufferGaugeService implements GaugeService {
|
||||
|
||||
private final ConcurrentHashMap<String, String> names = new ConcurrentHashMap<String, String>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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,7 +26,6 @@ import java.util.regex.Pattern;
|
||||
import org.springframework.boot.actuate.metrics.Metric;
|
||||
import org.springframework.boot.actuate.metrics.reader.MetricReader;
|
||||
import org.springframework.boot.actuate.metrics.reader.PrefixMetricReader;
|
||||
import org.springframework.lang.UsesJava8;
|
||||
|
||||
/**
|
||||
* {@link MetricReader} implementation using {@link CounterBuffers} and
|
||||
@@ -35,7 +34,6 @@ import org.springframework.lang.UsesJava8;
|
||||
* @author Dave Syer
|
||||
* @since 1.3.0
|
||||
*/
|
||||
@UsesJava8
|
||||
public class BufferMetricReader implements MetricReader, PrefixMetricReader {
|
||||
|
||||
private static final Predicate<String> ALL = Pattern.compile(".*").asPredicate();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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,8 +22,6 @@ import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.springframework.lang.UsesJava8;
|
||||
|
||||
/**
|
||||
* Base class used to manage a map of {@link Buffer} objects.
|
||||
*
|
||||
@@ -31,7 +29,6 @@ import org.springframework.lang.UsesJava8;
|
||||
* @author Phillip Webb
|
||||
* @param <B> The buffer type
|
||||
*/
|
||||
@UsesJava8
|
||||
abstract class Buffers<B extends Buffer<?>> {
|
||||
|
||||
private final ConcurrentHashMap<String, B> buffers = new ConcurrentHashMap<String, B>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
@@ -18,15 +18,12 @@ package org.springframework.boot.actuate.metrics.buffer;
|
||||
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
|
||||
import org.springframework.lang.UsesJava8;
|
||||
|
||||
/**
|
||||
* Mutable buffer containing a long adder (Java 8) and a timestamp.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @since 1.3.0
|
||||
*/
|
||||
@UsesJava8
|
||||
public class CounterBuffer extends Buffer<Long> {
|
||||
|
||||
private final LongAdder adder;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
@@ -18,15 +18,12 @@ package org.springframework.boot.actuate.metrics.buffer;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.springframework.lang.UsesJava8;
|
||||
|
||||
/**
|
||||
* Fast writes to in-memory metrics store using {@link CounterBuffer}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @since 1.3.0
|
||||
*/
|
||||
@UsesJava8
|
||||
public class CounterBuffers extends Buffers<CounterBuffer> {
|
||||
|
||||
public void increment(final String name, final long delta) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
@@ -18,15 +18,12 @@ package org.springframework.boot.actuate.metrics.buffer;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.springframework.lang.UsesJava8;
|
||||
|
||||
/**
|
||||
* Fast writes to in-memory metrics store using {@link GaugeBuffer}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @since 1.3.0
|
||||
*/
|
||||
@UsesJava8
|
||||
public class GaugeBuffers extends Buffers<GaugeBuffer> {
|
||||
|
||||
public void set(final String name, final double value) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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,7 +24,6 @@ import org.springframework.boot.actuate.metrics.Metric;
|
||||
import org.springframework.boot.actuate.metrics.reader.MetricReader;
|
||||
import org.springframework.integration.monitor.IntegrationMBeanExporter;
|
||||
import org.springframework.integration.support.management.Statistics;
|
||||
import org.springframework.lang.UsesJava7;
|
||||
|
||||
/**
|
||||
* A {@link MetricReader} for Spring Integration metrics (as provided by
|
||||
@@ -33,7 +32,6 @@ import org.springframework.lang.UsesJava7;
|
||||
* @author Dave Syer
|
||||
* @since 1.3.0
|
||||
*/
|
||||
@UsesJava7
|
||||
public class SpringIntegrationMetricReader implements MetricReader {
|
||||
|
||||
private final IntegrationMBeanExporter exporter;
|
||||
|
||||
@@ -39,7 +39,6 @@ import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.actuate.metrics.GaugeService;
|
||||
import org.springframework.boot.actuate.metrics.Metric;
|
||||
import org.springframework.lang.UsesJava8;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -50,7 +49,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@RunWith(Theories.class)
|
||||
@UsesJava8
|
||||
public class BufferGaugeServiceSpeedTests {
|
||||
|
||||
@DataPoints
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.actuate.metrics.CounterService;
|
||||
import org.springframework.boot.actuate.metrics.Metric;
|
||||
import org.springframework.lang.UsesJava8;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -49,7 +48,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@RunWith(Theories.class)
|
||||
@UsesJava8
|
||||
public class CounterServiceSpeedTests {
|
||||
|
||||
@DataPoints
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.springframework.boot.actuate.metrics.Metric;
|
||||
import org.springframework.boot.actuate.metrics.reader.MetricReader;
|
||||
import org.springframework.boot.actuate.metrics.repository.InMemoryMetricRepository;
|
||||
import org.springframework.boot.actuate.metrics.writer.DefaultCounterService;
|
||||
import org.springframework.lang.UsesJava8;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -49,7 +48,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@RunWith(Theories.class)
|
||||
@UsesJava8
|
||||
public class DefaultCounterServiceSpeedTests {
|
||||
|
||||
@DataPoints
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.springframework.boot.actuate.metrics.Metric;
|
||||
import org.springframework.boot.actuate.metrics.reader.MetricReader;
|
||||
import org.springframework.boot.actuate.metrics.repository.InMemoryMetricRepository;
|
||||
import org.springframework.boot.actuate.metrics.writer.DefaultGaugeService;
|
||||
import org.springframework.lang.UsesJava8;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -49,7 +48,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@RunWith(Theories.class)
|
||||
@UsesJava8
|
||||
public class DefaultGaugeServiceSpeedTests {
|
||||
|
||||
@DataPoints
|
||||
|
||||
@@ -39,7 +39,6 @@ import org.springframework.boot.actuate.metrics.Metric;
|
||||
import org.springframework.boot.actuate.metrics.dropwizard.DropwizardMetricServices;
|
||||
import org.springframework.boot.actuate.metrics.reader.MetricReader;
|
||||
import org.springframework.boot.actuate.metrics.reader.MetricRegistryMetricReader;
|
||||
import org.springframework.lang.UsesJava8;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -51,7 +50,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@RunWith(Theories.class)
|
||||
@UsesJava8
|
||||
public class DropwizardCounterServiceSpeedTests {
|
||||
|
||||
@DataPoints
|
||||
|
||||
@@ -594,12 +594,10 @@
|
||||
<skip>${disable.checks}</skip>
|
||||
<signature>
|
||||
<groupId>org.codehaus.mojo.signature</groupId>
|
||||
<artifactId>java16</artifactId>
|
||||
<version>1.1</version>
|
||||
<artifactId>java18</artifactId>
|
||||
<version>1.0</version>
|
||||
</signature>
|
||||
<annotations>
|
||||
<annotation>org.springframework.lang.UsesJava8</annotation>
|
||||
<annotation>org.springframework.lang.UsesJava7</annotation>
|
||||
<annotation>org.springframework.boot.lang.UsesUnsafeJava</annotation>
|
||||
</annotations>
|
||||
</configuration>
|
||||
|
||||
@@ -42,8 +42,6 @@ import java.util.jar.Manifest;
|
||||
import java.util.zip.CRC32;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
import org.springframework.lang.UsesJava7;
|
||||
|
||||
/**
|
||||
* Writes JAR content, ensuring valid directory entries are always create and duplicate
|
||||
* items are ignored.
|
||||
@@ -88,7 +86,6 @@ public class JarWriter {
|
||||
this.jarOutput = new JarOutputStream(fileOutputStream);
|
||||
}
|
||||
|
||||
@UsesJava7
|
||||
private void setExecutableFilePermission(File file) {
|
||||
try {
|
||||
Path path = file.toPath();
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
import org.springframework.boot.loader.tools.JarWriter.EntryTransformer;
|
||||
import org.springframework.lang.UsesJava8;
|
||||
|
||||
/**
|
||||
* Utility class that can be used to repackage an archive so that it can be executed using
|
||||
@@ -353,51 +352,21 @@ public class Repackager {
|
||||
}
|
||||
renamedEntry.setCompressedSize(entry.getCompressedSize());
|
||||
renamedEntry.setCrc(entry.getCrc());
|
||||
setCreationTimeIfPossible(entry, renamedEntry);
|
||||
if (entry.getCreationTime() != null) {
|
||||
renamedEntry.setCreationTime(entry.getCreationTime());
|
||||
}
|
||||
if (entry.getExtra() != null) {
|
||||
renamedEntry.setExtra(entry.getExtra());
|
||||
}
|
||||
setLastAccessTimeIfPossible(entry, renamedEntry);
|
||||
setLastModifiedTimeIfPossible(entry, renamedEntry);
|
||||
if (entry.getLastAccessTime() != null) {
|
||||
renamedEntry.setLastAccessTime(entry.getLastAccessTime());
|
||||
}
|
||||
if (entry.getLastModifiedTime() != null) {
|
||||
renamedEntry.setLastModifiedTime(entry.getLastModifiedTime());
|
||||
}
|
||||
return renamedEntry;
|
||||
}
|
||||
|
||||
@UsesJava8
|
||||
private void setCreationTimeIfPossible(JarEntry source, JarEntry target) {
|
||||
try {
|
||||
if (source.getCreationTime() != null) {
|
||||
target.setCreationTime(source.getCreationTime());
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
// Not running on Java 8. Continue.
|
||||
}
|
||||
}
|
||||
|
||||
@UsesJava8
|
||||
private void setLastAccessTimeIfPossible(JarEntry source, JarEntry target) {
|
||||
try {
|
||||
if (source.getLastAccessTime() != null) {
|
||||
target.setLastAccessTime(source.getLastAccessTime());
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
// Not running on Java 8. Continue.
|
||||
}
|
||||
}
|
||||
|
||||
@UsesJava8
|
||||
private void setLastModifiedTimeIfPossible(JarEntry source, JarEntry target) {
|
||||
try {
|
||||
if (source.getLastModifiedTime() != null) {
|
||||
target.setLastModifiedTime(source.getLastModifiedTime());
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
// Not running on Java 8. Continue.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import bitronix.tm.resource.jdbc.PoolingDataSource;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.lang.UsesJava7;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -111,7 +110,6 @@ public class PoolingDataSourceBean extends PoolingDataSource
|
||||
}
|
||||
|
||||
@Override
|
||||
@UsesJava7
|
||||
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
|
||||
try {
|
||||
return ((DataSource) this).getParentLogger();
|
||||
@@ -168,7 +166,6 @@ public class PoolingDataSourceBean extends PoolingDataSource
|
||||
}
|
||||
|
||||
@Override
|
||||
@UsesJava7
|
||||
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
|
||||
return this.dataSource.getParentLogger();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user