This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.0.x by this push:
new 449c3c5 Fix building releases with Java 11. Update change log for
Java 11 switch
449c3c5 is described below
commit 449c3c5f98f0e7bf10267407cf2e5554671f780e
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Jan 13 19:42:16 2022 +0000
Fix building releases with Java 11. Update change log for Java 11 switch
---
.../xreflection/ObjectReflectionPropertyInspector.java | 14 +++++++++++++-
webapps/docs/changelog.xml | 10 ++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git
a/java/org/apache/tomcat/util/xreflection/ObjectReflectionPropertyInspector.java
b/java/org/apache/tomcat/util/xreflection/ObjectReflectionPropertyInspector.java
index 514aeb4..cf67e47 100644
---
a/java/org/apache/tomcat/util/xreflection/ObjectReflectionPropertyInspector.java
+++
b/java/org/apache/tomcat/util/xreflection/ObjectReflectionPropertyInspector.java
@@ -147,9 +147,21 @@ public final class ObjectReflectionPropertyInspector {
(method.getParameterTypes() == null ||
method.getParameterTypes().length == 0) &&
ALLOWED_TYPES.contains(method.getReturnType()) &&
- !Modifier.isPrivate(method.getModifiers());
+ !Modifier.isPrivate(method.getModifiers()) &&
+ isPresentInJava8Api(method);
}
+ private static boolean isPresentInJava8Api(Method method) {
+ // Up to Java 18 EA 30 this was the only problematic method so this
+ // approach is OK. If we get more than a few of these this code may
+ // need to be refactored.
+ if (ClassLoader.class.isAssignableFrom(method.getDeclaringClass())) {
+ if ("getName".equals(method.getName())) {
+ return false;
+ }
+ }
+ return true;
+ }
private static SetPropertyClass getOrCreateSetPropertyClass(Class<?>
clazz) {
boolean base = (clazz.getSuperclass() == null || clazz.getSuperclass()
== Object.class);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 05f7e01..3d9f269 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,16 @@
issues do not "pop up" wrt. others).
-->
<section name="Tomcat 10.0.16 (markt)" rtext="in development">
+ <subsection name="Other">
+ <changelog>
+ <scode>
+ Switch to building with Java 11 and using <code>--release</code> to
+ target Java 8. Once back-ported to all currently supported branches
this
+ will reduce the number of Java versions developers need to juggle.
+ (markt)
+ </scode>
+ </changelog>
+ </subsection>
</section>
<section name="Tomcat 10.0.15 (markt)" rtext="release in progress">
<subsection name="Catalina">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]