Menu

#5 ACC_SUPER flag incorrectly added to interfaces

open
nobody
None
5
2009-11-13
2009-11-13
Alexei
No

The JVM spec 2nd ed., 4.1 The ClassFile Structure reads:
...
If the ACC_INTERFACE flag of this class file is set, its ACC_ABSTRACT flag must also be set (§2.13.1) and its ACC_PUBLIC flag may be set. Such a class file may not have any of the other flags in Table 4.1 set.
...

However, Jasmin-2.3 does not adds ACC_ABSTRACT to interfaces (though it does not fail class loading so far), and adds ACC_SUPER flag, which causes java.lang.ClassFormatError: Illegal class modifiers.

The bug is in the file src/jasmin/parser.cup, line 211.

Runtime used: Sun's JDK 1.6.0_12.

Discussion

  • Anonymous

    Anonymous - 2012-09-19

    I know I'm posting this several years after this bug report was made, but my personal jasmin github repository has a patch for this: https://github.com/luiscubal/jasmin/commit/343a5da03d884d7c0998ed5eaa50632c8205499a
    Feel free to use it if you want to.

    (Just remove "RuntimeConstants.ACC_SUPER |" from parser.cup line 210)

     

    Last edit: Anonymous 2014-08-19
  • Dan Smith

    Dan Smith - 2013-03-07

    Yes, please. The fix is trivial, and 2.4 was released long after this bug report. If there is ever a 2.5, please fix it there.

    In the mean time, Jasmin 2.4 is unusable to generate interfaces with bytecode version 49.0 or later. (The workaround is ".bytecode 48.0", or using no ".bytecode" instruction at all.)

    As an RFE, it would be nice to be able to express the ACC_SUPER flag directly (probably as an "opt out" for classes and an "opt in" for interfaces).

     

Log in to post a comment.