Skip to content

Replicate javap's version flag #6

@ExcaliburZero

Description

@ExcaliburZero

Currently we do not take in any command line arguments and flags other than the class file to parse and report on. We also as of #5 have the capability to have the executable not include the code references in the program output.

It would be nice to try to have some flags similar to those provided by javap to configure the output of the executable. A good flag to start with would be the -verbose flag.

For example:

$ javap classes/Dummy.class 
Compiled from "Dummy.java"
public class Dummy {
  public Dummy();
}
$ javap -v classes/Dummy.class
Classfile /home/chris/Code/jvm-class-file-parser/classes/Dummy.class
  Last modified Jan 4, 2021; size 184 bytes
  MD5 checksum a1fc389a27d8a93ab140f4a1ecaa33b7
  Compiled from "Dummy.java"
public class Dummy
  minor version: 0
  major version: 55
  flags: (0x0021) ACC_PUBLIC, ACC_SUPER
  this_class: #2                          // Dummy
  super_class: #3                         // java/lang/Object
  interfaces: 0, fields: 0, methods: 1, attributes: 1
Constant pool:
   #1 = Methodref          #3.#10         // java/lang/Object."<init>":()V
   #2 = Class              #11            // Dummy
   #3 = Class              #12            // java/lang/Object
   #4 = Utf8               <init>
   #5 = Utf8               ()V
   #6 = Utf8               Code
   #7 = Utf8               LineNumberTable
   #8 = Utf8               SourceFile
   #9 = Utf8               Dummy.java
  #10 = NameAndType        #4:#5          // "<init>":()V
  #11 = Utf8               Dummy
  #12 = Utf8               java/lang/Object
{
  public Dummy();
    descriptor: ()V
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: aload_0
         1: invokespecial #1                  // Method java/lang/Object."<init>":()V
         4: return
      LineNumberTable:
        line 1: 0
}
SourceFile: "Dummy.java"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions