redstone-dart / redstone

A metadata driven microframework for Dart.
http://redstone-dart.github.io/redstone
MIT License
342 stars 42 forks source link

Mapper Error: The null object does not have a getter 'isDartCore'. #79

Closed cgarciae closed 9 years ago

cgarciae commented 9 years ago

I am getting this error when I try to build. I really don't know what may cause it but it fatal since I cant deploy :(

Build error:
Transform StaticMapperGenerator on aristadart|web/main.dart threw error: The null object does not have a getter 'isDartCore'.

NoSuchMethodError: method not found: 'isDartCore'
Receiver: null
Arguments: []
dart:core-patch/object_patch.dart 45              Object.noSuchMethod
package:redstone_mapper/transformer.dart 508      _UsedLibs.resolveLib
package:redstone_mapper/transformer.dart 445      _TypeCodecGenerator._getTypeName
package:redstone_mapper/transformer.dart 479      _TypeCodecGenerator._buildMapper
package:redstone_mapper/transformer.dart 385      _TypeCodecGenerator._buildEncoder.<fn>
dart:collection/iterable.dart 227                 IterableBase.forEach
package:redstone_mapper/transformer.dart 381      _TypeCodecGenerator._buildEncoder
package:redstone_mapper/transformer.dart 367      _TypeCodecGenerator.toString
dart:core-patch/string_buffer_patch.dart 64       StringBuffer.write
dart:collection/maps.dart 302                     Maps.mapToString.<fn>
dart:collection-patch/collection_patch.dart 977   _HashMap&&_LinkedHashMapMixin.forEach
dart:collection/maps.dart 295                     Maps.mapToString
dart:collection-patch/collection_patch.dart 228   _HashMap.toString
package:redstone_mapper/transformer.dart 75       StaticMapperGenerator.applyResolver
package:code_transformers/src/resolvers.dart 113  Transformer&ResolverTransformer.applyToEntryPoints.<fn>.<fn>
dart:async/future.dart 118                        Future.Future.<fn>
dart:async-patch/timer_patch.dart 12              Timer._createTimer.<fn>
dart:io/timer_impl.dart 292                       _handleTimeout
dart:isolate-patch/isolate_patch.dart 130         _RawReceivePortImpl._handleMessage
cgarciae commented 9 years ago

This is my main file where the error is supposed to occure

import 'package:angular/angular.dart';
import 'package:angular/routing/module.dart';
import 'package:angular/application_factory.dart';
import 'package:logging/logging.dart';
import 'package:redstone_mapper/mapper_factory.dart';
import 'package:aristadart/arista_client.dart';

@MirrorsUsed(targets: const[
  'angular',
  'angular.core',
  'angular.core.dom',
  'angular.filter',
  'angular.perf',
  'angular.directive',
  'angular.routing',
  'angular.core.parser',
  'NodeTreeSanitizer'
  ],
  override: '*')
import 'dart:mirrors';

class MyAppModule extends Module
{
    MyAppModule()
    {
        bind (LoginVista);
        bind (HomeVista);
        bind (EventoVista);
        bind (VistaVista);
        bind (NuevoUsuarioVista);
        bind (AdminVista);
        bind (ModelVista);
        bind (TargetVista);
        bind (RouteInitializerFn, toValue: recipeBookRouteInitializer);
        bind (NgRoutingUsePushState, toValue: new NgRoutingUsePushState.value(false));
    }
}

void main()
{

    bootstrapMapper();

    Logger.root.level = Level.FINEST;
    Logger.root.onRecord.listen((LogRecord r) { print(r.message); });

    applicationFactory()
        .addModule(new MyAppModule())
        .rootContextType (MainController)
        .run();
}
luizmineo commented 9 years ago

Try to add a library directive to your main script. Example:

library aristadart.main

You can also heck if all imported scripts has a library directive.

cgarciae commented 9 years ago

Thanks, will try.

cgarciae commented 9 years ago

@luizmineo I pinned it down and found the problem (again) is

class MapResp extends Resp
{
    @Field() Map map;
}
luizmineo commented 9 years ago

The problem here is that the map field has no type parameters (for example: Map<String, MyObject> map). I've published redstone_mapper v0.1.13 with a fix that prevents the transformer from crashing in this case, but it's still unable to properly encode or decode Map and List objects without type parameters.

cgarciae commented 9 years ago

Yeah, I used it to see if a could avoid creating a class for the time being, but I don't think it would be a good practice.

luizmineo commented 9 years ago

Can you confirm that the fix solved the problem for you?