-
Interfaces Interface Description freemarker.template.TemplateMethodModel UseTemplateMethodModelEx
instead. This interface is from the old times when the only kind of value you could pass in was string.
-
Classes Class Description freemarker.core.CommandLine Will be removed (main method in a library, often classified as CWE-489 "Leftover Debug Code").freemarker.core.FreeMarkerTree Will be removed, as Swing classes aren't accessible on Google App Engine.freemarker.ext.ant.FreemarkerXmlTask FMPP is a more complete solution.freemarker.ext.dom.Transform Will be removed (main method in a library, often classified as CWE-489 "Leftover Debug Code").freemarker.ext.jdom.NodeListModel UseNodeModel
instead.freemarker.ext.xml.NodeListModel UseNodeModel
instead.freemarker.template.SimpleList Use SimpleSequence instead.freemarker.template.utility.CaptureOutput Use block-assignments instead, like<assign x>...</assign>
.freemarker.template.utility.Collections12 Not needed anymore, as FreeMarker now requires higher than Java 1.3freemarker.template.utility.ToCanonical Will be removed (main method in a library, often classified as CWE-489 "Leftover Debug Code").
-
Methods Method Description freemarker.cache.TemplateCache.createLegacyDefaultTemplateLoader() TheTemplateLoader
should be always specified by the constructor caller.freemarker.cache.TemplateCache.getFullTemplatePath(Environment, String, String) UseEnvironment.toFullTemplateName(String, String)
instead, as that can throwMalformedTemplateNameException
, and is on a more logical place anyway.freemarker.cache.TemplateCache.getTemplate(String, Locale, String, boolean) UseTemplateCache.getTemplate(String, Locale, Object, String, boolean)
, which can return more detailed result when the template is missing.freemarker.cache.TemplateCache.setConfiguration(Configuration) Use theTemplateCache(TemplateLoader, CacheStorage, Configuration)
constructor.freemarker.core.Configurable.getSetting(String) It's not possible in general to convert setting values to string, and thus it's impossible to ensure thatConfigurable.setSetting(String, String)
will work with the returned value correctly.freemarker.core.Configurable.getSettings() This method was always defective, and certainly it always will be. Don't use it. (Simply, it's hardly possible in general to convert setting values to text in a way that ensures thatConfigurable.setSettings(Properties)
will work with them correctly.)freemarker.core.Environment.getTemplate() UseEnvironment.getMainTemplate()
instead (orEnvironment.getCurrentNamespace()
and thenEnvironment.Namespace.getTemplate()
); the value returned by this method is often not what you expect when it comes to macro/function invocations.freemarker.ext.beans.BeansWrapper.finetuneMethodAppearance(Class, Method, BeansWrapper.MethodAppearanceDecision) UseBeansWrapper.setMethodAppearanceFineTuner(MethodAppearanceFineTuner)
; no need to extend this class anymore. Soon this method will be final, so trying to override it will break your app. Note that if themethodAppearanceFineTuner
property is set to non-null
, this method is not called anymore.freemarker.ext.beans.BeansWrapper.getDefaultInstance() UseBeansWrapperBuilder
instead. The instance returned here is not read-only, so it's dangerous to use.freemarker.ext.beans.BeansWrapper.getInstance(Object, ModelFactory) overrideBeansWrapper.getModelFactory(Class)
instead. Using this method will now bypass wrapper caching (if it's enabled) and always result in creation of a new wrapper. This method will be removed in 2.4freemarker.ext.beans.BeansWrapper.setNullModel(TemplateModel) Changing thenull
model can cause a lot of confusion; don't do it.freemarker.ext.dom.Transform.main(String[]) Will be removed (main method in a library, often classified as CWE-489 "Leftover Debug Code").freemarker.ext.jdom.NodeListModel.main(String[]) Will be removed (main method in a library, often classified as CWE-489 "Leftover Debug Code").freemarker.ext.servlet.FreemarkerServlet.getTemplatePath() Not called by FreeMarker code, and there's no point to override this (unless to cause confusion).freemarker.log.Logger.selectLoggerLibrary(int) This method isn't reliable, unless you can somehow ensure that you access the FreeMarker classes first; use the "org.freemarker.loggerLibrary" Java system property instead, likejava ... -Dorg.freemarker.loggerLibrary=slf4j
. SeeLogger.SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY
for more.freemarker.log.Logger.setCategoryPrefix(String) This wasn't reliable, unless you can somehow ensure that you access the FreeMarker classes first. As it's not known to be useful for users, consider it removed.freemarker.template.Configuration.getDefaultConfiguration() The usage of the static singleton (the "default")Configuration
instance can easily cause erroneous, unpredictable behavior. This is because multiple independent software components may use FreeMarker internally inside the same application, so they will interfere because of the commonConfiguration
instance. Each such component should use its own privateConfiguration
object instead, that it typically creates withnew Configuration()
when the component is initialized.freemarker.template.Configuration.getIncompatibleEnhancements() UseConfiguration.getIncompatibleImprovements()
instead.freemarker.template.Configuration.getParsedIncompatibleEnhancements() UseConfiguration.getIncompatibleImprovements()
instead.freemarker.template.Configuration.getVersionNumber() UseConfiguration.getVersion()
instead.freemarker.template.Configuration.setDefaultConfiguration(Configuration) Using the "default"Configuration
instance can easily lead to erroneous, unpredictable behaviour. See morehere...
.freemarker.template.Configuration.setIncompatibleEnhancements(String) UseConfiguration(Version)
, or as last chance,Configuration.setIncompatibleImprovements(Version)
instead.freemarker.template.Configuration.setStrictSyntaxMode(boolean) Onlytrue
(the default) value will be supported sometimes in the future.freemarker.template.Configuration.setTemplateUpdateDelay(int) UseConfiguration.setTemplateUpdateDelayMilliseconds(long)
instead, because the time granularity of this method is often misunderstood to be milliseconds.freemarker.template.SimpleSequence.add(boolean) UseSimpleSequence.add(Object)
instead, as this bypasses theObjectWrapper
.freemarker.template.SimpleSequence.toList() No replacement exists; not a reliable way of getting back the original list elemnts.freemarker.template.Template.addImport(LibraryLoad) Should only be used internally, and might will be removed later.freemarker.template.Template.addMacro(Macro) Should only be used internally, and might will be removed later.freemarker.template.Template.addPrefixNSMapping(String, String) Should only be used internally, and might will be removed later.freemarker.template.Template.containingElements(int, int) Should only be used internally, and might will be removed later.freemarker.template.Template.getImports() Should only be used internally, and might will be removed later.freemarker.template.Template.getMacros() Should only be used internally, and might will be removed later.freemarker.template.Template.getRootTreeNode() Should only be used internally, and might will be removed later.freemarker.template.Template.setEncoding(String) Should only be used internally, and might will be removed later.freemarker.template.TemplateException.getCauseException() Java 1.4 has introducedThrowable.getCause()
- use that instead, especially as this can't return runtime exceptions and errors as is.freemarker.template.TemplateException.getTemplateName() UseTemplateException.getTemplateSourceName()
instead, unless you are really sure that this is what you want. This method isn't really deprecated, it's just marked so to warn users about this.freemarker.template.utility.DeepUnwrap.premissiveUnwrap(TemplateModel) the name of this method is mistyped. UsepermissiveUnwrap(TemplateModel)
instead.freemarker.template.utility.StringUtil.HTMLEnc(String) UseStringUtil.XHTMLEnc(String)
instead, because it escapes apostrophe-quote too.freemarker.template.utility.ToCanonical.main(String[]) Will be removed (main method in a library, often classified as CWE-489 "Leftover Debug Code").freemarker.template.WrappingTemplateModel.getDefaultObjectWrapper() Don't depend on this object, as it can be replace by anybody in the same JVM.freemarker.template.WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper) This method has VM-wide effect, which makes it unsuitable for application where multiple components might use FreeMarker internally.