Jandex 2.4.3 and the path to 3.0
by Ladislav Thon
Hi,
last week, I've released Jandex 3.0.0-RC1, and yesterday, I've released
Jandex 2.4.3.Final. (A corresponding release of the Jandex Maven plugin is
on its way to Central as we speak.)
There's a few breaking changes in Jandex 3.0 and the 2.4.3 release is
supposed to make migration easier (or at least require less coordination).
Specifically, Jandex 2.4.3 deprecates these 2 methods because they have a
different return type in 3.0:
- ClassInfo.annotations()
- MethodInfo.parameters()
Replacements are, respectively:
- ClassInfo.annotationsMap()
- MethodInfo.parameterTypes()
These 2 replacement methods are present both in Jandex 2.4.3 and
3.0.0[-RC1].
Additionally, certain usages of MethodInfo.parameters() can be simplified
using MethodInfo.parametersCount() and parameterType(int). These 2 methods
are also present both in 2.4.3 and 3.0.0[-RC1].
Updating to Jandex 2.4.3 is safe, because it's fully compatible with
previous releases. A project that uses Jandex 2.4.3 and avoids deprecated
methods is almost fully _binary_ compatible with Jandex 3.0 (almost because
of the return type change in Indexer.index(), but that should only affect a
very small number of existing code paths).
I went through the projects that I know use Jandex and made the necessary
changes myself and will submit PRs in the coming days. These projects are:
- Quarkus, including ArC and RESTEasy Reactive
- Gizmo
- Weld
- SmallRye OpenAPI
- SmallRye Async API -- no changes required
- SmallRye GraphQL
- WildFly Core -- no changes required, just updating Jandex
- WildFly Full
- RESTEasy (classic) -- no changes required
If you maintain (or know about) some other project that uses Jandex, feel
free to ping me, I'll be happy to help.
Note that there are more changes in Jandex 3.0. All the details can be
found in the issue tracker: https://github.com/smallrye/jandex/milestone/3
For your convenience, here's a summary of what's coming in Jandex 3.0 and
is technically a breaking change, even though most of them won't likely
affect anyone:
- moved Jandex to SmallRye
- bumped minimum Java version to 8
- regularized access to annotations from AnnotationTarget
- this is why ClassInfo.annotations() needs to change the return type
- there are methods to access annotations without considering nested
annotation targets, too!
- regularized access to method parameters from MethodInfo
- this is why MethodInfo.parameters() needs to change the return type
- common parameter-accessing methods on MethodInfo ignore
mandated/synthetic parameters
- special methods exist to access all parameters, including
mandated/synthetic
- added a new kind of types, TypeVariableReference, to faithfully represent
recursive type variables
- changed Indexer.index() to return void (instead of ClassInfo)
- required to be able to post-process an index during Indexer.complete()
- added indexing of class-retained annotations
- Jandex 2 only indexes runtime-retained annotations
- AnnotationInstance.runtimeVisible() can be used to distinguish
- added a few methods to IndexView
- navigation for interfaces: getKnownDirectSubinterfaces(),
getAllKnownSubinterfaces()
- navigation for packages: getClassesInPackage(), getSubpackages()
- breaks projects that implement this interface on their own (which I
know at least WildFly and Quarkus do)
- removed IndexReader.getDataVersion()
- it's been incorrect anyway, and I couldn't find anyone using it
When Jandex 3.0 goes final, which I hope happens in a few weeks, I will
publish an announcement with all details on the SmallRye blog. In the
meantime, I'll use the previously mentioned projects (and their test
suites) to verify that Jandex 3.0 doesn't contain any hidden surprises.
Any questions? Ideas? My inbox and the Jandex issue tracker are always open
:-)
Thanks,
LT
2 years, 3 months
Be cautious with testsuite updates
by Darran Lofthouse
At the moment we are working on a branch called big-bang to refactor the
various testsuites in WildFly to use Jakarta EE 10.
For the next couple of weeks please be careful picking up tasks to develop
these testsuited further, obviously if changes are needed they are needed
but all changes in this area risk merge conflicts with big-bang so unless
the changes are urgent they may be better to hold off or if the testsuite
has already been migrated submitted straight to big-bang directly.
--
Darran Lofthouse
Red Hat <https://www.redhat.com/>
darran.lofthouse(a)jboss.com
<https://www.redhat.com/>
2 years, 6 months
New test suite for the management console
by Harald Pehl
As a follow-up on [1], I wanted to let you know that we set up a new
test suite for the management console: 'hal/manatoko' [2].
The motivation for the new test suite was to address some weak points
with the existing test suite 'hal/testsuite.next' [3]:
- Still on Arquillian 1.6, JUnit 4
- Weak SoC (separation of concerns)
- Hard to run in a CI environment
The new test suite was developed with the idea that each test should be
self-contained. This is possible by leveraging the Testcontainers [4]
framework. WildFly, the management console, and browsers run in containers,
and the unit tests can focus on testing the UI and verifying the modifications
in the management model.
This approach makes running the test suite in CI environments very easy.
We already do this using GitHub actions [5].
Currently, the new test suite doesn't contain all tests from the existing
test suite. But we already migrated 27 of 34 test modules. The migration
requires effort, but the new unit tests can re-use classes from the existing
test suite, such as Arquillian pages and constants from the HAL code base.
In the next month, I'd like to migrate the remaining tests from
'hal/testsuite.next' to 'hal/manatoko'.
If you want to learn more, browse the README.md [6]. If you have any questions
or any ideas or want to get involved, leave a comment or reach out to me.
Best regards
Harald Pehl
---
[1] https://lists.jboss.org/archives/list/wildfly-dev@lists.jboss.org/thread/...
[2] https://github.com/hal/manatoko
[3] https://github.com/hal/testsuite.next
[4] https://www.testcontainers.org/
[5] https://github.com/hal/manatoko/actions
[6] https://github.com/hal/manatoko#readme
2 years, 6 months