eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Eclipse 2023-09 erroneously reports a type hierarchy cycle and compiles successfully anyway

Open
#1,737 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

## Bug description ##

This bug was introduced in Eclipse 2023-09. Compilation worked with Eclipse 2023-06. I only detected this bug in eclipse 2023-12, because we skipped eclipse 2023-09 due to #1376.

When we try to compile our project, two exceptions are thrown:
1. Cycle detected: a cycle exists in the type hierarchy between OutputStep.XmlElementInputDataSource and BrowserOutputStep
2. The hierarchy of the type BrowserOutputStep is inconsistent

Strangely enough, class-files that are functional are produced by the compiler.

The architecture of the two relevant classes looks like this:
```
package test;

public class BrowserOutputStep extends OutputStep {

interface InputDataSource {
}

}
```

```
package test;

import test.BrowserOutputStep.InputDataSource;

public class OutputStep {

class XmlElementInputDataSource implements InputDataSource {
}
}

```

Unfortunately, the bug is hard to reproduce:
If these two example classes are copied to a new eclipse project, compilation works, and the bug is not produced.

In our project, the errors are only triggered during the initial build (or a clean build). When we change any of the classes in some minor way, the compiler manages to compile the classes and the errors disappear.

After moving the interface to its own file, the errors are also not triggered during a clean build.

## Analysis ##

I tried to turn on logging for my eclipse instance but failed. I added the following line to my eclipse.ini:
```
-debug

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.