Commit cf3cd0be authored by dreis2211's avatar dreis2211 Committed by Stephane Nicoll

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
parent 9e290213
/*
* 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();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment