News/Tech News

OmniFaces 4.0 is only minimally dependent on Java 11 and removes deprecated classes

Published on Nov 16, 2022

After almost five years since its last major release, OmniFaces 4.0 has been released following a series of milestones that included a “Jakartified version of 3.14 with some breaking changes” following the release of Jakarta EE 10. Aside from the minimum requirements and breaking changes, new utility methods have been added and omnifaces.js is now sourced from Typescript rather than vanilla JavaScript.

The most significant advantage of switching to TypeScript is its ability to compile the same source code to older versions of EcmaScript, such as ES5 or even ES3 for ancient web browsers. We intend to do the same for Jakarta Faces’ own faces.js. Omnifaces.js is compatible with all major web browsers and targets ES5.

OmniFaces 4.0 is compatible with Jakarta Faces 4.0 and Jakarta Faces 3.0 specifications from Jakarta EE 10 and Jakarta EE 9.1, respectively, with the minimum required Java 11 version. For component library authors who would like to be compatible with both Faces 3.0 and 4.0, the Components#addFacesScriptResource() method has been added. The component developer will be able to support both Faces 3.0 jakarta.faces:jsf.js and Faces 4.0 jakarta.faces:faces.js as resource dependencies. It is technically not possible to use a variable as an attribute of an annotation such as @ResourceDependency.

Besides the increase in the minimal version of Java, other minimum dependencies have also been updated: Java 11, Jakarta Server Faces 3.0, Jakarta Expression Language 4.0, Jakarta Servlet 5.0, Jakarta Contexts and Dependency Injection 3.0, Jakarta RESTful Web Services 2.0 and Jakarta Bean Validation 3.0. In other words, OmniFaces 4.0 is not backwards compatible with previous versions of these dependencies because of the compiler-incompatible rename of the javax. package to the jakarta. package.

Everything marked with the @Deprecated annotation in version 3.x has been physically removed from the current version. For instance: the tag ; and the WebXml.INSTANCE enumeration has been replaced with the WebXml.instance() and FacesConfigXml.instance() methods.

The built-in managed beans, #{now} and #{startup}, will now return instances of the Temporal interface rather than the Java Date class. As in #[now.time] and #[startup.time], the framework continues to support the time property in a backwards-compatible manner. Moreover, it provides two new convenience properties: instant and zonedDateTime, as in #{now.instant}, #{now.zonedDateTime}, #{startup.instant} and #{startup.zonedDateTime}.

Annotated under @Deprecated are the Callback interfaces that date back to Java 1.7, which had replacements available in Java 1.8. In particular, Callback.Void has been replaced by Runnable, Callback.Returning has been replaced by Supplier, Callback.WithArgument has been replaced by Consumer, and Callback.ReturningWithArgument has been replaced by Function. Components and Events have been updated to use the new types.

OmniFaces 4.0 is a long-awaited release after the stretched milestone releases, even if the changes are not revolutionary. A more current minimum dependency and the switch to TypeScript may provide component builders with interesting options.

Tech News

GitHub

GitHub Codespaces freely available to all GitHub users

The GitHub Codespaces feature is now generally available to GitHub Free…

W4SP Stealer targets developers with 29 malicious PyPI packages

W4SP Stealer targets developers with 29 malicious PyPI packages

Researchers have discovered 29 packages in PyPI, the official third-party software repository…

Our Latest Blog

Mastering Full Stack Python Development with Django A Comprehensive Guide

Mastering Full Stack Python Development with Django: A Comprehensive Guide

Python is a powerful programming language that has taken the world of web development by...
Read More
Mastering Machine Learning A Beginner's Guide to Python

Mastering Machine Learning: A Beginner’s Guide to Python

Welcome to the world of machine learning! With the ever-increasing demand for artificial intelligence and...
Read More
Unlocking the Power of Data Science with Python A Beginner's Guide

Unlocking the Power of Data Science with Python: A Beginner’s Guide

Data science has become an essential part of many industries today, and Python has become...
Read More

Follow Us

Resources

Presentations
Browse LSET presentations to understand interesting…

Explore Now


eBooks
Get complete guides to empower yourself academically…

Explore Now


Infographics
Learn about information technology and business…

Explore Now