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
Abstract method missing from ClassMirror's instanceMembers #15727
Comments
This comment was originally written by natha...@ofiesh.com This is from https://groups.google.com/a/dartlang.org/forum/#!topic/misc/UsOPKmV48Jw Possible source of bug: https://groups.google.com/a/dartlang.org/d/msg/misc/UsOPKmV48Jw/taVQoVxYf68J |
cc @peter-ahe-google. |
This comment was originally written by @stevenroose Why isn't this fixed yet? The documentation for instanceMembers is very clear
It should contain abstract methods since they will be part of every instance of the class. |
Abstract members are not part of an instance. They are par of the interface of the class, but not part of an actual instance of that class. It may be an actual member of a subclass, buy is only a warning if it isn't. The documentation seems to match the implementation. |
This comment was originally written by natha...@ofiesh.com If that's the case, IMO "instanceMembers" should be scrapped and replaced with "declaredMembers." In the mirror api, when getting the instance members, abstract methods are not added to "instanceMembers" because isAbstract == true. This is consistent with that definition, however there is no possible way in the API to reflect abstract methods. It would be far more useful to have all declared members and methods can be checked for isAbstract if needed. My problem right now is it's impossible to create a proxy of an abstract class with an abstract method. So if "instanceMembers" is working as intended, should I open a new bug for "No way to reflect abstract methods?" |
All declared members, including abstract ones, are available in "declarations". |
Can we close this bug? |
I read this as requesting a method that returns all the members of the interface. You can find them by traversing the super-class/super-interface tree but that is complex - which is probably why the functionality hasn't been implemented, but also why it's very inconvenient for a user to handle it - especially handling the unification of the types if a member is inherited from more than one interface. |
This comment was originally written by natha...@ofiesh.com As far as I'm concerned, it can be closed. If it's available in declarations then I don't care. I think declarations might not have been around when I filed this bug a year and a half ago, but not really sure--doesn't matter. |
This comment was originally written by @stevenroose How about a getter "interfaceMembers" that contains all members of the interface of the class? |
This issue was originally filed by natha...@ofiesh.com
What steps will reproduce the problem?
import "dart:mirrors";
abstract class Foo {
bar();
}
main() {
ClassMirror cm = reflectClass(Foo);
print(cm.instanceMembers[const Symbol("bar")]);
}
What is the expected output? What do you see instead?
Expected "MethodMirror on 'bar'"
Instead it prints null
What version of the product are you using? On what operating system?
Dart Editor version 1.1.0.dev_04_00 (DEV)
Dart SDK version 1.1.0-dev.4.0
Windows 7
Please provide any additional information below.
The text was updated successfully, but these errors were encountered: