diff --git a/spring-context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java b/spring-context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java index 3b4ef961f6..72bbaa3242 100644 --- a/spring-context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java +++ b/spring-context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java @@ -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. diff --git a/spring-core/src/main/java/org/springframework/core/MethodParameter.java b/spring-core/src/main/java/org/springframework/core/MethodParameter.java index bcb1a357ef..675229f2c7 100644 --- a/spring-core/src/main/java/org/springframework/core/MethodParameter.java +++ b/spring-core/src/main/java/org/springframework/core/MethodParameter.java @@ -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 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; diff --git a/spring-web/src/main/java/org/springframework/http/server/DefaultPathContainer.java b/spring-web/src/main/java/org/springframework/http/server/DefaultPathContainer.java index 2098f45941..4476df7391 100644 --- a/spring-web/src/main/java/org/springframework/http/server/DefaultPathContainer.java +++ b/spring-web/src/main/java/org/springframework/http/server/DefaultPathContainer.java @@ -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 elements = new ArrayList<>(); int begin; - if (path.length() > 0 && path.charAt(0) == separator) { + if (path.charAt(0) == separator) { begin = 1; elements.add(separatorElement); } diff --git a/spring-web/src/main/java/org/springframework/web/method/ControllerAdviceBean.java b/spring-web/src/main/java/org/springframework/web/method/ControllerAdviceBean.java index dc424a8627..2184684080 100644 --- a/spring-web/src/main/java/org/springframework/web/method/ControllerAdviceBean.java +++ b/spring-web/src/main/java/org/springframework/web/method/ControllerAdviceBean.java @@ -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);