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

Extension guide - merge two sections about bytecode inspection #15324

Merged
merged 1 commit into from
Feb 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions docs/src/main/asciidoc/writing-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2034,18 +2034,18 @@ The only particular aspect of writing Quarkus extensions in Eclipse is that APT

=== Troubleshooting / Debugging Tips

==== Automatically decompile Quarkus bytecode
// This id was previously used for the "Dump the Generated Classes to the File System" section
[[dump-the-generated-classes-to-the-file-system]]
==== Inspecting the Generated/Transformed Classes

As has been mentioned many times in this document, Quarkus always generates a host of classes as part of the build and in many cases also transforms existing classes.
When writing extensions it is often extremely useful to see a decompiled version (i.e. Java source code) of those classes, which is why Quarkus provides the `quarkus.package.fernflower.enabled` property (which is disabled by default).
When the flag is enabled, Quarkus will download and invoke the https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine[Fernflower decompiler] and dump the result in the `decompiled` directory
of the build tool output (`target/decompiled` for Maven for example).
Quarkus generates a lot of classes during the build phase and in many cases also transforms existing classes.
It is often extremely useful to see the generated bytecode and transformed classes during the development of an extension.

==== Dump the Generated Classes to the File System
If you set the `quarkus.package.fernflower.enabled` property to `true` then Quarkus will download and invoke the https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine[Fernflower decompiler] and dump the result in the `decompiled` directory of the build tool output (`target/decompiled` for Maven for example).

During the augmentation phase Quarkus extensions generate new and modify existing classes for various purposes.
Sometimes you need to inspect the generated bytecode to debug or understand an issue.
There are three system properties that allow you to dump the classes to the filesystem:
NOTE: This property only works during a normal production build (i.e. not for dev mode/tests) and when `fast-jar` packaging type is used (the default behavior).

There are also three system properties that allow you to dump the generated/transformed classes to the filesystem and inspect them later, for example via a decompiler in your IDE.

- `quarkus.debug.generated-classes-dir` - to dump the generated classes, such as bean metadata
- `quarkus.debug.transformed-classes-dir` - to dump the transformed classes, e.g. Panache entities
Expand Down Expand Up @@ -2078,7 +2078,6 @@ The property is also honored when running tests:

Analogously, you can use the `quarkus.debug.transformed-classes-dir` and `quarkus.debug.transformed-classes-dir` properties to dump the relevant output.


==== Multi-module Maven Projects and the Development Mode

It's not uncommon to develop an extension in a multi-module Maven project that also contains an "example" module.
Expand Down