Questions about the JVM .class bytecode format or instruction set.
Questions tagged [jvm-bytecode]
188 questions
128
votes
11 answers
Tool to read and display Java .class versions
Do any of you know of a tool that will search for .class files and then display their compiled versions?
I know you can look at them individually in a hex editor but I have a lot of class files to look over (something in my giant application is…

SCdF
- 57,260
- 24
- 77
- 113
83
votes
3 answers
Kotlin Bytecode - How to analyze in IntelliJ IDEA?
I want to see the compiled bytecode so I can learn more about how it works under the cover. I'm using IntelliJ IDEA 15 but can't find a way to see the bytecode. What am I missing?

CaseyB
- 24,780
- 14
- 77
- 112
42
votes
3 answers
Dynamic Java Bytecode Manipulation Framework Comparison
There are some frameworks out there for dynamic bytecode generation, manipulation and weaving (BCEL, CGLIB, javassist, ASM, MPS). I want to learn about them, but since I don't have much time to know all the details about all of them, I would like to…

Victor Stafusa - BozoNaCadeia
- 13,995
- 13
- 56
- 72
25
votes
2 answers
Null or empty lambda as default value
Which solution is better? Using a nullable lambda or passing an empty lambda as a default parameter? Would kotlin somehow optimize empty lambda, or create a new instance that does nothing?
class Test1(val action: () -> Unit = {})
Unfortunately, I do…

Paweł Byszewski
- 390
- 1
- 5
- 11
16
votes
1 answer
Java bytecode decompiler in IntelliJIDEA for Scala
I'm using IntellijIDEA Ultimate Edition. Browsing .class files that compiled from java source code is easy: I can just double-click on .class file and IDEA will decompile it.
However, with .class files that were compiled from scala source code it's…

Dmitry K
- 1,142
- 2
- 16
- 27
13
votes
3 answers
java.lang.VerifyError: Stack map does not match the one at exception handler
Faced this java.lang.VerifyError with code snippet as below during JVM loading bytecode.
try{
-----
} catch (NumberFormatException|CalculationException e) {
}
Here CalculationException is custom exception which extends java.lang.RuntimeException,…

tarunk
- 549
- 2
- 7
- 17
13
votes
1 answer
Kotlin inlined extension property
I know inline keyword means to avoid the call overhead calling a funtion. But I can't figure out what inline a extension property work for?
Let say we have two extension property named foo and another with is inlined named bar
val Any.foo : Long
…

crgarridos
- 8,758
- 3
- 49
- 61
11
votes
3 answers
Reversed if condition in java bytecode
Consider simple example
private static String isPositive(int val) {
if (val > 0) {
return "yes";
} else {
return "no";
}
}
Here it's pretty straightforward: if val > 0 return yes else return no.
But after compilation, in…

esin88
- 3,091
- 30
- 35
10
votes
1 answer
Status of JSR/RET in JVM spec
There are some parts of the JVM specification which suggest that the operations JSR (Jump SubRoutine), JSR_W (Jump SubRoutine Wide) and RET (RETurn from subroutine) may be used only up to class file version 50.0 (JDK 1.6):
3.13 Compiling…

MvG
- 57,380
- 22
- 148
- 276
9
votes
4 answers
Bytecode transforming record class to be mutable
I just saw that EBean does bytecode transformation of record class files in a way that feels odd to me and I seek an answer about whether this is legal from a JVM point of view.
Apparently, it is possible to have a class file, where the class…

Christian Beikov
- 15,141
- 2
- 32
- 58
9
votes
1 answer
Javap output: difference static {} and public {}
I have two example class files, one from an example Java app and one from an example C app (compiled to bytecode using LLJVM).
Looking at their outputs, I can see through javap -c -p that for initializing the (static) fields, the Java app shows the…

Sven
- 173
- 8
9
votes
1 answer
How to create a dynamic proxy using ByteBuddy
In Java it is possible to create dynamic proxies using an implementation of InvocationHandler. Despite JVM optimizations, using reflection will always have some overhead invoking a method.
To try to solve this problem, I tried to use ByteBuddy to…

Carlos Melo
- 3,052
- 3
- 37
- 45
7
votes
3 answers
Why does java bytecode "store" often followed by "load"?
When I read jvm bytecode which from some small java function, I found that when a new local variable is caculated on the operand stack, assuming that it will be stored in the local variable table, but usually it will be loaded to the operand stack…

Q_SJ
- 207
- 1
- 4
- 13
7
votes
1 answer
Variable 'final' modifier lost in Bytecode?
Analyzing the bytecode of this simple class, I have come to the conclusion that the compiler doesn't retain any information about a local variable being final. This seems weird though, since I believe the HotSpot compiler could actually use this…

Clashsoft
- 11,553
- 5
- 40
- 79
7
votes
1 answer
Why is there no ICMP instruction?
As some of you might know, we have a ton of opcodes for comparing different types of primitive…

Clashsoft
- 11,553
- 5
- 40
- 79