Repository navigation
[breaking change] Discontinue deprecated core library APIs, part II #49529
Copy link
Copy link
Closed
Labels
area-metaCross-cutting, high-level issues (for tracking many other implementation issues, ...).Cross-cutting, high-level issues (for tracking many other implementation issues, ...).enhancement-breaking-changeAn enhancement which is breaking.An enhancement which is breaking.
Description
The following Dart core library APIs, which are all currently deprecated, are now being fully removed.
This is the continuation of previous discontinuation work tracked in #34233
Phase II, scheduled for Dart 3.0
The following APIs are planned to be removed in 3.0, as some breakage is to be expected.
API changes which we believe are minimally breaking
dart:core
-
onErrorargument toint.parse,double.parse,num.parse:
CL: https://dart-review.googlesource.com/c/sdk/+/259042 -
proxyconstant:
CL: https://dart-review.googlesource.com/c/sdk/+/258004 -
Provisionalclass and associated constant:
CL: https://dart-review.googlesource.com/c/sdk/+/258004 -
Listconstructor (useList.Filled):
CL: https://dart-review.googlesource.com/c/sdk/+/258920 -
BidirectionalIteratorclass:
CL: https://dart-review.googlesource.com/c/sdk/+/276741 -
Deprecated.expiresgetter onDeprecated. UseDeprecated.messageinstead. - Errors:
-
AbstractClassInstantiationErrorclass (no longer relevant indart:corelibraries.dart:mirrorsmay still throw it and now has it's own definition of it):
CL: https://dart-review.googlesource.com/c/sdk/+/274383 -
CastErrorclass (useTypeError):
https://dart-review.googlesource.com/c/sdk/+/259041 -
FallThroughErrorclass (Unused since Dart 2.0):
https://dart-review.googlesource.com/c/sdk/+/261860,
CL: https://dart-review.googlesource.com/c/sdk/+/259041 -
NoSuchMethodErrordefault constructor (use the named constructorNoSuchMethod.withInvocation):
CL: https://dart-review.googlesource.com/c/sdk/+/271082 -
CyclicInitializationError(will never be thrown from code with sound null safety):
https://dart-review.git.corp.google.com/c/sdk/+/275120 -
NullThrownError(will never be thrown from code with sound null safety):
https://dart-review.googlesource.com/c/sdk/+/275840
-
dart:async
-
DeferredLibraryclass (use thedeferred asimport syntax):
CL: https://dart-review.git.corp.google.com/c/sdk/+/268460
dart:developer
-
MAX_USER_TAGSinUserTag:
CL: https://dart-review.git.corp.google.com/c/sdk/+/268340
dart:mirrors
None.
dart:html
-
document.registerElement®isterElement2:
[dart:html] Breaking change: delete registerElement* APIs in dart:html #49536,
CL 📝: https://dart-review.git.corp.google.com/c/sdk/+/268461
API changes which may be more breaking
These are postponed, and not planned for inclusion in Dart 3.
### dart:core
[ ]IntegerDivisionByZeroExceptionexception (useUnsupportedError):
RemoveIntegerDivisionByZeroException#30743[ ] Errors:
### dart:async
[ ]runZonedarg ononError:
CL: https://dart-review.googlesource.com/c/sdk/+/248002
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-metaCross-cutting, high-level issues (for tracking many other implementation issues, ...).Cross-cutting, high-level issues (for tracking many other implementation issues, ...).enhancement-breaking-changeAn enhancement which is breaking.An enhancement which is breaking.
Activity
mit-mit commentedon Sep 13, 2022
@sigmundch is the
NoSuchMethodErrorconstructor ready to be removed? There is a comment about dart2js here:https://github.com/dart-lang/sdk/blob/main/sdk/lib/core/errors.dart#L492
sigmundch commentedon Sep 19, 2022
Our dependency is still there, but probably can easily be refactored by updating the dart2js patch files without changing the compiler directly
/cc @rakudrama
srawlins commentedon Sep 28, 2022
If we want to ship
dart migratein Dart 3.0, is it ok if that tool does not understand these removed APIs?For example, if someone installs Dart 3.0, and uses that Dart's
dart migrateto try to migrate code which refers toCastError, is it ok ifdart migratefails in some way? Crashes or something like that on the unresolved element.FWIW,
dart migrateis implemented inpkg/dartdev, which has a simple import ofpkg/nnbd_migration. It does not currently shell out to a separate snapshot.[dart2js] stop using the deprecated NoSuchMethod consturctor
sigmundch commentedon Sep 29, 2022
@mit-mit efb509c should address the dependency from dart2js, I think the constructor is now ready to be removed.
mit-mit commentedon Oct 10, 2022
@srawlins I think that is OK. If a developer wants support for migrating away from discontinued APIs, they can use the 2.19 SDK.
mit-mit commentedon Oct 10, 2022
@sigmundch @kevmoo is the comment above about the
dart:htmlchange accurate (i.e. we're removing that in 2.19)?sigmundch commentedon Oct 17, 2022
@mit-mit, can you clarify which comment are you referring to?
We landed changes to mark the APIs deprecated in late July. Those haven't been released yet in the stable channel, so it will first get broad visibility with the 2.19 stable release. Given that, we wont be removing it entirely in 2.19, but the release that follows.
mit-mit commentedon Oct 24, 2022
@sigmundch I was looking at an older, stale version, sorry.
sgtm, we'll track that as a 3.0 removal then
[3.0 alpha] Bump version to 3.0.0
5 remaining items
[3.0 alpha] Remove error for use of the List default constructor
[3.0 alpha] Remove deprecated dart:async APIs
[3.0 alpha] Remove deprecated NoSuchMessageError API
nshahan commentedon Dec 12, 2022
@mit-mit Are you expecting there will be tracking issues for the removal of CyclicInitializationError and NullThrownError. Is there already discussion happening somewhere?
mit-mit commentedon Dec 12, 2022
Those are expected to be removed next few days; CLs will be linked from the top comment.
[3.0 alpha][vm] Remove transformation of List default constructor
[3.0 alpha] Remove deprecated public class CyclicInitializationError
[3.0 alpha] Remove deprecated dart:core List() constructor.
[3.0 alpha] Remove deprecated `CastError` and `FallThroughError` `dar…
mit-mit commentedon Dec 19, 2022
All done, closing
remove analyzer/server support for the default `List` constructor
dupuchba commentedon Apr 16, 2023
hey @mit-mit you forgot
MapEntryin your list which cannot be extends anymore (it breaks ClojureDart btw).lrhn commentedon Apr 16, 2023
Making
MapEntryafinalclass will, like all other now-finalclasses in the platform libraries, only affect code when it migrates to Dart 3.0.It's not, technically, considered breaking, even though it prevents some uses from being continued. The existing code, running at language version 2.19, will keep working until support for pre-3.0 code is removed, which is unlikely to be soon.
The list of classes which have become final are (lifted directly from the source code):
dart:asyncfinal class AsyncErrorfinal class DeferredLoadExceptionabstract final class ZoneSpecificationabstract final class ZoneDelegateabstract final class Zonedart:collectionabstract final class HashMapabstract final class HashSetfinal class HasNextIteratorabstract final class LinkedHashMapabstract final class LinkedHashSetfinal class DoubleLinkedQueuefinal class ListQueuefinal class SplayTreeMapfinal class SplayTreeSetdart:convertfinal class AsciiCodecfinal class Base64Codecfinal class Base64Encoderfinal class Base64Decoderfinal class HtmlEscapeModefinal class HtmlEscapefinal class JsonCodecfinal class JsonEncoderfinal class JsonUtf8Encoderfinal class JsonDecoderfinal class Latin1Codecfinal class Latin1Encoderfinal class Latin1Decoderfinal class LineSplitterfinal class Utf8Codecfinal class Utf8Encoderfinal class Utf8Decoderdart:coreabstract final class BigIntfinal class OutOfMemoryErrorfinal class StackOverflowErrorabstract final class Functionfinal class MapEntryfinal class Nullabstract final class Recordabstract final class Stringfinal class Expandoabstract final class WeakReferenceabstract final class Finalizerdart:developerabstract final class NativeRuntimefinal class ServiceExtensionResponseabstract final class UserTagfinal class ServiceProtocolInfofinal class Servicefinal class Flowabstract final class Timelinefinal class TimelineTaskdart:ffifinal class AbiSpecificIntegerMappingfinal class DartRepresentationOffinal class Unsizedfinal class Charfinal class SignedCharfinal class UnsignedCharfinal class Shortfinal class UnsignedShortfinal class Intfinal class UnsignedIntfinal class Longfinal class UnsignedLongfinal class LongLongfinal class UnsignedLongLongfinal class IntPtrfinal class UintPtrfinal class Sizefinal class WCharfinal class DynamicLibraryfinal class Pointerfinal class Arrayfinal class Dart_CObjectabstract final class NativeApifinal class FfiNativefinal class Nativefinal class DefaultAssetabstract final class NativeFinalizerabstract final class NativeTypefinal class Int8final class Int16final class Int32final class Int64final class Uint8final class Uint16final class Uint32final class Uint64final class Floatfinal class Doublefinal class Boolabstract final class Voidabstract final class Handleabstract final class NativeFunctionabstract final class VarArgsfinal class Packeddart:ioanddart:htmlabstract final class HttpClientBasicCredentialsabstract final class HttpClientDigestCredentialsfinal class HttpProfilerdart:ioabstract final class ZLibOptionfinal class ZLibCodecfinal class GZipCodecfinal class ZLibEncoderfinal class ZLibDecoderfinal class FileSystemEntityTypefinal class FileSystemEventfinal class FileSystemCreateEventfinal class FileSystemModifyEventfinal class FileSystemDeleteEventfinal class FileSystemMoveEventabstract final class Platformabstract final class ProcessInfofinal class ProcessStartModefinal class ProcessResultfinal class InternetAddressTypefinal class SocketDirectionfinal class SocketOptionfinal class RawSocketOptionfinal class ConnectionTaskfinal class Datagramfinal class SocketMessagefinal class StdioTypefinal class SystemEncodingdart:isolatefinal class Isolatefinal class RemoteErrorabstract final class TransferableTypedDatadart:typed_dataabstract final class ByteBufferabstract final class TypedDatafinal class Endianabstract final class ByteDataabstract final class Int8Listabstract final class Uint8Listabstract final class Uint8ClampedListabstract final class Int16Listabstract final class Uint16Listabstract final class Int32Listabstract final class Uint32Listabstract final class Int64Listabstract final class Uint64Listabstract final class Float32Listabstract final class Float64Listabstract final class Float32x4Listabstract final class Int32x4Listabstract final class Float64x2Listabstract final class Float32x4abstract final class Int32x4abstract final class Float64x2abstract final class UnmodifiableByteBufferViewabstract final class UnmodifiableByteDataViewabstract final class UnmodifiableUint8ListViewabstract final class UnmodifiableInt8ListViewabstract final class UnmodifiableUint8ClampedListViewabstract final class UnmodifiableUint16ListViewabstract final class UnmodifiableInt16ListViewabstract final class UnmodifiableUint32ListViewabstract final class UnmodifiableInt32ListViewabstract final class UnmodifiableUint64ListViewabstract final class UnmodifiableInt64ListViewabstract final class UnmodifiableInt32x4ListViewabstract final class UnmodifiableFloat32x4ListViewabstract final class UnmodifiableFloat64x2ListViewabstract final class UnmodifiableFloat32ListViewabstract final class UnmodifiableFloat64ListViewIt's possible,
dart:mirrorsmight also be made entirelyfinal, if time permits.dupuchba commentedon Apr 16, 2023
@lrhn I appreciate your perspective, but I must disagree with the assertion that
It's not, technically, considered breaking.... Allow me to share my viewpoint:As a library creator, supporting all major Dart version updates is crucial to prevent the library from becoming obsolete.
What occurred to libraries that failed to transition from Dart 1 to 2.X?
The
final classexample is an excellent illustration. Introducingfinal classin Dart standard libraries disrupts all code dependent on those classes when transitioning to Dart 3, generating unplanned work for library authors.When I examine the decision to make MapEntry a final class, it appears to be final for the sake of precaution rather than necessity.
Please don't misunderstand me; I adore Dart and the team behind it, and I will always be thankful for the impact it had on my life when I chose it for ClojureDart.
I would simply prefer minimal Breaking Changes.
Thanks for all your work 🙇