[ 
https://issues.apache.org/jira/browse/BCEL-370?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary D. Gregory resolved BCEL-370.
----------------------------------
    Fix Version/s: 6.8.1
       Resolution: Fixed

PR merged to git master.

Please validate your use case against git master and/or a snapshot build from 
https://repository.apache.org/content/repositories/snapshots/


> CONSTANT_Dynamic is not handled in LDC
> --------------------------------------
>
>                 Key: BCEL-370
>                 URL: https://issues.apache.org/jira/browse/BCEL-370
>             Project: Commons BCEL
>          Issue Type: Bug
>    Affects Versions: 6.7.0
>            Reporter: Judit Knoll
>            Priority: Major
>             Fix For: 6.8.1
>
>         Attachments: Foo.class
>
>
> The 
> [org.apache.bcel.generic.LDC|https://github.com/apache/commons-bcel/blob/master/src/main/java/org/apache/bcel/generic/LDC.java]
>  class does not support 
> [Const.CONSTANT_Dynamic|https://github.com/apache/commons-bcel/blob/master/src/main/java/org/apache/bcel/Const.java#L683C52-L683C52]
>  (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|https://github.com/jacoco/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|https://github.com/spotbugs/spotbugs/issues/2503] and 
> [spotbugs/pull/2512|https://github.com/spotbugs/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|https://github.com/spotbugs/spotbugs/issues/2503#issuecomment-1679085646].
> The issue can be reproduced by calling the 
> [org.apache.bcel.generic.TypeTestCase.testLDC(String 
> className)|https://github.com/apache/commons-bcel/blob/master/src/test/java/org/apache/bcel/generic/TypeTestCase.java#L71]
>  method with the attached class file as a parameter.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to