Dart 2 Breaking Change: New methods and constructors on Invocation

146 views
Skip to first unread message

Leaf Petersen

unread,
Feb 21, 2018, 6:06:56 PM2/21/18
to Dart Misc
TLDR: If you don't have code that implements or mixes in the `Invocation` class, you can stop reading.

We (the Dart team) are making some small breaking changes to the `Invocation` class to reflect the addition of generic methods to Dart 2.  See below for a summary of the change and its impact.

What is changing

We are adding the following getter to `Invocation`:

   List<Type> get typeArguments;

The method is added as non-abstract and returning an empty list, so all classes that currently extend Invocation will remain valid.

The Invocation class now has constructors that can create all instances with any valid state, so many classes implementing Invocation are probably now unnecessary.  As a result however,  the Invocation class can no longer be used as a mixin.

What will break?

All classes that implement `Invocation` need to add a corresponding getter:

  @override
  List<Type> get typeArguments {
    throw new UnimplementedError("typeArguments");
  }

Classes that use `Invocation` as a mixin will no longer work.  We are not aware of any such uses.

Why is this change being made?

Dart 2 adds generic methods to the language, and so method invocations may include type arguments which may need to be passed on to a noSuchMethod invocation.  There is currently no place in the `Invocation` class to record these type arguments. 

I will update here when this change lands.  Please reach out to me here or offline with any concerns, and/or with help resolving any issues after this change has landed.

thanks,
-leaf

Leaf Petersen

unread,
Apr 10, 2018, 8:07:13 PM4/10/18
to Dart Misc
This has landed.  Please let me know if you see any issues.

-leaf
Reply all
Reply to author
Forward
0 new messages