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

[breaking change] Discontinue deprecated core library APIs, part II #49529

Closed
16 tasks done
mit-mit opened this issue Jul 26, 2022 · 16 comments
Closed
16 tasks done

[breaking change] Discontinue deprecated core library APIs, part II #49529

mit-mit opened this issue Jul 26, 2022 · 16 comments
Assignees
Labels
area-meta Cross-cutting, high-level issues (for tracking many other implementation issues, ...). enhancement-breaking-change An enhancement which is breaking.

Comments

@mit-mit
Copy link
Member

mit-mit commented Jul 26, 2022

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

dart:async

dart:developer

dart:mirrors

None.

dart:html

API changes which may be more breaking

These are postponed, and not planned for inclusion in Dart 3.

### dart:core

### dart:async

@mit-mit
Copy link
Member Author

mit-mit commented Sep 13, 2022

@sigmundch is the NoSuchMethodError constructor 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
Copy link
Member

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
Copy link
Member

srawlins commented Sep 28, 2022

If we want to ship dart migrate in 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 migrate to try to migrate code which refers to CastError, is it ok if dart migrate fails in some way? Crashes or something like that on the unresolved element.

FWIW, dart migrate is implemented in pkg/dartdev, which has a simple import of pkg/nnbd_migration. It does not currently shell out to a separate snapshot.

copybara-service bot pushed a commit that referenced this issue Sep 29, 2022
This change is a small incremental step, but should allow us to delete
the public NoSuchMethod constructor in dart:core. The change simply creates
a private constructor in the dart2js patch file and uses that instead.

#49529

Change-Id: I51cb2ec3b7f169a6cb831e753a3e5e9bf0752dbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260940
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
@sigmundch
Copy link
Member

@mit-mit efb509c should address the dependency from dart2js, I think the constructor is now ready to be removed.

@mit-mit
Copy link
Member Author

mit-mit commented Oct 10, 2022

If we want to ship dart migrate in Dart 3.0, is it ok if that tool does not understand these removed APIs?

@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
Copy link
Member Author

mit-mit commented Oct 10, 2022

