Skip to content

The transformer makes an attempt to invoke null.parent. #37

Closed

Description

@zoechi

I got this exception on one of the entry-points

Serving polymer_elements_demo web on http://localhost:45700
Build error:
Transform Reflectable on polymer_elements_demo|ReflectableTransformed threw error: The null object does not have a getter 'parent'.

NoSuchMethodError: method not found: 'parent'
Receiver: null
Arguments: []
dart:core-patch/object_patch.dart 42 Object._noSuchMethod
dart:core-patch/object_patch.dart 45 Object.noSuchMethod
package:reflectable/src/transformer_implementation.dart 2326 _extractMetadataCode
package:reflectable/src/transformer_implementation.dart 739 _ReflectorDomain._generateCode.
dart:_internal/iterable.dart 390 MappedIterator.moveNext
dart:core-patch/growable_array.dart 188 List.addAll
package:reflectable/src/transformer_implementation.dart 752 _ReflectorDomain._generateCode
package:reflectable/src/transformer_implementation.dart 50 ReflectionWorld.generateCode.
dart:_internal/iterable.dart 413 MappedListIterable.elementAt
dart:_internal/iterable.dart 148 ListIterable.join
package:reflectable/src/transformer_implementation.dart 2145 _formatAsMap
package:reflectable/src/transformer_implementation.dart 48 ReflectionWorld.generateCode
package:reflectable/src/transformer_implementation.dart 1872 TransformerImplementation._generateNewEntryPoint
package:reflectable/src/transformer_implementation.dart 1996 TransformerImplementation.apply.
dart:async/zone.dart 1165 _RootZone.runUnary
dart:async/future_impl.dart 502 _Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 585 _Future._propagateToListeners
dart:async/future_impl.dart 376 _Future._completeWithValue
dart:async/future_impl.dart 430 _Future._asyncComplete.
dart:async/schedule_microtask.dart 43 _microtaskLoop
dart:async/schedule_microtask.dart 52 _microtaskLoopEntry
dart:isolate-patch/isolate_patch.dart 96 _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 151 _RawReceivePortImpl._handleMessage

dart:core Object.noSuchMethod
package:reflectable/src/transformer_implementation.dart 2326 _extractMetadataCode
package:reflectable/src/transformer_implementation.dart 739 _ReflectorDomain._generateCode.
dart:core List.addAll
package:reflectable/src/transformer_implementation.dart 752 _ReflectorDomain._generateCode
package:reflectable/src/transformer_implementation.dart 50 ReflectionWorld.generateCode.
dart:_internal ListIterable.join
package:reflectable/src/transformer_implementation.dart 2145 _formatAsMap
package:reflectable/src/transformer_implementation.dart 48 ReflectionWorld.generateCode
package:reflectable/src/transformer_implementation.dart 1872 TransformerImplementation._generateNewEntryPoint
package:reflectable/src/transformer_implementation.dart 1996 TransformerImplementation.apply.
Build completed with 1 errors.

when loading a Polymer entry page but the error wasn't even related to the page I was loading.
There is also no information about which entry-point caused the exception.

Activity

  1. eernstg commented on Oct 1, 2015

    @eernstg
    Collaborator

    This is a bug in the reflectable transformer, it should of course never make an attempt to call parent on null. There is just one place where it calls parent, and it hasn't been changed since version 0.1.1. It would be very helpful if you could provide source code that causes this failure to occur!

    The other topic is whether the transformer should continue to transform other entry points when the transformation of any given entry point fails with an transformer detected error in the program under transformation. I separated that out as a new issue #39.

  2. eernstg commented on Oct 1, 2015

    @eernstg
    Collaborator

    Adjusted the title, now that this issue is only about the null.parent bug.

  3. changed the title [-]Transformer should process other entry-points even when it encounters an error in one[/-] [+]The transformer makes an attempt to invoke `null.parent`.[/+] on Oct 1, 2015
  4. zoechi commented on Oct 1, 2015

    @zoechi
    ContributorAuthor

    Sorry, I guess I won't be able to reproduce.

    I'm working on porting PolymerElements from Polymer.js to Poylmer.dart
    There are quite a few entry points where the boilerplate is generated from a script which crawles GitHub organizations for repositories generates an entry page for each repository and copies some HTML and JS from GitHub into the generated Dart files.
    See https://github.com/bwu-dart-contributing/polymer_elements/tree/demo2/demo/web

    I also generated an entry_point line for each web_components and reflectable transformer and copied these into the pubspec.yaml file, which led to halfway valid generated code for a lot of entry-points.

    I then fixed one of the entry-points and tried to load it in Dartium which led to "unrelated" errors because the were from entry-points I didn't care about yet. I didn't expect this specific error to be of interest to you.
    The generating script changed a lot since then an produces much better code now by default. I didn't check in all the changes in between.

  5. eernstg commented on Oct 1, 2015

    @eernstg
    Collaborator

    OK, thanks for the quick reaction!

  6. zoechi commented on Oct 1, 2015

    @zoechi
    ContributorAuthor

    Seems not to difficult to reproduce after all. I just encountered it again.
    This is the source https://github.com/bwu-dart-playground/polymer_elements_parent

  7. eernstg commented on Oct 1, 2015

    @eernstg
    Collaborator

    OK, thanks!

    Apparently, it is possible for an analyzer FieldElement about a field on an instance of a subclass of Element from 'dart:html' to have null as its syntax (node). I've landed a commit (5725ef1) that protects against crashing in such a situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions