Merge pull request #31076 from 70825
* pr/31076: Polish "Wrap ternary operator within parentheses" Wrap ternary operator within parentheses Closes gh-31076
This commit is contained in:
commit
9c175608e5
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -59,7 +59,7 @@ public class CustomServerRequestObservationConvention implements ServerRequestOb
|
|||
}
|
||||
|
||||
private KeyValue exception(ServerRequestObservationContext context) {
|
||||
String exception = (context.getError() != null) ? context.getError().getClass().getSimpleName() : KeyValue.NONE_VALUE;
|
||||
String exception = (context.getError() != null ? context.getError().getClass().getSimpleName() : KeyValue.NONE_VALUE);
|
||||
return KeyValue.of(ServerHttpObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, exception);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class AspectJBeanFactoryInitializationAotProcessor implements BeanFactoryInitial
|
|||
private static AspectContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) {
|
||||
BeanFactoryAspectJAdvisorsBuilder builder = new BeanFactoryAspectJAdvisorsBuilder(beanFactory);
|
||||
List<Advisor> advisors = builder.buildAspectJAdvisors();
|
||||
return advisors.isEmpty() ? null : new AspectContribution(advisors);
|
||||
return (advisors.isEmpty() ? null : new AspectContribution(advisors));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -46,7 +46,8 @@ public class AspectEntry implements ParseState.Entry {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'" : "ref='" + this.ref + "'");
|
||||
return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'"
|
||||
: "ref='" + this.ref + "'");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -95,7 +95,7 @@ public class ConcurrencyThrottleInterceptorTests {
|
|||
ex.printStackTrace();
|
||||
}
|
||||
threads[i] = new ConcurrencyThread(proxy,
|
||||
i % 2 == 0 ? new OutOfMemoryError() : new IllegalStateException());
|
||||
(i % 2 == 0 ? new OutOfMemoryError() : new IllegalStateException()));
|
||||
threads[i].start();
|
||||
}
|
||||
for (int i = 0; i < NR_OF_THREADS; i++) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -157,9 +157,9 @@ public class TransactionAspectTests {
|
|||
}
|
||||
finally {
|
||||
assertThat(txManager.begun).isEqualTo(1);
|
||||
long expected1 = rollback ? 0 : 1;
|
||||
long expected1 = (rollback ? 0 : 1);
|
||||
assertThat(txManager.commits).isEqualTo(expected1);
|
||||
long expected = rollback ? 1 : 0;
|
||||
long expected = (rollback ? 1 : 0);
|
||||
assertThat(txManager.rollbacks).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1007,7 +1007,7 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
|
|||
hints.reflection().registerField(field);
|
||||
CodeBlock resolver = CodeBlock.of("$T.$L($S)",
|
||||
AutowiredFieldValueResolver.class,
|
||||
(!required) ? "forField" : "forRequiredField", field.getName());
|
||||
(!required ? "forField" : "forRequiredField"), field.getName());
|
||||
AccessControl accessControl = AccessControl.forMember(field);
|
||||
if (!accessControl.isAccessibleFrom(targetClassName)) {
|
||||
return CodeBlock.of("$L.resolveAndSet($L, $L)", resolver,
|
||||
|
|
@ -1022,7 +1022,7 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
|
|||
|
||||
CodeBlock.Builder code = CodeBlock.builder();
|
||||
code.add("$T.$L", AutowiredMethodArgumentsResolver.class,
|
||||
(!required) ? "forMethod" : "forRequiredMethod");
|
||||
(!required ? "forMethod" : "forRequiredMethod"));
|
||||
code.add("($S", method.getName());
|
||||
if (method.getParameterCount() > 0) {
|
||||
code.add(", $L", generateParameterTypesCode(method.getParameterTypes()));
|
||||
|
|
@ -1047,7 +1047,7 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
|
|||
private CodeBlock generateParameterTypesCode(Class<?>[] parameterTypes) {
|
||||
CodeBlock.Builder code = CodeBlock.builder();
|
||||
for (int i = 0; i < parameterTypes.length; i++) {
|
||||
code.add(i != 0 ? ", " : "");
|
||||
code.add((i != 0 ? ", " : ""));
|
||||
code.add("$T.class", parameterTypes[i]);
|
||||
}
|
||||
return code.build();
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ class BeanDefinitionPropertiesCodeGenerator {
|
|||
private static final ThreadLocal<ArrayDeque<String>> threadLocal = ThreadLocal.withInitial(ArrayDeque::new);
|
||||
|
||||
static void push(@Nullable String name) {
|
||||
String valueToSet = (name != null) ? name : "";
|
||||
String valueToSet = (name != null ? name : "");
|
||||
threadLocal.get().push(valueToSet);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
// named constructor arguments
|
||||
if (args.length > 1 && args[1] instanceof Class<?> clazz) {
|
||||
List<Object> constructorArgs =
|
||||
resolveConstructorArguments(args, 2, hasClosureArgument ? args.length - 1 : args.length);
|
||||
resolveConstructorArguments(args, 2, (hasClosureArgument ? args.length - 1 : args.length));
|
||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, clazz, constructorArgs);
|
||||
for (Map.Entry<?, ?> entity : namedArgs.entrySet()) {
|
||||
String propName = (String) entity.getKey();
|
||||
|
|
@ -525,7 +525,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||
}
|
||||
else {
|
||||
List<Object> constructorArgs =
|
||||
resolveConstructorArguments(args, 0, hasClosureArgument ? args.length - 1 : args.length);
|
||||
resolveConstructorArguments(args, 0, (hasClosureArgument ? args.length - 1 : args.length));
|
||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, null, constructorArgs);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -734,7 +734,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
|||
aliases.add(fullBeanName);
|
||||
}
|
||||
String[] retrievedAliases = super.getAliases(beanName);
|
||||
String prefix = factoryPrefix ? FACTORY_BEAN_PREFIX : "";
|
||||
String prefix = (factoryPrefix ? FACTORY_BEAN_PREFIX : "");
|
||||
for (String retrievedAlias : retrievedAliases) {
|
||||
String alias = prefix + retrievedAlias;
|
||||
if (!alias.equals(name)) {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ abstract class AutowireUtils {
|
|||
|
||||
public static final Comparator<Executable> EXECUTABLE_COMPARATOR = (e1, e2) -> {
|
||||
int result = Boolean.compare(Modifier.isPublic(e2.getModifiers()), Modifier.isPublic(e1.getModifiers()));
|
||||
return result != 0 ? result : Integer.compare(e2.getParameterCount(), e1.getParameterCount());
|
||||
return (result != 0 ? result : Integer.compare(e2.getParameterCount(), e1.getParameterCount()));
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public class Spr8954Tests {
|
|||
|
||||
@Override
|
||||
public Class<?> predictBeanType(Class<?> beanClass, String beanName) {
|
||||
return FactoryBean.class.isAssignableFrom(beanClass) ? PredictedType.class : null;
|
||||
return (FactoryBean.class.isAssignableFrom(beanClass) ? PredictedType.class : null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -57,7 +57,7 @@ class CaffeineCacheTests extends AbstractValueAdaptingCacheTests<CaffeineCache>
|
|||
|
||||
@Override
|
||||
protected CaffeineCache getCache(boolean allowNull) {
|
||||
return allowNull ? this.cache : this.cacheNoNull;
|
||||
return (allowNull ? this.cache : this.cacheNoNull);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -71,7 +71,7 @@ public class JCacheEhCacheApiTests extends AbstractValueAdaptingCacheTests<JCach
|
|||
|
||||
@Override
|
||||
protected JCacheCache getCache(boolean allowNull) {
|
||||
return allowNull ? this.cache : this.cacheNoNull;
|
||||
return (allowNull ? this.cache : this.cacheNoNull);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public abstract class AbstractCacheOperationTests<O extends JCacheOperation<?>>
|
|||
|
||||
private static String getCacheName(Annotation annotation) {
|
||||
Object cacheName = AnnotationUtils.getValue(annotation, "cacheName");
|
||||
return cacheName != null ? cacheName.toString() : "test";
|
||||
return (cacheName != null ? cacheName.toString() : "test");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -95,7 +95,7 @@ public class DelegatingMessageSource extends MessageSourceSupport implements Hie
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.parentMessageSource != null ? this.parentMessageSource.toString() : "Empty MessageSource";
|
||||
return (this.parentMessageSource != null ? this.parentMessageSource.toString() : "Empty MessageSource");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public interface TriggerContext {
|
|||
@Deprecated(since = "6.0")
|
||||
default Date lastScheduledExecutionTime() {
|
||||
Instant instant = lastScheduledExecution();
|
||||
return instant != null ? Date.from(instant) : null;
|
||||
return (instant != null ? Date.from(instant) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -73,7 +73,7 @@ public interface TriggerContext {
|
|||
@Deprecated(since = "6.0")
|
||||
default Date lastActualExecutionTime() {
|
||||
Instant instant = lastActualExecution();
|
||||
return instant != null ? Date.from(instant) : null;
|
||||
return (instant != null ? Date.from(instant) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -94,7 +94,7 @@ public interface TriggerContext {
|
|||
@Nullable
|
||||
default Date lastCompletionTime() {
|
||||
Instant instant = lastCompletion();
|
||||
return instant != null ? Date.from(instant) : null;
|
||||
return (instant != null ? Date.from(instant) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -68,7 +68,7 @@ public class SimpleTriggerContext implements TriggerContext {
|
|||
|
||||
@Nullable
|
||||
private static Instant toInstant(@Nullable Date date) {
|
||||
return date != null ? date.toInstant() : null;
|
||||
return (date != null ? date.toInstant() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ public class MethodValidationAdapter implements MethodValidator {
|
|||
}
|
||||
|
||||
return adaptViolations(target, method, violations,
|
||||
i -> parameters != null ? parameters[i] : initMethodParameter(method, i),
|
||||
i -> (parameters != null ? parameters[i] : initMethodParameter(method, i)),
|
||||
i -> arguments[i]);
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ public class MethodValidationAdapter implements MethodValidator {
|
|||
}
|
||||
|
||||
return adaptViolations(target, method, violations,
|
||||
i -> returnType != null ? returnType : initMethodParameter(method, -1),
|
||||
i -> (returnType != null ? returnType : initMethodParameter(method, -1)),
|
||||
i -> returnValue);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ final class TestNamespaceHandler extends NamespaceHandlerSupport {
|
|||
Element element = (Element) node;
|
||||
BeanDefinition def = definition.getBeanDefinition();
|
||||
|
||||
MutablePropertyValues mpvs = (def.getPropertyValues() == null) ? new MutablePropertyValues() : def.getPropertyValues();
|
||||
MutablePropertyValues mpvs = (def.getPropertyValues() == null ? new MutablePropertyValues() : def.getPropertyValues());
|
||||
mpvs.add("name", element.getAttribute("name"));
|
||||
mpvs.add("age", element.getAttribute("age"));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -63,7 +63,7 @@ public class ConcurrentMapCacheTests extends AbstractValueAdaptingCacheTests<Con
|
|||
|
||||
@Override
|
||||
protected ConcurrentMapCache getCache(boolean allowNull) {
|
||||
return allowNull ? this.cache : this.cacheNoNull;
|
||||
return (allowNull ? this.cache : this.cacheNoNull);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public class Spr8954Tests {
|
|||
|
||||
@Override
|
||||
public Class<?> predictBeanType(Class<?> beanClass, String beanName) {
|
||||
return FactoryBean.class.isAssignableFrom(beanClass) ? PredictedType.class : null;
|
||||
return (FactoryBean.class.isAssignableFrom(beanClass) ? PredictedType.class : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
|
|||
else {
|
||||
smc.multicastEvent(event);
|
||||
}
|
||||
int invocation = match ? 1 : 0;
|
||||
int invocation = (match ? 1 : 0);
|
||||
verify(listener, times(invocation)).onApplicationEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ class ResourceBundleMessageSourceTests {
|
|||
|
||||
Locale.setDefault(expectGermanFallback ? Locale.GERMAN : Locale.CANADA);
|
||||
assertThat(ac.getMessage("code1", null, Locale.ENGLISH)).isEqualTo("message1");
|
||||
Object expected = fallbackToSystemLocale && expectGermanFallback ? "nachricht2" : "message2";
|
||||
Object expected = (fallbackToSystemLocale && expectGermanFallback ? "nachricht2" : "message2");
|
||||
assertThat(ac.getMessage("code2", null, Locale.ENGLISH)).isEqualTo(expected);
|
||||
|
||||
assertThat(ac.getMessage("code2", null, Locale.GERMAN)).isEqualTo("nachricht2");
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class DateTimeFormatterFactoryTests {
|
|||
private static final TimeZone NEW_YORK = TimeZone.getTimeZone("America/New_York");
|
||||
|
||||
// Ensure that we are testing against a timezone other than the default.
|
||||
private static final TimeZone TEST_TIMEZONE = ZURICH.equals(TimeZone.getDefault()) ? NEW_YORK : ZURICH;
|
||||
private static final TimeZone TEST_TIMEZONE = (ZURICH.equals(TimeZone.getDefault()) ? NEW_YORK : ZURICH);
|
||||
|
||||
|
||||
private DateTimeFormatterFactory factory = new DateTimeFormatterFactory();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -468,7 +468,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
|||
|
||||
public int getCount(String attribute) {
|
||||
Integer count = (Integer) this.attributeCounts.get(attribute);
|
||||
return (count == null) ? 0 : count;
|
||||
return (count == null ? 0 : count);
|
||||
}
|
||||
|
||||
public Object getLastHandback(String attributeName) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ final class CompileWithForkedClassLoaderClassLoader extends ClassLoader {
|
|||
@Override
|
||||
protected Class<?> findClass(String name) throws ClassNotFoundException {
|
||||
byte[] bytes = findClassBytes(name);
|
||||
return (bytes != null) ? defineClass(name, bytes, 0, bytes.length, null) : super.findClass(name);
|
||||
return (bytes != null ? defineClass(name, bytes, 0, bytes.length, null) : super.findClass(name));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public class DynamicClassLoader extends ClassLoader {
|
|||
return classFile.getContent();
|
||||
}
|
||||
DynamicClassFileObject dynamicClassFile = this.dynamicClassFiles.get(name);
|
||||
return (dynamicClassFile != null) ? dynamicClassFile.getBytes() : null;
|
||||
return (dynamicClassFile != null ? dynamicClassFile.getBytes() : null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // on JDK 20
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -265,8 +265,8 @@ public final class TestCompiler {
|
|||
}
|
||||
|
||||
private DynamicClassLoader compile() {
|
||||
ClassLoader classLoaderToUse = (this.classLoader != null) ? this.classLoader
|
||||
: Thread.currentThread().getContextClassLoader();
|
||||
ClassLoader classLoaderToUse = (this.classLoader != null ? this.classLoader
|
||||
: Thread.currentThread().getContextClassLoader());
|
||||
List<DynamicJavaFileObject> compilationUnits = this.sourceFiles.stream().map(
|
||||
DynamicJavaFileObject::new).toList();
|
||||
StandardJavaFileManager standardFileManager = this.compiler.getStandardFileManager(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -100,7 +100,7 @@ public class StringUtilsBenchmark {
|
|||
}
|
||||
|
||||
private String createSamplePath(Random random) {
|
||||
String separator = random.nextBoolean() ? "/" : "\\";
|
||||
String separator = (random.nextBoolean() ? "/" : "\\");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("jar:file:///c:");
|
||||
for (int i = 0; i < this.segmentCount; i++) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -90,7 +90,7 @@ public final class GeneratedClass {
|
|||
private String generateSequencedMethodName(MethodName name) {
|
||||
int sequence = this.methodNameSequenceGenerator
|
||||
.computeIfAbsent(name, key -> new AtomicInteger()).getAndIncrement();
|
||||
return (sequence > 0) ? name.toString() + sequence : name.toString();
|
||||
return (sequence > 0 ? name.toString() + sequence : name.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -86,7 +86,7 @@ public class InMemoryGeneratedFiles implements GeneratedFiles {
|
|||
Assert.notNull(kind, "'kind' must not be null");
|
||||
Assert.hasLength(path, "'path' must not be empty");
|
||||
Map<String, InputStreamSource> paths = this.files.get(kind);
|
||||
return (paths != null) ? paths.get(path) : null;
|
||||
return (paths != null ? paths.get(path) : null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ final class MethodName {
|
|||
StringBuilder name = new StringBuilder(chars.length);
|
||||
boolean uppercase = false;
|
||||
for (char ch : chars) {
|
||||
char outputChar = (!uppercase) ? ch : Character.toUpperCase(ch);
|
||||
char outputChar = (!uppercase ? ch : Character.toUpperCase(ch));
|
||||
name.append((!Character.isLetter(ch)) ? "" : outputChar);
|
||||
uppercase = (ch == '.');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -80,7 +80,7 @@ public class ResourceHints {
|
|||
*/
|
||||
public ResourceHints registerPatternIfPresent(@Nullable ClassLoader classLoader, String location,
|
||||
Consumer<ResourcePatternHints.Builder> resourceHint) {
|
||||
ClassLoader classLoaderToUse = (classLoader != null) ? classLoader : getClass().getClassLoader();
|
||||
ClassLoader classLoaderToUse = (classLoader != null ? classLoader : getClass().getClassLoader());
|
||||
if (classLoaderToUse.getResource(location) != null) {
|
||||
registerPattern(resourceHint);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -73,7 +73,7 @@ final class SimpleTypeReference extends AbstractTypeReference {
|
|||
return new SimpleTypeReference(className.substring(0, i), className.substring(i + 1), null);
|
||||
}
|
||||
else {
|
||||
String packageName = isPrimitive(className) ? "java.lang" : "";
|
||||
String packageName = (isPrimitive(className) ? "java.lang" : "");
|
||||
return new SimpleTypeReference(packageName, className, null);
|
||||
}
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ final class SimpleTypeReference extends AbstractTypeReference {
|
|||
if (type == null) {
|
||||
return;
|
||||
}
|
||||
String typeName = (type.getEnclosingType() != null) ? "." + type.getSimpleName() : type.getSimpleName();
|
||||
String typeName = (type.getEnclosingType() != null ? "." + type.getSimpleName() : type.getSimpleName());
|
||||
sb.insert(0, typeName);
|
||||
buildName(type.getEnclosingType(), sb);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class FilePatternResourceHintsRegistrar {
|
|||
|
||||
@Deprecated(since = "6.0.12", forRemoval = true)
|
||||
public void registerHints(ResourceHints hints, @Nullable ClassLoader classLoader) {
|
||||
ClassLoader classLoaderToUse = (classLoader != null) ? classLoader : getClass().getClassLoader();
|
||||
ClassLoader classLoaderToUse = (classLoader != null ? classLoader : getClass().getClassLoader());
|
||||
List<String> includes = new ArrayList<>();
|
||||
for (String location : this.locations) {
|
||||
if (classLoaderToUse.getResource(location) != null) {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public class ResourceDecoder extends AbstractDataBufferDecoder<Resource> {
|
|||
}
|
||||
|
||||
Class<?> clazz = elementType.toClass();
|
||||
String filename = hints != null ? (String) hints.get(FILENAME_HINT) : null;
|
||||
String filename = (hints != null ? (String) hints.get(FILENAME_HINT) : null);
|
||||
if (clazz == InputStreamResource.class) {
|
||||
return new InputStreamResource(new ByteArrayInputStream(bytes)) {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
|||
}
|
||||
|
||||
protected String formatMappingName() {
|
||||
return this.beanName != null ? "'" + this.beanName + "'" : getClass().getName();
|
||||
return (this.beanName != null ? "'" + this.beanName + "'" : getClass().getName());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -589,9 +589,9 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
|||
private RequestPath getRequestPath(HttpServletRequest request) {
|
||||
// Expect pre-parsed path with DispatcherServlet,
|
||||
// but otherwise parse per handler lookup + cache for handling
|
||||
return request.getAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE) != null ?
|
||||
return (request.getAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE) != null ?
|
||||
ServletRequestPathUtils.getParsedRequestPath(request) :
|
||||
ServletRequestPathUtils.parseAndCache(request);
|
||||
ServletRequestPathUtils.parseAndCache(request));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -676,7 +676,7 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
|||
prev = curr;
|
||||
}
|
||||
}
|
||||
return sb != null ? sb.toString() : path;
|
||||
return (sb != null ? sb.toString() : path);
|
||||
}
|
||||
|
||||
private String cleanLeadingSlash(String path) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -233,8 +233,8 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
|
|||
}
|
||||
}
|
||||
|
||||
String mediaTypeInfo = logger.isDebugEnabled() && requestedMediaTypes != null ?
|
||||
" given " + requestedMediaTypes.toString() : "";
|
||||
String mediaTypeInfo = (logger.isDebugEnabled() && requestedMediaTypes != null ?
|
||||
" given " + requestedMediaTypes.toString() : "");
|
||||
|
||||
if (this.useNotAcceptableStatusCode) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue