Skip to content

WELD-2828 Ensure a proxy target JPMS module can read Weld JPMS modules#3280

Closed
arjantijms wants to merge 0 commit intoweld:6.0from
arjantijms:6.0
Closed

WELD-2828 Ensure a proxy target JPMS module can read Weld JPMS modules#3280
arjantijms wants to merge 0 commit intoweld:6.0from
arjantijms:6.0

Conversation

@arjantijms
Copy link
Copy Markdown
Contributor

When running Weld purely on the module path, it appears generated proxies don't work out of the box.

Weld contains code to ensure it can read the target module for which a proxy is inserted, but it doesn't do the reverse; make sure the target module can read Weld. This latter is needed because the proxy uses Weld classes, so the module obviously needs to have access to Weld.

This came up in eclipse-ee4j/jersey#6043

@arjantijms arjantijms requested a review from manovotn as a code owner January 16, 2026 23:00
@manovotn
Copy link
Copy Markdown
Member

IIUIC, you only need this because we don't have module name that the other project could explicitly declare reads on and you want to avoid adding that as a JVM param. Is that right?

If that's the case then I think we should rather look into having at least the automatic module names.
While your code isn't wrong it doesn't feel quite right to crack open modules by generating bytecode at runtime.

Also, this only solves the case when default proxy services are used - integrators are allowed to override that.
Which is also a way you could implement this outside of Weld (even if you just extend the current impl and override some methods).

@arjantijms
Copy link
Copy Markdown
Contributor Author

Is that right?

No, unfortunately not.

Weld is an implementation module where modules for which proxies are created probably not know about, or almost certainly don't know about.

Even if a module is aware that its classes are used for CDI, it's still not advisable for such module to declare a dependency on specific Weld modules.

Therefore, Weld having an automatic module name or even a true module-info.java would not change anything here.

@arjantijms
Copy link
Copy Markdown
Contributor Author

While your code isn't wrong it doesn't feel quite right to crack open modules by generating bytecode at runtime.

The problem is basically that we are already putting (injecting) a generated class into a target module. That generated class (the proxy) uses private implementation classes that the target module does not have access to.

Essentially that is the part that in a modulair world doesn't feel quite right, but obviously we can't just easily redesign that.

@manovotn
Copy link
Copy Markdown
Member

Thank you for the explanation, it makes sense now.

The only thing I am considering is whether this should be added to core where it affects all variations of Weld.
Though I suppose it does as for at least SE, there is no other way to achieve this 🤔

@arjantijms
Copy link
Copy Markdown
Contributor Author

p.s.

Also, this only solves the case when default proxy services are used - integrators are allowed to override that.

Yes, that's why I added it specifically there and not somewhere further up. Integrators have to use their own code and/or maybe look at the default proxy services as example.

@manovotn manovotn changed the title Ensure a proxy target JPMS module can read Weld JPMS modules WELD-2828 Ensure a proxy target JPMS module can read Weld JPMS modules Jan 20, 2026
@manovotn manovotn closed this Jan 20, 2026
@manovotn
Copy link
Copy Markdown
Member

Oops, made a bad push while renaming the commit to include the JIRA issue and that closed it.
I can't reopen it from here. I will just create a new one and send one for 7.x while at it.

@manovotn
Copy link
Copy Markdown
Member

manovotn commented Jan 20, 2026

Weld 6 PR - #3281
Weld 7 PR - #3282

JIRA - https://issues.redhat.com/browse/WELD-2828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants