-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work around no longer evaluated hibernate.properties.
the bytecode provider property is no longer supported so we need to bypass the default implementation to avoid failures with bytebuddy.
- Loading branch information
1 parent
731e8f1
commit 3e7e7ae
Showing
4 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...ore/6.5.0.CR1/src/test/java/org_hibernate_orm/hibernate_core/Target_BytecodeProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright and related rights waived via CC0 | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
package org_hibernate_orm.hibernate_core; | ||
|
||
import java.util.Map; | ||
|
||
import com.oracle.svm.core.annotate.Substitute; | ||
import com.oracle.svm.core.annotate.TargetClass; | ||
import org.hibernate.bytecode.spi.ReflectionOptimizer; | ||
import org.hibernate.property.access.spi.PropertyAccess; | ||
|
||
@TargetClass(className = "org.hibernate.bytecode.internal.none.BytecodeProviderImpl") | ||
final class Target_BytecodeProvider { | ||
|
||
@Substitute | ||
public ReflectionOptimizer getReflectionOptimizer(Class<?> clazz, Map<String, PropertyAccess> propertyAccessMap) { | ||
return null; | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
...6.5.0.CR1/src/test/java/org_hibernate_orm/hibernate_core/Target_BytecodeProviderImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Copyright and related rights waived via CC0 | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
package org_hibernate_orm.hibernate_core; | ||
|
||
import java.lang.reflect.Method; | ||
import java.util.Set; | ||
|
||
import com.oracle.svm.core.annotate.Substitute; | ||
import com.oracle.svm.core.annotate.TargetClass; | ||
import net.bytebuddy.ClassFileVersion; | ||
import org.hibernate.HibernateException; | ||
import org.hibernate.bytecode.enhance.spi.EnhancementContext; | ||
import org.hibernate.bytecode.enhance.spi.Enhancer; | ||
import org.hibernate.bytecode.spi.BasicProxyFactory; | ||
import org.hibernate.bytecode.spi.ProxyFactoryFactory; | ||
import org.hibernate.bytecode.spi.ReflectionOptimizer; | ||
import org.hibernate.engine.spi.SessionFactoryImplementor; | ||
import org.hibernate.engine.spi.SharedSessionContractImplementor; | ||
import org.hibernate.proxy.HibernateProxy; | ||
import org.hibernate.proxy.ProxyFactory; | ||
import org.hibernate.type.CompositeType; | ||
|
||
@TargetClass(className = "org.hibernate.bytecode.internal.bytebuddy.BytecodeProviderImpl") | ||
final class Target_BytecodeProviderImpl { | ||
|
||
@Substitute | ||
public Target_BytecodeProviderImpl() { | ||
|
||
} | ||
|
||
@Substitute | ||
public Target_BytecodeProviderImpl(ClassFileVersion targetCompatibleJVM) { | ||
|
||
} | ||
|
||
@Substitute | ||
public ProxyFactoryFactory getProxyFactoryFactory() { | ||
return new ProxyFactoryFactory() { | ||
@Override | ||
public ProxyFactory buildProxyFactory(SessionFactoryImplementor sessionFactory) { | ||
return new ProxyFactory() { | ||
@Override | ||
public void postInstantiate( | ||
String entityName, | ||
Class<?> persistentClass, | ||
Set<Class<?>> interfaces, | ||
Method getIdentifierMethod, | ||
Method setIdentifierMethod, | ||
CompositeType componentIdType) { | ||
} | ||
|
||
@Override | ||
public HibernateProxy getProxy(Object id, SharedSessionContractImplementor session) throws HibernateException { | ||
throw new HibernateException( "Generation of HibernateProxy instances at runtime is not allowed when the configured BytecodeProvider is 'none'; your model requires a more advanced BytecodeProvider to be enabled." ); | ||
} | ||
}; | ||
} | ||
|
||
@Override | ||
public BasicProxyFactory buildBasicProxyFactory(Class superClassOrInterface) { | ||
return new BasicProxyFactory() { | ||
@Override | ||
public Object getProxy() { | ||
throw new HibernateException( "NoneBasicProxyFactory is unable to generate a BasicProxy for type " + superClassOrInterface + ". Enable a different BytecodeProvider." ); | ||
} | ||
}; | ||
} | ||
}; | ||
} | ||
|
||
|
||
@Substitute | ||
public ReflectionOptimizer getReflectionOptimizer( | ||
Class clazz, | ||
String[] getterNames, | ||
String[] setterNames, | ||
Class[] types) { | ||
throw new HibernateException( "Using the ReflectionOptimizer is not possible when the configured BytecodeProvider is 'none'. Use a different BytecodeProvider" ); | ||
} | ||
|
||
@Substitute | ||
public Enhancer getEnhancer(EnhancementContext enhancementContext) { | ||
return null; | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
....CR1/src/test/java/org_hibernate_orm/hibernate_core/Target_BytecodeProviderInitiator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright and related rights waived via CC0 | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
package org_hibernate_orm.hibernate_core; | ||
|
||
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 org.hibernate.bytecode.spi.BytecodeProvider; | ||
|
||
import static com.oracle.svm.core.annotate.RecomputeFieldValue.Kind; | ||
|
||
@TargetClass(className = "org.hibernate.bytecode.internal.BytecodeProviderInitiator") | ||
final class Target_BytecodeProviderInitiator { | ||
|
||
@Alias | ||
public static String BYTECODE_PROVIDER_NAME_NONE; | ||
|
||
@Alias | ||
@RecomputeFieldValue(kind = Kind.FromAlias) | ||
public static String BYTECODE_PROVIDER_NAME_DEFAULT = BYTECODE_PROVIDER_NAME_NONE; | ||
|
||
@Substitute | ||
public static BytecodeProvider buildDefaultBytecodeProvider() { | ||
return new org.hibernate.bytecode.internal.none.BytecodeProviderImpl(); | ||
} | ||
|
||
@Substitute | ||
public static BytecodeProvider getBytecodeProvider(Iterable<BytecodeProvider> bytecodeProviders) { | ||
return new org.hibernate.bytecode.internal.none.BytecodeProviderImpl(); | ||
} | ||
|
||
} |