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

Reflection field hints can downgrade allowWrite #29055

Closed
philwebb opened this issue Sep 1, 2022 · 0 comments
Closed

Reflection field hints can downgrade allowWrite #29055

philwebb opened this issue Sep 1, 2022 · 0 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@philwebb
Copy link
Member

philwebb commented Sep 1, 2022

A field hint customizer can downgrade allowWrite if true is called before false. Here's a failing test:

	@Test
	void registerFieldWithCustomizersCannotDowngradeWrite() {
		Field field = ReflectionUtils.findField(TestType.class, "field");
		assertThat(field).isNotNull();
		this.reflectionHints.registerField(field, fieldHint -> fieldHint.allowWrite(true));
		this.reflectionHints.registerField(field, fieldHint -> fieldHint.allowWrite(false));
		assertTestTypeFieldHint(fieldHint -> {
			assertThat(fieldHint.getName()).isEqualTo("field");
			assertThat(fieldHint.isAllowWrite()).isTrue();
		});
	}
@philwebb philwebb self-assigned this Sep 1, 2022
@philwebb philwebb added the type: bug A general bug label Sep 1, 2022
@philwebb philwebb added this to the 6.0.0-M6 milestone Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant