Coder Social home page Coder Social logo

Comments (11)

eernstg avatar eernstg commented on July 19, 2024

Thanks! Do you have code which will reproduce the problem? (I couldn't see any references to code at dart-archive/dart-protoc-plugin#51, and I'm not sure git clone https://github.com/dart-lang/dart-protoc-plugin will do).

from reflectable.dart.

eernstg avatar eernstg commented on July 19, 2024

Tried

...$ git clone 'https://github.com/dart-lang/dart-protoc-plugin'
...$ cd dart-protoc-plugin
...$ pub get
...$ pub build --mode=debug test

where the latter produces 14919 lines of diagnostic messages, but it ends in 'Build failed.', none of the messages mention _Readonly, and the 'build' directory tree is empty, so that wasn't enough.

Could you give some more input on how you can reproduce the problem?

from reflectable.dart.

wienczny avatar wienczny commented on July 19, 2024

It took some time to prepare a minimal example: https://github.com/wienczny/ReflectableBugExample
dart-protoc-plugin used is dart-archive/dart-protoc-plugin@58a031c
The bug can be triggered inside the ReflectableBugExample by running pub build

from reflectable.dart.

eernstg avatar eernstg commented on July 19, 2024

Got it, thanks a lot!

from reflectable.dart.

eernstg avatar eernstg commented on July 19, 2024

Ah, sorry -- this is a very simple issue: The problem is that there is an attempt to access a private declaration in 'messages.pb.dart' and reflectable does not support access to private declarations.

It is common for Dart tools to react to this situation (access to private declarations across library boundaries) by claiming that the requested name does not exist. The underlying reason is that the private names are renamed such that there is no way to access them (not even with dynamic invocation).

Couldn't you simply make _ReadonlyEnvelope public?

from reflectable.dart.

eernstg avatar eernstg commented on July 19, 2024

Duplicate of #33.

from reflectable.dart.

wienczny avatar wienczny commented on July 19, 2024

If you mean manually modifying all _Readonly* in the generated code - I could do that.
I just prefer a solution that worked across rebuilds, though.

from reflectable.dart.

eernstg avatar eernstg commented on July 19, 2024

And you don't have enough control over that code generation process to avoid the generation of that as a private name in the first place?

For instance, if there is a transformer somewhere which will consistently create this type of problem for many of its users then the maintainer of that transformer might be persuaded to make that change..

from reflectable.dart.

sigurdm avatar sigurdm commented on July 19, 2024

We can sort private classes away when generating the code, I guess that is better than generating invalid code - not all classes might be in the users control to make public.

When sorting away a private member it could be logged with logger.fine so a pub build --verbose would reveal that it happened.

from reflectable.dart.

eernstg avatar eernstg commented on July 19, 2024

Reclassified as a bug: I forgot that we are actually generating that private name, which shouldn't happen in any case.

from reflectable.dart.

eernstg avatar eernstg commented on July 19, 2024

We're now avoiding to create the expressions that will not compile because they attempt to access a private declaration in a different library (commit 2d9b6f5 on reflectable).

Looking at your explanation again, it looks like the private class was not annotated directly by you, it may instead have been selected by subtype quantification in a reflector that you hadn't even written, and the class itself might even have been generated. That would of course make it quite difficult to avoid that it gets included. But the above-mentioned update should help you, and it does eliminate the problem in the example you provided.

from reflectable.dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.