This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 35abad9  Fix IDE warnings. Get build working with Java 8 through 14
35abad9 is described below

commit 35abad971594d467fbe3b85ae8c61575d2bd2eb6
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Nov 14 19:26:00 2019 +0000

    Fix IDE warnings. Get build working with Java 8 through 14
    
    "-XDignore.symbol.file" is a hack but it is the only solution I found
    that worked cleanly with all Java versions.
---
 build.xml                                                    |  7 +------
 .../apache/catalina/mbeans/JmxRemoteLifecycleListener.java   | 12 +++++++++++-
 res/findbugs/filter-false-positives.xml                      |  6 ++++++
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/build.xml b/build.xml
index 0499113..014e848 100644
--- a/build.xml
+++ b/build.xml
@@ -93,7 +93,6 @@
   <!-- Servlet 4.0 spec requires Java 8+ -->
   <property name="compile.source" value="8"/>
   <property name="compile.target" value="8"/>
-  <property name="compile.release" value="8"/>
   <property name="min.java.version" value="8"/>
 
   <!-- Locations to create the JAR artifacts -->
@@ -641,7 +640,6 @@
            deprecation="${compile.deprecation}"
            source="${compile.source}"
            target="${compile.target}"
-           release="${compile.release}"
            encoding="ISO-8859-1"
            includeAntRuntime="true" >
       <!-- Uncomment this to show unchecked warnings:
@@ -696,12 +694,12 @@
            deprecation="${compile.deprecation}"
            source="${compile.source}"
            target="${compile.target}"
-           release="${compile.release}"
            encoding="ISO-8859-1"
            includeAntRuntime="true" >
       <!-- Uncomment this to show unchecked warnings:
       <compilerarg value="-Xlint:unchecked"/>
       -->
+      <compilerarg value="-XDignore.symbol.file"/>
       <classpath refid="compile.classpath" />
     </javac>
     <!-- Copy static resource files -->
@@ -1216,7 +1214,6 @@
              debug="${compile.debug}" deprecation="${compile.deprecation}"
              source="${compile.source}"
              target="${compile.target}"
-             release="${compile.release}"
              classpath="${tomcat.classes}"
              encoding="ISO-8859-1"
              includeantruntime="false">
@@ -1228,7 +1225,6 @@
              debug="${compile.debug}" deprecation="${compile.deprecation}"
              source="${compile.source}"
              target="${compile.target}"
-             release="${compile.release}"
              classpath="${tomcat.classes}"
              encoding="ISO-8859-1"
              includeantruntime="false">
@@ -1465,7 +1461,6 @@
            deprecation="${compile.deprecation}"
            source="${compile.source}"
            target="${compile.target}"
-           release="${compile.release}"
            encoding="ISO-8859-1"
            includeantruntime="true">
       <classpath refid="tomcat.test.classpath" />
diff --git a/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java 
b/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
index 77a785d..d01ed8e 100644
--- a/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
+++ b/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
@@ -441,7 +441,13 @@ public class JmxRemoteLifecycleListener extends 
SSLHostConfig implements Lifecyc
             Remote jmxServer = server.toStub();
             // Create the RMI registry
             try {
-                new JmxRegistry(theRmiRegistryPort, registryCsf, registrySsf, 
"jmxrmi", jmxServer);
+                /*
+                 * JmxRegistry is registered as a side-effect of creation.
+                 * This object is here so we can tell the IDE it is OK for it
+                 * not to be used.
+                 */
+                @SuppressWarnings("unused")
+                JmxRegistry unused = new JmxRegistry(theRmiRegistryPort, 
registryCsf, registrySsf, "jmxrmi", jmxServer);
             } catch (RemoteException e) {
                 log.error(sm.getString(
                         "jmxRemoteLifecycleListener.createRegistryFailed",
@@ -589,6 +595,10 @@ public class JmxRemoteLifecycleListener extends 
SSLHostConfig implements Lifecyc
     }
 
 
+    /*
+     * Better to use the internal API than re-invent the wheel.
+     */
+    @SuppressWarnings("restriction")
     private static class JmxRegistry extends sun.rmi.registry.RegistryImpl {
         private static final long serialVersionUID = -3772054804656428217L;
         private final String jmxName;
diff --git a/res/findbugs/filter-false-positives.xml 
b/res/findbugs/filter-false-positives.xml
index 7fcc6bd..2c8d18b 100644
--- a/res/findbugs/filter-false-positives.xml
+++ b/res/findbugs/filter-false-positives.xml
@@ -344,6 +344,12 @@
     <Bug pattern="VO_VOLATILE_REFERENCE_TO_ARRAY" />
   </Match>
   <Match>
+    <!-- Object is used via side-effect of creation. -->
+    <Class name="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" />
+    <Method name="createServer" />
+    <Bug pattern="DLS_DEAD_LOCAL_STORE" />
+  </Match>
+  <Match>
     <!-- SQL construction is safe since it is from trusted config -->
     <Or>
       <Class name="org.apache.catalina.realm.DataSourceRealm" />


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to