compiler-explorer / compiler-explorer/compiler-explorer
[REQUEST]: Show Java class annotations
- Dominant language
- TypeScript
- Stars
- 19.1k
- Forks
- 2.1k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 67
Description
### Is your feature request related to a problem? Please describe
Similar to #7702 we don't show annotations for classes. Given a class with an annotation such as https://godbolt.org/z/rzdEnT4MG, we do not show the annotations table. This is the case for both CLASS and RUNTIME retention policies
Below is the raw javap output for `/opt/compiler-explorer/jdk-21.0.0/bin/javap -c -l -p -constants -v Hello`
```java
class Hello
minor version: 0
major version: 65
flags: (0x0020) ACC_SUPER
this_class: #7 // Hello
super_class: #2 // java/lang/Object
interfaces: 0, fields: 0, methods: 1, attributes: 2
Constant pool:
#1 = Methodref #2.#3 // java/lang/Object."":()V
#2 = Class #4 // java/lang/Object
#3 = NameAndType #5:#6 // "":()V
#4 = Utf8 java/lang/Object
#5 = Utf8
#6 = Utf8 ()V
#7 = Class #8 // Hello
#8 = Utf8 Hello
#9 = Utf8 Code
#10 = Utf8 LineNumberTable
#11 = Utf8 SourceFile
#12 = Utf8 test.java
#13 = Utf8 RuntimeInvisibleAnnotations
#14 = Utf8 Lhelp;
{
Hello();
descriptor: ()V
flags: (0x0000)
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."":()V
4: return
LineNumberTable:
line 4: 0
}
SourceFile: "test.java"
RuntimeInvisibleAnnotations:
0: #14()
help
```
### Describe the solution you'd like
It would be cool to output the annotations table
### Describe alternatives you've considered
It hasn't come up before so maybe it's not very important. I think it's still useful to track the unexpected behavior
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.