Add EmptyLineSeparator Checkstyle rule

* Support "blank lines around" via `spring-framework.xml` IDEA config
* Fix all the Checkstyle violations
This commit is contained in:
Artem Bilan
2024-03-27 16:54:25 -04:00
parent f71a2234d8
commit c155d5d418
932 changed files with 1341 additions and 2485 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-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.
@@ -87,7 +87,6 @@ public class ImapMailReceiver extends AbstractMailReceiver {
}
}
/**
* Check if messages should be marked as read.
* @return true if messages should be marked as read.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-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.
@@ -43,7 +43,6 @@ public class MailReceivingMessageSource extends AbstractMessageSource<Object> {
private final Queue<Object> mailQueue = new ConcurrentLinkedQueue<>();
public MailReceivingMessageSource(MailReceiver mailReceiver) {
Assert.notNull(mailReceiver, "mailReceiver must not be null");
this.mailReceiver = mailReceiver;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-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.
@@ -55,7 +55,6 @@ public class MailSendingMessageHandler extends AbstractMessageHandler {
private final MailSender mailSender;
/**
* Create a MailSendingMessageHandler.
* @param mailSender the {@link MailSender} instance to which this

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007-2022 the original author or authors.
* Copyright 2007-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.
@@ -36,7 +36,6 @@ public abstract class MailTransportUtils {
private static final Log LOGGER = LogFactory.getLog(MailTransportUtils.class);
/**
* Close the given JavaMail Service and ignore any thrown exception. This is useful for typical
* <code>finally</code>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
@@ -58,7 +58,6 @@ public class Pop3MailReceiver extends AbstractMailReceiver {
super(new URLName(PROTOCOL, host, port, "INBOX", username, password));
}
@Override
protected Message[] searchForNewMessages() throws MessagingException {
Folder folderToUse = getFolder();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-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.
@@ -103,4 +103,5 @@ public class ImapIdleChannelAdapterParser extends AbstractChannelAdapterParser {
IntegrationNamespaceUtils.setValueIfAttributeDefined(receiverBuilder, element, "cancel-idle-interval");
return receiverBuilder.getBeanDefinition();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2023 the original author or authors.
* Copyright 2014-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.
@@ -200,7 +200,6 @@ public final class Mail {
return transformer;
}
private Mail() {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-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.
@@ -405,7 +405,6 @@ public class ImapMailReceiverTests {
verify(logger).debug(org.mockito.ArgumentMatchers.contains("'msg2' will be discarded by the matching filter"));
}
@Test
public void receiveMarkAsReadAndDelete() throws Exception {
AbstractMailReceiver receiver = new ImapMailReceiver();
@@ -460,7 +459,6 @@ public class ImapMailReceiverTests {
given(folder.isOpen()).willReturn(true);
folderField.set(receiver, folder);
Message msg1 = GreenMailUtil.newMimeMessage("test1");
Message msg2 = GreenMailUtil.newMimeMessage("test2");
final Message[] messages = new Message[] {msg1, msg2};
@@ -599,7 +597,6 @@ public class ImapMailReceiverTests {
//ImapMailReceiver receiver = (ImapMailReceiver) TestUtils.getPropertyValue(adapter, "mailReceiver");
DirectChannel channel = new DirectChannel();
channel.subscribe(new AbstractReplyProducingMessageHandler() {
@@ -803,7 +800,6 @@ public class ImapMailReceiverTests {
given(store.getFolder(Mockito.any(URLName.class))).willReturn(folder);
given(folder.getPermanentFlags()).willReturn(new Flags(Flags.Flag.USER));
DirectFieldAccessor df = new DirectFieldAccessor(receiver);
df.setPropertyValue("store", store);
receiver.setBeanFactory(mock(BeanFactory.class));
@@ -928,6 +924,7 @@ public class ImapMailReceiverTests {
}
}
ImapMailReceiver receiver = new TestReceiver();
Message[] received = (Message[]) receiver.receive();
assertThat(received.length).isEqualTo(1);
@@ -983,7 +980,6 @@ public class ImapMailReceiverTests {
mailReceiver.setBeanFactory(bf);
}
private static class ImapSearchLoggingHandler extends Handler {
private final List<String> searches = new ArrayList<>();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -54,7 +54,6 @@ public class MailReceivingMessageSourceTests {
assertThat(source.receive()).as("Expected null after exhausting all messages").isNull();
}
@SuppressWarnings("unused")
private static class StubMailReceiver implements MailReceiver {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -64,7 +64,6 @@ public class MailSendingMessageHandlerContextTests {
@Autowired
private BeanFactory beanFactory;
@BeforeEach
public void reset() {
this.mailSender.reset();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -42,7 +42,6 @@ public class MailSendingMessageHandlerTests {
private StubJavaMailSender mailSender;
@BeforeEach
public void setUp() {
this.mailSender = new StubJavaMailSender(new MimeMessage((Session) null));
@@ -54,7 +53,6 @@ public class MailSendingMessageHandlerTests {
this.mailSender.reset();
}
@Test
public void textMessage() {
this.handler.handleMessage(MailTestsHelper.createIntegrationMessage());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -43,7 +43,6 @@ public class MailTestsHelper {
public static final String REPLY_TO = "replyTo@springframework.org";
private MailTestsHelper() {
super();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
@@ -40,12 +40,10 @@ public class StubJavaMailSender implements JavaMailSender {
private final List<SimpleMailMessage> sentSimpleMailMessages = new ArrayList<SimpleMailMessage>();
public StubJavaMailSender(MimeMessage uniqueMessage) {
this.uniqueMessage = uniqueMessage;
}
public List<MimeMessage> getSentMimeMessages() {
return this.sentMimeMessages;
}

View File

@@ -47,7 +47,6 @@ public class DefaultConfigurationTests {
@Autowired
private ApplicationContext context;
@Test
public void verifyErrorChannel() {
Object errorChannel = context.getBean("errorChannel");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -115,7 +115,6 @@ public class InboundChannelAdapterParserTests {
assertThat(receiverAccessor.getPropertyValue("simpleContent")).isEqualTo(Boolean.FALSE);
}
//==================== INT-1158 ====================
@Test
public void pop3ShouldDeleteTrueProperty() {
@@ -150,7 +149,6 @@ public class InboundChannelAdapterParserTests {
assertThat(value).isFalse();
}
//==================== INT-1159 ====================
@Test
public void pop3WithAuthenticator() {
@@ -179,13 +177,11 @@ public class InboundChannelAdapterParserTests {
assertThat(authenticator).isEqualTo(context.getBean("testAuthenticator"));
}
@SuppressWarnings("unused")
private static class TestAuthenticator extends Authenticator {
}
//==================== INT-1160 ====================
@Test
public void pop3WithMaxFetchSize() {
@@ -219,7 +215,6 @@ public class InboundChannelAdapterParserTests {
assertThat(value).isEqualTo(33);
}
//==================== INT-1161 ====================
@Test
public void pop3WithSession() {
@@ -248,7 +243,6 @@ public class InboundChannelAdapterParserTests {
assertThat(session).isEqualTo(context.getBean("testSession"));
}
//==================== INT-1162 ====================
@Test
public void pop3WithoutStoreUri() {
@@ -274,7 +268,6 @@ public class InboundChannelAdapterParserTests {
assertThat(url).isNull();
}
//==================== INT-1163 ====================
@Test
public void inboundChannelAdapterRequiresShouldDeleteMessages() {
@@ -284,7 +277,6 @@ public class InboundChannelAdapterParserTests {
.withCauseInstanceOf(SAXParseException.class);
}
//==================== INT-2800 ====================
@Test
public void imapWithSearchTermStrategy() {
@@ -305,7 +297,6 @@ public class InboundChannelAdapterParserTests {
.withStackTraceContaining("searchTermStrategy is only allowed with imap");
}
//===================== COMMON =====================
private AbstractMailReceiver getReceiver(String name) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -31,7 +31,6 @@ import org.springframework.messaging.support.GenericMessage;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* @author Mark Fisher
* @author Artem Bilan

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-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.
@@ -43,7 +43,6 @@ public class PollingMailSourceParserTests {
@Autowired
private ApplicationContext context;
@Test
public void imapAdapter() {
Object adapter = context.getBean("imapAdapter");