raphw / byte-buddy

Runtime code generation for the Java virtual machine.
https://bytebuddy.net
Apache License 2.0
6.23k stars 804 forks source link

No JPMS module-info or Automatic-Module-Name in byte-buddy-dep #1659

Closed Mechite closed 3 months ago

Mechite commented 3 months ago

738

This issue still occurs on the latest release. image

In the JAR, there is no Automatic-Module-Name in the MANIFEST, no module-info in root or multi-release folders in META-INF. Therefore, we receive this warning, and it is not safe to use bytebuddy in a JPMS project. This affects me as it will prevent me from modularizing my test suite, which uses Spock, which uses bytebuddy for mocks. It will more strongly affect other people, though, and should be fixed as soon as possible. image

raphw commented 3 months ago

byte-buddy-dep is not supposed to be used without shading. They should change to use byte-buddy instead what includes the module information.

Mechite commented 3 months ago

Spock does not bundle bytebuddy, and only fails when bytebuddy is unavailable when mocking is attempted to be used.

This is a mistake on my end.

Documentation for Spock also suggests the use of byte-buddy dependency. All is good

The following mock makers are built-in, and are selected in this order:

  • java-proxy: Uses the java.lang.reflect.Proxy API to create mocks of interfaces.
  • byte-buddy: Uses https://bytebuddy.net/[Byte Buddy] to create mock objects. ** Requires net.bytebuddy:byte-buddy 1.9+ on the class path.
  • cglib: Deprecated: Uses https://github.com/cglib/cglib[CGLIB] to create mock objects. ** Requires cglib:cglib-nodep 3.2.0+ on the class path.
  • mockito: Uses https://site.mockito.org/[Mockito] to create mock objects. Can be configured to use additional Mockito feature like mock Serializable Requires org.mockito:mockito-core 4.11+ on the class path.