Use Class.getName() as fallback in HandlerFunctionDescription
In JDK 15 the concept of hidden classes was introduced, which also affects Lambdas in so far that Class.getCanonicalName() will return null for those. This commit uses Class.getName() as a fallback when no canonical name is available. See gh-21713
This commit is contained in:
parent
9e2902130c
commit
cf3cd0be48
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
|
@ -29,11 +29,17 @@ public class HandlerFunctionDescription {
|
|||
private final String className;
|
||||
|
||||
HandlerFunctionDescription(HandlerFunction<?> handlerFunction) {
|
||||
this.className = handlerFunction.getClass().getCanonicalName();
|
||||
this.className = getHandlerFunctionClassName(handlerFunction);
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return this.className;
|
||||
}
|
||||
|
||||
private String getHandlerFunctionClassName(HandlerFunction<?> handlerFunction) {
|
||||
Class<?> functionClass = handlerFunction.getClass();
|
||||
String canonicalName = functionClass.getCanonicalName();
|
||||
return canonicalName != null ? canonicalName : functionClass.getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue