The MPS 2023.2 EAP Has Started

Today we’re releasing the first EAP build for MPS 2023.2, which means the next major release is just around the corner. Test it out and let us know how the new features work for you.


Here are some of the new features for you to try.

Support for JUnit 5

Tests in MPS are now generated as JUnit 5 tests. Limited support for JUnit 4 is still provided.

  • Any appropriately annotated Java class can be executed as a test.
  • Both options for running MPS tests – in-process and spawned – are available.
  • Existing test roots are generated with JUP Jupiter API annotations:
    • BTestCase
    • NodeTestCase
    • EditorTestCase
    • MigrationTestCase
    • PatternTest
    • GeneratorTest

Ant task for launching module tests with JUnit 5

A new <launchtests> Ant task is available with support for the following elements:

  • <library>
  • <macro>
  • <plugin>
  • <testmodules>

It supports the execution of all test artifacts, with the exception of JUnit 3, and serves as the new target for the test configuration build part.

Test Platform API

This API allows you to extend the types of tests available in MPS, as well as implement listeners for test sessions.
Classes in jetbrains.mps.baseLanguage.unitTest.platform form the MPS test platform API:

TestPlatform Defines the API for the MPS test platform.
TestDescriptor Represents a single test in the MPS Test Platform.
TestSource Represents the test source, such as an SNode.
TestSession Represents a test session.
TestDiscoveryParticipant Enables joining the test discovery process.
TestSessionListener Makes it possible to receive notifications from the test session.

Experimental support for custom test engines

JUnit 5 introduces, among other things, support for implementing tests that are executed with a custom engine. A popular example of such an engine is jqwik – – a property-based testing framework.

The TODO ability for custom comments

Extending the IGenericComment concept allows concepts that represent comments in custom languages to participate in the TODO functionality of MPS. Comments that represent TODOs will be collected by the TODO Finder, listed in the TODO Viewer, and checked during the commit process.

BaseLanguage improvements

In an earlier update, MPS received enhanced support for method references and the conversion of closures into Java lambdas. We’ve broadened this support with numerous minor features and bug fixes.

Generation of closures as lambdas

Closures used in collection operations are now generated as Java lambdas, which was initially available only for regular function calls that used Java interfaces. To maintain backward compatibility, there are instances when a closure will still be generated as an anonymous class:

  • When a variable name clashes with an external variable; a warning is now displayed suggesting it be renamed.
  • When the targetJava version is 8 or below.
  • When raw types are used; these do not mix well with Java lambdas.

Generally, this results in the improved quality of generated code, as lambdas, apart from being more readable, are less likely to be incorrectly generated.
On the other hand, MPS allows features with raw types that Java would not as detecting such instances is still challenging. As a result, in locations where raw types are employed, generation may fail.

Closure parameters

Closure parameters previously had various possible forms: ~param, <type> paramparam and var param. Adding parameters while skipping the type was cumbersome.
In this release, we’ve deprecated the ~param form in favor of the simple untyped parameter, which is now inserted by default. Also, when a closure is inserted in a function call, default parameters will be inserted from the expected function type.
Lastly, if their type is omitted in the source code, generated parameters will now omit the type, thereby further enhancing compilation quality.

Stream interoperability

While sequences are used extensively in MPS, there are occasions when Java streams must also be used. This update offers improved inference to mitigate type system issues related to complex methods that the Stream API may use.
We’ve added two operations to bridge streams and sequences:

  • <stream>.asSequence will convert a sequence to a stream.
  • <sequence>.toStream(parallel=…) will do the opposite.

In addition to allowing you to choose which API to use, this allows you to mix the benefits of sequences (repeatability) and those of streams (various collectors, more operators).

Collection improvements

We previously introduced the diamond operator (new ArrayList<>()) for BaseLanguage constructors, but collection creators were excluded from this improvement.
In this update, you can now omit type parameters from new collections, simplifying the code writing process:

  • Type inferred from initial values: var myList = new arraylist<> {myInitialValue}
  • Type inferred from variable declaration: map<int, string> myMap = new hashmap7lt;>

In addition, we’ve improved support for variance in collections. For example, it’s no longer possible to assign a ? extends Number notation. However, the type system will no longer object to the use of such bounded types when they are valid.
The sequence<> type will remain covariant by default as it won’t result in any unsafe consequences since you cannot insert it into a sequence of elements that are not of its type. This may bring new type checking issues where unsafe code previously went undetected. These can be resolved with either bounded types (list<? extends node<>>) or sequence types sequence<node<>>).

Disable Make On Startup

We’ve added a new option, Disable Make On Startup, which is available in Settings | Project Settings | Make. When this option is selected, MPS will not make all of the project’s modules when starting up. This may come in handy if you want to increase startup speed in situations when the initial make process takes too long or is likely to fail since manual configuration is necessary before the project can be successfully made.

Language aspects: manage Create New actions

For creating instances in an aspect model, MPS has so far followed a general logic that involved rootable non-abstract concepts, ordered by name or flag. Now, optional configuration can be specified along with an aspect declaration, allowing language designers to control which concepts are presented to the user, as well as their grouping and ordering.

See a full list of fixed issues here.

Try out these features and let us know if you have any issues so we can make sure the release suits your needs.
Your JetBrains MPS team

image description