Skip to content

Commit 9267c5e

Browse files
committed
HHH-14792 Remove support for bytecode enhancement via Javassist
1 parent a70b994 commit 9267c5e

File tree

60 files changed

+16
-4822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+16
-4822
lines changed

documentation/src/main/asciidoc/quickstart/tutorials/osgi/managed-jpa/features.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
6161
<bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
6262
<bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
63-
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
6463

6564
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
6665

documentation/src/main/asciidoc/quickstart/tutorials/osgi/managed-jpa/pom.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@
5656
org.apache.karaf.shell.console,
5757
org.apache.karaf.shell.commands,
5858
javax.persistence;version="[1.0.0,2.1.0]",
59-
<!-- Needed for proxying's Javassist enhancement during runtime -->
60-
org.hibernate.proxy,
61-
javassist.util.proxy,
6259
*
6360
</Import-Package>
6461
<Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>

documentation/src/main/asciidoc/quickstart/tutorials/osgi/unmanaged-jpa/features.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
3434
<bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
3535
<bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
36-
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
3736

3837
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
3938

documentation/src/main/asciidoc/quickstart/tutorials/osgi/unmanaged-jpa/pom.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@
6868
org.apache.karaf.shell.commands,
6969
org.h2,
7070
javax.persistence;version="[1.0.0,2.1.0]",
71-
<!-- Needed for proxying's Javassist enhancement during runtime -->
72-
org.hibernate.proxy,
73-
javassist.util.proxy,
7471
*
7572
</Import-Package>
7673
</instructions>

documentation/src/main/asciidoc/quickstart/tutorials/osgi/unmanaged-native/features.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
4242
<bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
4343
<bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
44-
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>
4544

4645
<bundle>mvn:org.hibernate.common/hibernate-commons-annotations/4.0.5.Final</bundle>
4746

documentation/src/main/asciidoc/quickstart/tutorials/osgi/unmanaged-native/pom.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@
7676
org.hibernate.cfg,
7777
org.hibernate.service,
7878
javax.persistence;version="[1.0.0,2.1.0]",
79-
<!-- Needed for proxy enhancement during runtime -->
80-
org.hibernate.proxy,
81-
javassist.util.proxy,
8279
*
8380
</Import-Package>
8481
</instructions>

documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ Enable lazy loading feature in runtime bytecode enhancement. This way, even basi
434434
Enable association management feature in runtime bytecode enhancement which automatically synchronizes a bidirectional association when only one side is changed.
435435

436436
`*hibernate.bytecode.provider*` (e.g. `bytebuddy` (default value))::
437-
The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/BytecodeProvider.html[`BytecodeProvider`] built-in implementation flavor. Currently, only `bytebuddy` and `javassist` are valid values; `bytebuddy` is the default and recommended choice; `javassist` will be removed soon.
437+
The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/BytecodeProvider.html[`BytecodeProvider`] built-in implementation flavor. Currently, only `bytebuddy` is a valid value, as older deprecated options have been removed.
438438

439439
`*hibernate.bytecode.use_reflection_optimizer*` (e.g. `true` or `false` (default value))::
440440
Should we use reflection optimization? The reflection optimizer implements the https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/ReflectionOptimizer.html[`ReflectionOptimizer`] interface and improves entity instantiation and property getter/setter calls.

documentation/src/main/asciidoc/userguide/chapters/domain/entity.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,9 @@ Hibernate will trigger a Persistence Context flush if there are pending `Account
455455
==== Define a custom entity proxy
456456

457457
By default, when it needs to use a proxy instead of the actual POJO, Hibernate is going to use a Bytecode manipulation library like
458-
https://jboss-javassist.github.io/javassist/[Javassist] or
459458
https://bytebuddy.net/[Byte Buddy].
460459

461-
However, if the entity class is final, Javassist will not create a proxy and you will get a POJO even when you only need a proxy reference.
460+
However, if the entity class is final, a proxy will not be created; you will get a POJO even when you only need a proxy reference.
462461
In this case, you could proxy an interface that this particular entity implements, as illustrated by the following example.
463462

464463
[[entity-proxy-interface-mapping]]

documentation/src/main/asciidoc/userguide/chapters/osgi/OSGi.adoc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ That `DataSource` is then used by your `persistence.xml` persistence-unit. The f
9393
Your bundle's manifest will need to import, at a minimum:
9494

9595
* `javax.persistence`
96-
* `org.hibernate.proxy` and `javassist.util.proxy`, due to Hibernate's ability to return proxies for lazy initialization (Javassist enhancement occurs on the entity's `ClassLoader` during runtime).
9796

9897
=== Obtaining an EntityManger
9998

@@ -123,7 +122,6 @@ Similar to any other JPA setup, your bundle must include a `persistence.xml` fil
123122
Your bundle's manifest will need to import, at a minimum:
124123

125124
* `javax.persistence`
126-
* `org.hibernate.proxy` and `javassist.util.proxy`, due to Hibernate's ability to return proxies for lazy initialization (Javassist enhancement occurs on the entity's `ClassLoader` during runtime)
127125
* JDBC driver package (example: `org.h2`)
128126
* `org.osgi.framework`, necessary to discover the `EntityManagerFactory` (described below)
129127

@@ -157,7 +155,6 @@ Native Hibernate use is also supported. The client bundle is responsible for man
157155
Your bundle's manifest will need to import, at a minimum:
158156

159157
* `javax.persistence`
160-
* `org.hibernate.proxy` and `javassist.util.proxy`, due to Hibernate's ability to return proxies for lazy initialization (Javassist enhancement occurs on the entity's `ClassLoader` during runtime)
161158
* JDBC driver package (example: `org.h2`)
162159
* `org.osgi.framework`, necessary to discover the `SessionFactory` (described below)
163160
* `org.hibernate.*` packages, as necessary (ex: cfg, criterion, service, etc.)

gradle/java-module.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ dependencies {
7272
testCompile( libraries.byteman_bmunit )
7373

7474
testRuntime( libraries.log4j2 )
75-
testRuntime( libraries.javassist )
7675
testRuntime( libraries.byteBuddy )
7776

7877
//Databases

gradle/libraries.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ ext {
2424
weldVersion = '3.1.5.Final'
2525
jakartaWeldVersion = '4.0.1.SP1'
2626

27-
javassistVersion = '3.27.0-GA'
2827
byteBuddyVersion = '1.11.12'
2928

3029
agroalVersion = '1.9'
@@ -64,9 +63,6 @@ ext {
6463
// Dom4J
6564
dom4j: 'org.dom4j:dom4j:2.1.3@jar',
6665

67-
// Javassist
68-
javassist: "org.javassist:javassist:${javassistVersion}",
69-
7066
// Byte Buddy
7167
byteBuddy: "net.bytebuddy:byte-buddy:${byteBuddyVersion}",
7268

hibernate-core-jakarta/hibernate-core-jakarta.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ configurations {
2020

2121
dependencies {
2222
compile( libraries.jakarta_jpa )
23-
// This can now be made provided
24-
compile( libraries.javassist )
2523
// Could be made optional?
2624
compile( libraries.byteBuddy )
2725
compile( libraries.antlr )
@@ -75,7 +73,6 @@ dependencies {
7573
testRuntime( "org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:1.0.0.Final" )
7674
testRuntime( libraries.jakarta_el )
7775
testRuntime( 'jaxen:jaxen:1.1' )
78-
testRuntime( libraries.javassist )
7976
testRuntime( libraries.byteBuddy )
8077
testRuntime( libraries.jakarta_weld )
8178
testRuntime( libraries.atomikos )

hibernate-core/hibernate-core.gradle

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,17 @@ sourceSets {
2828
setSrcDirs( ['src/test/java','src/test/resources','src/test/bundles'] )
2929
}
3030
}
31-
32-
testJavassist {
33-
java {
34-
compileClasspath += main.output + test.output
35-
runtimeClasspath += main.output + test.output
36-
}
37-
}
3831
}
3932

4033
configurations {
4134
tests {
4235
description = 'Configuration for the produced test jar'
4336
}
44-
45-
//Configures the compile and runtime configurations for our javassist tests
46-
//and includes the dependencies of the test task.
47-
testJavassistCompile.extendsFrom testCompile
48-
testJavassistRuntime.extendsFrom testRuntime
4937
}
5038

5139
dependencies {
5240

5341
compile( libraries.jpa )
54-
// This can now be made provided
55-
compile( libraries.javassist )
5642
// Could be made optional?
5743
compile( libraries.byteBuddy )
5844
compile( libraries.antlr )
@@ -103,7 +89,6 @@ dependencies {
10389
testRuntime( "org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:1.0.0.Final" )
10490
testRuntime( libraries.expression_language )
10591
testRuntime( 'jaxen:jaxen:1.1' )
106-
testRuntime( libraries.javassist )
10792
testRuntime( libraries.byteBuddy )
10893
testRuntime( libraries.weld )
10994
testRuntime( libraries.atomikos )
@@ -118,9 +103,6 @@ dependencies {
118103
testCompile libraries.jboss_ejb_spec_jar
119104
testCompile libraries.jboss_annotation_spec_jar
120105

121-
// Additional tests requiring Javassist
122-
// folder in src/javassist/java
123-
testJavassistCompile libraries.javassist
124106
}
125107

126108
jar {
@@ -265,35 +247,3 @@ test {
265247
}
266248
}
267249

268-
//Create the task that runs the integration tests found from the
269-
//configured source directory and uses the correct classpath.
270-
task testJavassist(type: Test) {
271-
testClassesDirs = sourceSets.testJavassist.output.classesDirs
272-
classpath = sourceSets.testJavassist.runtimeClasspath
273-
//If you want to ensure that integration tests are run every time when you invoke
274-
//this task, uncomment the following line.
275-
//outputs.upToDateWhen { false }
276-
277-
if ( gradle.ext.javaToolchainEnabled ) {
278-
// Configure version of Java tools
279-
javaLauncher = javaToolchains.launcherFor {
280-
languageVersion = gradle.ext.javaVersions.test.launcher
281-
}
282-
283-
// Configure JVM Options
284-
jvmArgs( getProperty( 'toolchain.launcher.jvmargs' ).toString().split( ' ' ) )
285-
286-
// Display version of Java tools
287-
doFirst {
288-
logger.lifecycle "Testing javassist with '${javaLauncher.get().metadata.installationPath}'"
289-
}
290-
}
291-
292-
if ( gradle.ext.javaVersions.test.launcher.asInt() >= 9 ) {
293-
// Javassist needs this to generate proxies
294-
jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] )
295-
}
296-
}
297-
298-
check.dependsOn testJavassist
299-
testJavassist.mustRunAfter test

0 commit comments

Comments
 (0)