Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xbase/Xtend refactoring #2890

Merged
merged 10 commits into from
Jan 8, 2024

Conversation

LorenzoBettini
Copy link
Contributor

This provides some general refactoring for Xbase and Xtend and as a preparation for #2886, for which I'll also provide a PR soon.

The main focus is on the treatment of anonymous classes, which was originally split into Xbase and Xtend. In this PR, anonymous classes are handled by the XbaseCompiler completely, which now provides a new method https://github.com/eclipse/xtext/compare/main...LorenzoBettini:xtext:lb_xbase_cleanup-1?expand=1#diff-3c98e6c5688a98e8fc686a884a0462f80d32c824ea233925c42b813a15345743R1148 canCompileToJavaAnonymousClasses. This relies on the JvmGenericType.isAnonymous. This was done before by XbaseCompiler, though with some duplicated code. Now, XbaseCompiler consistently calls this method to treat other situations that in the past were customized in XtendCompiler.

For example, isVariableDeclarationRequired is now properly handled in the XbaseCompiler also for constructor calls, which possibly refer to an anonymous class and does not need to be customized by XtendCompiler.

Similarly, _toJavaStatement(final XConstructorCall expr... does not need to be redefined by the XtendCompiler, which only needs to redefine constructorCallToJavaExpression to handle the generation of its anonymous classes.

I also took the chance to restrict the visibility of a few methods in XtendCompiler, which are used only internally.

The build is green.

@LorenzoBettini LorenzoBettini merged commit b85670b into eclipse-xtext:main Jan 8, 2024
5 checks passed
@LorenzoBettini LorenzoBettini deleted the lb_xbase_cleanup-1 branch January 8, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants