Skip to content

Comments

fix for issue 354#355

Merged
eernstg merged 1 commit intogoogle:masterfrom
StuartSharpless:fix_354
Feb 5, 2026
Merged

fix for issue 354#355
eernstg merged 1 commit intogoogle:masterfrom
StuartSharpless:fix_354

Conversation

@StuartSharpless
Copy link
Contributor

Fix, if you want it, for issue 354 Exception in _getLibraryMetadata while running reflectable_builder

Just adding the length check for the directives list.

@google-cla
Copy link

google-cla bot commented Feb 4, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Collaborator

@eernstg eernstg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @StuartSharpless, this looks good to me!

@sigurdm, could you take a look as well?

@eernstg eernstg requested a review from sigurdm February 4, 2026 10:54
@eernstg
Copy link
Collaborator

eernstg commented Feb 4, 2026

@StuartSharpless, the 'contributor license agreement' needs to be in place in order to land this PR. If you're OK with that then please check out the 'Details' in the 'cla/google' item above. Otherwise I can just create a new PR to do the same thing.

@StuartSharpless
Copy link
Contributor Author

@eernstg I think I have now completed the CIA it shows successful for me. I thought I had before as well :-)

@eernstg
Copy link
Collaborator

eernstg commented Feb 5, 2026

It's such a basic thing to check that a list isn't empty before accessing the first element in it, so it's kind of surprising that this bug could exist for years and years without being detected.

However, it does make sense that it wouldn't happen often: The empty list can only be encountered in a situation where the reflectable code generator is invoked on an entry point that has no imports (and no exports, etc, but "no imports" is the one that matters), and this implies that the run would fail very soon after: The code generator bails out if the program (all libraries reachable from the entry point) doesn't include reflectable.dart. So we'll avoid the crash, but the code generator will then immediately end the run and announce that there's nothing it can do with this entry point. ;-)

@eernstg eernstg merged commit 6f2fb8d into google:master Feb 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants