eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
156 stars 123 forks source link

SplitPackageBinding might be added as child of PlainPackageBinding #2748

Closed PPazderski closed 1 month ago

PPazderski commented 1 month ago

There is some additional context for this at the end of #2646.

In that issue I described a false "package not found" error I got from the compiler which is, at least for my project setup, avoided with #2730.

Stephan mentioned and added an assert to ensure a SplitPackageBinding is never a child (knownPackage) of a PlainPackageBinding but I still see this happening. This time I was able to create a reproducing example.

multi-module-project.zip

The zip contains four projects. If I compile the "app" project (or all) I will run into the new assertion. https://github.com/eclipse-jdt/eclipse.jdt.core/blob/7ea3685728d498c68f7f132a034049a7ba94da06/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/PlainPackageBinding.java#L50

I also transformed this project setup into a unit test. Will link it in the next comment. (they are not exactly equal but should behave the same)

PPazderski commented 1 month ago

JUnit test which should trigger the assertion can be found at

https://github.com/PPazderski/eclipse.jdt.core/commit/a4ca0b9d29eec9915fce5cdd05ed35a9d7bb7291

stephan-herrmann commented 1 month ago

Thanks, @PPazderski - greatly appreciate your report.

For compliance to process, could you please create a PR from your (failing) test? That way I could directly work from there.