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 2020/02/06 12:47:11 UTC

[tomcat] branch 7.0.x updated: Javadoc clean-up to avoid warnings with newer Java versions

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

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


The following commit(s) were added to refs/heads/7.0.x by this push:
     new 3a740e9  Javadoc clean-up to avoid warnings with newer Java versions
3a740e9 is described below

commit 3a740e992ddafad51e716566e5081cc2176e5368
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Feb 6 12:46:52 2020 +0000

    Javadoc clean-up to avoid warnings with newer Java versions
---
 java/org/apache/jasper/compiler/AntCompiler.java   |   2 +
 .../org/apache/jasper/compiler/BeanRepository.java |   2 +
 java/org/apache/jasper/compiler/Compiler.java      |  27 +++++-
 .../apache/jasper/compiler/ELFunctionMapper.java   |   1 +
 java/org/apache/jasper/compiler/ELInterpreter.java |   3 +-
 .../jasper/compiler/ELInterpreterFactory.java      |   5 +-
 .../apache/jasper/compiler/ErrorDispatcher.java    | 103 ++++++++++++++-------
 7 files changed, 101 insertions(+), 42 deletions(-)

diff --git a/java/org/apache/jasper/compiler/AntCompiler.java b/java/org/apache/jasper/compiler/AntCompiler.java
index 2dcd528..f54a32f 100644
--- a/java/org/apache/jasper/compiler/AntCompiler.java
+++ b/java/org/apache/jasper/compiler/AntCompiler.java
@@ -349,6 +349,8 @@ public class AntCompiler extends Compiler {
 
 
         /**
+         * @return the stream that has been wrapped
+         *
          * @deprecated Unused. Will be removed in Tomcat 8.0.x.
          */
         @Deprecated
diff --git a/java/org/apache/jasper/compiler/BeanRepository.java b/java/org/apache/jasper/compiler/BeanRepository.java
index e3cc96d..fa0e062 100644
--- a/java/org/apache/jasper/compiler/BeanRepository.java
+++ b/java/org/apache/jasper/compiler/BeanRepository.java
@@ -35,6 +35,8 @@ public class BeanRepository {
 
     /**
      * Constructor.
+     * @param loader The class loader
+     * @param err The error dispatcher that will be used to report errors
      */
     public BeanRepository(ClassLoader loader, ErrorDispatcher err) {
         this.loader = loader;
diff --git a/java/org/apache/jasper/compiler/Compiler.java b/java/org/apache/jasper/compiler/Compiler.java
index 4f6e9c3..6345409 100644
--- a/java/org/apache/jasper/compiler/Compiler.java
+++ b/java/org/apache/jasper/compiler/Compiler.java
@@ -86,6 +86,7 @@ public abstract class Compiler {
      * return null. Used in development mode for generating detailed error
      * messages. http://bz.apache.org/bugzilla/show_bug.cgi?id=37062.
      * </p>
+     * @return the page nodes
      */
     public Node.Nodes getPageNodes() {
         return this.pageNodes;
@@ -332,13 +333,21 @@ public abstract class Compiler {
     }
 
     /**
-     * Compile the servlet from .java file to .class file
+     * Servlet compilation. This compiles the generated sources into
+     * Servlets.
+     * @param smap The SMAP files for source debugging
+     * @throws FileNotFoundException Source files not found
+     * @throws JasperException Compilation error
+     * @throws Exception Some other error
      */
     protected abstract void generateClass(String[] smap)
             throws FileNotFoundException, JasperException, Exception;
 
     /**
-     * Compile the jsp file from the current engine context
+     * Compile the jsp file from the current engine context.
+     * @throws FileNotFoundException Source files not found
+     * @throws JasperException Compilation error
+     * @throws Exception Some other error
      */
     public void compile() throws FileNotFoundException, JasperException,
             Exception {
@@ -352,6 +361,9 @@ public abstract class Compiler {
      * @param compileClass
      *            If true, generate both .java and .class file If false,
      *            generate only .java file
+     * @throws FileNotFoundException Source files not found
+     * @throws JasperException Compilation error
+     * @throws Exception Some other error
      */
     public void compile(boolean compileClass) throws FileNotFoundException,
             JasperException, Exception {
@@ -367,6 +379,9 @@ public abstract class Compiler {
      *            generate only .java file
      * @param jspcMode
      *            true if invoked from JspC, false otherwise
+     * @throws FileNotFoundException Source files not found
+     * @throws JasperException Compilation error
+     * @throws Exception Some other error
      */
     public void compile(boolean compileClass, boolean jspcMode)
             throws FileNotFoundException, JasperException, Exception {
@@ -427,6 +442,8 @@ public abstract class Compiler {
     /**
      * This is a protected method intended to be overridden by subclasses of
      * Compiler. This is used by the compile method to do all the compilation.
+     * @return <code>true</code> if the source generation and compilation
+     *  should occur
      */
     public boolean isOutDated() {
         return isOutDated(true);
@@ -441,6 +458,8 @@ public abstract class Compiler {
      * @param checkClass
      *            If true, check against .class file, if false, check against
      *            .java file.
+     * @return <code>true</code> if the source generation and compilation
+     *  should occur
      */
     public boolean isOutDated(boolean checkClass) {
 
@@ -545,14 +564,14 @@ public abstract class Compiler {
     }
 
     /**
-     * Gets the error dispatcher.
+     * @return the error dispatcher.
      */
     public ErrorDispatcher getErrorDispatcher() {
         return errDispatcher;
     }
 
     /**
-     * Gets the info about the page under compilation
+     * @return the info about the page under compilation
      */
     public PageInfo getPageInfo() {
         return pageInfo;
diff --git a/java/org/apache/jasper/compiler/ELFunctionMapper.java b/java/org/apache/jasper/compiler/ELFunctionMapper.java
index 1381979..3f2f3e1 100644
--- a/java/org/apache/jasper/compiler/ELFunctionMapper.java
+++ b/java/org/apache/jasper/compiler/ELFunctionMapper.java
@@ -46,6 +46,7 @@ public class ELFunctionMapper {
      * Creates the functions mappers for all EL expressions in the JSP page.
      *
      * @param page The current compilation unit.
+     * @throws JasperException EL error
      */
     public static void map(Node.Nodes page)
                 throws JasperException {
diff --git a/java/org/apache/jasper/compiler/ELInterpreter.java b/java/org/apache/jasper/compiler/ELInterpreter.java
index d2c5bce..bcb3f28 100644
--- a/java/org/apache/jasper/compiler/ELInterpreter.java
+++ b/java/org/apache/jasper/compiler/ELInterpreter.java
@@ -33,7 +33,8 @@ public interface ELInterpreter {
      * String, Class, javax.servlet.jsp.PageContext,
      * org.apache.jasper.runtime.ProtectedFunctionMapper, boolean)} but other
      * implementations may produce more optimised code.
-     *
+     * @param context The compilation context
+     * @param isTagFile <code>true</code> if in a tag file rather than a JSP
      * @param expression a String containing zero or more "${}" expressions
      * @param expectedType the expected type of the interpreted result
      * @param fnmapvar Variable pointing to a function map.
diff --git a/java/org/apache/jasper/compiler/ELInterpreterFactory.java b/java/org/apache/jasper/compiler/ELInterpreterFactory.java
index 0804a00..d4d1fdb 100644
--- a/java/org/apache/jasper/compiler/ELInterpreterFactory.java
+++ b/java/org/apache/jasper/compiler/ELInterpreterFactory.java
@@ -43,6 +43,9 @@ public class ELInterpreterFactory {
 
     /**
      * Obtain the correct EL Interpreter for the given web application.
+     * @param context The Servlet context
+     * @return the EL interpreter
+     * @throws Exception If an error occurs creating the interpreter
      */
     public static ELInterpreter getELInterpreter(ServletContext context)
             throws Exception {
@@ -82,7 +85,7 @@ public class ELInterpreterFactory {
     private static ELInterpreter createInstance(ServletContext context,
             String className) throws Exception {
         return (ELInterpreter) context.getClassLoader().loadClass(
-                    className).newInstance();
+                    className).getConstructor().newInstance();
     }
 
 
diff --git a/java/org/apache/jasper/compiler/ErrorDispatcher.java b/java/org/apache/jasper/compiler/ErrorDispatcher.java
index 1675404..a869b6f 100644
--- a/java/org/apache/jasper/compiler/ErrorDispatcher.java
+++ b/java/org/apache/jasper/compiler/ErrorDispatcher.java
@@ -62,7 +62,7 @@ public class ErrorDispatcher {
         this.jspcMode = jspcMode;
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -70,12 +70,13 @@ public class ErrorDispatcher {
      * message.
      *
      * @param errCode Error code
+     * @throws JasperException An error occurred
      */
     public void jspError(String errCode) throws JasperException {
         dispatch(null, errCode, null, null);
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -84,12 +85,13 @@ public class ErrorDispatcher {
      *
      * @param where Error location
      * @param errCode Error code
+     * @throws JasperException An error occurred
      */
     public void jspError(Mark where, String errCode) throws JasperException {
         dispatch(where, errCode, null, null);
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -98,12 +100,13 @@ public class ErrorDispatcher {
      *
      * @param n Node that caused the error
      * @param errCode Error code
+     * @throws JasperException An error occurred
      */
     public void jspError(Node n, String errCode) throws JasperException {
         dispatch(n.getStart(), errCode, null, null);
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -112,12 +115,13 @@ public class ErrorDispatcher {
      *
      * @param errCode Error code
      * @param arg Argument for parametric replacement
+     * @throws JasperException An error occurred
      */
     public void jspError(String errCode, String arg) throws JasperException {
         dispatch(null, errCode, new Object[] {arg}, null);
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -127,13 +131,14 @@ public class ErrorDispatcher {
      * @param where Error location
      * @param errCode Error code
      * @param arg Argument for parametric replacement
+     * @throws JasperException An error occurred
      */
     public void jspError(Mark where, String errCode, String arg)
                 throws JasperException {
         dispatch(where, errCode, new Object[] {arg}, null);
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -143,13 +148,14 @@ public class ErrorDispatcher {
      * @param n Node that caused the error
      * @param errCode Error code
      * @param arg Argument for parametric replacement
+     * @throws JasperException An error occurred
      */
     public void jspError(Node n, String errCode, String arg)
                 throws JasperException {
         dispatch(n.getStart(), errCode, new Object[] {arg}, null);
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -159,13 +165,14 @@ public class ErrorDispatcher {
      * @param errCode Error code
      * @param arg1 First argument for parametric replacement
      * @param arg2 Second argument for parametric replacement
+     * @throws JasperException An error occurred
      */
     public void jspError(String errCode, String arg1, String arg2)
                 throws JasperException {
         dispatch(null, errCode, new Object[] {arg1, arg2}, null);
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -176,13 +183,14 @@ public class ErrorDispatcher {
      * @param arg1 First argument for parametric replacement
      * @param arg2 Second argument for parametric replacement
      * @param arg3 Third argument for parametric replacement
+     * @throws JasperException An error occurred
      */
     public void jspError(String errCode, String arg1, String arg2, String arg3)
                 throws JasperException {
         dispatch(null, errCode, new Object[] {arg1, arg2, arg3}, null);
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -193,13 +201,14 @@ public class ErrorDispatcher {
      * @param errCode Error code
      * @param arg1 First argument for parametric replacement
      * @param arg2 Second argument for parametric replacement
+     * @throws JasperException An error occurred
      */
     public void jspError(Mark where, String errCode, String arg1, String arg2)
                 throws JasperException {
         dispatch(where, errCode, new Object[] {arg1, arg2}, null);
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -211,15 +220,15 @@ public class ErrorDispatcher {
      * @param arg1 First argument for parametric replacement
      * @param arg2 Second argument for parametric replacement
      * @param arg3 Third argument for parametric replacement
+     * @throws JasperException An error occurred
      */
-
     public void jspError(Mark where, String errCode, String arg1, String arg2,
                          String arg3)
                 throws JasperException {
         dispatch(where, errCode, new Object[] {arg1, arg2, arg3}, null);
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -230,14 +239,14 @@ public class ErrorDispatcher {
      * @param errCode Error code
      * @param arg1 First argument for parametric replacement
      * @param arg2 Second argument for parametric replacement
+     * @throws JasperException An error occurred
      */
-
     public void jspError(Node n, String errCode, String arg1, String arg2)
                 throws JasperException {
         dispatch(n.getStart(), errCode, new Object[] {arg1, arg2}, null);
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -249,18 +258,19 @@ public class ErrorDispatcher {
      * @param arg1 First argument for parametric replacement
      * @param arg2 Second argument for parametric replacement
      * @param arg3 Third argument for parametric replacement
+     * @throws JasperException An error occurred
      */
-
     public void jspError(Node n, String errCode, String arg1, String arg2,
                          String arg3)
                 throws JasperException {
         dispatch(n.getStart(), errCode, new Object[] {arg1, arg2, arg3}, null);
     }
 
-    /*
+    /**
      * Dispatches the given parsing exception to the configured error handler.
      *
      * @param e Parsing exception
+     * @throws JasperException An error occurred
      */
     public void jspError(Exception e) throws JasperException {
         dispatch(null, null, null, e);
@@ -276,6 +286,7 @@ public class ErrorDispatcher {
      * @param errCode Error code
      * @param arg Argument for parametric replacement
      * @param e Parsing exception
+     * @throws JasperException An error occurred
      */
     public void jspError(Exception e, String errCode, String arg)
                 throws JasperException {
@@ -283,6 +294,11 @@ public class ErrorDispatcher {
     }
 
     /**
+     * @param errCode Error code
+     * @param arg Argument for parametric replacement
+     * @param e Parsing exception
+     * @throws JasperException An error occurred
+
      * @deprecated Replaced by jspError(Exception, String, String)
      */
     @Deprecated
@@ -299,16 +315,17 @@ public class ErrorDispatcher {
      * message.
      *
      * @param where Error location
+     * @param e Parsing exception
      * @param errCode Error code
      * @param args Arguments for parametric replacement
-     * @param e Parsing exception
+     * @throws JasperException An error occurred
      */
     public void jspError(Mark where, Exception e, String errCode, String... args)
                 throws JasperException {
         dispatch(where, errCode, args, e);
     }
 
-    /*
+    /**
      * Dispatches the given JSP parse error to the configured error handler.
      *
      * The given error code is localized. If it is not found in the
@@ -316,9 +333,10 @@ public class ErrorDispatcher {
      * message.
      *
      * @param n Node that caused the error
+     * @param e Parsing exception
      * @param errCode Error code
      * @param arg Argument for parametric replacement
-     * @param e Parsing exception
+     * @throws JasperException An error occurred
      */
     public void jspError(Node n, Exception e, String errCode, String arg)
                 throws JasperException {
@@ -326,6 +344,11 @@ public class ErrorDispatcher {
     }
 
     /**
+     * @param n Node that caused the error
+     * @param errCode Error code
+     * @param arg Argument for parametric replacement
+     * @param e Parsing exception
+     * @throws JasperException An error occurred
      * @deprecated Replaced by jspError(Node, Exception, String, String)
      */
     @Deprecated
@@ -345,6 +368,8 @@ public class ErrorDispatcher {
      *
      * @return Array of javac compilation errors, or null if the given error
      * message does not contain any compilation error line numbers
+     * @throws JasperException An error occurred
+     * @throws IOException IO error which usually should not occur
      */
     public static JavacErrorDetail[] parseJavacErrors(String errMsg,
                                                       String fname,
@@ -354,11 +379,12 @@ public class ErrorDispatcher {
         return parseJavacMessage(errMsg, fname, page);
     }
 
-    /*
+    /**
      * Dispatches the given javac compilation errors to the configured error
      * handler.
      *
      * @param javacErrors Array of javac compilation errors
+     * @throws JasperException An error occurred
      */
     public void javacError(JavacErrorDetail[] javacErrors)
             throws JasperException {
@@ -367,12 +393,13 @@ public class ErrorDispatcher {
     }
 
 
-    /*
+    /**
      * Dispatches the given compilation error report and exception to the
      * configured error handler.
      *
      * @param errorReport Compilation error report
      * @param e Compilation exception
+     * @throws JasperException An error occurred
      */
     public void javacError(String errorReport, Exception e)
                 throws JasperException {
@@ -446,7 +473,7 @@ public class ErrorDispatcher {
         }
     }
 
-    /*
+    /**
      * Parses the given Java compilation error message, which may contain one
      * or more compilation errors, into an array of JavacErrorDetail instances.
      *
@@ -461,6 +488,8 @@ public class ErrorDispatcher {
      *
      * @return Array of JavacErrorDetail instances corresponding to the
      * compilation errors
+     * @throws JasperException An error occurred
+     * @throws IOException IO error which usually should not occur
      */
     private static JavacErrorDetail[] parseJavacMessage(
                                 String errMsg, String fname, Node.Nodes page)
@@ -531,12 +560,13 @@ public class ErrorDispatcher {
 
 
     /**
-     * @param fname
-     * @param page
-     * @param errMsgBuf
-     * @param lineNum
+     * Create a compilation error.
+     * @param fname The file name
+     * @param page The page nodes
+     * @param errMsgBuf The error message
+     * @param lineNum The source line number of the error
      * @return JavacErrorDetail The error details
-     * @throws JasperException
+     * @throws JasperException An error occurred
      */
     public static JavacErrorDetail createJavacError(String fname,
             Node.Nodes page, StringBuilder errMsgBuf, int lineNum)
@@ -546,13 +576,14 @@ public class ErrorDispatcher {
 
 
     /**
-     * @param fname
-     * @param page
-     * @param errMsgBuf
-     * @param lineNum
-     * @param ctxt
+     * Create a compilation error.
+     * @param fname The file name
+     * @param page The page nodes
+     * @param errMsgBuf The error message
+     * @param lineNum The source line number of the error
+     * @param ctxt The compilation context
      * @return JavacErrorDetail The error details
-     * @throws JasperException
+     * @throws JasperException An error occurred
      */
     public static JavacErrorDetail createJavacError(String fname,
             Node.Nodes page, StringBuilder errMsgBuf, int lineNum,
@@ -607,7 +638,7 @@ public class ErrorDispatcher {
     }
 
 
-    /*
+    /**
      * Visitor responsible for mapping a line number in the generated servlet
      * source code to the corresponding JSP node.
      */
@@ -622,7 +653,7 @@ public class ErrorDispatcher {
          */
         Node found;
 
-        /*
+        /**
          * Constructor.
          *
          * @param lineNum Source line number in the generated servlet code
@@ -639,7 +670,7 @@ public class ErrorDispatcher {
             }
         }
 
-        /*
+        /**
          * Gets the JSP node to which the source line number in the generated
          * servlet code was mapped.
          *


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