diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGenerator.java b/spring-beans/src/main/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGenerator.java index 9ae4f0db3a2..ee140ce108e 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGenerator.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGenerator.java @@ -288,9 +288,9 @@ class InstanceSupplierCodeGenerator { } private CodeBlock generateWithGeneratorCode(boolean hasArguments, CodeBlock newInstance) { - CodeBlock lambdaArguments = (hasArguments - ? CodeBlock.of("($L, $L)", REGISTERED_BEAN_PARAMETER_NAME, ARGS_PARAMETER_NAME) - : CodeBlock.of("($L)", REGISTERED_BEAN_PARAMETER_NAME)); + CodeBlock lambdaArguments = (hasArguments ? + CodeBlock.of("($L, $L)", REGISTERED_BEAN_PARAMETER_NAME, ARGS_PARAMETER_NAME) : + CodeBlock.of("($L)", REGISTERED_BEAN_PARAMETER_NAME)); Builder code = CodeBlock.builder(); code.add("\n"); code.indent().indent(); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/aot/AotServicesTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/aot/AotServicesTests.java index f1098d11b84..a4ddb202a5d 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/aot/AotServicesTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/aot/AotServicesTests.java @@ -238,10 +238,9 @@ class AotServicesTests { @Override public Enumeration getResources(String name) throws IOException { - return (!"META-INF/spring/aot.factories".equals(name)) - ? super.getResources(name) - : super.getResources("org/springframework/beans/factory/aot/" - + this.factoriesName); + return (!"META-INF/spring/aot.factories".equals(name) ? + super.getResources(name) : + super.getResources("org/springframework/beans/factory/aot/" + this.factoriesName)); } } diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java index ddc7d8c9bd5..b80ca7f5cdd 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java @@ -147,9 +147,8 @@ class ConfigurationClassParser { this.problemReporter = problemReporter; this.environment = environment; this.resourceLoader = resourceLoader; - this.propertySourceRegistry = (this.environment instanceof ConfigurableEnvironment ce - ? new PropertySourceRegistry(new PropertySourceProcessor(ce, this.resourceLoader)) - : null); + this.propertySourceRegistry = (this.environment instanceof ConfigurableEnvironment ce ? + new PropertySourceRegistry(new PropertySourceProcessor(ce, this.resourceLoader)) : null); this.registry = registry; this.componentScanParser = new ComponentScanAnnotationParser( environment, resourceLoader, componentScanBeanNameGenerator, registry); diff --git a/spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFile.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFile.java index 91f7da6f8b4..bf0ae02076d 100644 --- a/spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFile.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFile.java @@ -180,9 +180,8 @@ public final class SourceFile extends DynamicFile implements AssertProvider" : "") - + "::" + methodName; + return ((this.declaringClass != null) ? + "<" + this.declaringClass + ">" : "") + "::" + methodName; } } diff --git a/spring-core/src/main/java/org/springframework/aot/generate/MethodReference.java b/spring-core/src/main/java/org/springframework/aot/generate/MethodReference.java index f6dda971007..a33573d74fd 100644 --- a/spring-core/src/main/java/org/springframework/aot/generate/MethodReference.java +++ b/spring-core/src/main/java/org/springframework/aot/generate/MethodReference.java @@ -94,8 +94,8 @@ public interface MethodReference { * @return a new {@link ArgumentCodeGenerator} instance */ static ArgumentCodeGenerator of(Class argumentType, String argumentCode) { - return from(candidateType -> (candidateType.equals(ClassName.get(argumentType)) - ? CodeBlock.of(argumentCode) : null)); + return from(candidateType -> candidateType.equals(ClassName.get(argumentType)) ? + CodeBlock.of(argumentCode) : null); } /** diff --git a/spring-core/src/main/java/org/springframework/aot/hint/AbstractTypeReference.java b/spring-core/src/main/java/org/springframework/aot/hint/AbstractTypeReference.java index ddc26ebfc8c..834753f6163 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/AbstractTypeReference.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/AbstractTypeReference.java @@ -47,9 +47,8 @@ public abstract class AbstractTypeReference implements TypeReference { public String getName() { TypeReference enclosingType = getEnclosingType(); String simpleName = getSimpleName(); - return (enclosingType != null - ? (enclosingType.getName() + '$' + simpleName) - : addPackageIfNecessary(simpleName)); + return (enclosingType != null ? (enclosingType.getName() + '$' + simpleName) : + addPackageIfNecessary(simpleName)); } @Override diff --git a/spring-core/src/main/java/org/springframework/aot/hint/ReflectionTypeReference.java b/spring-core/src/main/java/org/springframework/aot/hint/ReflectionTypeReference.java index 2da3520648c..ea0a2788098 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/ReflectionTypeReference.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/ReflectionTypeReference.java @@ -35,9 +35,8 @@ final class ReflectionTypeReference extends AbstractTypeReference { @Nullable private static TypeReference getEnclosingClass(Class type) { - Class candidate = (type.isArray() - ? type.getComponentType().getEnclosingClass() - : type.getEnclosingClass()); + Class candidate = (type.isArray() ? type.getComponentType().getEnclosingClass() : + type.getEnclosingClass()); return (candidate != null ? new ReflectionTypeReference(candidate) : null); } diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PropertySourceProcessor.java b/spring-core/src/main/java/org/springframework/core/io/support/PropertySourceProcessor.java index 58835cc229e..e89169d0cff 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PropertySourceProcessor.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PropertySourceProcessor.java @@ -77,9 +77,8 @@ public class PropertySourceProcessor { List locations = descriptor.locations(); Assert.isTrue(locations.size() > 0, "At least one @PropertySource(value) location is required"); boolean ignoreResourceNotFound = descriptor.ignoreResourceNotFound(); - PropertySourceFactory factory = (descriptor.propertySourceFactory() != null - ? instantiateClass(descriptor.propertySourceFactory()) - : DEFAULT_PROPERTY_SOURCE_FACTORY); + PropertySourceFactory factory = (descriptor.propertySourceFactory() != null ? + instantiateClass(descriptor.propertySourceFactory()) : DEFAULT_PROPERTY_SOURCE_FACTORY); for (String location : locations) { try { diff --git a/spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsComposedOnSingleAnnotatedElementTests.java b/spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsComposedOnSingleAnnotatedElementTests.java index 5c6aa83ee16..154c9d9f4fa 100644 --- a/spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsComposedOnSingleAnnotatedElementTests.java +++ b/spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsComposedOnSingleAnnotatedElementTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 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. @@ -180,9 +180,7 @@ class MergedAnnotationsComposedOnSingleAnnotatedElementTests { methods.add(method); } }); - Method bridgeMethod = methods.get(0).getReturnType().equals(Object.class) - ? methods.get(0) - : methods.get(1); + Method bridgeMethod = methods.get(0).getReturnType() == Object.class ? methods.get(0) : methods.get(1); assertThat(bridgeMethod.isBridge()).isTrue(); return bridgeMethod; } diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/adapter/AbstractAdaptableMessageListener.java b/spring-jms/src/main/java/org/springframework/jms/listener/adapter/AbstractAdaptableMessageListener.java index 0cd9bf2bd8e..3a50c92dbdf 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/adapter/AbstractAdaptableMessageListener.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/adapter/AbstractAdaptableMessageListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 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. @@ -303,8 +303,8 @@ public abstract class AbstractAdaptableMessageListener * @see #setMessageConverter */ protected Message buildMessage(Session session, Object result) throws JMSException { - Object content = preProcessResponse(result instanceof JmsResponse - ? ((JmsResponse) result).getResponse() : result); + Object content = preProcessResponse(result instanceof JmsResponse jmsResponse ? + jmsResponse.getResponse() : result); MessageConverter converter = getMessageConverter(); if (converter != null) { diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java index 2e1fdb201b1..2ab46427747 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java @@ -170,8 +170,8 @@ public class InvocableHandlerMethod extends HandlerMethod { } catch (IllegalArgumentException ex) { assertTargetBean(getBridgedMethod(), getBean(), args); - String text = (ex.getMessage() == null || ex.getCause() instanceof NullPointerException) - ? "Illegal argument": ex.getMessage(); + String text = (ex.getMessage() == null || ex.getCause() instanceof NullPointerException) ? + "Illegal argument": ex.getMessage(); throw new IllegalStateException(formatInvokeError(text, args), ex); } catch (InvocationTargetException ex) {