Skip to content

Commit c975ed5

Browse files
HHH-19365 - revert format updated code
This reverts commit b2f27c1.
1 parent 55ab3c5 commit c975ed5

File tree

163 files changed

+4290
-5388
lines changed

Some content is hidden

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

163 files changed

+4290
-5388
lines changed

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
db=h2
2+
23
# Keep all these properties in sync unless you know what you are doing!
34
# We set '-Dlog4j2.disableJmx=true' to prevent classloader leaks triggered by the logger.
45
# (Some of these settings need to be repeated in the test.jvmArgs blocks of each module)
56
org.gradle.jvmargs=-Dlog4j2.disableJmx -Xmx2g -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8
67
toolchain.compiler.jvmargs=-Dlog4j2.disableJmx=true -Xmx2g -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8
78
toolchain.javadoc.jvmargs=-Dlog4j2.disableJmx=true -Xmx2g -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8
89
toolchain.launcher.jvmargs=-Dlog4j2.disableJmx=true -Xmx2g -XX:MaxMetaspaceSize=448m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8
10+
911
org.gradle.parallel=true
12+
1013
# enable Gradle's Task Cache. worst case:
1114
# > rm -rf ~/.gradle/caches/build-cache-1
1215
org.gradle.caching=true
16+
1317
# JDK auto-detection is not quite ready yet in Gradle 6.7.
1418
# On Fedora in particular, if you have the package java-1.8.0-openjdk-headless-1.8.0.265.b01-1.fc32.x86_64 installed,
1519
# Gradle will look for the Java binaries in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/bin/java
@@ -20,6 +24,7 @@ org.gradle.java.installations.auto-detect=false
2024
# We can't rely on Gradle's auto-download of JDKs as it doesn't support EA releases.
2125
# See https://github.com/gradle/gradle/blob/fc7ea24f3c525d8d12a4346eb0f15976a6be9414/subprojects/platform-jvm/src/main/java/org/gradle/jvm/toolchain/install/internal/AdoptOpenJdkRemoteBinary.java#L114
2226
org.gradle.java.installations.auto-download=false
27+
2328
# externalized definition of JDK versions so that they are available in both Project (build.gradle) and Settings (settings.gradle)
2429
orm.jdk.base=17
2530
orm.jdk.max=22

hibernate-core/src/main/java/org/hibernate/dialect/AbstractGaussDBStructJdbcType.java

