News

Weld 3.1.0.Final

2019-2-6   release   Matej Novotny

Weld 3.1.0.Final and Weld API 3.1.Final are now up for grabs. What’s in it for you?

There are quite a few new things in the mix - InterceptionFactory improvements, new API clases and methods, improvements to class defining for integrators in preparation for JDK 12. We now also support CDI context propagation between threads; there is a whole new SPI that allows users and/or frameworks to propagate request, session or conversation contexts. Last but no least, there are bug fixes, so let’s get right into it!

Note
Integrators (WildFly, Liberty, GlassFish, …​) will have to adjust to the changes made in SPI. Those are, most notably, the removal of long deprecated methods (WELD-2558) and reworked ProxyServices which now delegate class defining responsibility to the integrator (WELD-2556). This is crucial for Weld to operate on newer JDKs (12) and while Weld will work with the old approach for now, we will eventually fully swap to this new SPI.

Fixes and improvements:

  • Weld API/SPI

    • Added API to allow for CDI context propagation between threads (WELD-2497)

      • New API class was introduced (WeldAlterableContext), this class offers methods to manipulate context state

      • You can now propagate Request, Session and Conversation contexts between threads as they all implement WeldAlterableContext

      • This comes with certain limitations and is mostly designed for frameworks which would do this for you (such as MicroProfile Concurrency) but anyone can use it

      • For more information, please glance at this part of Weld documentation

    • WeldManager, providing extra methods over what BeanManager offers, is now an injectable bean (WELD-2538)

    • WeldManager now offers new util methods allowing you to easily grab active contexts

      • This is mainly for the purpose of context propagation as it also allows you to grab all active contexts that support it

    • WeldManager can now be used to check if any given context is active without having to care about exceptions (WELD-2537)

    • Added new SPI for class defining, deprecated old approach in ProxyServices (WELD-2556)

      • Integrators will have to implement this new API to be able to operate on JDK 12+

      • Weld now delegates class defining to integrators in order to avoid having to crack open ClassLoader methods

      • Previously, integrators provided ClassLoader instance which Weld then used to invoke defineClass() methods

      • We now ask integrators to invoke those methods themselves while providing them with all the necessary bits for doing so

    • Remove deprecated parts of API/SPI (WELD-2558)

      • Lots of unused and long deprecated methods were removed, should have no effect on code as those weren’t used anyway (most of them since Weld 3.0.0)

  • Weld Core

    • Weld will now log a WARNING if you try to register an invalid qualifier (WELD-2522)

    • You can now use InterceptionFactory with an interface as a parameter (WELD-2550, WELD-2533)

      • This means the proxy class will be based off an interface which is by definition always proxyable

      • You can therefore even supply an unproxyable implementation and it will still work

      • Note that this is experimental feature with some limitations to it, see Weld docs for more details

    • Correct atomic behaviour in RequestContextController (WELD-2536)

    • Fix rare race condition in ConcurrentValidator (WELD-2545)

    • Small correction to interceptor resolution when they have no bindings (WELD-2521)

    • Enforce consistent behaviour between AnnotatedType and WithAnnotations in regards to default methods (WELD-2551)

    • All proxy-specific methods added by Weld now have more complex names to avoid (very rare) method clashes (WELD-2508)

    • Lower logging level of InterceptorLogger.unableToDetermineInterceptedBean() from WARN to INFO (WELD-2546)

  • Weld SE

    • You can now extend the set of bean defining annotations in Weld SE (WELD-2523)

      • This is handy for when you have discovery on and want custom beans automatically picked up while still avoiding the all discovery mode

    • Fix bug in handling JAR dependencies added onto classpath where you could accidentally add more packages than desired (WELD-2535)

    • Correct ALLOW_OPTIMIZED_CLEANUP configuration key value (WELD-2547)

    • When running with SecurityManager enabled, Weld will now refuse to use ForkJoinPool for startup and will pick different pool instead (WELD-2517)

  • Probe development tool

    • Make sure ProbeExtension has priority over any other existing extensions (WELD-2524)

  • Other

    • Stabilize testsuite and make sure dependencies are EE 8 based (WELD-2519, WELD-2553)

    • Documentation has been updated to reflects EE 8 versions of servers (WELD-2529)

    • Documented all changes coming to Weld API in 3.1 update (WELD-2540)

    • Re-enable SpotBugs code quality checking on JDK 11+ (WELD-2544)

    • Upgraded WildFly Arquillian adapter to 2.1.1.Final (WELD-2543)

    • Revisit testing on Jetty (WELD-2528)

    • We are now regularly testing with JDK 11 and looking into JDK 12 testing

