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

Fix the non-default constructor mechanism of bytecode recording #31183

Merged
merged 4 commits into from
Feb 16, 2023

Conversation

gastaldi
Copy link
Contributor

@gastaldi
Copy link
Contributor Author

gastaldi commented Feb 15, 2023

Thanks to @Ladicek and @geoand who helped with the investigation and provided the proper fix!

@geoand
Copy link
Contributor

geoand commented Feb 15, 2023

I didn't do anything, you guys did all the work :)

@gastaldi
Copy link
Contributor Author

@geoand well, you approved this PR, so that's something 😉

@Ladicek
Copy link
Contributor

Ladicek commented Feb 15, 2023

LGTM, obviously :-) It would be nice if @stuartwdouglas could also take a look!

@quarkus-bot

This comment has been minimized.

Bytecode recorders attempt to match constructor parameters to properties
and skip setting properties that were initialized by the constructor.
The assumption is that if the constructor has a parameter with the same
name as the property, the property is set by the constructor. Otherwise
it needs to be set using a setter.

This matching was not implemented for the non-default constructor mechanism.
This commit fixes that.
- Change creation of a large collection in `BytecodeRecorderTestCase.java` from using a loop to using `Collections.nCopies`
@gastaldi
Copy link
Contributor Author

@Ladicek looks like ArC didn't like that change:

Could not find parameters for constructor public io.smallrye.config.ConfigMappings$ConfigClassWithPrefix(java.lang.Class,java.lang.String) could not read field values [arg1, arg0]

Bytecode recorders attempt to match properties to constructor parameters
by the property/parameter name. However, parameters do not always have
to have their names available. This commit fixes the bytecode recorder
matching mechanism to avoid parameters that do not have an available name.
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 15, 2023

Failing Jobs - Building 8a65238

Status Name Step Failures Logs Raw logs
✔️ JVM Tests - JDK 11
✔️ JVM Tests - JDK 17
JVM Tests - JDK 18 Build ⚠️ Check → Logs Raw logs
MicroProfile TCKs Tests Verify Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ MicroProfile TCKs Tests #

- Failing: tcks/microprofile-lra 

📦 tcks/microprofile-lra

org.eclipse.microprofile.lra.tck.TckCancelOnTests.cancelOn301 line 120 - More details - Source on GitHub

java.lang.AssertionError: Response status on call to 'http://localhost:8081/lraresource-cancelon/cancelOn301' failed to match. expected:<301> but was:<503>
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.failNotEquals(Assert.java:835)

org.eclipse.microprofile.lra.tck.TckCancelOnTests.cancelOnFamilyDefault4xx line 68 - More details - Source on GitHub

java.lang.AssertionError: Response status on call to 'http://localhost:8081/lraresource-cancelon/cancelOnFamilyDefault4xx' failed to match. expected:<400> but was:<503>
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.failNotEquals(Assert.java:835)

org.eclipse.microprofile.lra.tck.TckCancelOnTests.cancelOnFamilyDefault5xx line 84 - More details - Source on GitHub

java.lang.AssertionError: Response status on call to 'http://localhost:8081/lraresource-cancelon/cancelOnFamilyDefault5xx' failed to match. expected:<500> but was:<503>
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.failNotEquals(Assert.java:835)

org.eclipse.microprofile.lra.tck.TckCancelOnTests.notCancelOnFamily5xx line 140 - More details - Source on GitHub

java.lang.AssertionError: Response status on call to 'http://localhost:8081/lraresource-cancelon/notCancelOnFamily5xx' failed to match. expected:<500> but was:<503>
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.failNotEquals(Assert.java:835)

org.eclipse.microprofile.lra.tck.TckCancelOnTests.cancelOnFamily3xx line 100 - More details - Source on GitHub

java.lang.AssertionError: Response status on call to 'http://localhost:8081/lraresource-cancelon/cancelOnFamily3xx' failed to match. expected:<303> but was:<503>
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.failNotEquals(Assert.java:835)

org.eclipse.microprofile.lra.tck.TckCancelOnTests.cancelFromRemoteCall line 160 - More details - Source on GitHub

java.lang.AssertionError: Response status on call to 'http://localhost:8081/lraresource-cancelon/cancelFromRemoteCall' failed to match. expected:<200> but was:<503>
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.failNotEquals(Assert.java:835)

@gastaldi
Copy link
Contributor Author

Test failures are unrelated and happen in current main branch

@gastaldi gastaldi merged commit c60b62e into quarkusio:main Feb 16, 2023
@gastaldi gastaldi deleted the bytecode_recorder_collection branch February 16, 2023 02:13
@quarkus-bot quarkus-bot bot added this to the 3.0 - main milestone Feb 16, 2023
@gsmet
Copy link
Member

gsmet commented Feb 16, 2023

If we want it backported, we will need specific PRs. It doesn't apply cleanly and I prefer having the author fix the conflicts given it's a sensitive matter.

@gastaldi
Copy link
Contributor Author

gastaldi commented Feb 16, 2023

I'll refrain from backporting this to 2.13 because it involves changes that would require a deeper analysis (like the introduction of RecordingAnnotationsUtil)

UPDATE: actually, I think that's quite trivial, let me check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in Quarkus bytecode generation
5 participants