MPS 2023.2 brings improvements to BaseLanguage lambda generation, JUnit 5 support, type system inference rule overriding, and more.
Tests in MPS are now generated as JUnit 5 tests. Limited support for JUnit 4 is still provided.
BTestCase
NodeTestCase
EditorTestCase
MigrationTestCase
PatternTest
GeneratorTest
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.
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 on 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. |
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.
We recently added a feature that allows type system rules to override rules defined
on super-concepts. This can be done in cases where the sub-concepts are defined in
a language that extends the language containing the super-concept. The feature
is supported for Inference
rules.
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.
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:
Generally, this results in the improved quality of generated code, as lambdas, apart from being more readable, are less likely to be generated incorrectly. On the other hand, MPS allows features with raw types that Java would not allow, as detecting such instances is still challenging. As a result, in locations where raw types are employed, generation may fail.
Closure parameters previously had various possible forms: ~param
,
<type> param
, param
, 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,
the generated parameters will now omit the type, thereby further enhancing
the compilation quality.
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 combine the benefits of sequences (repeatability) with those of streams (various collectors, more operators).
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:
var myList = new arraylist<> {myInitialValue}
map<int, string> myMap = new hashmap<>
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<>>
.
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.
A new Edit option was added to the Java tab of the module properties dialog. It’s hard to spot, but very convenient. When you need to alter the set of your module’s jar libraries, just use this new option, and you won’t have to perform a tedious sequence of an entry removal followed by an add.
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.
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.
This confusing warning used to be shown when a ClassConcept
extended
or otherwise exposed its use of a ClassConcept
from another module.
Prior to version 2023.2, MPS relied on module dependencies specified in module
descriptors to build the dependencies graph. Now that MPS builds the dependency
information based on the actual generators and languages involved in transforming
a model, you no longer need to specify these dependencies explicitly, hence
there’s no more need for the check.
Sharing is a useful trait of any community. The following features have been implemented based on requests from the commercial MPS users who sponsored us developing them. Now, you can also take full advantage of these handy additions.
The model checker can now effectively utilize parallel hardware, thereby speeding up the process of model checking. Depending on the settings in Settings | Tools | Model Checker, it can spawn multiple threads when starting this process.
The FilePerRootDataSource.getStreamByName()
method has been
optimized to improve the performance of model data loading. If you use
File-per-root persistence to store rather large models, this change will
be noticeable.
The existing Find text in project action has been improved, and it now also searches for references of named nodes, bringing up additional relevant results. A preview panel has been added that allows you to see the results directly in the search dialog. Text containing HTML content is now rendered as plain text in the results and not as HTML as in previous versions.
While migrating a project using Ant tasks provided by MPS,
dependencies may not get properly migrated. We added a flag to continue
the migration of a project even in such cases. Stopping the migration process
as soon as a non-migrated dependency is discovered remains the default behavior.
To use this flag, add haltOnDependencyError="false"
to your
migrate
Ant task.
In v2023.2 it’s possible to zoom into and out of the IDE entirely, increasing or decreasing the size of all UI elements at once. From the main menu, select View | Appearance and adjust the IDE’s scaling. Additionally, you can assign custom shortcuts for calling these actions in Settings/Preferences | Keymap | Main Menu | View | Appearance.
In MPS 2023.2, we’ve introduced a new layout option that allows you to unify the width of the side tool windows or retain the ability to freely adjust their sizes as you customize your layout. The new Remember size for each tool window checkbox is available in Settings/Preferences | Appearance & Behavior | Appearance | Tool Windows. Learn about how this setting works for the new and the old UI in this blog post.
In Settings / Preferences | Editor | Inspections, code samples now include syntax highlighting, which makes it easier to understand what triggers an inspection and decide whether you want it to be active or inactive.
The Fill Paragraph editor action is now supported for Markdown files, allowing you to break long texts into several lines of even length. To do this, set the caret inside the paragraph you want to edit and search for the Fill Paragraph command using Find Action (Ctrl+Shift+A).
We’ve improved the usability of the Branches popup. For instance, navigating between branches is now easier, as they are grouped and stored in expandable lists.
MPS 2023.2 provides auto-completion in the Create New Branch popup. Once you start typing a name for your new branch, the IDE will suggest relevant prefixes based on the names of existing local branches.
For every major release, we prepare instructions on how to migrate from older MPS versions to ensure everything goes smoothly. Please review them carefully.