Uploaded image for project: 'Commons BCEL'
  1. Commons BCEL
  2. BCEL-370

CONSTANT_Dynamic is not handled in LDC

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 6.7.0
    • 6.8.1
    • None
    • None

    Description

      The org.apache.bcel.generic.LDC class does not support Const.CONSTANT_Dynamic (Condy, Dynamic class-file constant) in the following methods:

      • public Type getType(final ConstantPoolGen cpg);
      • public Object getValue(final ConstantPoolGen cpg);

      JaCoCo >= 0.8.4 (see jacoco/pull/845) creates class files which have Constant_Dynamic. When visiting the instructions of a method and calling either of the mentioned method of LDC, an IllegalArgumentException occurs: "Unknown or invalid constant type at 32".

      This error causes a problem, when someone tries to analyze a class file containing condy with spotbugs, which uses BCEL. The error was originally found in spotbugs (see spotbugs/issues/2503 and spotbugs/pull/2512).

      Attached a class built by Java 17 and JaCoCo 0.8.9., the source of this file is spotbugs/issues/2503/comment.
      The issue can be reproduced by calling the org.apache.bcel.generic.TypeTestCase.testLDC(String className) method with the attached class file as a parameter.

      Attachments

        1. Foo.class
          0.8 kB
          Judit Knoll

        Issue Links

          Activity

            People

              Unassigned Unassigned
              juditknoll Judit Knoll
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: