-
Notifications
You must be signed in to change notification settings - Fork 582
4.x: Tests fail when upgrading to Hibernate 6.6.23.Final #10441 #10487
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Copyright (c) 2025 Oracle and/or its affiliates. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package io.helidon.integrations.cdi.hibernate; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| import com.oracle.svm.core.annotate.Alias; | ||
| import com.oracle.svm.core.annotate.RecomputeFieldValue; | ||
| import com.oracle.svm.core.annotate.Substitute; | ||
| import com.oracle.svm.core.annotate.TargetClass; | ||
| import net.bytebuddy.description.field.FieldDescription; | ||
| import net.bytebuddy.description.method.MethodDescription; | ||
| import net.bytebuddy.matcher.ElementMatcher; | ||
|
|
||
| @TargetClass(className = "org.hibernate.bytecode.enhance.internal.bytebuddy.ByteBuddyEnhancementContext") | ||
| @SuppressWarnings("checkstyle:StaticVariableName") | ||
| final class ByteBuddyEnhancementContext { | ||
|
|
||
| @Alias | ||
| @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias) | ||
| private static ElementMatcher.Junction<MethodDescription> IS_GETTER; | ||
|
|
||
| @Substitute | ||
| Optional<MethodDescription> resolveGetter(FieldDescription fieldDescription) { | ||
| return Optional.empty(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * Copyright (c) 2025 Oracle and/or its affiliates. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package io.helidon.integrations.cdi.hibernate; | ||
|
|
||
| import java.util.Collection; | ||
| import java.util.function.BiFunction; | ||
|
|
||
| import com.oracle.svm.core.annotate.Alias; | ||
| import com.oracle.svm.core.annotate.RecomputeFieldValue; | ||
| import com.oracle.svm.core.annotate.Substitute; | ||
| import com.oracle.svm.core.annotate.TargetClass; | ||
| import net.bytebuddy.ByteBuddy; | ||
| import net.bytebuddy.NamingStrategy; | ||
| import net.bytebuddy.description.type.TypeDefinition; | ||
| import net.bytebuddy.description.type.TypeDescription; | ||
| import net.bytebuddy.dynamic.DynamicType; | ||
|
|
||
|
|
||
| @TargetClass(className = "org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyHelper") | ||
| @SuppressWarnings("checkstyle:StaticVariableName") | ||
| final class ByteBuddyProxyHelper { | ||
|
|
||
| @Alias | ||
| @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias) | ||
| private static TypeDescription OBJECT; | ||
|
|
||
| @Substitute | ||
| private BiFunction<ByteBuddy, NamingStrategy, DynamicType.Builder<?>> proxyBuilder(TypeDefinition persistentClass, | ||
| Collection<? extends TypeDefinition> interfaces) { | ||
| return null; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2147,5 +2147,13 @@ | |
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "org.hibernate.event.spi.PostUpsertEventListener[]", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jbescos such metadata should be unnecessary if you use the Hibernate provided GraalVM module? I created that module to simplify such integrations by other frameworks, please let us know if it's not useful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this file we tell GraalVM what classes should be available for reflection at runtime. I added that because GraalVM told me to do so. We don't have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I understand, but it makes more sense to have the rules which are specific to a library to be maintained by the library - otherwise you'll need to make changes for each new Hibernate release.
Such features need to be activated |
||
| "allDeclaredConstructors": true, | ||
| "allPublicConstructors": true, | ||
| "allDeclaredMethods": true, | ||
| "allDeclaredFields": true, | ||
| "unsafeAllocated": true | ||
| } | ||
| ] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern would be that this is going to fail at runtime. Just hiding / postponing problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use static enhancement, so bytebuddy related things should not be executed. This args allows me to replace the static fields that are triggering reflection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand - but the compiler is usually right, it's running a formal proof. So if it's including it, this would suggest that there are some corner cases in which this code is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
--trace-class-initializationonly shows the stack traces I printed here. It starts withByteBuddyEnhancementContextandByteBuddyProxyHelper. We cannot know more about why are that static fields loaded.We already have a lot of GraalVM configuration related to Hibernate here and some other methods substitutions here. I was not part of this, but it seems this integration was not easy.