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

Output a comment with unknown attributes #284

Open
zeichenreihe opened this issue Jul 9, 2023 · 1 comment
Open

Output a comment with unknown attributes #284

zeichenreihe opened this issue Jul 9, 2023 · 1 comment
Labels
enhancement New feature or request Priority: Low Low priority Subsystem: Parsing Anything concerning how bytecode is parsed and read Subsystem: Writing Anything concerning how expressions are written

Comments

@zeichenreihe
Copy link

As the jvm must silently ignore any unknown attributes, and having a look at attributes might be relevant, VF showing attributes it doesn't know (in comment form), would be a nice feature to have.

If for example the ClassFile structure has some attribute with name VFDoesntKnowThis, with the data in the info being 20, 30, 40, 155, it should produce something like, possibly even escaping non-printable (or non-ascii) utf8 in the name

// VF: Unknown Attribute: "VFDoesntKnowThis" [20, 30, 40, 255]
// VF: Unknown Attribute: "VFDoesntKnowThisAgain" []
class ThatClass {
  // VF: Unknown Attribute: "VFDoesntKnowThisFieldAttr" [0, 255]
  String foo;

  // VF: Unknown Attribute: "VFDoesntKnowThisMethodAttr" []
  void bar() {
    // VF: Unknown Attribute: "VFDoesntKnowThisCodeAttr" [23, 233]
    System.out.println("Hello world!");
  }
}

Something similar should happen for an attribute on a field_info and on a method_info, and for a Code_attribute, it should be in the first line of the method.

@skyrising
Copy link
Contributor

The JVM must silently ignore them, so why shouldn't VF ignore them as well? Sure it might be interesting to see them, but javap can already do that, so I don't really see much value in VF outputting a list of numbers.

@jaskarth jaskarth added enhancement New feature or request Subsystem: Writing Anything concerning how expressions are written Priority: Low Low priority Subsystem: Parsing Anything concerning how bytecode is parsed and read labels Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Priority: Low Low priority Subsystem: Parsing Anything concerning how bytecode is parsed and read Subsystem: Writing Anything concerning how expressions are written
Projects
None yet
Development

No branches or pull requests

3 participants