You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/01/17 09:31:49 UTC
[tomcat] 04/07: Fix building releases with Java 11. Update change log for Java 11 switch
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 702f2076574c3989ccb402d2cb664097d6600ee3
Author: Mark Thomas <ma...@apache.org>
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 828f33d..109bb9c 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 9.0.59 (remm)" 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 9.0.58 (remm)" rtext="release in progress 2022-01-15">
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org