Enable compile linting and treat warnings as errors
Closes gh-232
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2024 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,7 @@ import org.springframework.data.annotation.CreatedBy;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedBy;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
import org.springframework.data.cassandra.core.cql.PrimaryKeyType;
|
||||
import org.springframework.data.cassandra.core.mapping.Column;
|
||||
import org.springframework.data.cassandra.core.mapping.Indexed;
|
||||
@@ -65,7 +65,7 @@ public class Order {
|
||||
this(customerId, null);
|
||||
}
|
||||
|
||||
@PersistenceConstructor
|
||||
@PersistenceCreator
|
||||
public Order(String id, String customerId, Date orderDate, List<LineItem> items) {
|
||||
|
||||
this.id = id;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2024 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.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.example.data.mongodb.reactive;
|
||||
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
|
||||
public class LineItem {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class LineItem {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
@PersistenceConstructor
|
||||
@PersistenceCreator
|
||||
public LineItem(String caption, double price, int quantity) {
|
||||
|
||||
this(caption, price);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2024 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,7 @@ import org.springframework.data.annotation.CreatedBy;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedBy;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
import org.springframework.data.mongodb.core.mapping.Field;
|
||||
@@ -61,7 +61,7 @@ public class Order {
|
||||
this(customerId, null);
|
||||
}
|
||||
|
||||
@PersistenceConstructor
|
||||
@PersistenceCreator
|
||||
public Order(String id, String customerId, Date orderDate, List<LineItem> items) {
|
||||
|
||||
this.id = id;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2024 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.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.example.data.mongodb;
|
||||
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
|
||||
public class LineItem {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class LineItem {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
@PersistenceConstructor
|
||||
@PersistenceCreator
|
||||
public LineItem(String caption, double price, int quantity) {
|
||||
|
||||
this(caption, price);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
* Copyright 2022-2024 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,7 @@ import org.springframework.data.annotation.CreatedBy;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedBy;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.mongodb.core.index.Index;
|
||||
import org.springframework.data.mongodb.core.index.IndexDefinition;
|
||||
@@ -87,7 +87,7 @@ public class Order {
|
||||
this(customerId, null);
|
||||
}
|
||||
|
||||
@PersistenceConstructor
|
||||
@PersistenceCreator
|
||||
public Order(String id, String customerId, Date orderDate, List<LineItem> items) {
|
||||
|
||||
this.id = id;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class CLR implements CommandLineRunner {
|
||||
|
||||
public void entityGraph(Long id) {
|
||||
|
||||
EntityGraph entityGraph = entityManager.getEntityGraph("Book.authors");
|
||||
EntityGraph<?> entityGraph = entityManager.getEntityGraph("Book.authors");
|
||||
|
||||
System.out.println("entityGraph: " + entityGraph);
|
||||
|
||||
|
||||
@@ -109,13 +109,13 @@ class WebfluxJettyApplicationAotTests {
|
||||
|
||||
@Test
|
||||
@Disabled("https://github.com/spring-projects/spring-boot/issues/33347")
|
||||
@SuppressWarnings({ "deprecation", "removal" })
|
||||
void websocket(@ApplicationUrl(scheme = Scheme.WEBSOCKET) URI applicationUrl) {
|
||||
JettyWebSocketClient client = new JettyWebSocketClient();
|
||||
client.start();
|
||||
try {
|
||||
// We can't use StepVerifier here, as it isn't designed to be used in a
|
||||
// reactive
|
||||
// pipeline
|
||||
// reactive pipeline
|
||||
AtomicReference<List<String>> messages = new AtomicReference<>();
|
||||
client
|
||||
.execute(URI.create(applicationUrl.resolve("/ws/count").toString()),
|
||||
|
||||
@@ -108,7 +108,7 @@ class WebfluxUndertowApplicationAotTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled("https://github.com/spring-projects/spring-boot/issues/33347")
|
||||
@SuppressWarnings({ "deprecation", "removal" })
|
||||
void websocket(@ApplicationUrl(scheme = Scheme.WEBSOCKET) URI applicationUrl) {
|
||||
JettyWebSocketClient client = new JettyWebSocketClient();
|
||||
client.start();
|
||||
|
||||
@@ -26,7 +26,7 @@ class CLR implements CommandLineRunner {
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
WebSocketSession session = this.webSocketClient
|
||||
.doHandshake(new MyWebsocketHandler(), null,
|
||||
.execute(new MyWebsocketHandler(), null,
|
||||
URI.create("ws://localhost:%d/echo".formatted(getServerPort())))
|
||||
.get(5, TimeUnit.SECONDS);
|
||||
TextMessage message = new TextMessage("Hello Websocket");
|
||||
|
||||
@@ -31,7 +31,7 @@ class CLR implements CommandLineRunner {
|
||||
public void run(String... args) throws Exception {
|
||||
MyStompHandler handler = new MyStompHandler();
|
||||
StompSession stompSession = this.webSocketStompClient
|
||||
.connect("ws://localhost:%d/stomp".formatted(getServerPort()), handler)
|
||||
.connectAsync("ws://localhost:%d/stomp".formatted(getServerPort()), handler)
|
||||
.get(5, TimeUnit.SECONDS);
|
||||
|
||||
stompSession.subscribe("/topic/greetings", handler);
|
||||
|
||||
@@ -26,7 +26,7 @@ class CLR implements CommandLineRunner {
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
WebSocketSession session = this.webSocketClient
|
||||
.doHandshake(new MyWebsocketHandler(), null,
|
||||
.execute(new MyWebsocketHandler(), null,
|
||||
URI.create("ws://localhost:%d/echo".formatted(getServerPort())))
|
||||
.get(5, TimeUnit.SECONDS);
|
||||
TextMessage message = new TextMessage("Hello Websocket");
|
||||
|
||||
@@ -46,6 +46,7 @@ import org.gradle.api.plugins.JavaPluginExtension;
|
||||
import org.gradle.api.provider.Provider;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
import org.gradle.api.tasks.compile.JavaCompile;
|
||||
import org.gradle.api.tasks.testing.Test;
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile;
|
||||
|
||||
@@ -86,6 +87,16 @@ public class AotSmokeTestPlugin implements Plugin<Project> {
|
||||
SourceSet appTest = javaExtension.getSourceSets().create("appTest");
|
||||
javaExtension.setSourceCompatibility(JavaVersion.VERSION_17);
|
||||
javaExtension.setTargetCompatibility(JavaVersion.VERSION_17);
|
||||
project.getTasks()
|
||||
.withType(JavaCompile.class,
|
||||
(javaCompile) -> javaCompile.getOptions()
|
||||
.getCompilerArgs()
|
||||
.addAll(List.of("-Werror", "-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:rawtypes",
|
||||
"-Xlint:varargs")));
|
||||
project.getDependencies()
|
||||
.add(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, "com.google.code.findbugs:jsr305:3.0.2");
|
||||
project.getDependencies()
|
||||
.add(JavaPlugin.TEST_COMPILE_ONLY_CONFIGURATION_NAME, "com.google.code.findbugs:jsr305:3.0.2");
|
||||
if (project.hasProperty("fromMavenLocal")) {
|
||||
String fromMavenLocal = project.property("fromMavenLocal").toString();
|
||||
Stream<String> includedGroups = Stream.of(fromMavenLocal.split(","));
|
||||
|
||||
@@ -51,7 +51,7 @@ public class KafkaAvroApplication {
|
||||
|
||||
@Bean
|
||||
public ConcurrentMessageListenerContainer<Object, Object> container3(NotAComponentMessageListener listener,
|
||||
ConsumerFactory cf, ProducerFactory pf, ConcurrentKafkaListenerContainerFactory<Object, Object> factory) {
|
||||
ConsumerFactory<Object, Object> cf, ProducerFactory<Object, SpecificRecord> pf, ConcurrentKafkaListenerContainerFactory<Object, Object> factory) {
|
||||
|
||||
((DefaultKafkaConsumerFactory<Object, Object>) cf).setValueDeserializer(new ThingAvroSerde());
|
||||
((DefaultKafkaProducerFactory<Object, SpecificRecord>) pf).setValueSerializer(new ThingAvroSerde());
|
||||
@@ -63,8 +63,8 @@ public class KafkaAvroApplication {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConcurrentMessageListenerContainer<Object, Object> container6(BML6 listener, ConsumerFactory cf,
|
||||
ProducerFactory pf, ConcurrentKafkaListenerContainerFactory<Object, Object> factory) {
|
||||
public ConcurrentMessageListenerContainer<Object, Object> container6(BML6 listener, ConsumerFactory<Object, Object> cf,
|
||||
ProducerFactory<Object, Object> pf, ConcurrentKafkaListenerContainerFactory<Object, Object> factory) {
|
||||
|
||||
factory.setCommonErrorHandler(new CommonContainerStoppingErrorHandler());
|
||||
ConcurrentMessageListenerContainer<Object, Object> container = factory.createContainer("graal6");
|
||||
@@ -74,8 +74,8 @@ public class KafkaAvroApplication {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConcurrentMessageListenerContainer<Object, Object> container7(BML7 listener, ConsumerFactory cf,
|
||||
ProducerFactory pf, ConcurrentKafkaListenerContainerFactory<Object, Object> factory) {
|
||||
public ConcurrentMessageListenerContainer<Object, Object> container7(BML7 listener, ConsumerFactory<Object, Object> cf,
|
||||
ProducerFactory<Object, Object> pf, ConcurrentKafkaListenerContainerFactory<Object, Object> factory) {
|
||||
|
||||
factory.setCommonErrorHandler(new CommonContainerStoppingErrorHandler());
|
||||
ConcurrentMessageListenerContainer<Object, Object> container = factory.createContainer("graal7");
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.springframework.security.provisioning.UserDetailsManager;
|
||||
class SecurityConfiguration {
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("deprecation")
|
||||
UserDetailsManager userDetailsManager() {
|
||||
UserDetails user = User.withDefaultPasswordEncoder()
|
||||
.username("user")
|
||||
|
||||
@@ -136,6 +136,7 @@ public class OAuth2AuthorizationServerSecurityConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("deprecation")
|
||||
public UserDetailsService userDetailsService() {
|
||||
// @formatter:off
|
||||
UserDetails userDetails = User.withDefaultPasswordEncoder()
|
||||
|
||||
@@ -29,6 +29,7 @@ public class WebSecurityConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("deprecation")
|
||||
public ReactiveUserDetailsService userDetailsService() {
|
||||
UserDetails user = User.withDefaultPasswordEncoder()
|
||||
.username("user")
|
||||
|
||||
@@ -29,6 +29,7 @@ public class WebSecurityConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("deprecation")
|
||||
public UserDetailsService userDetailsService() {
|
||||
UserDetails user = User.withDefaultPasswordEncoder()
|
||||
.username("user")
|
||||
|
||||
Reference in New Issue
Block a user