WildFly Patch

This time around, the patch for WildFly 15.0.1.Final is available.

If you’re not familiar with patching WildFly, check the FAQ.


Weld 2.4.8.Final

2018-9-26   release   Matej Novotny

Weld 2 has entered maintenance mode with its 2.4.7.Final release earlier this year. Now we are coming with a maintenance release containing fixes to several nuisances you might have come across.

Notable fixes and improvements:

  • Weld Core:

    • Opt-in enhancement in HTTP session replication, more eager approach (WELD-1130)

      • Note that WildFly does not need to use this

    • AfterTypeDiscovery did not allow to remove declared interceptors/decorators/alternatives correctly (WELD-2479)

    • Corrected decorator subclass creation when said decorator overrides only default method (WELD-2501)

    • Avoid optimizing self invocation of private methods in order to avoid IllegalAccessError(WELD-2506)

    • Allow interception of abstract, package-private classes with public methods (WELD-2507)

    • Fix interception of overriden generic methods invoked via superclass (WELD-2514)

    • Implement reflection fallback for qualifier loading when there are multiple instances of the class in the deployment (WELD-2531)

    • Fixed possible race condition appearing during bean index creation (WELD-2532)

  • Weld SE

    • Fix NPE which could occur if trying to intercept a method called by constructor (WELD-2473 and WELD-2478)

  • Other

    • Correction to licenses in Probe (WELD-2480)

WildFly Patch

As usual, a patch for WildFly 11.0.0.Final is available. If you’re not familiar with patching WildFly, check the FAQ.


Weld 3.0.5.Final

2018-7-26   release   Matej Novotny

Weld 3.0.5.Final is here and hand in hand with it comes Weld API 3.0.SP4. And in case you missed it, there was CDI 2.0.SP1 release as well. It comes with few security manager related fixes and Weld is of course compliant with it. If you are running on a servlet or in SE, you may need to update it yourself, in case of EE it usually falls to the server to update this dependency for you.

Note
This time around we are not providing a patch for WildFly 13 as there were major changes blocking us from doing so. However, Wildfly 14 will contain all of the above updates - Weld core, Weld API, CDI API - so keep an eye out for its release!

As for updates and fixes, we keep looking at JDK 11 and have done another round of fixing to keep up with adjustments and removals going on in JDK. There is a bunch of interceptor/decorator fixes for those of you who indulge in using complex class hierarchies with abstractions, generics and default methods. So let’s take a look at them all, shall we?

Fixes and improvements:

  • Weld Core

    • Fixed possible race condition appearing during bean index creation (WELD-2492)

    • Avoid creating unnecessary bean metatada for anonymous and local classes (WELD-2498)

    • Corrected decorator subclass creation when said decorator overrides only default method (WELD-2501)

    • Avoid optimizing self invocation of private methods in order to avoid IllegalAccessError (WELD-2506)

    • Allow interception of abstract, package-private classes with public methods (WELD-2507)

    • Fix interception of overriden generic methods invoked via superclass (WELD-2514)

    • Implement reflection fallback for qualifier loading when there are multiple instances of the class in the deployment (WELD-2250)

    • Make conversation ID parameter detection more robust (WELD-2512)

  • Weld SE

    • Make default StartMain more container friendly by exiting with error code should an exception appear (WELD-2502)

      • There is also a follow-up custom exception handling proposal if you want to glance at it (WELD-2503)

    • Fix possible NPE coming from beans.xml merging in complex Weld SE deployment scenarios (WELD-2515)

  • JDK 9/10 and onwards

    • WeldProvider moved to servlet core module to align it with how Jigsaw handles services (WELD-2435)

    • Fixed SE/Servlet resource loading behavior when ForkJoinPool is used on JDK 9+ (WELD-2494)

    • Review executability of Weld examples on JDK 10+ (WELD-2495)

    • Update to JBoss Classfilewriter 1.2.3.Final which is JDK 11 compliant (WELD-2509)

    • If running in JPMS, remove dependency on java.desktop to shrink the footprint (WELD-2504)

  • Probe development tool

    • Probe now recognizes BeforeDestroyed event (WELD-2500)

  • Other

    • We are now looking at testing Weld with JDK 11 on a regular basis and have taken steps to ensure it works (WELD-2516)

    • Updated patching profiles for Weld 3 and WFLY, the process is now more automated and configurable (WELD-2491)

    • OSGi bundle now import BCEL only optionally (WELD-2499)


