Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated classes are not associated with an artifact #44657

Open
dmlloyd opened this issue Nov 22, 2024 · 4 comments
Open

Generated classes are not associated with an artifact #44657

dmlloyd opened this issue Nov 22, 2024 · 4 comments

Comments

@dmlloyd
Copy link
Member

dmlloyd commented Nov 22, 2024

We generate all of our classes into one big bucket, with no link between the class and the artifact it is augmenting. This causes problems with modules, which require a strong association between package and module. We should link up each class to its corresponding host artifact. This could be done in a few different ways (with different pros/cons):

  • Link to the artifact coordinates from the generated class BI
  • Link to a host class from the generated class BI (this is somewhat similar to how defining classes via Lookup works)
  • Some external mapping of generated class package to artifact (this falls down if we start allowing multiple instances of an artifact in the run time image e.g. two versions of Kafka)

It's not clear which (if any) of these ideas is practical.

References:

  • io.quarkus.deployment.builditem.GeneratedClassBuildItem
  • java.lang.Module#getPackages
  • java.lang.invoke.MethodHandles.Lookup#defineClass
  • java.lang.invoke.MethodHandles.Lookup#defineHiddenClass
  • java.lang.invoke.MethodHandles.Lookup#defineHiddenClassWithClassData
@geoand
Copy link
Contributor

geoand commented Nov 25, 2024

Which mode is this affecting?

Because if we are talking about prod-mode, I would love to know how this a problem because we are just dumping class files into a jar in some package.

Copy link

quarkus-bot bot commented Nov 25, 2024

/cc @Sanne (core), @aloubyansky (core), @gsmet (core), @radcortez (core), @stuartwdouglas (core)

@dmlloyd
Copy link
Member Author

dmlloyd commented Nov 25, 2024

This is affecting all modes when launching a modular app (which I'm developing out of tree right now). Essentially, if you're using modules, you cannot split packages.

@geoand
Copy link
Contributor

geoand commented Nov 25, 2024

Okay, thanks. Now I see what you mean

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

No branches or pull requests

2 participants