Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for behavior of bundles with cloneType. #908

Closed
wants to merge 5 commits into from

Conversation

grebe
Copy link
Contributor

@grebe grebe commented Oct 13, 2018

This test currently gives an inscrutable NoSuchElementException. It should be better!

This test currently fails. It should always fail. However, it currently fails with a totally inscrutable error message. I'm not sure what the right error message is, but we should make it better and make the test expect it.

Related issue:

Type of change: other enhancement

Impact: no functional change

Development Phase: bug report via test

Release Notes

This test currently gives an inscrutable NoSuchElementException. It
should be better!
@grebe grebe requested a review from a team as a code owner October 13, 2018 00:04
@chick
Copy link
Contributor

chick commented Oct 16, 2018

Can you add me as collaborator, I'd like to push a proposed improvement for the
behavior described here

chick and others added 4 commits October 16, 2018 17:06
- Add new GetReferenceException to builder
- catch .get on None in emitType on aggregate
- Throw partially filled in GetReferenceException
-
Proposed changes to give user friendlier messages on missing cloneType
@chick chick requested a review from ducky64 October 17, 2018 16:31
@chick
Copy link
Contributor

chick commented Oct 17, 2018

@ducky64 can you review this. There might be a better way, but this seemed like
the simplest way to provide a hint as to what is going on in the situation Paul found.

Copy link
Contributor

@ducky64 ducky64 left a comment

Choose a reason for hiding this comment

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

I'm not sure this is the best / cleanest solution. Fundamentally, I think this is an autoclonetype issue, and autoclonetype should detect whether there is aliasing in its field (which I assume is the problem here?), which can be done by testing referential equality of members between the source and cloned object. This seems to be an oversight in the autoclonetype implementation, despite the existence of a whole bunch of other sanity checks.

I also think that exposing cloneType as a public API isn't a great idea, since it exposes internal details and really requires a good grasp on internals to know when to use it. I think the consensus (#765) was to introduce a Field(...) API for Bundles, which would replace the use of cloneType here as well as make all Bundle fields uniform with things like Input(...) and Output(...). It may be worth taking another look at and bumping the priority of fixing #765.

Assuming both of the above are fine, I think it's mainly a question of what the immediate (before we get a fix for #765 in) error message for field aliasing should be. I'd like to avoid the proliferation of cloneType.

I'm kind of surprised it's causing a reference exception instead of something like a rebinding exception.

@albert-magyar albert-magyar mentioned this pull request Oct 23, 2018
@edwardcwang
Copy link
Contributor

@ducky64 to create an issue to check for referential equality of source and dest bundle fields in autoclonetype

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.

5 participants