package com.zarbosoft.semicompiled;
import java.lang.Long;
class Main {
public static void myMain() {
long x = Long.valueOf((long) 2).longValue();
}
}
Classfile /tmp/semicompiled-LW2Uf666-QfXtniZ9-5361633425152320347/com/zarbosoft/semicompiled/Main.class
Last modified Jun 2, 2024; size 291 bytes
MD5 checksum b7e44122283af997f8c3c79c8fa27cfb
class com.zarbosoft.semicompiled.Main
minor version: 0
major version: 52
flags: (0x0020) ACC_SUPER
this_class: #6 // com/zarbosoft/semicompiled/Main
super_class: #7 // java/lang/Object
interfaces: 0, fields: 0, methods: 2, attributes: 0
Constant pool:
#1 = Methodref #7.#12 // java/lang/Object."<init>":()V
#2 = Long 2l
#4 = Methodref #13.#14 // java/lang/Long.valueOf:(J)Ljava/lang/Long;
#5 = Methodref #13.#15 // java/lang/Long.longValue:()J
#6 = Class #16 // com/zarbosoft/semicompiled/Main
#7 = Class #17 // java/lang/Object
#8 = Utf8 <init>
#9 = Utf8 ()V
#10 = Utf8 Code
#11 = Utf8 myMain
#12 = NameAndType #8:#9 // "<init>":()V
#13 = Class #18 // java/lang/Long
#14 = NameAndType #19:#20 // valueOf:(J)Ljava/lang/Long;
#15 = NameAndType #21:#22 // longValue:()J
#16 = Utf8 com/zarbosoft/semicompiled/Main
#17 = Utf8 java/lang/Object
#18 = Utf8 java/lang/Long
#19 = Utf8 valueOf
#20 = Utf8 (J)Ljava/lang/Long;
#21 = Utf8 longValue
#22 = Utf8 ()J
{
com.zarbosoft.semicompiled.Main();
descriptor: ()V
flags: (0x0000)
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
public static void myMain();
descriptor: ()V
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=2, locals=2, args_size=0
0: ldc2_w #2 // long 2l
3: invokestatic #4 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
6: invokevirtual #5 // Method java/lang/Long.longValue:()J
9: lstore_0
10: return
}
package asm.com.zarbosoft.semicompiled;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Attribute;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.ConstantDynamic;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Handle;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.RecordComponentVisitor;
import org.objectweb.asm.Type;
import org.objectweb.asm.TypePath;
public class MainDump implements Opcodes {
public static byte[] dump() throws Exception {
ClassWriter classWriter = new ClassWriter(0);
FieldVisitor fieldVisitor;
RecordComponentVisitor recordComponentVisitor;
MethodVisitor methodVisitor;
AnnotationVisitor annotationVisitor0;
classWriter.visit(
V1_8, ACC_SUPER, "com/zarbosoft/semicompiled/Main", null, "java/lang/Object", null);
{
methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
methodVisitor.visitCode();
methodVisitor.visitVarInsn(ALOAD, 0);
methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
methodVisitor.visitInsn(RETURN);
methodVisitor.visitMaxs(1, 1);
methodVisitor.visitEnd();
}
{
methodVisitor = classWriter.visitMethod(ACC_PUBLIC | ACC_STATIC, "myMain", "()V", null, null);
methodVisitor.visitCode();
methodVisitor.visitLdcInsn(new Long(2L));
methodVisitor.visitMethodInsn(
INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false);
methodVisitor.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J", false);
methodVisitor.visitVarInsn(LSTORE, 0);
methodVisitor.visitInsn(RETURN);
methodVisitor.visitMaxs(2, 2);
methodVisitor.visitEnd();
}
classWriter.visitEnd();
return classWriter.toByteArray();
}
}
Classfile /tmp/semicompiled-LW2Uf666-QfXtniZ9-5361633425152320347/com/zarbosoft/semicompiled/Main.class
Last modified Jun 2, 2024; size 478 bytes
MD5 checksum 74ead131afee57cf62fa878c99d77fed
Compiled from "Main.java"
class com.zarbosoft.semicompiled.Main
minor version: 0
major version: 52
flags: (0x0020) ACC_SUPER
this_class: #6 // com/zarbosoft/semicompiled/Main
super_class: #7 // java/lang/Object
interfaces: 0, fields: 0, methods: 2, attributes: 1
Constant pool:
#1 = Methodref #7.#20 // java/lang/Object."<init>":()V
#2 = Long 2l
#4 = Methodref #21.#22 // java/lang/Long.valueOf:(J)Ljava/lang/Long;
#5 = Methodref #21.#23 // java/lang/Long.longValue:()J
#6 = Class #24 // com/zarbosoft/semicompiled/Main
#7 = Class #25 // java/lang/Object
#8 = Utf8 <init>
#9 = Utf8 ()V
#10 = Utf8 Code
#11 = Utf8 LineNumberTable
#12 = Utf8 LocalVariableTable
#13 = Utf8 this
#14 = Utf8 Lcom/zarbosoft/semicompiled/Main;
#15 = Utf8 myMain
#16 = Utf8 x
#17 = Utf8 J
#18 = Utf8 SourceFile
#19 = Utf8 Main.java
#20 = NameAndType #8:#9 // "<init>":()V
#21 = Class #26 // java/lang/Long
#22 = NameAndType #27:#28 // valueOf:(J)Ljava/lang/Long;
#23 = NameAndType #29:#30 // longValue:()J
#24 = Utf8 com/zarbosoft/semicompiled/Main
#25 = Utf8 java/lang/Object
#26 = Utf8 java/lang/Long
#27 = Utf8 valueOf
#28 = Utf8 (J)Ljava/lang/Long;
#29 = Utf8 longValue
#30 = Utf8 ()J
{
com.zarbosoft.semicompiled.Main();
descriptor: ()V
flags: (0x0000)
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 5: 0
LocalVariableTable:
Start Length Slot Name Signature
0 5 0 this Lcom/zarbosoft/semicompiled/Main;
public static void myMain();
descriptor: ()V
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=2, locals=2, args_size=0
0: ldc2_w #2 // long 2l
3: invokestatic #4 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
6: invokevirtual #5 // Method java/lang/Long.longValue:()J
9: lstore_0
10: return
LineNumberTable:
line 7: 0
line 8: 10
LocalVariableTable:
Start Length Slot Name Signature
10 1 0 x J
}
SourceFile: "Main.java"
package asm.com.zarbosoft.semicompiled;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Attribute;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.ConstantDynamic;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Handle;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.RecordComponentVisitor;
import org.objectweb.asm.Type;
import org.objectweb.asm.TypePath;
public class MainDump implements Opcodes {
public static byte[] dump() throws Exception {
ClassWriter classWriter = new ClassWriter(0);
FieldVisitor fieldVisitor;
RecordComponentVisitor recordComponentVisitor;
MethodVisitor methodVisitor;
AnnotationVisitor annotationVisitor0;
classWriter.visit(
V1_8, ACC_SUPER, "com/zarbosoft/semicompiled/Main", null, "java/lang/Object", null);
classWriter.visitSource("Main.java", null);
{
methodVisitor = classWriter.visitMethod(0, "<init>", "()V", null, null);
methodVisitor.visitCode();
Label label0 = new Label();
methodVisitor.visitLabel(label0);
methodVisitor.visitLineNumber(5, label0);
methodVisitor.visitVarInsn(ALOAD, 0);
methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
methodVisitor.visitInsn(RETURN);
Label label1 = new Label();
methodVisitor.visitLabel(label1);
methodVisitor.visitLocalVariable(
"this", "Lcom/zarbosoft/semicompiled/Main;", null, label0, label1, 0);
methodVisitor.visitMaxs(1, 1);
methodVisitor.visitEnd();
}
{
methodVisitor = classWriter.visitMethod(ACC_PUBLIC | ACC_STATIC, "myMain", "()V", null, null);
methodVisitor.visitCode();
Label label0 = new Label();
methodVisitor.visitLabel(label0);
methodVisitor.visitLineNumber(7, label0);
methodVisitor.visitLdcInsn(new Long(2L));
methodVisitor.visitMethodInsn(
INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false);
methodVisitor.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J", false);
methodVisitor.visitVarInsn(LSTORE, 0);
Label label1 = new Label();
methodVisitor.visitLabel(label1);
methodVisitor.visitLineNumber(8, label1);
methodVisitor.visitInsn(RETURN);
Label label2 = new Label();
methodVisitor.visitLabel(label2);
methodVisitor.visitLocalVariable("x", "J", null, label1, label2, 0);
methodVisitor.visitMaxs(2, 2);
methodVisitor.visitEnd();
}
classWriter.visitEnd();
return classWriter.toByteArray();
}
}
Join the thriving social scene at github.com/andrewbaxter/semicompiled.