Weld team changes

2018-7-10   team   Martin Kouba

I’m pleased to announce a couple of changes coming to the Weld team.

First of all, Matěj Novotný will be taking over the leadership of the project. Matěj has proven himself to be an excellent engineer, contributing not only to Weld projects but also to the CDI specification and TCK development. I’m really happy that I can hand over the leadership to this guy!

Matěj’s primary task is leading the project towards "Java 11 world" and to meet the other challenges such as reactive programming model enhancements.

Secondly, Nikoleta Žiaková is joining the team as a quality engineer. She’s going to work on expanding our testsuites and improving our continuous integration.

Last but not least, I’m not going to leave the project but stay as a contributor focused on related technologies such as WildFly, Thorntail and MicroProfile.

Martin


Weld 3.0.4.Final

2018-4-26   release   Matej Novotny

Weld 3.0.4.Final is here along with Weld API 3.0.SP3 - make sure you update both.

In this release we took first steps towards eliminating illegal access in JDK 10+. The good news is, Weld should now be able to run with --illegal-access=deny. The project and CI infrastructure around it went through a lot of changes to be able to build and execute on JDK 10 and there is still more to come. There are also numerous optimizations - beans.xml parsing, AT identifier representation, optional memory savings. And of course, bug fixes, so let us take a look at all of it.

Noticeable amount of reports, suggestions and even fixes came from the community - for that you have our thanks (and a new version of Weld of course)!

Fixes and improvements:

  • Weld Core

    • Correct proxy generation for class hierarchy with abstract class and generics (WELD-2470)

    • Opt-in enhancement in HTTP session replication, more eager approach (WELD-1130)

      • Note that WildFly does not need or use this

    • Fix NPE which could occur with SecurityManager if getPermissions() returned null (WELD-2464)

    • Relax bean type check in BeanManager.getInjectableReference() (WELD-2466)

    • AfterTypeDiscovery did not allow to remove declared interceptors/decorators/alternatives correctly (WELD-2479)

    • Two globally selected alternatives with the same priority should result in ambiguous dependency (WELD-2482)

    • Configurator SPI now uses sensible toString() so that user can tell what went wrong (WELD-2484)

    • Improve performance of beans.xml parsing (WELD-2469)

    • Introduce an optional configuration allowing Weld to perform cleanup after boot (WELD-2457 and WELD-2475)

      • In EE servers, if integrators meet certain conditions and allow for this, Weld can them drop metadata from some beans which will not be used in runtime

      • See Docs section for links

    • Optimise String representation of AnnotatedTypeIdentifier (WELD-2477)

  • Weld SE

    • Fix NPE which could occur if trying to intercept a method called by constructor (WELD-2478 and WELD-2473)

  • JDK 9/10 and onwards (WELD-2460)

    • Weld uses JDK’s internal BCEL classes (WELD-2490)

      • This is only used to report errors in generated bytecode on proxies/subclasses

      • We added a dependency on org.apache.bcel:bcel which enables this functionality without reflective access to internal libraries

      • In order to keep Weld’s footprint minimal, this dependency is optional only

    • Upgrade JBoss Classfilewriter to 1.2.2.Final (WELD-2487)

      • Eliminates another bunch of illegal access problems

  • Probe development tool

    • Probe now uses JDK-agnostic Annotation.toString() version (WELD-2463)

    • Correction to licences in Probe (WELD-2480)

  • Docs

    • WeldTerminalListener had wrong FQCN in our documentation which resulted in errors when trying to use it in Tomcat (WELD-2486)

    • Newly added memory-saving option ConfigurationKey.ALLOW_OPTIMIZED_CLEANUP is documented (WELD-2472)

      • If you wish to learn more, please glance here

      • Please note that integrator has to allow for this optimization, otherwise your settings won’t count (psst, WildFly 12 allows this!)

WildFly Patch

As usual, a patch for WildFly 12.0.0.Final is available. Please note that Weld 3.0.4.Final will still allow you to boot up WildFly in either EE 7 or EE 8 mode, whichever you prefer.

If this is the first time you hear about EE 8 mode for WildFly, check this post.

If you’re not familiar with patching WildFly, check the FAQ.