open-telemetry / open-telemetry/opentelemetry-java-instrumentation
MuzzleCodeGenerationPlugin is not a proper Byte Buddy plugin
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 1.2k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 228
Description
Is your feature request related to a problem? Please describe.
The API docs for net.bytebuddy.build.Plugin say, among other things:
Plugin types must be public, non-abstract and must declare a public default constructor to work.
MuzzleCodeGenerationPlugin does not declare any default constructor, only a custom one accepting a URLClassLoader argument. I.e., the plugin neither works from Byte Buddy (BB) Maven nor BB Gradle plugin, only from the custom Gradle plugin. Otherwise, it would easily be possible to use the regular BB plugins, no custom plugin would be necessary. The apply interface method accepts 3 parameters, among them a ClassFileLocator which is completely ignored by MuzzleCodeGenerationPlugin in favour of the URLClassLoader.
Describe the solution you'd like
I suggest to refactor the plugin into something using BB infrastructure as intended, which in the end would mean less code to maintain (no more custom build plugin but the default BB build plugins for Maven and Gradle calling the BB plugin implementation via normal parametrisation). The build process for extensions would be closer to the standard BB provides infrastructure for, and on top of Gradle Maven would be supported out of the box.
Describe alternatives you've considered
No response
Additional context
See this related Stack Overflow question which I have answered, describing workarounds for Maven.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating MuzzleCodeGenerationPlugin and reading the net.bytebuddy.build.Plugin API requirements described in the issue. Compare its URLClassLoader constructor and apply method with the Byte Buddy Maven and Gradle plugin integration paths. Done means the plugin uses the standard Byte Buddy infrastructure and supports both Maven and Gradle without the custom build plugin.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100