dart-league / dson

dart library which converts Dart Objects into their JSON representation
Apache License 2.0
66 stars 14 forks source link

Exception when deserializing simple json object. #11

Closed slodko closed 8 years ago

slodko commented 8 years ago

I've got exception when deserializing simple json:

Exception: Uncaught Error: type 'List<Object>' is not a subtype of type 'List<InstanceMirror>' of 'ams'.
Stack Trace:
#0      GetValueOfAnnotation._fromAnnotations (package:drails_commons/src/scanners.dart:16:43)
#1      GetValueOfAnnotation.fromDeclaration (package:drails_commons/src/scanners.dart:11:46)
#2      _fillObject.<anonymous closure> (package:dson/src/deserializer.dart:139:72)
#3      _HashVMBase&MapMixin&&_LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:340)
#4      _fillObject (package:dson/src/deserializer.dart:122:68)
#5      fromJson (package:dson/src/deserializer.dart:23:3)

The argument of GetValueOfAnnotation._fromAnnotations() should probably be List<Object> not List<InstanceMirror>.

luisvt commented 8 years ago

let me check. In the mean time could you test using dartVM in no checked mode?

slodko commented 8 years ago

When checked mode is turned off everything works ok.

luisvt commented 8 years ago

If I'm not wrong this error is caused by reflectable library. This is because the getter DeclarationMirror.metadata returns List<Obje> instead List<InstanceMirror>. If you see their source code:

List<Object> get metadata; // TYARG: InstanceMirror

you see something about that, however I don't understand completely why need to do this.

I'm going to close this issue, thanks for submitting it, and please let me know of any new issue or any new request.