Skip to content

Migrate to JMLtk - #3966

Open
wadoon wants to merge 7 commits into
mainfrom
weigl/jmltk
Open

Migrate to JMLtk#3966
wadoon wants to merge 7 commits into
mainfrom
weigl/jmltk

Conversation

@wadoon

@wadoon wadoon commented Aug 15, 2026

Copy link
Copy Markdown
Member

Intended Change

With this PR, wadoon/key-javaparser becomes obsolete in favour of the JMLtk fork!

This PR does not

  • use JMLtk to parse JML.
  • use JML-AST classes.

Regressions:

  • Positioning on invalid ExpressionStmt (int x = ;)

Changes to key-javaparser

  • JML modifiers are printed escaped => (/*@ ghost */ int x;)
  • KeyRangeExpression gone
  • KeyMarkerStatement gone
  • Consistent names are in favour of JavaParser (e.g., XStatement vs. XStmt)

Plan

Things to do after review:

  • decide when to make JMLtk first release

    • update K counter on JMLtk
  • discuss sacrifices in JMLtk for KeY compat:
    /*@ghost*/ int #x; vs. ghost int #x;

  • How to proceed further with exchanging JML parsing

Type of pull request

  • Refactoring (behaviour should not change or only minimally change)

Ensuring quality

  • I made sure that introduced/changed code is well documented (javadoc and inline comments).
  • I have tested the feature as follows: unit-tests

@wadoon wadoon self-assigned this Aug 16, 2026
@wadoon wadoon added JavaJMLParser Feature New feature or request Java Parser Java Pull requests that update Java code labels Aug 16, 2026
@wadoon wadoon added this to the v3.1.0 milestone Aug 16, 2026
@wadoon
wadoon marked this pull request as ready for review August 16, 2026 23:48
@wadoon

wadoon commented Aug 16, 2026

Copy link
Copy Markdown
Member Author

Squash before merge

@wadoon
wadoon requested a review from unp1 August 16, 2026 23:49

@unp1 unp1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! I think all the mentioned issues are just one comment. Otherwise the changes to error reporting seem to be a regression in the reported position, so we should fix that position reporting not the tests. I'll look into that myself.

@@ -1,4 +1,4 @@
public record SimpleRecord(/*@ nullable */ String name) implements Serializable {
public record SimpleRecord([[JML modifiers]] String name) implements Serializable {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That does not look right

@@ -1,4 +1,4 @@
public record SimpleRecord(/*@ nullable */ String name) implements Serializable {
public record SimpleRecord([[JML modifiers]] String name) implements Serializable {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that should also be nullable

@@ -1,4 +1,4 @@
public record SimpleRecord(/*@ nullable */ String name) implements Serializable {
public record SimpleRecord([[JML modifiers]] String name) implements Serializable {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/@ nullable @/

@@ -1,4 +1,4 @@
public record SimpleRecord(/*@ nullable */ String name) implements Serializable {
public record SimpleRecord([[JML modifiers]] String name) implements Serializable {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/@ nullable @/


@javax.annotation.processing.Generated("RecordClassBuilder")
private final /*@ nullable */ String name;
private final [[JML modifiers]] String name;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/@ nullable @/


@javax.annotation.processing.Generated("RecordClassBuilder")
public final /*@ nullable */ String name() {
public final [[JML modifiers]] String name() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/@ nullable @/


@javax.annotation.processing.Generated("RecordClassBuilder")
private final /*@ nullable */ nullable String name;
private final [[JML modifiers]] /*@ nullable */ String name;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/@ nullable @/


@javax.annotation.processing.Generated("RecordClassBuilder")
public final /*@ nullable */ nullable String name() {
public final [[JML modifiers]] /*@ nullable */ String name() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/@ nullable @/

It is still a regression, as the reported token is now "int" and not "=" as before.
@unp1

unp1 commented Aug 17, 2026

Copy link
Copy Markdown
Member

Improved the position recording slightly. But the parser now reports "int" as last successfull token and no longer "=", so the position is no longer as precise as before where the dialog underlined the empty space after '='

@unp1 unp1 closed this Aug 17, 2026
@unp1
unp1 deleted the weigl/jmltk branch August 17, 2026 21:30
@unp1 unp1 reopened this Aug 17, 2026
@unp1

unp1 commented Aug 17, 2026

Copy link
Copy Markdown
Member

Sorry my fault, restored to open.

First pushed to the wrong branch due to a typo jmtk and then deleted the correct one....
Nothing got lost everything restored

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New feature or request Java Parser Java Pull requests that update Java code JavaJMLParser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants