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

fix: Legacy datatype constructor compatibility in Java #5558

Merged

Conversation

robin-aws
Copy link
Member

Description

Addresses the specific problem described in #5555, without yet setting up enough regression testing for the general problem.

Adds a hidden --legacy-data-constructors option for the Java backend, to create @Deprecated() overloads of methods that create data constructors such as create_Foo and Default that don't take TypeDescriptor arguments and instead initialize them to null, so that Dafny code generated before #4240 is not broken.

Also fixes #5553.

How has this been tested?

Cloned separate-compilation/usesTimesTwo.dfy to create a version with the Java code for the consuming code pre-compiled using Dafny 4.2 checked in.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@@ -26,6 +29,17 @@ public class JavaBackend : ExecutableBackend {
public override bool SupportsInMemoryCompilation => false;
public override bool TextualTargetIsExecutable => false;

public static readonly Option<bool> LegacyDataConstructors = new("--legacy-data-constructors",
@"Generate deprecated data constructor methods".TrimStart()) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Will expand the description a bit more

Copy link
Member

@keyboardDrummer keyboardDrummer left a comment

Choose a reason for hiding this comment

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

Great work, thanks

Copy link
Collaborator

@RustanLeino RustanLeino left a comment

Choose a reason for hiding this comment

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

Nice. Thanks!

@robin-aws robin-aws enabled auto-merge (squash) June 17, 2024 13:06
@robin-aws robin-aws merged commit aa58409 into dafny-lang:master Jun 17, 2024
21 checks passed
@robin-aws robin-aws deleted the legacy-datatype-constructor-compatibility branch June 17, 2024 20:47
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.

Helpers.unsignedLongToBigInteger removed from Java runtime
3 participants