You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2026/05/10 22:55:03 UTC

(freemarker) branch 2.3-gae updated: [FREEMARKER-234] Fixed a unit test. Improved Configuration.incompatibleImprovements javadoc.

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

asf-gitbox-commits pushed a commit to branch 2.3-gae
in repository https://gitbox.apache.org/repos/asf/freemarker.git


The following commit(s) were added to refs/heads/2.3-gae by this push:
     new 09d6cfb3 [FREEMARKER-234] Fixed a unit test. Improved Configuration.incompatibleImprovements javadoc.
09d6cfb3 is described below

commit 09d6cfb39f340cc6ad5ba86b48969d0969cd6c78
Author: ddekany <dd...@apache.org>
AuthorDate: Mon May 11 00:54:38 2026 +0200

    [FREEMARKER-234] Fixed a unit test. Improved Configuration.incompatibleImprovements javadoc.
---
 .../java/freemarker/template/Configuration.java    | 104 ++++++---------------
 .../template/DefaultObjectWrapperTest.java         |  55 ++++-------
 2 files changed, 46 insertions(+), 113 deletions(-)

diff --git a/freemarker-core/src/main/java/freemarker/template/Configuration.java b/freemarker-core/src/main/java/freemarker/template/Configuration.java
index d5155a98..c993790b 100644
--- a/freemarker-core/src/main/java/freemarker/template/Configuration.java
+++ b/freemarker-core/src/main/java/freemarker/template/Configuration.java
@@ -19,6 +19,14 @@
 
 package freemarker.template;
 
+import freemarker.cache.*;
+import freemarker.cache.TemplateCache.MaybeMissingTemplate;
+import freemarker.core.*;
+import freemarker.ext.beans.BeansWrapper;
+import freemarker.ext.beans.BeansWrapperBuilder;
+import freemarker.log.Logger;
+import freemarker.template.utility.*;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.Writer;
@@ -26,82 +34,11 @@ import java.lang.reflect.InvocationTargetException;
 import java.net.URLConnection;
 import java.text.Collator;
 import java.text.DecimalFormat;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
+import java.util.*;
 import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TimeZone;
-import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import freemarker.cache.CacheStorage;
-import freemarker.cache.ClassTemplateLoader;
-import freemarker.cache.FileTemplateLoader;
-import freemarker.cache.MruCacheStorage;
-import freemarker.cache.MultiTemplateLoader;
-import freemarker.cache.SoftCacheStorage;
-import freemarker.cache.TemplateCache;
-import freemarker.cache.TemplateCache.MaybeMissingTemplate;
-import freemarker.cache.TemplateConfigurationFactory;
-import freemarker.cache.TemplateLoader;
-import freemarker.cache.TemplateLookupContext;
-import freemarker.cache.TemplateLookupStrategy;
-import freemarker.cache.TemplateNameFormat;
-import freemarker.cache.URLTemplateLoader;
-import freemarker.core.BugException;
-import freemarker.core.CFormat;
-import freemarker.core.CSSOutputFormat;
-import freemarker.core.CombinedMarkupOutputFormat;
-import freemarker.core.Configurable;
-import freemarker.core.Environment;
-import freemarker.core.HTMLOutputFormat;
-import freemarker.core.JSONOutputFormat;
-import freemarker.core.JavaScriptOrJSONCFormat;
-import freemarker.core.JavaScriptOutputFormat;
-import freemarker.core.LegacyCFormat;
-import freemarker.core.MarkupOutputFormat;
-import freemarker.core.OutputFormat;
-import freemarker.core.ParseException;
-import freemarker.core.ParserConfiguration;
-import freemarker.core.PlainTextOutputFormat;
-import freemarker.core.RTFOutputFormat;
-import freemarker.core.TemplateConfiguration;
-import freemarker.core.TemplateMarkupOutputModel;
-import freemarker.core.UndefinedOutputFormat;
-import freemarker.core.UnregisteredOutputFormatException;
-import freemarker.core.XHTMLOutputFormat;
-import freemarker.core.XMLOutputFormat;
-import freemarker.core.XSCFormat;
-import freemarker.core._CoreAPI;
-import freemarker.core._DelayedJQuote;
-import freemarker.core._MiscTemplateException;
-import freemarker.core._ObjectBuilderSettingEvaluator;
-import freemarker.core._SettingEvaluationEnvironment;
-import freemarker.core._SortedArraySet;
-import freemarker.core._UnmodifiableCompositeSet;
-import freemarker.ext.beans.BeansWrapper;
-import freemarker.ext.beans.BeansWrapperBuilder;
-import freemarker.log.Logger;
-import freemarker.template.utility.CaptureOutput;
-import freemarker.template.utility.ClassUtil;
-import freemarker.template.utility.Constants;
-import freemarker.template.utility.HtmlEscape;
-import freemarker.template.utility.NormalizeNewlines;
-import freemarker.template.utility.NullArgumentException;
-import freemarker.template.utility.SecurityUtilities;
-import freemarker.template.utility.StandardCompress;
-import freemarker.template.utility.StringUtil;
-import freemarker.template.utility.XmlEscape;
-
 /**
  * <b>The main entry point into the FreeMarker API</b>; encapsulates the configuration settings of FreeMarker,
  * also serves as a central template-loading and caching service.
@@ -877,7 +814,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      *       <li><p>
      *          {@link DefaultObjectWrapper} has some minor changes with {@code incompatibleImprovements} 2.3.24;
      *          check them out at {@link DefaultObjectWrapper#DefaultObjectWrapper(Version)}. It's important to know
-     *          that if you set the {@code object_wrapper} setting (to an other value than {@code "default"}), rather
+     *          that if you set the {@code object_wrapper} setting (to another value than {@code "default"}), rather
      *          than leaving it on its default value, the {@code object_wrapper} won't inherit the
      *          {@code incompatibleImprovements} of the {@link Configuration}. In that case, if you want the 2.3.24
      *          improvements of {@link DefaultObjectWrapper}, you have to set it in the {@link DefaultObjectWrapper}
@@ -938,7 +875,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      *          exception (though almost all implementation does), you couldn't use said directives inside the
      *          transformed block. It's very unlikely that user code is affected by this, partially because these aren't
      *          commonly implemented interfaces (especially not {@link TransformControl}), and because it's unlikely
-     *          that templates utilize the the bug that's not fixed.
+     *          that templates utilize the bug that's not fixed.
      *     </ul>
      *   </li>
      *   <li><p>
@@ -997,7 +934,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      *       <p>
      *       2.3.33 (or higher):
      *       <ul>
-     *         <li><p>Comparing strings is now way faster. If your template does lot of string comparisons, this can
+     *         <li><p>Comparing strings is now way faster. If your template does a lot of string comparisons, this can
      *           mean very significant speedup. We now use a simpler way of comparing strings, and because templates
      *           were only ever allowed equality comparisons between strings (not less-than, or greater-than), it's very
      *           unlikely to change the behavior of your templates. (Technically, what changes is that instead of using
@@ -1008,8 +945,8 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      *           normalization, so combining characters won't break your comparisons.)</p></li>
      *         <li><p>
      *          The default {@link Configuration#setObjectWrapper(ObjectWrapper) object_wrapper} now exposes Java
-     *          records public methods with 0-arguments and non-void return type are now exposed both as properties,
-     *          and as methods; see {@link BeansWrapper#BeansWrapper(Version)}.
+     *          records public methods with 0-arguments and non-void return type both as properties and as methods;
+     *          see {@link BeansWrapper#BeansWrapper(Version)}.
      *       </ul>
      *   </li>
      *   <li>
@@ -1025,6 +962,19 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      *           text, just as it's done for any other FTL tags.
      *       </ul>
      *   </li>
+     *   <li>
+     *       <p>
+     *       2.3.35 (or higher):
+     *       <ul>
+     *         <li><p>
+     *          The default {@link Configuration#setObjectWrapper(ObjectWrapper) object_wrapper} now exposes "is"
+     *          methods (like {@code isExpired()}) as a JavaBeans property (like {@code obj.expirted}) even if the
+     *          return type is not primitive {@code boolean}, but {@code Boolean}. The method will be still also be
+     *          exposed as a plain method ({@code obj.isExpirted()}), so this is a mostly backward compatible change.
+     *          see {@link BeansWrapper#BeansWrapper(Version)}.
+     *         </li>
+     *      </ul>
+     *   </li>
      * </ul>
      * 
      * @throws IllegalArgumentException
diff --git a/freemarker-jython25/src/test/java/freemarker/template/DefaultObjectWrapperTest.java b/freemarker-jython25/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
index 96262b48..1c9fb517 100644
--- a/freemarker-jython25/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
+++ b/freemarker-jython25/src/test/java/freemarker/template/DefaultObjectWrapperTest.java
@@ -19,49 +19,32 @@
 
 package freemarker.template;
 
-import static freemarker.test.hamcerst.Matchers.*;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.Vector;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.hamcrest.Matchers;
-import org.junit.Test;
-import org.python.core.PyString;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
-
 import freemarker.ext.beans.BeansWrapper;
 import freemarker.ext.beans.EnumerationModel;
 import freemarker.ext.beans.HashAdapter;
 import freemarker.ext.beans.WhitelistMemberAccessPolicy;
 import freemarker.ext.jython.JythonSequenceModel;
 import freemarker.ext.util.WrapperTemplateModel;
+import org.hamcrest.Matchers;
+import org.junit.Test;
+import org.python.core.PyString;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.*;
+
+import static freemarker.test.hamcerst.Matchers.containsStringIgnoringCase;
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
 
 public class DefaultObjectWrapperTest {
 
@@ -106,7 +89,7 @@ public class DefaultObjectWrapperTest {
         expected.add(Configuration.VERSION_2_3_27); // no non-BC change in 2.3.32
         expected.add(Configuration.VERSION_2_3_33);
         expected.add(Configuration.VERSION_2_3_33); // no non-BC change in 2.3.34
-        expected.add(Configuration.VERSION_2_3_33); // no non-BC change in 2.3.35
+        expected.add(Configuration.VERSION_2_3_35); // no non-BC change in 2.3.35
 
         List<Version> actual = new ArrayList<>();
         for (int i = _VersionInts.V_2_3_0; i <= Configuration.getVersion().intValue(); i++) {