Bug 578279 - Eclipse compiler fails to report package conflict problem
Summary: Eclipse compiler fails to report package conflict problem
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.22   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-19 09:14 EST by Nicolas Baumann CLA
Modified: 2022-06-18 16:02 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Baumann CLA 2022-01-19 09:14:53 EST
I have this error :

Errors occurred during the build.
Errors running builder 'Java Builder' on project 'test-gradle'.
java.lang.ArrayIndexOutOfBoundsException
	at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:133)

In my minimal example, I just have one record in src/main/java :

public record MyRecord(String s1, String s2) {
}

My build.gradle at the root my project is :

plugins {
  id 'java'
}

repositories {
  mavenCentral()
}

dependencies {
    //implementation 'org.netbeans.modules:org-netbeans-bootstrap:RELEASE90' // => OK 
    implementation 'org.netbeans.modules:org-netbeans-bootstrap:RELEASE100' // => ArrayIndexOutOfBoundsException 
}

I remote debugged my own Eclipse to find out the ArrayIndexOutOfBoundsException occurs on records. 
When I change a record to a final class, it fails on the next record and so on.
The issue occurs with versions RELEASE100 to RELEASE126 of the dependency but not with RELEASE90.
I also tried all its dependencies successfully but I don't think anything's wrong with the jar itself.
It works fine with a normal command line gradle build.
The issue only occurs in Eclipse.


Version: 2021-12 (4.22.0)
Build id: 20211202-1639

Gradle: 7.3.3
JDK: 17.0.1
Comment 1 Nicolas Baumann CLA 2022-01-20 08:38:26 EST
The java/lang/Module class inside the jar causes the crash!
Comment 2 Kalyan Prasad Tatavarthi CLA 2022-01-22 11:12:32 EST
Moving to JDT Core.
Comment 3 Nicolas Baumann CLA 2022-01-24 10:29:27 EST
Small mistake from me : The java/lang/Module class was introduced in RELEASE110, not RELEASE100. I understand it's illegal to do repackage class from java/lang package but still unhappy to see my favorite tool crash.
Comment 4 Nicolas Baumann CLA 2022-06-18 16:02:53 EDT
Please ignore last comment.

As I look at the code at the line of the crash (QualifiedTypeReference.java:133), I see that the compiler is precisely trying to report that exact same problem of package conflict.

I changed the tile accordingly.

The Netbeans part of the bug is here https://github.com/apache/netbeans/issues/4243.