Dart: allow conditionally disabling 'Finalizable' marker usage #1646
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
---------- Motivation ----------
It turned out that in certain rare cases
Dart compiler experiences internal compiler
error related to scope building when 'Finalizable'
is used.
The fix for the problems is available in Dart SDK 3.6.0+.
There can be problems if the user cannot immediately
upgrade to the new Dart SDK and wants to use other
new features/bug-fixes.
---------- Implemented change ----------
In order to ease the transition phase for users the
new CLI flag called 'dartdisablefinalizablemarker' was
introduced. It allows users to conditionally disable
the usage of 'Finalizable' marker interface.
Moreover, new CMake tests have been introduced to verify
that 'GLUECODIUM_DART_DISABLE_FINALIZABLE_MARKER'
flag works as expected. They bring also a new utility for CMake
tests, which allow users to verify if the generated file contains a
given string.
---------- IMPORTANT ----------
It is discouraged to use this flag, because when 'Finalizable'
marker interface is not used a rare race conditions between
garbage collection and native finalizers may occur.
The flag is designed ONLY to help during the transition phase to
Dart SDK 3.6.0+.