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

Generate IR definitions by annotation processor - 1st step #11770

Open
wants to merge 191 commits into
base: develop
Choose a base branch
from

Conversation

Akirathan
Copy link
Member

@Akirathan Akirathan commented Dec 4, 2024

This PR is the initial step for migrating all the IR elements implemented as Scala case classes to Java classes generated by an annotation processor.

This PR was created from the abandoned #11267 that tried to generated subclasses.

Pull Request Description

The overall description is the same as in #11267, but this approach tries to generate super classes as suggested in https://github.com/enso-org/enso/pull/11267/files#r1869342527

References

Important Notes

Apart from the annotation processor implementation and tests, CallArgument.Specified was migrated to the new approach from Scala case class. I uploaded its generated class code in this gist so you can see it without compilation.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • Benchmarks are OK
  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

This will be important for mapExpressions method implementation
This is the only way to retain 100% backward compatibility.
this.location,
this.id,
this.name(),
value,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy method generated in 1ceabfe

Great, this looks like the most elegant code to delegate to.

@JaroslavTulach
Copy link
Member

A problem generating ScalaDoc for Java class that extends AP generated class breaks the CI:

[error] /home/runner/work/enso/enso/engine/runtime-parser/src/main/java/org/enso/compiler/core/ir/CallArgument.java:39:33: not found: type SpecifiedGen
[error]   final class Specified extends SpecifiedGen {
[error]                                 ^
[error] /home/runner/work/enso/enso/engine/runtime-parser/src/main/java/org/enso/compiler/core/ir/Empty.java:7:34: not found: type EmptyGen
[error] public final class Empty extends EmptyGen {
[error]                                  ^
[error] two errors found
[info] [FrgaalJavaCompiler] compiling 17 Java sources with module-info.java to /home/runner/work/enso/enso/engine/runtime-parser/target/classes ...
[info] done compiling
[error] Scaladoc generation failed
[error] 	at scala.tools.xsbt.Runner.run(ScaladocBridge.scala:54)
[error] 	at scala.tools.xsbt.ScaladocBridge.run(ScaladocBridge.scala:25)
[error] 	at sbt.internal.inc.AnalyzingCompiler.doc(AnalyzingCompiler.scala:154)
[error] 	at sbt.internal.inc.AnalyzingCompiler.doc(AnalyzingCompiler.scala:133)
[error] 	at sbt.Doc$.$anonfun$scaladoc$1(Doc.scala:53)
[error] 	at sbt.Doc$.$anonfun$scaladoc$1$adapted(Doc.scala:41)

@@ -128,6 +128,9 @@ jobs:
java-version: "21"
distribution: "graalvm-community"

- name: Clean sbt
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that generated sources are removed before running sbt publishM2.

@Akirathan
Copy link
Member Author

Akirathan commented Jan 6, 2025

All the engine tests are green. Scheduling benchmarks:

GitHub
Enso Analytics is a self-service data prep and analysis platform designed for data teams. - Benchmark Engine · 291e593
GitHub
Enso Analytics is a self-service data prep and analysis platform designed for data teams. - Benchmark Standard Libraries · 291e593

@Akirathan Akirathan force-pushed the wip/akirathan/java-ir-superclass branch from ef121e9 to dd5efcd Compare January 6, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants