usethesource / rascal

The implementation of the Rascal meta-programming language (including interpreter, type checker, parser generator, compiler and JVM based run-time system)
http://www.rascal-mpl.org
Other
394 stars 77 forks source link

Support Java JLS 13 and JLS14 preview in M3 models and Java ASTs; also make ASTs jump through the correctness specification in lang::analysis::AST #1936

Closed jurgenvinju closed 1 month ago

jurgenvinju commented 2 months ago

This branch starts from the main branch where Java support for M3 and ASTs was done up to level 8 of the Java Language Standard (JLS8).

However several key concepts were missing from the syntax trees namely type parameters and modifiers and annotations here and there. Some of these concepts were represented only in the M3 database, and at the time it was decided that double representation was not good for memory consumption. Today and with experience from the C++/C M3 models, PHP and Ada, this design decision has shifted: every AST must be fully informative, and the AST model must be aligned with the M3 model by sharing src (physical location), decl (logical location) and typ resolved static types keyword parameters on representative AST nodes. The full specification of a correct AST nodes is a boolean predicate in lang::analysis::M3.

jurgenvinju commented 1 month ago

I think this is ready for review, but I should want that the number of changes is quite enormous.

jurgenvinju commented 1 month ago

Am still working to run the astNodeSpecification checker over all the ASTs. Errors keep popping up. Those are going to be minor changes of list.insert to list.append and such.

jurgenvinju commented 1 month ago

Ok all the Java ASTs now pass all of the AST specification. The M3 specification (made based on the C++ support) is not robust enough yet to be able to be used as a quality gate.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 56.46186% with 411 lines in your changes are missing coverage. Please review.

Project coverage is 49%. Comparing base (6bb94a2) to head (efa6401).

Files Patch % Lines
...pl/library/lang/java/m3/internal/ASTConverter.java 58% 198 Missing and 25 partials :warning:
...pl/library/lang/java/m3/internal/JarConverter.java 19% 52 Missing and 3 partials :warning:
...library/lang/java/m3/internal/SourceConverter.java 32% 53 Missing and 2 partials :warning:
...ary/lang/java/m3/internal/EclipseJavaCompiler.java 54% 24 Missing and 5 partials :warning:
...ibrary/lang/java/m3/internal/BindingsResolver.java 66% 9 Missing and 8 partials :warning:
...y/lang/java/m3/internal/JavaToRascalConverter.java 67% 8 Missing and 6 partials :warning:
...library/lang/java/m3/internal/ASMNodeResolver.java 89% 4 Missing and 3 partials :warning:
...mpl/library/lang/java/m3/internal/M3Converter.java 75% 6 Missing :warning:
src/org/rascalmpl/library/Prelude.java 0% 3 Missing :warning:
...org/rascalmpl/repl/TerminalProgressBarMonitor.java 0% 1 Missing :warning:
... and 1 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1936 +/- ## ======================================== - Coverage 49% 49% -1% - Complexity 6193 6215 +22 ======================================== Files 663 662 -1 Lines 58946 59432 +486 Branches 8575 8637 +62 ======================================== + Hits 29026 29178 +152 - Misses 27724 28018 +294 - Partials 2196 2236 +40 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jurgenvinju commented 1 month ago

Thanks @DavyLandman As soon as the tests run on the server, I'll merge.

jurgenvinju commented 1 month ago

Aha! The type-checker is now forcing us to update JavaToObjectFlow :-) good catch.