On Thu, 5 Mar 2026 01:11:17 GMT, Hyeonsoo Lee <[email protected]> wrote:

>> ## Summary
>> 
>> Follow-up to [JDK-8341608](https://bugs.openjdk.org/browse/JDK-8341608), 
>> which addressed `ClassFileError` propagation in jdeps but did not fix the 
>> underlying signature parsing.
>> 
>> `SignaturesImpl.classTypeSig()` throws `IllegalArgumentException` when 
>> parsing a class type signature that contains an empty identifier after the 
>> inner class separator `.`.
>> 
>> ## Problem
>> 
>> The Scala compiler emits class type signatures such as:
>> 
>>     
>> Lcoursierapi/shaded/scala/collection/immutable/TreeMap$TreeMapBuilder<TK;TV;>.;
>> 
>> Here the `.` after the type arguments is followed directly by `;` with no 
>> inner class name. While this violates JVMS ยง4.7.9.1 (which requires an 
>> identifier after `.`), such signatures exist widely in published Scala 
>> artifacts on Maven Central and cannot be recompiled.
>> 
>> Running `jdeps` against JARs containing these signatures crashes with:
>> 
>>     Exception in thread "main" 
>> com.sun.tools.jdeps.Dependencies$ClassFileError
>>     Caused by: java.lang.IllegalArgumentException:
>>       Unexpected character ; at position 78, expected an identifier
>> 
>> ## Fix
>> 
>> In `classTypeSig()`, the identifier after `.` is now optional when an outer 
>> type is already present. On the first iteration (no outer type), an 
>> identifier is still strictly required.
>> 
>> ## Test
>> 
>> Added `LOuter<TK;TV;>.;` to `goodTypeSignatures` in `SignaturesTest`.
>
> Hyeonsoo Lee has refreshed the contents of this pull request, and previous 
> commits have been removed. The incremental views will show differences 
> compared to the previous content of the PR. The pull request contains one new 
> commit since the last revision:
> 
>   jdeps: catch ClassFileError in transitive dependency analysis path
>   
>   DependencyFinder.parse(Archive, Finder, String) is used by
>   DepsAnalyzer.transitiveDeps() to resolve individual classes by name.
>   Unlike ClassFileReader.forEachClassFile(), this code path did not
>   catch Dependencies.ClassFileError, causing jdeps to crash when
>   encountering malformed class files during transitive analysis.
>   
>   This is a follow-up to JDK-8341608, which added ClassFileError
>   handling only in the initial archive parsing path.

https://mvnrepository.com/artifact/io.get-coursier/interface/1.0.28


jdeps -R interface-1.0.28.jar 


Exception in thread "main" com.sun.tools.jdeps.Dependencies$ClassFileError: 
Unexpected character ; at position 78, expected an identifier: 
Lcoursierapi/shaded/scala/collection/immutable/TreeMap$TreeMapBuilder<TK;TV;>.;
        at 
jdk.jdeps/com.sun.tools.jdeps.Dependencies$BasicDependencyFinder$Visitor.scanAttributes(Dependencies.java:630)
        at 
jdk.jdeps/com.sun.tools.jdeps.Dependencies$ClassDependencyFinder.findDependencies(Dependencies.java:468)
        at 
jdk.jdeps/com.sun.tools.jdeps.DependencyFinder$Finder.findDependencies(DependencyFinder.java:315)
        at 
jdk.jdeps/com.sun.tools.jdeps.DependencyFinder.parse(DependencyFinder.java:242)
        at 
jdk.jdeps/com.sun.tools.jdeps.DependencyFinder.parse(DependencyFinder.java:148)
        at 
jdk.jdeps/com.sun.tools.jdeps.DepsAnalyzer.transitiveDeps(DepsAnalyzer.java:246)
        at jdk.jdeps/com.sun.tools.jdeps.DepsAnalyzer.run(DepsAnalyzer.java:139)
        at 
jdk.jdeps/com.sun.tools.jdeps.JdepsTask$AnalyzeDeps.run(JdepsTask.java:764)
        at 
jdk.jdeps/com.sun.tools.jdeps.JdepsTask$AnalyzeDeps.run(JdepsTask.java:751)
        at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:571)
        at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:529)
        at jdk.jdeps/com.sun.tools.jdeps.Main.main(Main.java:50)
Caused by: java.lang.IllegalArgumentException: Unexpected character ; at 
position 78, expected an identifier: 
Lcoursierapi/shaded/scala/collection/immutable/TreeMap$TreeMapBuilder<TK;TV;>.;
        at 
java.base/jdk.internal.classfile.impl.SignaturesImpl.error(SignaturesImpl.java:377)
        at 
java.base/jdk.internal.classfile.impl.SignaturesImpl.unexpectedError(SignaturesImpl.java:371)
        at 
java.base/jdk.internal.classfile.impl.SignaturesImpl.requireIdentifier(SignaturesImpl.java:239)
        at 
java.base/jdk.internal.classfile.impl.SignaturesImpl.classTypeSig(SignaturesImpl.java:174)
        at 
java.base/jdk.internal.classfile.impl.SignaturesImpl.referenceTypeSig(SignaturesImpl.java:141)
        at 
java.base/jdk.internal.classfile.impl.SignaturesImpl.typeSig(SignaturesImpl.java:135)
        at 
java.base/jdk.internal.classfile.impl.SignaturesImpl.parseSignature(SignaturesImpl.java:98)
        at java.base/java.lang.classfile.Signature.parseFrom(Signature.java:68)
        at 
java.base/java.lang.classfile.attribute.SignatureAttribute.asTypeSignature(SignatureAttribute.java:103)
        at 
jdk.jdeps/com.sun.tools.jdeps.Dependencies$BasicDependencyFinder$Visitor.scanAttributes(Dependencies.java:603)
        ... 11 more

-------------

PR Comment: https://git.openjdk.org/jdk/pull/30041#issuecomment-4004388150

Reply via email to