@sigmundch @kevmoo is the comment above about the dart:html change accurate (i.e. we're removing that in 2.19)?

@sigmundch
Copy link
Member

@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
Copy link
Member Author

mit-mit commented Oct 24, 2022

@sigmundch I was looking at an older, stale version, sorry.

Given that, we wont be removing it entirely in 2.19, but the release that follows.

sgtm, we'll track that as a 3.0 removal then

copybara-service bot pushed a commit that referenced this issue Dec 6, 2022
Tested: Standard CQ.
Bug: #49529
Change-Id: I329b9940db7309c7e48f17eecd7a66d5b853a484
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271922
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
@dcharkes
Copy link
Contributor

dcharkes commented Dec 8, 2022

AbstractClassInstantiationError class (no longer relevant)

The class may be irrelevant when running normal Dart code, but not when using mirrors:

assertInstanitationErrorOnGenerativeConstructors(reflectType(num));
assertInstanitationErrorOnGenerativeConstructors(reflectType(double));
assertInstanitationErrorOnGenerativeConstructors(reflectType(StackTrace));
assertInstanitationErrorOnGenerativeConstructors(reflectType(AbstractClass));

Should classMirror.newInstance(decl.constructorName, args) start throwing a different type of exception, or should we move AbstractClassInstantiationError to dart:mirrors as per https://dart-review.googlesource.com/c/sdk/+/259041/16/sdk/lib/mirrors/mirrors.dart ? @mit-mit

@mit-mit
Copy link
Member Author

mit-mit commented Dec 8, 2022

The class may be irrelevant when running normal Dart code, but not when using mirrors:

The text was unclear. It's no longer relevant in the dart:core libraries. But, yes mirrors can still throw it, and now have their own definition of it: https://dart-review.googlesource.com/c/sdk/+/259041/16/sdk/lib/mirrors/mirrors.dart

copybara-service bot pushed a commit that referenced this issue Dec 8, 2022
I don't believe this is used anywhere, but causes failures once the
class is removed from the core libraries.

Split off from https://dart-review.googlesource.com/c/sdk/+/259041

Bug: #49529
Change-Id: I9a215c981b0359b1d4521df9a330ec263b3b6c04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274382
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 8, 2022
`CastError` is replaced by `TypeError`.

Also makes the fields of TypeError nullable. See:
#49279

TEST=build SDK and run default suites.

Bug: #49529
Change-Id: I7e880ff2d8b18c4bffdd7a942efd743244a12734
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274381
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 9, 2022
Split off https://dart-review.googlesource.com/c/sdk/+/259041 so that
the VM changes can be landed separately.

TEST=tests/lib/mirrors/instantiate_abstract_class_test.dart

Bug: #49529
Change-Id: Ic06dee0dfeaea64d9d9ffd9511ec66d9d0837e7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274383
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 9, 2022
Contributes to #49529

Change-Id: I65d147aa8f5f692df00663f5fac024351da7aaa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272161
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 12, 2022
Contributes to #49529

Change-Id: Ib70efd0f388f50686e1745ca5237d06a4538a870
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268460
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 12, 2022
Contributes to #49529

Change-Id: I2cef41b991c59869f606235929347449e17022cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271082
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
@nshahan
Copy link
Contributor

nshahan commented 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
Copy link
Member Author

mit-mit commented Dec 12, 2022

Those are expected to be removed next few days; CLs will be linked from the top comment.

copybara-service bot pushed a commit that referenced this issue Dec 12, 2022
In preparation for removal of the List default constructor from
dart:core. See #49529

TEST=existing

Change-Id: I68cd8097ed33c0b0d91a75cd890f53fd1ea1ed09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273723
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 15, 2022
This deprecated class cannot be removed just yet because
we still need to throw something in case of cyclic initialization
in Dart legacy libraries (which are still supported).

Class CyclicInitializationError is copied for each implementation
(VM, dart2js and DDC) and made private. Each implementation now has
an independent private class which can be removed separately.

TEST=ci
Issue: #49529
Change-Id: I8100bbe16636c12c4cbabbb5fe770f4c648c4249
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275120
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 15, 2022
TEST=ci

Bug: Contributes to #49529
Change-Id: Ic129ef2d89f625d9ec6a7a1c301cffddd60b2ff7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258920
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
copybara-service bot pushed a commit that referenced this issue Dec 15, 2022
…t:core` errors

TEST=ci

Bug: #49529
Change-Id: I52495d3e5319f0555714f4f8247149afc06128a1
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,dart-sdk-linux-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259041
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
@mit-mit
Copy link
Member Author

mit-mit commented Dec 19, 2022

All done, closing

@mit-mit mit-mit closed this as completed Dec 19, 2022
copybara-service bot pushed a commit that referenced this issue Jan 3, 2023
See: #49529

Change-Id: Id52ac534405b3552812e6bb8ce49e09c60cbdfd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276770
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
@dupuchba
Copy link

hey @mit-mit you forgot MapEntry in your list which cannot be extends anymore (it breaks ClojureDart btw).

@lrhn
Copy link
Member

lrhn commented Apr 16, 2023

Making MapEntry a final class will, like all other now-final classes 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:async

  • final class AsyncError
  • final class DeferredLoadException
  • abstract final class ZoneSpecification
  • abstract final class ZoneDelegate
  • abstract final class Zone

dart:collection

  • abstract final class HashMap
  • abstract final class HashSet
  • final class HasNextIterator
  • abstract final class LinkedHashMap
  • abstract final class LinkedHashSet
  • final class DoubleLinkedQueue
  • final class ListQueue
  • final class SplayTreeMap
  • final class SplayTreeSet

dart:convert

  • final class AsciiCodec
  • final class Base64Codec
  • final class Base64Encoder
  • final class Base64Decoder
  • final class HtmlEscapeMode
  • final class HtmlEscape
  • final class JsonCodec
  • final class JsonEncoder
  • final class JsonUtf8Encoder
  • final class JsonDecoder
  • final class Latin1Codec
  • final class Latin1Encoder
  • final class Latin1Decoder
  • final class LineSplitter
  • final class Utf8Codec
  • final class Utf8Encoder
  • final class Utf8Decoder

dart:core

  • abstract final class BigInt
  • final class OutOfMemoryError
  • final class StackOverflowError
  • abstract final class Function
  • final class MapEntry
  • final class Null
  • abstract final class Record
  • abstract final class String
  • final class Expando
  • abstract final class WeakReference
  • abstract final class Finalizer

dart:developer

  • abstract final class NativeRuntime
  • final class ServiceExtensionResponse
  • abstract final class UserTag
  • final class ServiceProtocolInfo
  • final class Service
  • final class Flow
  • abstract final class Timeline
  • final class TimelineTask

dart:ffi

  • final class AbiSpecificIntegerMapping
  • final class DartRepresentationOf
  • final class Unsized
  • final class Char
  • final class SignedChar
  • final class UnsignedChar
  • final class Short
  • final class UnsignedShort
  • final class Int
  • final class UnsignedInt
  • final class Long
  • final class UnsignedLong
  • final class LongLong
  • final class UnsignedLongLong
  • final class IntPtr
  • final class UintPtr
  • final class Size
  • final class WChar
  • final class DynamicLibrary
  • final class Pointer
  • final class Array
  • final class Dart_CObject
  • abstract final class NativeApi
  • final class FfiNative
  • final class Native
  • final class DefaultAsset
  • abstract final class NativeFinalizer
  • abstract final class NativeType
  • final class Int8
  • final class Int16
  • final class Int32
  • final class Int64
  • final class Uint8
  • final class Uint16
  • final class Uint32
  • final class Uint64
  • final class Float
  • final class Double
  • final class Bool
  • abstract final class Void
  • abstract final class Handle
  • abstract final class NativeFunction
  • abstract final class VarArgs
  • final class Packed

dart:io and dart:html

  • abstract final class HttpClientBasicCredentials
  • abstract final class HttpClientDigestCredentials
  • final class HttpProfiler

dart:io

  • abstract final class ZLibOption
  • final class ZLibCodec
  • final class GZipCodec
  • final class ZLibEncoder
  • final class ZLibDecoder
  • final class FileSystemEntityType
  • final class FileSystemEvent
  • final class FileSystemCreateEvent
  • final class FileSystemModifyEvent
  • final class FileSystemDeleteEvent
  • final class FileSystemMoveEvent
  • abstract final class Platform
  • abstract final class ProcessInfo
  • final class ProcessStartMode
  • final class ProcessResult
  • final class InternetAddressType
  • final class SocketDirection
  • final class SocketOption
  • final class RawSocketOption
  • final class ConnectionTask
  • final class Datagram
  • final class SocketMessage
  • final class StdioType
  • final class SystemEncoding

dart:isolate

  • final class Isolate
  • final class RemoteError
  • abstract final class TransferableTypedData

dart:typed_data

  • abstract final class ByteBuffer
  • abstract final class TypedData
  • final class Endian
  • abstract final class ByteData
  • abstract final class Int8List
  • abstract final class Uint8List
  • abstract final class Uint8ClampedList
  • abstract final class Int16List
  • abstract final class Uint16List
  • abstract final class Int32List
  • abstract final class Uint32List
  • abstract final class Int64List
  • abstract final class Uint64List
  • abstract final class Float32List
  • abstract final class Float64List
  • abstract final class Float32x4List
  • abstract final class Int32x4List
  • abstract final class Float64x2List
  • abstract final class Float32x4
  • abstract final class Int32x4
  • abstract final class Float64x2
  • abstract final class UnmodifiableByteBufferView
  • abstract final class UnmodifiableByteDataView
  • abstract final class UnmodifiableUint8ListView
  • abstract final class UnmodifiableInt8ListView
  • abstract final class UnmodifiableUint8ClampedListView
  • abstract final class UnmodifiableUint16ListView
  • abstract final class UnmodifiableInt16ListView
  • abstract final class UnmodifiableUint32ListView
  • abstract final class UnmodifiableInt32ListView
  • abstract final class UnmodifiableUint64ListView
  • abstract final class UnmodifiableInt64ListView
  • abstract final class UnmodifiableInt32x4ListView
  • abstract final class UnmodifiableFloat32x4ListView
  • abstract final class UnmodifiableFloat64x2ListView
  • abstract final class UnmodifiableFloat32ListView
  • abstract final class UnmodifiableFloat64ListView

It's possible, dart:mirrors might also be made entirely final, if time permits.

@dupuchba
Copy link

@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 class example is an excellent illustration. Introducing final class in 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 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-meta Cross-cutting, high-level issues (for tracking many other implementation issues, ...). enhancement-breaking-change An enhancement which is breaking.
Projects
None yet
Development

No branches or pull requests

7 participants