Polishing

This commit is contained in:
Juergen Hoeller
2020-01-09 17:03:17 +01:00
parent e8ef93c508
commit 4936a637fe
4 changed files with 14 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -867,8 +867,8 @@ public class MethodParameter {
/**
* Check whether the specified {@link MethodParameter} represents a nullable Kotlin type,
* an optional parameter (with a default value in the Kotlin declaration) or a {@code Continuation} parameter
* used in suspending functions.
* an optional parameter (with a default value in the Kotlin declaration) or a
* {@code Continuation} parameter used in suspending functions.
*/
public static boolean isOptional(MethodParameter param) {
Method method = param.getMethod();
@@ -880,16 +880,18 @@ public class MethodParameter {
KFunction<?> function;
Predicate<KParameter> predicate;
if (method != null) {
if (param.parameterType.getName().equals("kotlin.coroutines.Continuation")) {
if (param.getParameterType().getName().equals("kotlin.coroutines.Continuation")) {
return true;
}
function = ReflectJvmMapping.getKotlinFunction(method);
predicate = p -> KParameter.Kind.VALUE.equals(p.getKind());
}
else {
function = ReflectJvmMapping.getKotlinFunction(param.getConstructor());
predicate = p -> KParameter.Kind.VALUE.equals(p.getKind()) ||
KParameter.Kind.INSTANCE.equals(p.getKind());
Constructor<?> ctor = param.getConstructor();
Assert.state(ctor != null, "Neither method nor constructor found");
function = ReflectJvmMapping.getKotlinFunction(ctor);
predicate = p -> (KParameter.Kind.VALUE.equals(p.getKind()) ||
KParameter.Kind.INSTANCE.equals(p.getKind()));
}
if (function != null) {
int i = 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -107,7 +107,7 @@ final class DefaultPathContainer implements PathContainer {
}
List<Element> elements = new ArrayList<>();
int begin;
if (path.length() > 0 && path.charAt(0) == separator) {
if (path.charAt(0) == separator) {
begin = 1;
elements.add(separatorElement);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -149,7 +149,7 @@ public class ControllerAdviceBean implements Ordered {
public int getOrder() {
if (this.order == null) {
Object resolvedBean = null;
if (this.beanOrName instanceof String) {
if (this.beanFactory != null && this.beanOrName instanceof String) {
String beanName = (String) this.beanOrName;
String targetBeanName = ScopedProxyUtils.getTargetBeanName(beanName);
boolean isScopedProxy = this.beanFactory.containsBean(targetBeanName);