Bug 577072

Summary: Multi release JAR class loading is messy
Product: [Eclipse Project] JDT Reporter: Jeff MAURY <jmaury>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: loskutov
Version: 4.21Keywords: needinfo
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard: stalebug
Attachments:
Description Flags
Project
none
Simple test project none

Description Jeff MAURY CLA 2021-11-04 14:05:55 EDT
When a JAR from the class path is a multi release JAR, versions specific classes are shown in the tree but they can not be opened.

To reproduce, create a Maven project from the POM:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.redhat.devtools</groupId>
  <artifactId>multijar</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  <properties>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
  </properties>
  
  <dependencies>
    <dependency>
      <groupId>io.smallrye</groupId>
      <artifactId>smallrye-context-propagation</artifactId>
      <version>1.2.2</version>
    </dependency>
  </dependencies>
</project>

Then in the Maven dependencies, you should see the io.smallrye.context.Jdk9CompletableFutureWrapper class. Try to open it and you will get the error
Comment 1 Jeff MAURY CLA 2021-11-04 14:08:21 EDT
Seems to me the buggy code is in org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryTypeFactory.java around line 72
Comment 2 Andrey Loskutov CLA 2021-11-09 09:48:44 EST
Don't get me wrong, could you please attach a simple "ready to use" project that demonstrates the problem? This will save our all time.

(In reply to Jeff MAURY from comment #1)
> Seems to me the buggy code is in
> org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/
> BinaryTypeFactory.java around line 72

If you have patch in mind, please share. Line 72 in current master doesn't look wrong to me.
Comment 3 Jeff MAURY CLA 2021-11-09 10:06:29 EST
Created attachment 287469 [details]
Project
Comment 4 Andrey Loskutov CLA 2022-04-07 09:07:54 EDT
Please report the issue for m2e project: https://github.com/eclipse-m2e/m2e-core/issues or provide a reproducer that doesn't use m2e.
Comment 5 Jeff MAURY CLA 2022-04-08 03:41:31 EDT
Created attachment 288417 [details]
Simple test project

Simple test project without Maven
Comment 6 Eclipse Genie CLA 2024-04-06 12:41:47 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.