HHH-11377 - ReflectHelper#getConstantValue should consider digits as well
This commit is contained in:
parent
2b59aadc94
commit
491d7341ad
|
@ -188,6 +188,12 @@ subprojects { subProject ->
|
|||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// compilation
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
task compile
|
||||
compile.dependsOn compileJava, processResources, compileTestJava, processTestResources
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.hibernate.type.Type;
|
|||
public final class ReflectHelper {
|
||||
|
||||
private static final Pattern JAVA_CONSTANT_PATTERN = Pattern.compile(
|
||||
"[a-z]+\\.([A-Z]{1}[a-z]+)+\\$?([A-Z]{1}[a-z]+)*\\.[A-Z_\\$]+" );
|
||||
"[a-z\\d]+\\.([A-Z]{1}[a-z\\d]+)+\\$?([A-Z]{1}[a-z\\d]+)*\\.[A-Z_\\$]+", Pattern.UNICODE_CHARACTER_CLASS);
|
||||
|
||||
public static final Class[] NO_PARAM_SIGNATURE = new Class[0];
|
||||
public static final Object[] NO_PARAMS = new Object[0];
|
||||
|
|
|
@ -11,6 +11,7 @@ import javax.persistence.FetchType;
|
|||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.internal.util.hib3rnat3.C0nst4nts३;
|
||||
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||
|
||||
import org.junit.Before;
|
||||
|
@ -123,4 +124,14 @@ public class ReflectHelperTest {
|
|||
assertEquals( Status.ON, value );
|
||||
verify(classLoaderServiceMock, times(1)).classForName( eq("org.hibernate.internal.util.ReflectHelperTest$Status") );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getConstantValue_constant_digits() {
|
||||
|
||||
when( sessionFactoryOptionsMock.isConventionalJavaConstants() ).thenReturn( true );
|
||||
when( classLoaderServiceMock.classForName( "org.hibernate.internal.util.hib3rnat3.C0nst4nts३" ) ).thenReturn( (Class) C0nst4nts३.class );
|
||||
Object value = ReflectHelper.getConstantValue( "org.hibernate.internal.util.hib3rnat3.C0nst4nts३.ABC_DEF", sessionFactoryImplementorMock);
|
||||
assertEquals( C0nst4nts३.ABC_DEF, value );
|
||||
verify(classLoaderServiceMock, times(1)).classForName( eq("org.hibernate.internal.util.hib3rnat3.C0nst4nts३") );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.internal.util.hib3rnat3;
|
||||
|
||||
/**
|
||||
* @author Vlad Mihalcea
|
||||
*/
|
||||
public class C0nst4nts३ {
|
||||
|
||||
public static final String ABC_DEF = "xyz";
|
||||
}
|
Loading…
Reference in New Issue