This is an automated email from the ASF dual-hosted git repository. ddekany pushed a commit to branch 3 in repository https://gitbox.apache.org/repos/asf/freemarker.git
commit 0ab9e9567cfb9c77d8f46389d000ab360d97e8d5 Author: ddekany <[email protected]> AuthorDate: Sat Dec 9 16:49:14 2023 +0100 Javadoc HTML fixes to satisfy the linter of Java 17 javadoc --- .../freemarker/core/TagSyntaxVariationsTest.java | 13 ++-- .../core/templatesuite/models/BooleanHash1.java | 6 +- .../core/templatesuite/models/BooleanHash2.java | 6 +- .../org/apache/freemarker/core/ASTDirInclude.java | 6 +- .../apache/freemarker/core/ASTExpHashLiteral.java | 12 ++-- .../freemarker/core/ASTExpStringLiteral.java | 8 +-- .../apache/freemarker/core/ASTImplicitParent.java | 2 +- .../apache/freemarker/core/ASTInterpolation.java | 8 +-- .../java/org/apache/freemarker/core/ASTNode.java | 2 +- .../freemarker/core/BuiltInsForSequences.java | 31 +++----- .../freemarker/core/BuiltInsForStringsMisc.java | 25 +++---- .../java/org/apache/freemarker/core/CallPlace.java | 10 +-- .../org/apache/freemarker/core/Configuration.java | 2 +- .../org/apache/freemarker/core/Environment.java | 16 ++--- .../core/MutableProcessingConfiguration.java | 44 ++++++------ .../freemarker/core/ParsingConfiguration.java | 2 +- .../freemarker/core/ProcessingConfiguration.java | 4 +- .../org/apache/freemarker/core/StopException.java | 2 +- .../java/org/apache/freemarker/core/Template.java | 4 +- .../apache/freemarker/core/debug/DebugModel.java | 6 +- .../freemarker/core/debug/DebuggerClient.java | 8 +-- .../core/model/AdapterTemplateModel.java | 4 +- .../freemarker/core/model/TemplateHashModel.java | 6 +- .../freemarker/core/model/TemplateNullModel.java | 2 +- .../freemarker/core/model/impl/ArgumentTypes.java | 14 ++-- .../freemarker/core/model/impl/BeanModel.java | 40 ++++------- .../core/model/impl/DefaultObjectWrapper.java | 24 +++---- .../core/model/impl/MethodAppearanceFineTuner.java | 20 +++--- .../core/model/impl/OverloadedNumberUtils.java | 8 +-- .../core/model/impl/ResourceBundleModel.java | 19 ++--- .../freemarker/core/model/impl/SimpleDate.java | 6 +- .../freemarker/core/model/impl/SimpleHash.java | 18 ++--- .../freemarker/core/model/impl/SimpleIterable.java | 18 ++--- .../freemarker/core/model/impl/SimpleNumber.java | 8 +-- .../freemarker/core/model/impl/SimpleString.java | 14 ++-- .../freemarker/core/model/impl/StaticModel.java | 16 ++--- .../freemarker/core/model/impl/StaticModels.java | 4 +- .../core/templateresolver/TemplateLoader.java | 8 +-- .../apache/freemarker/core/util/DeepUnwrap.java | 23 ++---- .../apache/freemarker/core/util/_StringUtils.java | 43 ++++++------ .../main/javacc/org/apache/freemarker/core/FTL.jj | 2 +- .../freemarker/servlet/AllHttpScopesHashModel.java | 23 +++--- .../freemarker/servlet/FreemarkerServlet.java | 20 +++--- .../freemarker/servlet/jsp/EventForwarding.java | 23 +++--- .../freemarker/servlet/jsp/TaglibFactory.java | 82 ++++++---------------- .../apache/freemarker/test/TemplateTestSuite.java | 6 +- 46 files changed, 282 insertions(+), 386 deletions(-) diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TagSyntaxVariationsTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TagSyntaxVariationsTest.java index ca24bfdb..895e1a1c 100644 --- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TagSyntaxVariationsTest.java +++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TagSyntaxVariationsTest.java @@ -19,18 +19,17 @@ package org.apache.freemarker.core; +import junit.framework.TestCase; +import org.apache.freemarker.core.userpkg.UpperCaseDirective; +import org.apache.freemarker.core.util._StringUtils; +import org.apache.freemarker.test.TestConfigurationBuilder; + import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; import java.util.Collections; import java.util.Map; -import org.apache.freemarker.core.userpkg.UpperCaseDirective; -import org.apache.freemarker.core.util._StringUtils; -import org.apache.freemarker.test.TestConfigurationBuilder; - -import junit.framework.TestCase; - /** * Test various generated templates (permutations), including some deliberately * wrong ones, with various tagSyntax settings. @@ -109,7 +108,7 @@ public class TagSyntaxVariationsTest extends TestCase { } /** - * @param expected the expected output or <tt>null</tt> if we expect + * @param expected the expected output or {@code null} if we expect * a parsing error. */ private static void test( diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/BooleanHash1.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/BooleanHash1.java index da94fa62..c8008103 100644 --- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/BooleanHash1.java +++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/BooleanHash1.java @@ -30,11 +30,11 @@ import org.apache.freemarker.core.model.impl.SimpleString; public class BooleanHash1 implements TemplateHashModel { /** - * Gets a <tt>TemplateModel</tt> from the hash. + * Gets a {@code TemplateModel} from the hash. * - * @param key the name by which the <tt>TemplateModel</tt> + * @param key the name by which the {@code TemplateModel} * is identified in the template. - * @return the <tt>TemplateModel</tt> referred to by the key, + * @return the {@code TemplateModel} referred to by the key, * or null if not found. */ @Override diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/BooleanHash2.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/BooleanHash2.java index bf7dcce9..030ceea1 100644 --- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/BooleanHash2.java +++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/BooleanHash2.java @@ -28,11 +28,11 @@ import org.apache.freemarker.core.model.TemplateModel; public class BooleanHash2 implements TemplateHashModel { /** - * Gets a <tt>TemplateModel</tt> from the hash. + * Gets a {@code TemplateModel} from the hash. * - * @param key the name by which the <tt>TemplateModel</tt> + * @param key the name by which the {@code TemplateModel} * is identified in the template. - * @return the <tt>TemplateModel</tt> referred to by the key, + * @return the {@code TemplateModel} referred to by the key, * or null if not found. */ @Override diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirInclude.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirInclude.java index 5afc30ad..10256190 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirInclude.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirInclude.java @@ -19,11 +19,11 @@ package org.apache.freemarker.core; -import java.io.IOException; - import org.apache.freemarker.core.templateresolver.MalformedTemplateNameException; import org.apache.freemarker.core.util._StringUtils; +import java.io.IOException; + /** * AST directive node: {@code #include} */ @@ -33,7 +33,7 @@ final class ASTDirInclude extends ASTDirective { private final Boolean ignoreMissingExpPrecalcedValue; /** - * @param template the template that this <tt>#include</tt> is a part of. + * @param template the template that this {@code #include} is a part of. * @param includedTemplateNameExp the path of the template to be included. */ ASTDirInclude(Template template, diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpHashLiteral.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpHashLiteral.java index e2df12f1..a109b614 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpHashLiteral.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpHashLiteral.java @@ -19,18 +19,18 @@ package org.apache.freemarker.core; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.ListIterator; - import org.apache.freemarker.core.model.TemplateCollectionModel; import org.apache.freemarker.core.model.TemplateHashModelEx; import org.apache.freemarker.core.model.TemplateModel; import org.apache.freemarker.core.model.TemplateModelIterator; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.ListIterator; + /** - * AST expression node: <tt>{ keyExp: valueExp, ... }</tt> + * AST expression node: <code>{ keyExp: valueExp, ... }</code> */ final class ASTExpHashLiteral extends ASTExpression { diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpStringLiteral.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpStringLiteral.java index 6c8d2220..968c8285 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpStringLiteral.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpStringLiteral.java @@ -19,9 +19,6 @@ package org.apache.freemarker.core; -import java.io.StringReader; -import java.util.List; - import org.apache.freemarker.core.model.TemplateMarkupOutputModel; import org.apache.freemarker.core.model.TemplateModel; import org.apache.freemarker.core.model.TemplateStringModel; @@ -29,6 +26,9 @@ import org.apache.freemarker.core.model.impl.SimpleString; import org.apache.freemarker.core.outputformat.OutputFormat; import org.apache.freemarker.core.util.TemplateLanguageUtils; +import java.io.StringReader; +import java.util.List; + /** * AST expression node: string literal */ @@ -144,7 +144,7 @@ final class ASTExpStringLiteral extends ASTExpression implements TemplateStringM } /** - * Tells if this is something like <tt>"${foo}"</tt>, which is usually a user mistake. + * Tells if this is something like <code>"${foo}"</code>, which is usually a user mistake. */ boolean isSingleInterpolationLiteral() { return dynamicValue != null && dynamicValue.size() == 1 diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTImplicitParent.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTImplicitParent.java index f87da420..ecf1da07 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTImplicitParent.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTImplicitParent.java @@ -39,7 +39,7 @@ final class ASTImplicitParent extends ASTElement { } /** - * Processes the contents of the internal <tt>ASTElement</tt> list, + * Processes the contents of the internal {@code ASTElement} list, * and outputs the resulting text. */ @Override diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTInterpolation.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTInterpolation.java index 56805d2a..1574e78d 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTInterpolation.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTInterpolation.java @@ -19,17 +19,17 @@ package org.apache.freemarker.core; -import java.io.IOException; -import java.io.Writer; - import org.apache.freemarker.core.model.TemplateMarkupOutputModel; import org.apache.freemarker.core.outputformat.MarkupOutputFormat; import org.apache.freemarker.core.outputformat.OutputFormat; import org.apache.freemarker.core.util.BugException; import org.apache.freemarker.core.util.TemplateLanguageUtils; +import java.io.IOException; +import java.io.Writer; + /** - * AST interpolation node: <tt>${exp}</tt> + * AST interpolation node: <code>${exp}</code> */ //TODO [FM3] will be public final class ASTInterpolation extends ASTElement { diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTNode.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTNode.java index bcce5de5..ed1c0727 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTNode.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTNode.java @@ -180,7 +180,7 @@ abstract class ASTNode { /** * A very sort single-line string that describes what kind of AST node this is, without describing any - * embedded expression or child element. Examples: {@code "#if"}, {@code "+"}, <tt>"${...}</tt>. These values should + * embedded expression or child element. Examples: {@code "#if"}, {@code "+"}, <code>"${...}</code>. These values should * be suitable as tree node labels in a tree view. Yet, they should be consistent and complete enough so that an AST * that is equivalent with the original could be reconstructed from the tree view. Thus, for literal values that are * leaf nodes the symbols should be the canonical form of value. diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForSequences.java b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForSequences.java index e22d2e1d..793f0d31 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForSequences.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForSequences.java @@ -19,7 +19,14 @@ package org.apache.freemarker.core; -import static org.apache.freemarker.core.util.CallableUtils.*; +import org.apache.freemarker.core.arithmetic.ArithmeticEngine; +import org.apache.freemarker.core.model.*; +import org.apache.freemarker.core.model.impl.SequenceTemplateModelIterator; +import org.apache.freemarker.core.model.impl.SimpleNumber; +import org.apache.freemarker.core.model.impl.SimpleString; +import org.apache.freemarker.core.model.impl.TemplateModelListSequence; +import org.apache.freemarker.core.util.BugException; +import org.apache.freemarker.core.util._StringUtils; import java.io.Serializable; import java.text.Collator; @@ -28,25 +35,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.Date; -import org.apache.freemarker.core.arithmetic.ArithmeticEngine; -import org.apache.freemarker.core.model.ArgumentArrayLayout; -import org.apache.freemarker.core.model.TemplateBooleanModel; -import org.apache.freemarker.core.model.TemplateCollectionModel; -import org.apache.freemarker.core.model.TemplateDateModel; -import org.apache.freemarker.core.model.TemplateFunctionModel; -import org.apache.freemarker.core.model.TemplateHashModel; -import org.apache.freemarker.core.model.TemplateIterableModel; -import org.apache.freemarker.core.model.TemplateModel; -import org.apache.freemarker.core.model.TemplateModelIterator; -import org.apache.freemarker.core.model.TemplateNumberModel; -import org.apache.freemarker.core.model.TemplateSequenceModel; -import org.apache.freemarker.core.model.TemplateStringModel; -import org.apache.freemarker.core.model.impl.SequenceTemplateModelIterator; -import org.apache.freemarker.core.model.impl.SimpleNumber; -import org.apache.freemarker.core.model.impl.SimpleString; -import org.apache.freemarker.core.model.impl.TemplateModelListSequence; -import org.apache.freemarker.core.util.BugException; -import org.apache.freemarker.core.util._StringUtils; +import static org.apache.freemarker.core.util.CallableUtils.*; /** * A holder for builtins that operate on sequence (or some even on iterable) left-hand value. @@ -616,7 +605,7 @@ class BuiltInsForSequences { } /** - * Sorts a sequence for the <tt>sort</tt> and <tt>sort_by</tt> + * Sorts a sequence for the {@code sort} and {@code sort_by} * built-ins. * * @param seq the sequence to sort. diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForStringsMisc.java b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForStringsMisc.java index 3fcb4e24..6607cccb 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForStringsMisc.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForStringsMisc.java @@ -19,18 +19,7 @@ package org.apache.freemarker.core; -import java.io.IOException; -import java.io.StringReader; -import java.io.Writer; - -import org.apache.freemarker.core.model.ArgumentArrayLayout; -import org.apache.freemarker.core.model.ObjectWrapper; -import org.apache.freemarker.core.model.TemplateBooleanModel; -import org.apache.freemarker.core.model.TemplateDirectiveModel; -import org.apache.freemarker.core.model.TemplateFunctionModel; -import org.apache.freemarker.core.model.TemplateModel; -import org.apache.freemarker.core.model.TemplateSequenceModel; -import org.apache.freemarker.core.model.TemplateStringModel; +import org.apache.freemarker.core.model.*; import org.apache.freemarker.core.model.impl.BeanModel; import org.apache.freemarker.core.model.impl.DefaultObjectWrapper; import org.apache.freemarker.core.model.impl.SimpleNumber; @@ -39,6 +28,10 @@ import org.apache.freemarker.core.outputformat.OutputFormat; import org.apache.freemarker.core.templateresolver.MalformedTemplateNameException; import org.apache.freemarker.core.util.CallableUtils; +import java.io.IOException; +import java.io.StringReader; +import java.io.Writer; + class BuiltInsForStringsMisc { // Can't be instantiated @@ -161,7 +154,7 @@ class BuiltInsForStringsMisc { * transform model that evaluates the template in place. * The template inherits the configuration and environment of the executing * template. By default, its name will be equal to - * <tt>executingTemplate.getLookupName() + "$anonymous_interpreted"</tt>. You can + * {@code executingTemplate.getLookupName() + "$anonymous_interpreted"}. You can * specify another parameter to the method call in which case the * template name suffix is the specified id instead of "anonymous_interpreted". */ @@ -179,8 +172,8 @@ class BuiltInsForStringsMisc { * template a name. * * @return a {@link TemplateDirectiveModel} that when executed inside - * a <tt><transform></tt> block will process the generated template - * just as if it had been <tt><transform></tt>-ed at that point. + * a <code><transform></code> block will process the generated template + * just as if it had been <code><transform></code>-ed at that point. */ @Override protected TemplateModel calculateResult(Environment env) throws TemplateException { @@ -283,7 +276,7 @@ class BuiltInsForStringsMisc { /** * A built-in that allows us to instantiate an instance of a java class. - * Usage is something like: <tt><#assign foobar = "foo.bar.MyClass"?new()></tt>; + * Usage is something like: <code><#assign foobar = "foo.bar.MyClass"?new()></code>; */ static class newBI extends ASTExpBuiltIn { diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/CallPlace.java b/freemarker-core/src/main/java/org/apache/freemarker/core/CallPlace.java index 6135d3a3..9437ed49 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/CallPlace.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/CallPlace.java @@ -19,14 +19,14 @@ package org.apache.freemarker.core; -import java.io.IOException; -import java.io.Writer; -import java.util.IdentityHashMap; - import org.apache.freemarker.core.model.TemplateDirectiveModel; import org.apache.freemarker.core.model.TemplateModel; import org.apache.freemarker.core.util.CommonSupplier; +import java.io.IOException; +import java.io.Writer; +import java.util.IdentityHashMap; + /** * The place (in a template, usually) from where a directive (like a macro) or function was called; * <b>Do not implement this interface yourself</b>, as new methods may be added any time! Only FreeMarker itself @@ -157,7 +157,7 @@ public interface CallPlace { /** * Tells if the output of the nested content can be safely cached, as it only depends on the template content (not * on variable values and such) and has no side-effects (other than writing to the output). Examples of cases that - * give {@code false}: {@code <@foo>Name: } <tt>${name}</tt>{@code</@foo>}, {@code <@foo>Name: <#if + * give {@code false}: {@code <@foo>Name: } <code>${name}</code>{@code</@foo>}, {@code <@foo>Name: <#if * condition>bar</#if></@foo>}. Examples of cases that give {@code true}: {@code <@foo>Name: Joe</@foo>}, {@code * <@foo />}. Note that we get {@code true} for no nested content, because that's equivalent to 0-length nested * content. diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java index cc9a8375..64337a48 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java @@ -1543,7 +1543,7 @@ public final class Configuration implements TopLevelConfiguration, CustomStateSc /** * Returns the names of the directives that are predefined by FreeMarker. These are the things that you call like - * <tt><#directiveName ...></tt>. + * <code><#directiveName ...></code>. */ public Set<String> getSupportedBuiltInDirectiveNames() { return ASTDirective.BUILT_IN_DIRECTIVE_NAMES; diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java b/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java index c6ab7154..5351d0ca 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/Environment.java @@ -53,15 +53,15 @@ import static org.apache.freemarker.core.util.CallableUtils._newNullOrOmittedArg /** * Object that represents the runtime environment during template processing. For every invocation of a - * <tt>Template.process()</tt> method, a new instance of this object is created, and then discarded when - * <tt>process()</tt> returns. This object stores the set of temporary variables created by the template, the value of + * {@code Template.process()} method, a new instance of this object is created, and then discarded when + * {@code process()} returns. This object stores the set of temporary variables created by the template, the value of * settings set by the template, the reference to the data model root, etc. Everything that is needed to fulfill the * template processing job. * <p> - * Data models that need to access the <tt>Environment</tt> object that represents the template processing on the + * Data models that need to access the {@code Environment} object that represents the template processing on the * current thread can use the {@link #getCurrentEnvironment()} method. * <p> - * If you need to modify or read this object before or after the <tt>process</tt> call, use + * If you need to modify or read this object before or after the {@code process} call, use * {@link Template#createProcessingEnvironment(Object rootMap, Writer out, ObjectWrapper wrapper)} * <p> * The {@link ProcessingConfiguration} reader methods of this class don't throw {@link CoreSettingValueNotSetException} @@ -493,9 +493,9 @@ public final class Environment extends MutableProcessingConfiguration<Environmen } /** - * Tells if we are inside an <tt>#attempt</tt> block (but before <tt>#recover</tt>). This can be useful for + * Tells if we are inside an {@code #attempt} block (but before {@code #recover}). This can be useful for * {@link TemplateExceptionHandler}-s, as then they may don't want to print the error to the output, as - * <tt>#attempt</tt> will roll it back anyway. + * {@code #attempt} will roll it back anyway. */ public boolean isInAttemptBlock() { return inAttemptBlock; @@ -922,7 +922,7 @@ public final class Environment extends MutableProcessingConfiguration<Environmen } /* - * Note that although it's not allowed to set this setting with the <tt>setting</tt> directive, it still must be + * Note that although it's not allowed to set this setting with the {@code setting} directive, it still must be * allowed to set it from Java code while the template executes, since some frameworks allow templates to actually * change the output encoding on-the-fly. */ @@ -2425,7 +2425,7 @@ public final class Environment extends MutableProcessingConfiguration<Environmen } /** - * sets TemplateNodeModel as the current visitor node. <tt>.node</tt> + * sets TemplateNodeModel as the current visitor node. {@code .node} */ public void setCurrentVisitorNode(TemplateNodeModel node) { currentVisitorNode = node; diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java index 5679adee..740f17ff 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java @@ -1453,8 +1453,8 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces * with {@code "allowedClasses:"} and/or * {@code "trustedTemplates:"}. Examples of valid values: * - * <table style="width: auto; border-collapse: collapse" border="1" - * summary="trustedTemplate value examples"> + * <table style="width: auto; border-collapse: collapse" border="1"> + * <caption style="display: none">trustedTemplates value examples</caption> * <tr> * <th>Setting value * <th>Meaning @@ -1574,8 +1574,8 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces * maximum strong and soft sizes specified with the setting value. Examples * of valid setting values: * - * <table style="width: auto; border-collapse: collapse" border="1" summary="templateCacheStorage value - * examples"> + * <table style="width: auto; border-collapse: collapse" border="1"> + * <caption style="display: none">templateCacheStorage value examples</caption> * <tr><th>Setting value<th>max. strong size<th>max. soft size * <tr><td>{@code "strong:50, soft:500"}<td>50<td>500 * <tr><td>{@code "strong:100, soft"}<td>100<td>{@code Integer.MAX_VALUE} @@ -1585,7 +1585,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces * <tr><td>{@code "soft"}<td>0<td>{@code Integer.MAX_VALUE} * </table> * - * <p>The value is not case sensitive. The order of <tt>soft</tt> and <tt>strong</tt> + * <p>The value is not case sensitive. The order of {@code soft} and {@code strong} * entries is not significant. * * <li><p>{@code "templateUpdateDelay"}: @@ -1626,40 +1626,40 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces * {@link DefaultTemplateNameFormat#INSTANCE}. * </ul> * - * <p><a name="fm_obe"></a>Regarding <em>object builder expressions</em> (used by the setting values where it was + * <p id="fm_obe">Regarding <em>object builder expressions</em> (used by the setting values where it was * indicated): * <ul> * <li><p>Before FreeMarker 2.3.21 it had to be a fully qualified class name, and nothing else.</li> * <li><p>Since 2.3.21, the generic syntax is: - * <tt><i>className</i>(<i>constrArg1</i>, <i>constrArg2</i>, ... <i>constrArgN</i>, + * <code><i>className</i>(<i>constrArg1</i>, <i>constrArg2</i>, ... <i>constrArgN</i>, * <i>propName1</i>=<i>propValue1</i>, <i>propName2</i>=<i>propValue2</i>, ... - * <i>propNameN</i>=<i>propValueN</i>)</tt>, + * <i>propNameN</i>=<i>propValueN</i>)</code>, * where - * <tt><i>className</i></tt> is the fully qualified class name of the instance to invoke (except if we have - * builder class or <tt>INSTANCE</tt> field around, but see that later), - * <tt><i>constrArg</i></tt>-s are the values of constructor arguments, - * and <tt><i>propName</i>=<i>propValue</i></tt>-s set JavaBean properties (like <tt>x=1</tt> means - * <tt>setX(1)</tt>) on the created instance. You can have any number of constructor arguments and property + * <code><i>className</i></code> is the fully qualified class name of the instance to invoke (except if we have + * builder class or {@code INSTANCE} field around, but see that later), + * <code><i>constrArg</i></code>-s are the values of constructor arguments, + * and <code><i>propName</i>=<i>propValue</i></code>-s set JavaBean properties (like {@code x=1} means + * {@code setX(1)}) on the created instance. You can have any number of constructor arguments and property * setters, including 0. Constructor arguments must precede any property setters. * </li> * <li> - * Example: <tt>com.example.MyObjectWrapper(1, 2, exposeFields=true, cacheSize=5000)</tt> is nearly + * Example: {@code com.example.MyObjectWrapper(1, 2, exposeFields=true, cacheSize=5000)} is nearly * equivalent with this Java code: - * <tt>obj = new com.example.MyObjectWrapper(1, 2); obj.setExposeFields(true); obj.setCacheSize(5000);</tt> + * {@code obj = new com.example.MyObjectWrapper(1, 2); obj.setExposeFields(true); obj.setCacheSize(5000);} * </li> * <li> - * <p>If you have no constructor arguments and property setters, and the <tt><i>className</i></tt> class has + * <p>If you have no constructor arguments and property setters, and the <code><i>className</i></code> class has * a public static {@code INSTANCE} field, the value of that filed will be the value of the expression, and * the constructor won't be called. * </li> * <li> - * <p>If there exists a class named <tt><i>className</i>Builder</tt>, then that class will be instantiated + * <p>If there exists a class named <code><i>className</i>Builder</code>, then that class will be instantiated * instead with the given constructor arguments, and the JavaBean properties of that builder instance will be - * set. After that, the public <tt>build()</tt> method of the instance will be called, whose return value - * will be the value of the whole expression. (The builder class and the <tt>build()</tt> method is simply + * set. After that, the public {@code build()} method of the instance will be called, whose return value + * will be the value of the whole expression. (The builder class and the {@code build()} method is simply * found by name, there's no special interface to implement.)Note that if you have a builder class, you don't - * actually need a <tt><i>className</i></tt> class (since 2.3.24); after all, - * <tt><i>className</i>Builder.build()</tt> can return any kind of object. + * actually need a <code><i>className</i></code> class (since 2.3.24); after all, + * <code><i>className</i>Builder.build()</code> can return any kind of object. * </li> * <li> * <p>Currently, the values of arguments and properties can only be one of these: @@ -1673,7 +1673,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces * {@code BigDecimal} and "bi" for {@code BigInteger}.</li> * <li>A boolean literal: {@code true} or {@code false} * <li>The null literal: {@code null} - * <li>A string literal with FTL syntax, except that it can't contain <tt>${...}</tt>-s. + * <li>A string literal with FTL syntax, except that it can't contain <code>${...}</code>-s. * Examples: {@code "Line 1\nLine 2"} or {@code r"C:\temp"}. * <li>A list literal (since 2.3.24) with FTL-like syntax, for example {@code [ 'foo', 2, true ]}. * If the parameter is expected to be array, the list will be automatically converted to array. diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ParsingConfiguration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ParsingConfiguration.java index 2f46a83d..4780b7bc 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/ParsingConfiguration.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ParsingConfiguration.java @@ -268,7 +268,7 @@ public interface ParsingConfiguration { * {@link Configuration} level. * <p> * Individual templates may specify their own charset by starting with - * <tt><#ftl sourceEncoding="..."></tt>. However, before that's detected, at least part of template must be + * <code><#ftl sourceEncoding="..."></code>. However, before that's detected, at least part of template must be * decoded with some charset first, so this setting (and * {@link Configuration#getTemplateConfigurations() templateConfigurations}) still have role. */ diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java index 5cfc05a2..2410e87a 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java @@ -559,7 +559,7 @@ public interface ProcessingConfiguration { * (and its overloads). Its {@link Configuration}-level default is {@code true}. * <p> * Using {@code false} is needed for example when a Web page is composed from several boxes (like portlets, GUI - * panels, etc.) that aren't inserted with <tt>#include</tt> (or with similar directives) into a master FreeMarker + * panels, etc.) that aren't inserted with {@code #include} (or with similar directives) into a master FreeMarker * template, rather they are all processed with a separate {@link Template#process(Object, Writer)} call. In a such * scenario the automatic flushes would commit the HTTP response after each box, hence interfering with full-page * buffering, and also possibly decreasing performance with too frequent and too early response buffer flushes. @@ -731,7 +731,7 @@ public interface ProcessingConfiguration { * @return The value of the custom setting; possibly {@code null}, as that's a legal attribute value. The content * of the value object shouldn't be changed after it was added as an attribute (ideally, it should be an * immutable object); if you need to change the content, certainly you should use the {@link CustomStateScope} - * API. Note that if the custom setting was created with <tt><#ftl customSettings={...}></tt>, then + * API. Note that if the custom setting was created with <code><#ftl customSettings={...}></code>, then * this value is already unwrapped (i.e. it's a <code>String</code>, or a <code>List</code>, or a <code>Map</code>, * ...etc., not a FreeMarker specific class). * diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/StopException.java b/freemarker-core/src/main/java/org/apache/freemarker/core/StopException.java index 97064565..969098c1 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/StopException.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/StopException.java @@ -23,7 +23,7 @@ import java.io.PrintStream; import java.io.PrintWriter; /** - * This exception is thrown when a <tt>#stop</tt> directive is encountered. + * This exception is thrown when a {@code #stop} directive is encountered. */ public class StopException extends TemplateException { diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java b/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java index 09c81200..7a3823b5 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/Template.java @@ -467,7 +467,7 @@ public class Template implements ProcessingConfiguration, CustomStateScope { /** * Like {@link #process(Object, Writer)}, but also sets a (XML-)node to be recursively processed by the template. - * That node is accessed in the template with <tt>.node</tt>, <tt>#recurse</tt>, etc. See the + * That node is accessed in the template with {@code .node}, {@code #recurse}, etc. See the * <a href="http://freemarker.org/docs/xgui_declarative.html" target="_blank">Declarative XML Processing</a> as a * typical example of recursive node processing. * @@ -512,7 +512,7 @@ public class Template implements ProcessingConfiguration, CustomStateScope { * <pre> * myTemplate.process(root, out);</pre> * - * <p>But with <tt>createProcessingEnvironment</tt>, you can manipulate the environment + * <p>But with {@code createProcessingEnvironment}, you can manipulate the environment * before and after the processing: * * <pre> diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebugModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebugModel.java index 423a5330..4e0d66e5 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebugModel.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebugModel.java @@ -19,12 +19,12 @@ package org.apache.freemarker.core.debug; +import org.apache.freemarker.core.TemplateException; + import java.rmi.Remote; import java.rmi.RemoteException; import java.util.Date; -import org.apache.freemarker.core.TemplateException; - /** * Represents the debugger-side mirror of a TemplateModel object, a Template * object, or a Configuration object. The Environment objects are also represented @@ -33,7 +33,7 @@ import org.apache.freemarker.core.TemplateException; * almost all of FreeMarker template models with identical method signatures. * For purposes of optimizing network traffic there are bulk retrieval methods * for sequences and hashes, as well as a {@link #getModelTypes()} method that - * returns a bit mask of various <tt>TYPE_xxx</tt> constants flagging which + * returns a bit mask of various {@code TYPE_xxx} constants flagging which * template models are implemented by the mirrored object. */ public interface DebugModel extends Remote { diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebuggerClient.java b/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebuggerClient.java index 26d5616a..4e46035d 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebuggerClient.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/debug/DebuggerClient.java @@ -19,6 +19,8 @@ package org.apache.freemarker.core.debug; +import org.apache.freemarker.core.util.UndeclaredThrowableException; + import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; @@ -31,8 +33,6 @@ import java.security.MessageDigest; import java.util.Collection; import java.util.List; -import org.apache.freemarker.core.util.UndeclaredThrowableException; - /** * A utility class that allows you to connect to the FreeMarker debugger service * running on a specific host and port. @@ -44,8 +44,8 @@ public class DebuggerClient { /** * Connects to the FreeMarker debugger service running on a specific host * and port. The Java VM to which the connection is made must have defined - * the system property <tt>org.apache.freemarker.core.debug.password</tt> in order to enable - * the debugger service. Additionally, the <tt>org.apache.freemarker.core.debug.port</tt> + * the system property {@code org.apache.freemarker.core.debug.password} in order to enable + * the debugger service. Additionally, the {@code org.apache.freemarker.core.debug.port} * system property can be set to specify the port where the debugger service * is listening. When not specified, it defaults to * {@link Debugger#DEFAULT_PORT}. diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/AdapterTemplateModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/AdapterTemplateModel.java index 9dc65873..ee131523 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/AdapterTemplateModel.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/AdapterTemplateModel.java @@ -37,8 +37,8 @@ public interface AdapterTemplateModel extends TemplateModel { * class, but if that is impossible, it must at least return the underlying * object as-is. As a minimal requirement, an implementation must always * return the exact underlying object when - * <tt>hint.isInstance(underlyingObject)</tt> holds. When called - * with <tt>java.lang.Object.class</tt>, it should return a generic Java + * {@code hint.isInstance(underlyingObject)} holds. When called + * with {@code java.lang.Object.class}, it should return a generic Java * object (i.e. if the model is wrapping a scripting language object that is * further wrapping a Java object, the deepest underlying Java object should * be returned). diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModel.java index 489d5cc1..2d34d994 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModel.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModel.java @@ -32,11 +32,11 @@ public interface TemplateHashModel extends TemplateModel { TemplateHashModelEx EMPTY_HASH = new EmptyHashModel(); /** - * Gets a <tt>TemplateModel</tt> from the hash. + * Gets a {@code TemplateModel} from the hash. * - * @param key the name by which the <tt>TemplateModel</tt> + * @param key the name by which the {@code TemplateModel} * is identified in the template. - * @return the <tt>TemplateModel</tt> referred to by the key, + * @return the {@code TemplateModel} referred to by the key, * or null if not found. */ TemplateModel get(String key) throws TemplateException; diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateNullModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateNullModel.java index d7bbb8da..dac3a484 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateNullModel.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateNullModel.java @@ -24,7 +24,7 @@ package org.apache.freemarker.core.model; * the Java {@code null} value, and {@code null} represents that the value (or rather what holds it) doesn't exist * at all. * - * <p>Some examples to make this more understandable:<p> + * <p>Some examples to make this more understandable:</p> * <ul> * <li>If you try to read the variable {@code myVar}, but such a variable was never declared anywhere, then that's * a {@code null}. If the variable itself exists, but was set to {@code null}, then that's a diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ArgumentTypes.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ArgumentTypes.java index 20a2c147..61f390ac 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ArgumentTypes.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ArgumentTypes.java @@ -18,17 +18,17 @@ */ package org.apache.freemarker.core.model.impl; +import org.apache.freemarker.core.TemplateException; +import org.apache.freemarker.core.model.TemplateModel; +import org.apache.freemarker.core.util.BugException; +import org.apache.freemarker.core.util._ClassUtils; + import java.lang.reflect.InvocationTargetException; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import org.apache.freemarker.core.TemplateException; -import org.apache.freemarker.core.model.TemplateModel; -import org.apache.freemarker.core.util.BugException; -import org.apache.freemarker.core.util._ClassUtils; - /** * The argument types of a method call; usable as cache key. */ @@ -439,7 +439,7 @@ final class ArgumentTypes { * parameter types represented by this ArgumentTypes object, also tells * how difficult that conversion is. * - * @return One of the <tt>CONVERSION_DIFFICULTY_...</tt> constants. + * @return One of the {@code CONVERSION_DIFFICULTY_...} constants. */ private int isApplicable(ReflectionCallableMemberDescriptor memberDesc, boolean varArg) { final Class<?>[] paramTypes = memberDesc.getParamTypes(); @@ -492,7 +492,7 @@ final class ArgumentTypes { * parameter type should be convertible; possibly a primitive type * @param actual the argument type; not a primitive type, maybe {@link Null}. * - * @return One of the <tt>CONVERSION_DIFFICULTY_...</tt> constants. + * @return One of the {@code CONVERSION_DIFFICULTY_...} constants. */ private int isMethodInvocationConvertible(final Class<?> formal, final Class<?> actual) { // Check for identity or widening reference conversion diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/BeanModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/BeanModel.java index 585825b8..a74be003 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/BeanModel.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/BeanModel.java @@ -19,38 +19,24 @@ package org.apache.freemarker.core.model.impl; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - import org.apache.freemarker.core.TemplateException; import org.apache.freemarker.core._DelayedJQuote; import org.apache.freemarker.core._DelayedTemplateLanguageTypeDescription; -import org.apache.freemarker.core.model.AdapterTemplateModel; -import org.apache.freemarker.core.model.ObjectWrappingException; -import org.apache.freemarker.core.model.TemplateCollectionModel; -import org.apache.freemarker.core.model.TemplateFunctionModel; -import org.apache.freemarker.core.model.TemplateHashModelEx; -import org.apache.freemarker.core.model.TemplateModel; -import org.apache.freemarker.core.model.TemplateModelWithAPISupport; -import org.apache.freemarker.core.model.TemplateStringModel; -import org.apache.freemarker.core.model.WrapperTemplateModel; +import org.apache.freemarker.core.model.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.*; + /** * A class that will wrap an arbitrary object into {@link org.apache.freemarker.core.model.TemplateHashModel} * interface allowing calls to arbitrary property getters and invocation of * accessible methods on the object from a template using the - * <tt>object.foo</tt> to access properties and <tt>object.bar(arg1, arg2)</tt> to - * invoke methods on it. You can also use the <tt>object.foo[index]</tt> syntax to + * {@code object.foo} to access properties and {@code object.bar(arg1, arg2)} to + * invoke methods on it. You can also use the {@code object.foo[index]} syntax to * access indexed properties. It uses Beans {@link java.beans.Introspector} * to dynamically discover the properties and methods. */ @@ -117,12 +103,12 @@ public class BeanModel * they reload a web application) and flushes the cache. If no method or * property matching the key is found, the framework will try to invoke * methods with signature - * <tt>non-void-return-type get(java.lang.String)</tt>, - * then <tt>non-void-return-type get(java.lang.Object)</tt>, or + * {@code non-void-return-type get(java.lang.String)}, + * then {@code non-void-return-type get(java.lang.Object)}, or * alternatively (if the wrapped object is a resource bundle) - * <tt>Object get(java.lang.String)</tt>. + * {@code Object get(java.lang.String)}. * @throws TemplateException if there was no property nor method nor - * a generic <tt>get</tt> method to invoke. + * a generic {@code get} method to invoke. */ @Override public TemplateModel get(String key) @@ -322,7 +308,7 @@ public class BeanModel /** * Helper method to support TemplateHashModelEx. Returns the Set of * Strings which are available via the TemplateHashModel - * interface. Subclasses that override <tt>invokeGenericGet</tt> to + * interface. Subclasses that override {@code invokeGenericGet} to * provide additional hash keys should also override this method. * Also, if this is overwritten, {@link #getHashSize()} should be too. */ diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java index 718d3269..1616cabd 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java @@ -190,7 +190,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper { } /** - * By default returns <tt>this</tt>. + * By default returns {@code this}. * @see ExtendableBuilder#setOuterIdentity(ObjectWrapper) */ public ObjectWrapper getOuterIdentity() { @@ -1511,8 +1511,8 @@ public class DefaultObjectWrapper implements RichObjectWrapper { /** * Sets the default date type to use for date models that result from - * a plain <tt>java.util.Date</tt> instead of <tt>java.sql.Date</tt> or - * <tt>java.sql.Time</tt> or <tt>java.sql.Timestamp</tt>. Default value is + * a plain {@code java.util.Date} instead of {@code java.sql.Date} or + * {@code java.sql.Time} or {@code java.sql.Timestamp}. Default value is * {@link TemplateDateModel#UNKNOWN}. * @param defaultDateType the new default date type. */ @@ -1583,19 +1583,19 @@ public class DefaultObjectWrapper implements RichObjectWrapper { * Specifies if an attempt to read a bean property that doesn't exist in the * wrapped object should throw an {@link InvalidPropertyException}. * - * <p>If this property is <tt>false</tt> (the default) then an attempt to read + * <p>If this property is {@code false} (the default) then an attempt to read * a missing bean property is the same as reading an existing bean property whose - * value is <tt>null</tt>. The template can't tell the difference, and thus always - * can use <tt>!'something'</tt> and <tt>??</tt> and similar expressions + * value is {@code null}. The template can't tell the difference, and thus always + * can use {@code !'something'} and {@code ??} and similar expressions * to handle the situation. * - * <p>If this property is <tt>true</tt> then an attempt to read a bean propertly in - * the template (like <tt>myBean.aProperty</tt>) that doesn't exist in the bean - * object (as opposed to just holding <tt>null</tt> value) will cause + * <p>If this property is {@code true} then an attempt to read a bean propertly in + * the template (like {@code myBean.aProperty}) that doesn't exist in the bean + * object (as opposed to just holding {@code null} value) will cause * {@link InvalidPropertyException}, which can't be suppressed in the template - * (not even with <tt>myBean.noSuchProperty!'something'</tt>). This way - * <tt>!'something'</tt> and <tt>??</tt> and similar expressions can be used to - * handle existing properties whose value is <tt>null</tt>, without the risk of + * (not even with {@code myBean.noSuchProperty!'something'}). This way + * {@code !'something'} and {@code ??} and similar expressions can be used to + * handle existing properties whose value is {@code null}, without the risk of * hiding typos in the property names. Typos will always cause error. But mind you, it * goes against the basic approach of FreeMarker, so use this feature only if you really * know what you are doing. diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MethodAppearanceFineTuner.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MethodAppearanceFineTuner.java index 0482878f..397b784f 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MethodAppearanceFineTuner.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/MethodAppearanceFineTuner.java @@ -34,35 +34,35 @@ public interface MethodAppearanceFineTuner { * Implement this to tweak certain aspects of how methods appear in the * data-model. {@link DefaultObjectWrapper} will pass in all Java methods here that * it intends to expose in the data-model as methods (so you can do - * <tt>obj.foo()</tt> in the template). + * {@code obj.foo()} in the template). * With this method you can do the following tweaks: * <ul> * <li>Hide a method that would be otherwise shown by calling * {@link MethodAppearanceFineTuner.Decision#setExposeMethodAs(String)} - * with <tt>null</tt> parameter. Note that you can't un-hide methods + * with {@code null} parameter. Note that you can't un-hide methods * that are not public or are considered to by unsafe * (like {@link Object#wait()}) because * {@link #process} is not called for those.</li> * <li>Show the method with a different name in the data-model than its * real name by calling * {@link MethodAppearanceFineTuner.Decision#setExposeMethodAs(String)} - * with non-<tt>null</tt> parameter. + * with non-{@code null} parameter. * <li>Create a fake JavaBean property for this method by calling * {@link MethodAppearanceFineTuner.Decision#setExposeAsProperty(PropertyDescriptor)}. - * For example, if you have <tt>int size()</tt> in a class, but you - * want it to be accessed from the templates as <tt>obj.size</tt>, - * rather than as <tt>obj.size()</tt>, you can do that with this + * For example, if you have {@code int size()} in a class, but you + * want it to be accessed from the templates as {@code obj.size}, + * rather than as {@code obj.size()}, you can do that with this * (but remember calling * {@link Decision#setMethodShadowsProperty(boolean) * setMethodShadowsProperty(false)} as well, if the method name is exactly * the same as the property name). * The default is {@code null}, which means that no fake property is * created for the method. You need not and shouldn't set this - * to non-<tt>null</tt> for the getter methods of real JavaBean + * to non-{@code null} for the getter methods of real JavaBean * properties, as those are automatically shown as properties anyway. * The property name in the {@link PropertyDescriptor} can be anything, * but the method (or methods) in it must belong to the class that - * is given as the <tt>clazz</tt> parameter or it must be inherited from + * is given as the {@code clazz} parameter or it must be inherited from * that class, or else whatever errors can occur later. * {@link IndexedPropertyDescriptor}-s are supported. * If a real JavaBean property of the same name exists, or a fake property @@ -72,9 +72,9 @@ public interface MethodAppearanceFineTuner { * <li>Prevent the method to hide a JavaBean property (fake or real) of * the same name by calling * {@link MethodAppearanceFineTuner.Decision#setMethodShadowsProperty(boolean)} - * with <tt>false</tt>. The default is <tt>true</tt>, so if you have + * with {@code false}. The default is {@code true}, so if you have * both a property and a method called "foo", then in the template - * <tt>myObject.foo</tt> will return the method itself instead + * {@code myObject.foo} will return the method itself instead * of the property value, which is often undesirable. * </ul> * diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedNumberUtils.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedNumberUtils.java index bf798490..feababae 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedNumberUtils.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedNumberUtils.java @@ -19,13 +19,13 @@ package org.apache.freemarker.core.model.impl; -import java.math.BigDecimal; -import java.math.BigInteger; - import org.apache.freemarker.core.model.TemplateNumberModel; import org.apache.freemarker.core.util._ClassUtils; import org.apache.freemarker.core.util._NumberUtils; +import java.math.BigDecimal; +import java.math.BigInteger; + /** * Everything related to coercion to ambiguous numerical types. */ @@ -84,7 +84,7 @@ class OverloadedNumberUtils { * type and the coerced type, all encoded into the class of the value, which is used as the overloaded method lookup * cache key. * - * <p>See also: <tt>src\main\misc\overloadedNumberRules\prices.ods</tt>. + * <p>See also: {@code src\main\misc\overloadedNumberRules\prices.ods}. * * @param num the number to coerce * @param typeFlags the type flags of the target parameter position; see {@link TypeFlags} diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ResourceBundleModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ResourceBundleModel.java index a9744162..7b8ac36d 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ResourceBundleModel.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/ResourceBundleModel.java @@ -19,14 +19,6 @@ package org.apache.freemarker.core.model.impl; -import java.text.MessageFormat; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.util.Set; - import org.apache.freemarker.core.CallPlace; import org.apache.freemarker.core.Environment; import org.apache.freemarker.core.TemplateException; @@ -36,6 +28,9 @@ import org.apache.freemarker.core.model.TemplateFunctionModel; import org.apache.freemarker.core.model.TemplateModel; import org.apache.freemarker.core.util.CallableUtils; +import java.text.MessageFormat; +import java.util.*; + /** * <p>A hash model that wraps a resource bundle. Makes it convenient to store * localized content in the data model. It also acts as a method model that will @@ -44,10 +39,10 @@ import org.apache.freemarker.core.util.CallableUtils; * * <p>Typical usages:</p> * <ul> - * <li><tt>bundle.resourceKey</tt> will retrieve the object from resource bundle - * with key <tt>resourceKey</tt></li> - * <li><tt>bundle("patternKey", arg1, arg2, arg3)</tt> will retrieve the string - * from resource bundle with key <tt>patternKey</tt>, and will use it as a pattern + * <li>{@code bundle.resourceKey} will retrieve the object from resource bundle + * with key {@code resourceKey}</li> + * <li>{@code bundle("patternKey", arg1, arg2, arg3)} will retrieve the string + * from resource bundle with key {@code patternKey}, and will use it as a pattern * for MessageFormat with arguments arg1, arg2 and arg3</li> * </ul> */ diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleDate.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleDate.java index 08a6d943..be92b4ce 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleDate.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleDate.java @@ -19,12 +19,12 @@ package org.apache.freemarker.core.model.impl; -import java.io.Serializable; - import org.apache.freemarker.core.model.TemplateDateModel; +import java.io.Serializable; + /** - * A simple implementation of the <tt>TemplateDateModel</tt> + * A simple implementation of the {@code TemplateDateModel} * interface. Note that this class is immutable. * <p>This class is thread-safe. */ diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java index 47eb1db2..f86d099f 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java @@ -19,21 +19,11 @@ package org.apache.freemarker.core.model.impl; -import java.util.ConcurrentModificationException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.SortedMap; -import java.util.TreeMap; - import org.apache.freemarker.core.TemplateException; import org.apache.freemarker.core._DelayedJQuote; -import org.apache.freemarker.core.model.ObjectWrapper; -import org.apache.freemarker.core.model.TemplateBooleanModel; -import org.apache.freemarker.core.model.TemplateCollectionModel; -import org.apache.freemarker.core.model.TemplateHashModelEx; -import org.apache.freemarker.core.model.TemplateModel; -import org.apache.freemarker.core.model.WrappingTemplateModel; +import org.apache.freemarker.core.model.*; + +import java.util.*; /** * A simple implementation of the {@link TemplateHashModelEx} interface, using its own underlying {@link Map} or @@ -154,7 +144,7 @@ public class SimpleHash extends WrappingTemplateModel implements TemplateHashMod /** * Puts a boolean in the map * - * @param key the name by which the resulting <tt>TemplateModel</tt> + * @param key the name by which the resulting {@code TemplateModel} * is identified in the template. * @param b the boolean to store. */ diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleIterable.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleIterable.java index 34ce0216..3c23c141 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleIterable.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleIterable.java @@ -19,17 +19,13 @@ package org.apache.freemarker.core.model.impl; +import org.apache.freemarker.core.TemplateException; +import org.apache.freemarker.core.model.*; + import java.io.Serializable; import java.util.Iterator; import java.util.List; -import org.apache.freemarker.core.TemplateException; -import org.apache.freemarker.core.model.ObjectWrapper; -import org.apache.freemarker.core.model.TemplateIterableModel; -import org.apache.freemarker.core.model.TemplateModel; -import org.apache.freemarker.core.model.TemplateModelIterator; -import org.apache.freemarker.core.model.WrappingTemplateModel; - /** * A simple implementation of {@link TemplateIterableModel}. * It's able to wrap {@link Iterable}-s and {@link Iterator}-s. @@ -67,10 +63,10 @@ implements TemplateIterableModel, Serializable { /** * Retrieves a template model iterator that is used to iterate over the elements in this iterable. * - * <p>When you wrap an <tt>Iterator</tt> and you get <tt>TemplateModelIterator</tt> for multiple times, - * only one of the returned <tt>TemplateModelIterator</tt> instances can be really used. When you have called a - * method of a <tt>TemplateModelIterator</tt> instance, all other instance will throw a - * {@link TemplateException} when you try to call their methods, since the wrapped <tt>Iterator</tt> + * <p>When you wrap an {@code Iterator} and you get {@code TemplateModelIterator} for multiple times, + * only one of the returned {@code TemplateModelIterator} instances can be really used. When you have called a + * method of a {@code TemplateModelIterator} instance, all other instance will throw a + * {@link TemplateException} when you try to call their methods, since the wrapped {@code Iterator} * can't return the first element anymore. */ @Override diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleNumber.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleNumber.java index 6f588b66..6ff73227 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleNumber.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleNumber.java @@ -19,13 +19,13 @@ package org.apache.freemarker.core.model.impl; -import java.io.Serializable; - import org.apache.freemarker.core.model.TemplateNumberModel; +import java.io.Serializable; + /** - * A simple implementation of the <tt>TemplateNumberModel</tt> + * A simple implementation of the {@code TemplateNumberModel} * interface. Note that this class is immutable. * * <p>This class is thread-safe. @@ -33,7 +33,7 @@ import org.apache.freemarker.core.model.TemplateNumberModel; public final class SimpleNumber implements TemplateNumberModel, Serializable { /** - * @serial the value of this <tt>SimpleNumber</tt> + * @serial the value of this {@code SimpleNumber} */ private final Number value; diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleString.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleString.java index 8b91452f..9b167bcb 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleString.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleString.java @@ -19,13 +19,13 @@ package org.apache.freemarker.core.model.impl; -import java.io.Serializable; - import org.apache.freemarker.core.model.TemplateStringModel; +import java.io.Serializable; + /** - * A simple implementation of the <tt>TemplateStringModel</tt> - * interface, using a <tt>String</tt>. + * A simple implementation of the {@code TemplateStringModel} + * interface, using a {@code String}. * * <p>This class is thread-safe. * @@ -36,13 +36,13 @@ public final class SimpleString implements TemplateStringModel, Serializable { /** - * @serial the value of this <tt>SimpleString</tt> if it wraps a - * <tt>String</tt>. + * @serial the value of this {@code SimpleString} if it wraps a + * {@code String}. */ private final String value; /** - * Constructs a <tt>SimpleString</tt> containing a string value. + * Constructs a {@code SimpleString} containing a string value. * @param value the string value. If this is {@code null}, its value in FTL will be {@code ""}. */ public SimpleString(String value) { diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java index fad96e85..bce3583b 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModel.java @@ -19,13 +19,6 @@ package org.apache.freemarker.core.model.impl; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - import org.apache.freemarker.core.TemplateException; import org.apache.freemarker.core.model.TemplateCollectionModel; import org.apache.freemarker.core.model.TemplateFunctionModel; @@ -34,6 +27,13 @@ import org.apache.freemarker.core.model.TemplateModel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + /** * Wraps the static fields and methods of a class in a {@link org.apache.freemarker.core.model.TemplateHashModel}. * Fields are wrapped using {@link DefaultObjectWrapper#wrap(Object)}, and methods are wrapped into an appropriate @@ -55,7 +55,7 @@ final class StaticModel implements TemplateHashModelEx { } /** - * Returns the field or method named by the <tt>key</tt> + * Returns the field or method named by the {@code key} * parameter. */ @Override diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModels.java b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModels.java index a7b0b844..0fd5c409 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModels.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/StaticModels.java @@ -25,9 +25,9 @@ import org.apache.freemarker.core.model.TemplateModel; /** * Utility class for instantiating {@link StaticModel} instances from * templates. If your template's data model contains an instance of - * StaticModels (named, say <tt>StaticModels</tt>), then you can + * StaticModels (named, say {@code StaticModels}), then you can * instantiate an arbitrary StaticModel using get syntax (i.e. - * <tt>StaticModels["java.lang.System"].currentTimeMillis()</tt>). + * {@code StaticModels["java.lang.System"].currentTimeMillis()}). */ class StaticModels extends ClassBasedModelFactory { diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/TemplateLoader.java b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/TemplateLoader.java index f835c255..9f5989d5 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/TemplateLoader.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/templateresolver/TemplateLoader.java @@ -18,13 +18,13 @@ */ package org.apache.freemarker.core.templateresolver; -import java.io.IOException; -import java.io.Serializable; - import org.apache.freemarker.core.Configuration; import org.apache.freemarker.core.TemplateNotFoundException; import org.apache.freemarker.core.templateresolver.impl.DefaultTemplateResolver; +import java.io.IOException; +import java.io.Serializable; + /** * FreeMarker loads template "files" through objects that implement this interface, thus the templates need not be real * files, and can come from any kind of data source (like classpath, servlet context, database, etc). While FreeMarker @@ -73,7 +73,7 @@ public interface TemplateLoader { * loader-defined root location (often referred as the "template root directory"), and will never start * with a slash, nor will they contain a path component consisting of either a single or a double dot -- * these are all resolved by the template cache before passing the name to the loader. As a side effect, - * paths that trivially reach outside template root directory, such as <tt>../my.f3ah</tt>, will be + * paths that trivially reach outside template root directory, such as {@code ../my.f3ah}, will be * rejected by the template cache, so they never reach the template loader. Note again, that if the path * uses backslash as path separator instead of slash as (the template loader should not accept that), the * normalization will not properly happen, as FreeMarker (the cache) recognizes only the slashes as diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/util/DeepUnwrap.java b/freemarker-core/src/main/java/org/apache/freemarker/core/util/DeepUnwrap.java index 0a90ec6c..9d4ff5ad 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/util/DeepUnwrap.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/util/DeepUnwrap.java @@ -19,27 +19,16 @@ package org.apache.freemarker.core.util; +import org.apache.freemarker.core.TemplateException; +import org.apache.freemarker.core.model.*; +import org.apache.freemarker.core.model.TemplateHashModelEx.KeyValuePair; +import org.apache.freemarker.core.model.TemplateHashModelEx.KeyValuePairIterator; + import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; -import org.apache.freemarker.core.TemplateException; -import org.apache.freemarker.core.model.AdapterTemplateModel; -import org.apache.freemarker.core.model.TemplateBooleanModel; -import org.apache.freemarker.core.model.TemplateDateModel; -import org.apache.freemarker.core.model.TemplateHashModelEx; -import org.apache.freemarker.core.model.TemplateHashModelEx.KeyValuePair; -import org.apache.freemarker.core.model.TemplateHashModelEx.KeyValuePairIterator; -import org.apache.freemarker.core.model.TemplateIterableModel; -import org.apache.freemarker.core.model.TemplateModel; -import org.apache.freemarker.core.model.TemplateModelIterator; -import org.apache.freemarker.core.model.TemplateNullModel; -import org.apache.freemarker.core.model.TemplateNumberModel; -import org.apache.freemarker.core.model.TemplateSequenceModel; -import org.apache.freemarker.core.model.TemplateStringModel; -import org.apache.freemarker.core.model.WrapperTemplateModel; - /** * Utility methods for unwrapping {@link TemplateModel}-s. */ @@ -50,7 +39,7 @@ public class DeepUnwrap { * The converting of the {@link TemplateModel} object happens with the following rules: * <ol> * <li>If the object implements {@link AdapterTemplateModel}, then the result - * of {@link AdapterTemplateModel#getAdaptedObject(Class)} for <tt>Object.class</tt> is returned. + * of {@link AdapterTemplateModel#getAdaptedObject(Class)} for {@code Object.class} is returned. * <li>If the object implements {@link WrapperTemplateModel}, then the result * of {@link WrapperTemplateModel#getWrappedObject()} is returned. * <li>If the object is identical to the null model of the current object diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_StringUtils.java b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_StringUtils.java index c427cef5..b504dcd3 100644 --- a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_StringUtils.java +++ b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_StringUtils.java @@ -219,8 +219,8 @@ public class _StringUtils { } /** - * XML encoding for attribute values quoted with <tt>"</tt> (not with <tt>'</tt>!). - * Also can be used for HTML attributes that are quoted with <tt>"</tt>. + * XML encoding for attribute values quoted with {@code "} (not with {@code '}!). + * Also can be used for HTML attributes that are quoted with {@code "}. * @see #XMLEnc(String) */ public static String XMLEncQAttr(String s) { @@ -710,7 +710,7 @@ public class _StringUtils { * * <p>All characters under UCS code point 0x20 will be escaped. * Where they have no dedicated escape sequence in Java, they will - * be replaced with hexadecimal escape (<tt>\</tt><tt>u<i>XXXX</i></tt>). + * be replaced with hexadecimal escape ({@code \}<code>u<i>XXXX</i></code>). * * @see #jQuote(String) */ @@ -802,44 +802,45 @@ public class _StringUtils { * touching pieces that were escaped with this, no character sequence can occur that closes the * JavaScript/JSON string literal, or has a meaning in HTML/XML that causes the HTML script section to be closed. * (If, however, the escaped section is preceded by or followed by strings from other sources, this can't be - * guaranteed in some rare cases. Like <tt>x = "</${a?js_string}"</tt> might closes the "script" + * guaranteed in some rare cases. Like <code>x = "</${a?js_string}"</code> might closes the "script" * element if {@code a} is {@code "script>"}.) * * The escaped characters are: * - * <table style="width: auto; border-collapse: collapse" border="1" summary="Characters escaped by jsStringEnc"> + * <table style="width: auto; border-collapse: collapse" border="1"> + * <caption style="display: none">Characters escaped by jsStringEnc</caption> * <tr> * <th>Input * <th>Output * <tr> - * <td><tt>"</tt> - * <td><tt>\"</tt> + * <td>{@code "} + * <td>{@code \"} * <tr> - * <td><tt>'</tt> if not in JSON-mode, nor is the {@code quited} argument {@code true} - * <td><tt>\'</tt> + * <td>{@code '} if not in JSON-mode, nor is the {@code quited} argument {@code true} + * <td>{@code \'} * <tr> - * <td><tt>\</tt> - * <td><tt>\\</tt> + * <td>{@code \} + * <td>{@code \\} * <tr> - * <td><tt>/</tt> if the method can't know that it won't be directly after <tt><</tt> - * <td><tt>\/</tt> + * <td>{@code /} if the method can't know that it won't be directly after <code><</code> + * <td>{@code \/} * <tr> - * <td><tt>></tt> if the method can't know that it won't be directly after <tt>]]</tt> or <tt>--</tt> - * <td>JavaScript: <tt>\></tt>; JSON: <tt>\</tt><tt>u003E</tt> + * <td><code>></code> if the method can't know that it won't be directly after {@code ]]} or {@code --} + * <td>JavaScript: <code>\></code>; JSON: {@code \}{@code u003E} * <tr> - * <td><tt><</tt> if the method can't know that it won't be directly followed by <tt>!</tt> or <tt>?</tt> - * <td><tt><tt>\</tt>u003C</tt> + * <td><code><</code> if the method can't know that it won't be directly followed by {@code !} or {@code ?} + * <td><code>\{@code u}003C</code> * <tr> * <td> * u0000-u001f (UNICODE control characters - disallowed by JSON)<br> * u007f-u009f (UNICODE control characters - disallowed by JSON) - * <td><tt>\n</tt>, <tt>\r</tt> and such, or if there's no such dedicated escape: - * JavaScript: <tt>\x<i>XX</i></tt>, JSON: <tt>\<tt>u</tt><i>XXXX</i></tt> + * <td>{@code \n}, {@code \r} and such, or if there's no such dedicated escape: + * JavaScript: <code>\x<i>XX</i></code>, JSON: <code>\{@code u}<i>XXXX</i></code> * <tr> * <td> * u2028 (Line separator - source code line-break in ECMAScript)<br> * u2029 (Paragraph separator - source code line-break in ECMAScript)<br> - * <td><tt>\<tt>u</tt><i>XXXX</i></tt> + * <td><code>\{@code u}<i>XXXX</i></code> * </table> * * @param s The string to escape @@ -978,7 +979,7 @@ public class _StringUtils { /** * Parses a name-value pair list, where the pairs are separated with comma, * and the name and value is separated with colon. - * The keys and values can contain only letters, digits and <tt>_</tt>. They + * The keys and values can contain only letters, digits and {@code _}. They * can't be quoted. White-space around the keys and values are ignored. The * value can be omitted if <code>defaultValue</code> is not null. When a * value is omitted, then the colon after the key must be omitted as well. diff --git a/freemarker-core/src/main/javacc/org/apache/freemarker/core/FTL.jj b/freemarker-core/src/main/javacc/org/apache/freemarker/core/FTL.jj index 0ebf6206..69bd6559 100644 --- a/freemarker-core/src/main/javacc/org/apache/freemarker/core/FTL.jj +++ b/freemarker-core/src/main/javacc/org/apache/freemarker/core/FTL.jj @@ -1989,7 +1989,7 @@ ASTExpression BuiltIn(ASTExpression lhoExp) : /** - * production for when a key is specified by <DOT> + keyname + * production for when a key is specified by {@code <DOT>} + keyname */ ASTExpression DotVariable(ASTExpression exp) : { diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/AllHttpScopesHashModel.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/AllHttpScopesHashModel.java index 819458ac..80e0f9a6 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/AllHttpScopesHashModel.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/AllHttpScopesHashModel.java @@ -19,28 +19,27 @@ package org.apache.freemarker.servlet; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - import org.apache.freemarker.core.TemplateException; import org.apache.freemarker.core.model.ObjectWrapper; import org.apache.freemarker.core.model.TemplateModel; import org.apache.freemarker.core.model.impl.SimpleHash; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import java.util.HashMap; +import java.util.Map; + /** * An extension of SimpleHash that looks up keys in the hash, then in the * request, session, and servlet context scopes. Makes "Application", "Session" * and "Request" keys largely obsolete, however we keep them for backward * compatibility (also, "Request" is required for proper operation of JSP * taglibs). - * It is on purpose that we didn't override <tt>keys</tt> and <tt>values</tt> + * It is on purpose that we didn't override {@code keys} and {@code values} * methods. That way, only those variables assigned into the hash directly by a - * subclass of <tt>FreemarkerServlet</tt> that overrides - * <tt>preTemplateProcess</tt>) are discovered as "page" variables by the FM + * subclass of {@code FreemarkerServlet} that overrides + * {@code preTemplateProcess}) are discovered as "page" variables by the FM * JSP PageContext implementation. */ public class AllHttpScopesHashModel extends SimpleHash { @@ -63,8 +62,8 @@ public class AllHttpScopesHashModel extends SimpleHash { } /** - * Stores a model in the hash so that it doesn't show up in <tt>keys()</tt> - * and <tt>values()</tt> methods. Used to put the Application, Session, + * Stores a model in the hash so that it doesn't show up in {@code keys()} + * and {@code values()} methods. Used to put the Application, Session, * Request, RequestParameters and JspTaglibs objects. * @param key the key under which the model is stored * @param model the stored model diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java index 4fa8cd20..b7301fb2 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/FreemarkerServlet.java @@ -104,9 +104,9 @@ import java.util.regex.Pattern; * this is interpreted as a {@link ServletContext} resource path, which practically means a web application directory * relative path, or a {@code WEB-INF/lib/*.jar/META-INF/resources}-relative path (note that this last haven't always * worked before FreeMarker 2.3.23).<br> - * Alternatively, you can prepend it with <tt>file://</tt> to indicate a literal path in the file system (i.e. - * <tt>file:///var/www/project/templates/</tt>). Note that three slashes were used to specify an absolute path.<br> - * Also, you can prepend it with {@code classpath:}, like in <tt>classpath:com/example/templates</tt>, to indicate that + * Alternatively, you can prepend it with {@code file://} to indicate a literal path in the file system (i.e. + * {@code file:///var/www/project/templates/}). Note that three slashes were used to specify an absolute path.<br> + * Also, you can prepend it with {@code classpath:}, like in {@code classpath:com/example/templates}, to indicate that * you want to load templates from the specified package accessible through the Thread Context Class Loader of the * thread that initializes this servlet.<br> * If {@code incompatibleImprovements} is set to 2.3.22 (or higher), you can specify multiple comma separated locations @@ -119,10 +119,10 @@ import java.util.regex.Pattern; * {@link WebAppTemplateLoader#setAttemptFileAccess(boolean)} and * {@link WebAppTemplateLoader#setURLConnectionUsesCaches(Boolean)} to tune the {@link WebAppTemplateLoader}. For * backward compatibility (not recommended!), you can use the {@code class://} prefix, like in - * <tt>class://com/example/templates</tt> format, which is similar to {@code classpath:}, except that it uses the + * {@code class://com/example/templates} format, which is similar to {@code classpath:}, except that it uses the * defining class loader of this servlet's class. This can cause template-not-found errors, if that class (in * {@code freemarer.jar} usually) is not local to the web application, while the templates are.<br> - * The default value is <tt>class://</tt> (that is, the root of the class hierarchy), which is not recommended anymore, + * The default value is {@code class://} (that is, the root of the class hierarchy), which is not recommended anymore, * and should be overwritten with the {@value #INIT_PARAM_TEMPLATE_PATH} init-param.</li> * * <li><strong>{@value #INIT_PARAM_NO_CACHE}</strong>: If set to {@code true}, generates headers in the response that @@ -136,8 +136,8 @@ import java.util.regex.Pattern; * <li>If the {@value #INIT_PARAM_OVERRIDE_RESPONSE_CONTENT_TYPE} init-param is {@value #INIT_PARAM_VALUE_NEVER} (the * default is {@value #INIT_PARAM_VALUE_ALWAYS}), then the value of {@link HttpServletResponse#getContentType()} is used * if that's non-{@code null}. - * <li>The template's <tt>content_type</tt> custom setting, usually specified via the <tt>attributes</tt> parameter of - * the <tt><#ftl></tt> directive. This is a legacy feature, deprecated by the {@link OutputFormat} mechanism. + * <li>The template's {@code content_type} custom setting, usually specified via the {@code attributes} parameter of + * the <code><#ftl></code> directive. This is a legacy feature, deprecated by the {@link OutputFormat} mechanism. * <li>The {@linkplain Template#getOutputFormat() output format of the template}, if that has non-{@code null} MIME-type * ({@link OutputFormat#getMimeType()}). When a template has no output format specified, {@link UndefinedOutputFormat} * is used, which has {@code null} MIME-type. (The output format of a template is deduced from {@link Configuration} @@ -148,9 +148,9 @@ import java.util.regex.Pattern; * (the default is {@value #INIT_PARAM_VALUE_ALWAYS}), then the value of {@link HttpServletResponse#getContentType()} is * used if that's non-{@code null}. * </ol> - * If none of the above gives a MIME type, then this init-param does. Defaults to <tt>"text/html"</tt>. If and only if + * If none of the above gives a MIME type, then this init-param does. Defaults to {@code "text/html"}. If and only if * the {@value #INIT_PARAM_RESPONSE_CHARACTER_ENCODING} init-param is set to {@value #INIT_PARAM_VALUE_LEGACY} (which is - * the default of it), the content type may include the charset (as in <tt>"text/html; charset=utf-8"</tt>), in which + * the default of it), the content type may include the charset (as in {@code "text/html; charset=utf-8"}), in which * case that specifies the actual charset of the output. If the the {@value #INIT_PARAM_RESPONSE_CHARACTER_ENCODING} * init-param is not set to {@value #INIT_PARAM_VALUE_LEGACY}, then specifying the charset in the * {@value #INIT_PARAM_CONTENT_TYPE} init-param is not allowed, and will cause servlet initialization error.</li> @@ -162,7 +162,7 @@ import java.util.regex.Pattern; * type in the response, unless {@link HttpServletResponse#getContentType()} is {@code null}. The third possible value * is {@value #INIT_PARAM_VALUE_WHEN_TEMPLATE_HAS_MIME_TYPE}, which means that we only set the content type if either * the template has an associated {@link OutputFormat} with non-{@code null} {@link OutputFormat#getMimeType()}, or it - * has a custom setting with name <tt>content_type</tt>, or {@link HttpServletResponse#getContentType()} is + * has a custom setting with name {@code content_type}, or {@link HttpServletResponse#getContentType()} is * {@code null}. Setting this init-param allows you to specify the content type before forwarding to * {@link FreemarkerServlet}.</li> * diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/EventForwarding.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/EventForwarding.java index c3c48857..4123f169 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/EventForwarding.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/EventForwarding.java @@ -19,27 +19,22 @@ package org.apache.freemarker.servlet.jsp; -import java.util.ArrayList; -import java.util.EventListener; -import java.util.Iterator; -import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextAttributeEvent; -import javax.servlet.ServletContextAttributeListener; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; +import javax.servlet.*; import javax.servlet.http.HttpSessionAttributeListener; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.util.ArrayList; +import java.util.EventListener; +import java.util.Iterator; +import java.util.List; /** - * An instance of this class should be registered as a <tt><listener></tt> in - * the <tt>web.xml</tt> descriptor in order to correctly dispatch events to + * An instance of this class should be registered as a <code><listener></code> in + * the {@code web.xml} descriptor in order to correctly dispatch events to * event listeners that are specified in TLD files. */ public class EventForwarding diff --git a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java index c34aab26..f7034d3e 100644 --- a/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java +++ b/freemarker-servlet/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java @@ -19,35 +19,32 @@ package org.apache.freemarker.servlet.jsp; +import org.apache.freemarker.core.ConfigurationException; +import org.apache.freemarker.core.Environment; +import org.apache.freemarker.core.TemplateException; +import org.apache.freemarker.core.model.*; +import org.apache.freemarker.core.model.impl.DefaultObjectWrapper; +import org.apache.freemarker.core.util.*; +import org.apache.freemarker.servlet.FreemarkerServlet; +import org.apache.freemarker.servlet.HttpRequestHashModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.xml.sax.*; +import org.xml.sax.helpers.DefaultHandler; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.jsp.tagext.Tag; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParserFactory; import java.beans.IntrospectionException; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FilenameFilter; -import java.io.FilterInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; +import java.io.*; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.net.JarURLConnection; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLConnection; -import java.net.URLDecoder; -import java.net.URLEncoder; +import java.net.*; import java.nio.charset.Charset; import java.text.ParseException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Stack; -import java.util.TreeSet; +import java.util.*; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.regex.Pattern; @@ -55,39 +52,6 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipInputStream; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.jsp.tagext.Tag; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParserFactory; - -import org.apache.freemarker.core.ConfigurationException; -import org.apache.freemarker.core.Environment; -import org.apache.freemarker.core.TemplateException; -import org.apache.freemarker.core.model.ObjectWrapper; -import org.apache.freemarker.core.model.TemplateDirectiveModel; -import org.apache.freemarker.core.model.TemplateFunctionModel; -import org.apache.freemarker.core.model.TemplateHashModel; -import org.apache.freemarker.core.model.TemplateModel; -import org.apache.freemarker.core.model.impl.DefaultObjectWrapper; -import org.apache.freemarker.core.util.BugException; -import org.apache.freemarker.core.util.CommonBuilder; -import org.apache.freemarker.core.util._ClassUtils; -import org.apache.freemarker.core.util._NullArgumentException; -import org.apache.freemarker.core.util._StringUtils; -import org.apache.freemarker.servlet.FreemarkerServlet; -import org.apache.freemarker.servlet.HttpRequestHashModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xml.sax.Attributes; -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.DefaultHandler; - /** * A hash model associated with a servlet context that can load JSP tag libraries associated with that servlet context. * An instance of this class is made available in the root data model of templates executed by @@ -227,7 +191,7 @@ public class TaglibFactory implements TemplateHashModel { * {@code http://example.com/foo}), root relative URI (like {@code /bar/foo.tld}) and non-root relative * URI (like {@code bar/foo.tld}). Note that if a non-root relative URI is used it's resolved relative to * the URL of the current request. In this case, the current request is obtained by looking up a - * {@link HttpRequestHashModel} object named <tt>Request</tt> in the root data model. + * {@link HttpRequestHashModel} object named {@code Request} in the root data model. * {@link FreemarkerServlet} provides this object under the expected name, and custom servlets that want * to integrate JSP taglib support should do the same. * @@ -1134,7 +1098,7 @@ public class TaglibFactory implements TemplateHashModel { } /** - * To search TLD-s under <tt>sevletContext:/WEB-INF/lib/*.{jar,zip}/META-INF/**</tt><tt>/*.tld</tt>, as requested by + * To search TLD-s under <code>sevletContext:/WEB-INF/lib/*.{jar,zip}/META-INF/**</code>{@code /*.tld}, as requested by * the JSP specification. Note that these also used to be in the classpath, so it's redundant to use this together * with a sufficiently permissive {@link ClasspathMetaInfTldSource}. */ diff --git a/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TemplateTestSuite.java b/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TemplateTestSuite.java index 8041db57..ac50fa73 100644 --- a/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TemplateTestSuite.java +++ b/freemarker-test-utils/src/main/java/org/apache/freemarker/test/TemplateTestSuite.java @@ -49,10 +49,10 @@ import java.util.regex.Pattern; * To add a test-case, go to the resource directory that corresponds to the package of the {@link TemplateTestSuite} * subclass and inside that directory:</p> * <ol> - * <li>Add a new <tt>testcase</tt> element to <tt>testcases.xml</tt></li> - * <li>Add a template to <tt>templates/</tt> with fits the <tt>testcase</tt> added to the XML (by default it's the test + * <li>Add a new {@code testcase} element to {@code testcases.xml}</li> + * <li>Add a template to {@code templates/} with fits the {@code testcase} added to the XML (by default it's the test * case name + ".f3ac")</li> - * <li>Add the expected output to <tt>references/</tt> with fits the <tt>testcase</tt> added to the XML (by default + * <li>Add the expected output to {@code references/} with fits the {@code testcase} added to the XML (by default * it's the test name + ".txt")</li> * <li>If you want to add items to the data-model or change the {@link Configuration}, modify the * {@link #setUpTestCase(String, Map, Configuration.ExtendableBuilder)}} method in the {@link TemplateTestSuite}