Lines changed: 31 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
55
package org.hibernate.dialect;
6-
76
import java.lang.reflect.Array;
87
import java.sql.CallableStatement;
98
import java.sql.ResultSet;
@@ -57,39 +56,36 @@
5756
* is probably not very efficient.
5857
*
5958
* @author liubao
60-
* <p>
59+
*
6160
* Notes: Original code of this class is based on AbstractPostgreSQLStructJdbcType.
6261
*/
6362
public abstract class AbstractGaussDBStructJdbcType implements StructuredJdbcType {
6463

6564
private static final DateTimeFormatter LOCAL_DATE_TIME;
66-
6765
static {
6866
LOCAL_DATE_TIME = new DateTimeFormatterBuilder()
6967
.parseCaseInsensitive()
70-
.append( DateTimeFormatter.ISO_LOCAL_DATE )
71-
.appendLiteral( ' ' )
72-
.append( DateTimeFormatter.ISO_LOCAL_TIME )
68+
.append(DateTimeFormatter.ISO_LOCAL_DATE)
69+
.appendLiteral(' ')
70+
.append(DateTimeFormatter.ISO_LOCAL_TIME)
7371
.optionalStart()
7472
.appendOffset( "+HH:mm", "+00" )
7573
.toFormatter();
7674
}
7775

7876
// Need a custom formatter for parsing what PostgresPlus/EDB produces
7977
private static final DateTimeFormatter LOCAL_DATE;
80-
8178
static {
8279
LOCAL_DATE = new DateTimeFormatterBuilder()
8380
.parseCaseInsensitive()
84-
.append( DateTimeFormatter.ISO_LOCAL_DATE )
81+
.append(DateTimeFormatter.ISO_LOCAL_DATE)
8582
.optionalStart()
86-
.appendLiteral( ' ' )
87-
.append( DateTimeFormatter.ISO_LOCAL_TIME )
83+
.appendLiteral(' ')
84+
.append(DateTimeFormatter.ISO_LOCAL_TIME)
8885
.optionalStart()
8986
.appendOffset( "+HH:mm", "+00" )
9087
.toFormatter();
9188
}
92-
9389
private final String typeName;
9490
private final int[] orderMapping;
9591
private final int[] inverseOrderMapping;
@@ -166,7 +162,7 @@ private X getObject(Object object, WrapperOptions options) throws SQLException {
166162
if ( object == null ) {
167163
return null;
168164
}
169-
return ((AbstractGaussDBStructJdbcType) getJdbcType()).fromString(
165+
return ( (AbstractGaussDBStructJdbcType) getJdbcType() ).fromString(
170166
object.toString(),
171167
getJavaType(),
172168
options
@@ -189,14 +185,12 @@ protected <X> X fromString(String string, JavaType<X> javaType, WrapperOptions o
189185
array = values.toArray();
190186
}
191187
else {
192-
array = new Object[embeddableMappingType.getJdbcValueCount() + (embeddableMappingType.isPolymorphic() ? 1
193-
: 0)];
188+
array = new Object[embeddableMappingType.getJdbcValueCount() + ( embeddableMappingType.isPolymorphic() ? 1 : 0 )];
194189
end = deserializeStruct( string, 0, 0, array, returnEmbeddable, options );
195190
}
196191
assert end == string.length();
197192
if ( returnEmbeddable ) {
198-
final StructAttributeValues attributeValues = getAttributeValues( embeddableMappingType, orderMapping,
199-
array, options );
193+
final StructAttributeValues attributeValues = getAttributeValues( embeddableMappingType, orderMapping, array, options );
200194
//noinspection unchecked
201195
return (X) instantiate( embeddableMappingType, attributeValues );
202196
}
@@ -330,15 +324,15 @@ private int deserializeStruct(
330324
// Fall-through since a backslash is an escaping mechanism for a start quote within arrays
331325
case '"':
332326
if ( inQuote ) {
333-
if ( isDoubleQuote( string, i, 1 << (quotes + 1) ) ) {
327+
if ( isDoubleQuote( string, i, 1 << ( quotes + 1 ) ) ) {
334328
// Skip quote escaping as that will be unescaped later
335329
if ( escapingSb == null ) {
336330
escapingSb = new StringBuilder();
337331
}
338332
escapingSb.append( string, start, i );
339333
escapingSb.append( '"' );
340334
// Move forward to the last quote
341-
i += (1 << (quotes + 1)) - 1;
335+
i += ( 1 << ( quotes + 1 ) ) - 1;
342336
start = i + 1;
343337
continue;
344338
}
@@ -406,7 +400,7 @@ private int deserializeStruct(
406400
case SqlTypes.VARBINARY:
407401
case SqlTypes.LONGVARBINARY:
408402
case SqlTypes.LONG32VARBINARY:
409-
final int backslashes = 1 << (quotes + 1);
403+
final int backslashes = 1 << ( quotes + 1 );
410404
assert repeatsChar( string, start, backslashes, '\\' );
411405
final int xCharPosition = start + backslashes;
412406
assert string.charAt( xCharPosition ) == 'x';
@@ -475,8 +469,7 @@ private int deserializeStruct(
475469
subValues,
476470
options
477471
);
478-
values[column] = instantiate( structJdbcType.embeddableMappingType,
479-
attributeValues );
472+
values[column] = instantiate( structJdbcType.embeddableMappingType, attributeValues );
480473
}
481474
else {
482475
if ( structJdbcType.inverseOrderMapping != null ) {
@@ -561,7 +554,7 @@ else if ( string.charAt( i + 1 ) == '{' ) {
561554
);
562555
}
563556
else if ( jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
564-
&& jdbcMapping.getJdbcType().isInteger() ) {
557+
&& jdbcMapping.getJdbcType().isInteger() ) {
565558
values[column] = fromRawObject(
566559
jdbcMapping,
567560
IntegerJavaType.INSTANCE.fromEncodedString( string, start, i ),
@@ -597,7 +590,7 @@ else if ( jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
597590
);
598591
}
599592
else if ( jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
600-
&& jdbcMapping.getJdbcType().isInteger() ) {
593+
&& jdbcMapping.getJdbcType().isInteger() ) {
601594
values[column] = fromRawObject(
602595
jdbcMapping,
603596
IntegerJavaType.INSTANCE.fromEncodedString( string, start, i ),
@@ -619,8 +612,7 @@ else if ( jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
619612
break;
620613
case '{':
621614
if ( !inQuote ) {
622-
final BasicPluralType<?, ?> pluralType = (BasicPluralType<?, ?>) getJdbcValueSelectable(
623-
column ).getJdbcMapping();
615+
final BasicPluralType<?, ?> pluralType = (BasicPluralType<?, ?>) getJdbcValueSelectable( column ).getJdbcMapping();
624616
final ArrayList<Object> arrayList = new ArrayList<>();
625617
//noinspection unchecked
626618
i = deserializeArray(
@@ -718,15 +710,15 @@ private int deserializeArray(
718710
// Fall-through since a backslash is an escaping mechanism for a start quote within arrays
719711
case '"':
720712
if ( inQuote ) {
721-
if ( isDoubleQuote( string, i, 1 << (quotes + 1) ) ) {
713+
if ( isDoubleQuote( string, i, 1 << ( quotes + 1 ) ) ) {
722714
// Skip quote escaping as that will be unescaped later
723715
if ( escapingSb == null ) {
724716
escapingSb = new StringBuilder();
725717
}
726718
escapingSb.append( string, start, i );
727719
escapingSb.append( '"' );
728720
// Move forward to the last quote
729-
i += (1 << (quotes + 1)) - 1;
721+
i += ( 1 << ( quotes + 1 ) ) - 1;
730722
start = i + 1;
731723
continue;
732724
}
@@ -801,7 +793,7 @@ private int deserializeArray(
801793
case SqlTypes.VARBINARY:
802794
case SqlTypes.LONGVARBINARY:
803795
case SqlTypes.LONG32VARBINARY:
804-
final int backslashes = 1 << (quotes + 1);
796+
final int backslashes = 1 << ( quotes + 1 );
805797
assert repeatsChar( string, start, backslashes, '\\' );
806798
final int xCharPosition = start + backslashes;
807799
assert string.charAt( xCharPosition ) == 'x';
@@ -912,7 +904,7 @@ private int deserializeArray(
912904
case SqlTypes.LONGVARBINARY:
913905
case SqlTypes.LONG32VARBINARY:
914906
// Skip past the backslashes in the binary literal, this will be handled later
915-
final int backslashes = 1 << (quotes + 1);
907+
final int backslashes = 1 << ( quotes + 1 );
916908
assert repeatsChar( string, start, backslashes, '\\' );
917909
i += backslashes;
918910
break;
@@ -934,7 +926,7 @@ private int deserializeArray(
934926
);
935927
}
936928
else if ( elementType.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
937-
&& elementType.getJdbcType().isInteger() ) {
929+
&& elementType.getJdbcType().isInteger() ) {
938930
values.add(
939931
fromRawObject(
940932
elementType,
@@ -973,7 +965,7 @@ else if ( elementType.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
973965
);
974966
}
975967
else if ( elementType.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
976-
&& elementType.getJdbcType().isInteger() ) {
968+
&& elementType.getJdbcType().isInteger() ) {
977969
values.add(
978970
fromRawObject(
979971
elementType,
@@ -1005,15 +997,14 @@ else if ( elementType.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
1005997
private SelectableMapping getJdbcValueSelectable(int jdbcValueSelectableIndex) {
1006998
if ( orderMapping != null ) {
1007999
final int numberOfAttributeMappings = embeddableMappingType.getNumberOfAttributeMappings();
1008-
final int size = numberOfAttributeMappings + (embeddableMappingType.isPolymorphic() ? 1 : 0);
1000+
final int size = numberOfAttributeMappings + ( embeddableMappingType.isPolymorphic() ? 1 : 0 );
10091001
int count = 0;
10101002
for ( int i = 0; i < size; i++ ) {
10111003
final ValuedModelPart modelPart = getEmbeddedPart( embeddableMappingType, orderMapping[i] );
10121004
if ( modelPart.getMappedType() instanceof EmbeddableMappingType embeddableMappingType ) {
10131005
final SelectableMapping aggregateMapping = embeddableMappingType.getAggregateMapping();
10141006
if ( aggregateMapping == null ) {
1015-
final SelectableMapping subSelectable = embeddableMappingType.getJdbcValueSelectable(
1016-
jdbcValueSelectableIndex - count );
1007+
final SelectableMapping subSelectable = embeddableMappingType.getJdbcValueSelectable( jdbcValueSelectableIndex - count );
10171008
if ( subSelectable != null ) {
10181009
return subSelectable;
10191010
}
@@ -1055,7 +1046,7 @@ private static boolean isDoubleQuote(String string, int start, int escapes) {
10551046
if ( escapes == 1 ) {
10561047
return string.charAt( start ) == '"';
10571048
}
1058-
assert (escapes & 1) == 0 : "Only an even number of escapes allowed";
1049+
assert ( escapes & 1 ) == 0 : "Only an even number of escapes allowed";
10591050
final int end = start + escapes;
10601051
if ( end < string.length() ) {
10611052
for ( ; start < end; start += 2 ) {
@@ -1186,8 +1177,7 @@ protected <X> String toString(X value, JavaType<X> javaType, WrapperOptions opti
11861177
return sb.toString();
11871178
}
11881179

1189-
private void serializeStructTo(PostgreSQLAppender appender, Object value, WrapperOptions options)
1190-
throws SQLException {
1180+
private void serializeStructTo(PostgreSQLAppender appender, Object value, WrapperOptions options) throws SQLException {
11911181
serializeDomainValueTo( appender, options, value, '(' );
11921182
appender.append( ')' );
11931183
}
@@ -1306,7 +1296,7 @@ private void serializeConvertedBasicTo(
13061296
byte[].class,
13071297
options
13081298
);
1309-
appender.ensureCanFit( appender.quote + 1 + (bytes.length << 1) );
1299+
appender.ensureCanFit( appender.quote + 1 + ( bytes.length << 1 ) );
13101300
appender.append( '\\' );
13111301
appender.append( '\\' );
13121302
appender.append( 'x' );
@@ -1362,8 +1352,7 @@ private void serializeConvertedBasicTo(
13621352
}
13631353
break;
13641354
default:
1365-
throw new UnsupportedOperationException(
1366-
"Unsupported JdbcType nested in struct: " + jdbcMapping.getJdbcType() );
1355+
throw new UnsupportedOperationException( "Unsupported JdbcType nested in struct: " + jdbcMapping.getJdbcType() );
13671356
}
13681357
}
13691358

@@ -1373,7 +1362,7 @@ private StructAttributeValues getAttributeValues(
13731362
Object[] rawJdbcValues,
13741363
WrapperOptions options) throws SQLException {
13751364
final int numberOfAttributeMappings = embeddableMappingType.getNumberOfAttributeMappings();
1376-
final int size = numberOfAttributeMappings + (embeddableMappingType.isPolymorphic() ? 1 : 0);
1365+
final int size = numberOfAttributeMappings + ( embeddableMappingType.isPolymorphic() ? 1 : 0 );
13771366
final StructAttributeValues attributeValues = new StructAttributeValues(
13781367
numberOfAttributeMappings,
13791368
orderMapping != null ?
@@ -1500,8 +1489,7 @@ else if ( value instanceof java.util.Calendar calendar ) {
15001489
appendAsTimestampWithMillis( appender, calendar, jdbcTimeZone );
15011490
}
15021491
else if ( value instanceof TemporalAccessor temporalAccessor ) {
1503-
appendAsTimestampWithMicros( appender, temporalAccessor,
1504-
temporalAccessor.isSupported( ChronoField.OFFSET_SECONDS ), jdbcTimeZone );
1492+
appendAsTimestampWithMicros( appender, temporalAccessor, temporalAccessor.isSupported( ChronoField.OFFSET_SECONDS ), jdbcTimeZone );
15051493
}
15061494
else {
15071495
appendAsTimestampWithMicros(
@@ -1517,7 +1505,6 @@ else if ( value instanceof TemporalAccessor temporalAccessor ) {
15171505

15181506
appender.append( '"' );
15191507
}
1520-
15211508
private static TimeZone getJdbcTimeZone(WrapperOptions options) {
15221509
return options == null || options.getJdbcTimeZone() == null
15231510
? TimeZone.getDefault()

0 commit comments

Comments
 (0)