Skip to content
This repository was archived by the owner on Apr 21, 2023. It is now read-only.
This repository was archived by the owner on Apr 21, 2023. It is now read-only.

name clash with lambda as anon inner class compilation #1301

Closed
@dpetroff

Description

@dpetroff

Today I upgraded from Xtend 2.21 to 2.26 and my code base broke the IDE generator targeting Java 11.

Consider the method

def getMyAdapter(extension EObject it) {
	eAdapters.filter(AdapterImpl).head ?: (new AdapterImpl() => [eAdapters += it])
}

In the most recent Eclipse package (2022-03), the IDE generator generates distinctly different code from gradle for this example. In particular, the gradle generator uses Java lambda notation, while the IDE does not. Additionally, the IDE generated code also results in broken Java because it does not disambiguate between the EObject it and the Adapter it inside the lambda. Notice that the EObject it is declared as an extension, so the eAdapters call inside the lambda should apply to it. This works as expected when building with gradle and previous versions of the IDE, but the current IDE generator does not appear to disambiguate between the two its, which results in broken Java code.

myGradleProject.zip is a minimal gradle project reproducing the issue. Note that building with gradle is successful, including the test phase, and as long as the IDE generator doesn't rebuild the source after refreshing the gradle project in the IDE, there are no errors in the editor. Once the IDE has rebuilt the source, it is necessary to rebuild again with gradle and refresh the gradle project in the IDE again to get rid of the error.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions