Skip to content

Generated code references private class constructor which leads to compile error #351

Description

@al-the-bear

Reflectable should either handle private classes gracefully or somehow ignore them.

When I generate for my project Reflectable somehow includes the _StringStacktrace class from dart.core:

  r.NonGenericClassMirrorImpl(
    r'_StringStackTrace',
    r'dart.core._StringStackTrace',
    134217767,
    80,
    const prefix0.TomReflector(),
    const <int>[1192, 1193],
    const <int>[162, 1192, 164, 165, 166],
    const <int>[],
    41,
    {},
    {},
    {
      r'': (bool b) =>
          (_stackTrace) => b ? _StringStackTrace(_stackTrace) : null,
    },
    14, ...

The line

(_stackTrace) => b ? _StringStackTrace(_stackTrace) : null,

results in a compiler error "The function '_StringStackTrace' isn't defined."

I got this specific case several times in different projects, but it obviously depends on what parts of the dare libraries are used. I actually haven't figured out what exactly trigger this problem. I also got a similar error once from one of my classes which I resolved by changing the classname to not have the underscore prefix.

As I'm generating not automatically to save time by only generating from time to time I can simply fix this manually every time I generate, but this doesn't sound like a final solution to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions