Skip to content

Commit b2f27c1

Browse files
HHH-19365 - format updated code
1 parent 5452d14 commit b2f27c1

File tree

163 files changed

+5388
-4290
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

+5388
-4290
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: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
db=h2
2-
32
# Keep all these properties in sync unless you know what you are doing!
43
# We set '-Dlog4j2.disableJmx=true' to prevent classloader leaks triggered by the logger.
54
# (Some of these settings need to be repeated in the test.jvmArgs blocks of each module)
65
org.gradle.jvmargs=-Dlog4j2.disableJmx -Xmx4g -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8
76
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
87
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
98
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-
119
org.gradle.parallel=true
12-
1310
# enable Gradle's Task Cache. worst case:
1411
# > rm -rf ~/.gradle/caches/build-cache-1
1512
org.gradle.caching=true
16-
1713
# JDK auto-detection is not quite ready yet in Gradle 6.7.
1814
# 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,
1915
# 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
@@ -24,7 +20,6 @@ org.gradle.java.installations.auto-detect=false
2420
# We can't rely on Gradle's auto-download of JDKs as it doesn't support EA releases.
2521
# See https://github.com/gradle/gradle/blob/fc7ea24f3c525d8d12a4346eb0f15976a6be9414/subprojects/platform-jvm/src/main/java/org/gradle/jvm/toolchain/install/internal/AdoptOpenJdkRemoteBinary.java#L114
2622
org.gradle.java.installations.auto-download=false
27-
2823
# externalized definition of JDK versions so that they are available in both Project (build.gradle) and Settings (settings.gradle)
2924
orm.jdk.base=17
3025
orm.jdk.max=22

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

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright Red Hat Inc. and Hibernate Authors
44
*/
55
package org.hibernate.dialect;
6+
67
import java.lang.reflect.Array;
78
import java.sql.CallableStatement;
89
import java.sql.ResultSet;
@@ -56,36 +57,39 @@
5657
* is probably not very efficient.
5758
*
5859
* @author liubao
59-
*
60+
* <p>
6061
* Notes: Original code of this class is based on AbstractPostgreSQLStructJdbcType.
6162
*/
6263
public abstract class AbstractGaussDBStructJdbcType implements StructuredJdbcType {
6364

6465
private static final DateTimeFormatter LOCAL_DATE_TIME;
66+
6567
static {
6668
LOCAL_DATE_TIME = new DateTimeFormatterBuilder()
6769
.parseCaseInsensitive()
68-
.append(DateTimeFormatter.ISO_LOCAL_DATE)
69-
.appendLiteral(' ')
70-
.append(DateTimeFormatter.ISO_LOCAL_TIME)
70+
.append( DateTimeFormatter.ISO_LOCAL_DATE )
71+
.appendLiteral( ' ' )
72+
.append( DateTimeFormatter.ISO_LOCAL_TIME )
7173
.optionalStart()
7274
.appendOffset( "+HH:mm", "+00" )
7375
.toFormatter();
7476
}
7577

7678
// Need a custom formatter for parsing what PostgresPlus/EDB produces
7779
private static final DateTimeFormatter LOCAL_DATE;
80+
7881
static {
7982
LOCAL_DATE = new DateTimeFormatterBuilder()
8083
.parseCaseInsensitive()
81-
.append(DateTimeFormatter.ISO_LOCAL_DATE)
84+
.append( DateTimeFormatter.ISO_LOCAL_DATE )
8285
.optionalStart()
83-
.appendLiteral(' ')
84-
.append(DateTimeFormatter.ISO_LOCAL_TIME)
86+
.appendLiteral( ' ' )
87+
.append( DateTimeFormatter.ISO_LOCAL_TIME )
8588
.optionalStart()
8689
.appendOffset( "+HH:mm", "+00" )
8790
.toFormatter();
8891
}
92+
8993
private final String typeName;
9094
private final int[] orderMapping;
9195
private final int[] inverseOrderMapping;
@@ -162,7 +166,7 @@ private X getObject(Object object, WrapperOptions options) throws SQLException {
162166
if ( object == null ) {
163167
return null;
164168
}
165-
return ( (AbstractGaussDBStructJdbcType) getJdbcType() ).fromString(
169+
return ((AbstractGaussDBStructJdbcType) getJdbcType()).fromString(
166170
object.toString(),
167171
getJavaType(),
168172
options
@@ -185,12 +189,14 @@ protected <X> X fromString(String string, JavaType<X> javaType, WrapperOptions o
185189
array = values.toArray();
186190
}
187191
else {
188-
array = new Object[embeddableMappingType.getJdbcValueCount() + ( embeddableMappingType.isPolymorphic() ? 1 : 0 )];
192+
array = new Object[embeddableMappingType.getJdbcValueCount() + (embeddableMappingType.isPolymorphic() ? 1
193+
: 0)];
189194
end = deserializeStruct( string, 0, 0, array, returnEmbeddable, options );
190195
}
191196
assert end == string.length();
192197
if ( returnEmbeddable ) {
193-
final StructAttributeValues attributeValues = getAttributeValues( embeddableMappingType, orderMapping, array, options );
198+
final StructAttributeValues attributeValues = getAttributeValues( embeddableMappingType, orderMapping,
199+
array, options );
194200
//noinspection unchecked
195201
return (X) instantiate( embeddableMappingType, attributeValues );
196202
}
@@ -324,15 +330,15 @@ private int deserializeStruct(
324330
// Fall-through since a backslash is an escaping mechanism for a start quote within arrays
325331
case '"':
326332
if ( inQuote ) {
327-
if ( isDoubleQuote( string, i, 1 << ( quotes + 1 ) ) ) {
333+
if ( isDoubleQuote( string, i, 1 << (quotes + 1) ) ) {
328334
// Skip quote escaping as that will be unescaped later
329335
if ( escapingSb == null ) {
330336
escapingSb = new StringBuilder();
331337
}
332338
escapingSb.append( string, start, i );
333339
escapingSb.append( '"' );
334340
// Move forward to the last quote
335-
i += ( 1 << ( quotes + 1 ) ) - 1;
341+
i += (1 << (quotes + 1)) - 1;
336342
start = i + 1;
337343
continue;
338344
}
@@ -400,7 +406,7 @@ private int deserializeStruct(
400406
case SqlTypes.VARBINARY:
401407
case SqlTypes.LONGVARBINARY:
402408
case SqlTypes.LONG32VARBINARY:
403-
final int backslashes = 1 << ( quotes + 1 );
409+
final int backslashes = 1 << (quotes + 1);
404410
assert repeatsChar( string, start, backslashes, '\\' );
405411
final int xCharPosition = start + backslashes;
406412
assert string.charAt( xCharPosition ) == 'x';
@@ -469,7 +475,8 @@ private int deserializeStruct(
469475
subValues,
470476
options
471477
);
472-
values[column] = instantiate( structJdbcType.embeddableMappingType, attributeValues );
478+
values[column] = instantiate( structJdbcType.embeddableMappingType,
479+
attributeValues );
473480
}
474481
else {
475482
if ( structJdbcType.inverseOrderMapping != null ) {
@@ -554,7 +561,7 @@ else if ( string.charAt( i + 1 ) == '{' ) {
554561
);
555562
}
556563
else if ( jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
557-
&& jdbcMapping.getJdbcType().isInteger() ) {
564+
&& jdbcMapping.getJdbcType().isInteger() ) {
558565
values[column] = fromRawObject(
559566
jdbcMapping,
560567
IntegerJavaType.INSTANCE.fromEncodedString( string, start, i ),
@@ -590,7 +597,7 @@ else if ( jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
590597
);
591598
}
592599
else if ( jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
593-
&& jdbcMapping.getJdbcType().isInteger() ) {
600+
&& jdbcMapping.getJdbcType().isInteger() ) {
594601
values[column] = fromRawObject(
595602
jdbcMapping,
596603
IntegerJavaType.INSTANCE.fromEncodedString( string, start, i ),
@@ -612,7 +619,8 @@ else if ( jdbcMapping.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
612619
break;
613620
case '{':
614621
if ( !inQuote ) {
615-
final BasicPluralType<?, ?> pluralType = (BasicPluralType<?, ?>) getJdbcValueSelectable( column ).getJdbcMapping();
622+
final BasicPluralType<?, ?> pluralType = (BasicPluralType<?, ?>) getJdbcValueSelectable(
623+
column ).getJdbcMapping();
616624
final ArrayList<Object> arrayList = new ArrayList<>();
617625
//noinspection unchecked
618626
i = deserializeArray(
@@ -710,15 +718,15 @@ private int deserializeArray(
710718
// Fall-through since a backslash is an escaping mechanism for a start quote within arrays
711719
case '"':
712720
if ( inQuote ) {
713-
if ( isDoubleQuote( string, i, 1 << ( quotes + 1 ) ) ) {
721+
if ( isDoubleQuote( string, i, 1 << (quotes + 1) ) ) {
714722
// Skip quote escaping as that will be unescaped later
715723
if ( escapingSb == null ) {
716724
escapingSb = new StringBuilder();
717725
}
718726
escapingSb.append( string, start, i );
719727
escapingSb.append( '"' );
720728
// Move forward to the last quote
721-
i += ( 1 << ( quotes + 1 ) ) - 1;
729+
i += (1 << (quotes + 1)) - 1;
722730
start = i + 1;
723731
continue;
724732
}
@@ -793,7 +801,7 @@ private int deserializeArray(
793801
case SqlTypes.VARBINARY:
794802
case SqlTypes.LONGVARBINARY:
795803
case SqlTypes.LONG32VARBINARY:
796-
final int backslashes = 1 << ( quotes + 1 );
804+
final int backslashes = 1 << (quotes + 1);
797805
assert repeatsChar( string, start, backslashes, '\\' );
798806
final int xCharPosition = start + backslashes;
799807
assert string.charAt( xCharPosition ) == 'x';
@@ -904,7 +912,7 @@ private int deserializeArray(
904912
case SqlTypes.LONGVARBINARY:
905913
case SqlTypes.LONG32VARBINARY:
906914
// Skip past the backslashes in the binary literal, this will be handled later
907-
final int backslashes = 1 << ( quotes + 1 );
915+
final int backslashes = 1 << (quotes + 1);
908916
assert repeatsChar( string, start, backslashes, '\\' );
909917
i += backslashes;
910918
break;
@@ -926,7 +934,7 @@ private int deserializeArray(
926934
);
927935
}
928936
else if ( elementType.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
929-
&& elementType.getJdbcType().isInteger() ) {
937+
&& elementType.getJdbcType().isInteger() ) {
930938
values.add(
931939
fromRawObject(
932940
elementType,
@@ -965,7 +973,7 @@ else if ( elementType.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
965973
);
966974
}
967975
else if ( elementType.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
968-
&& elementType.getJdbcType().isInteger() ) {
976+
&& elementType.getJdbcType().isInteger() ) {
969977
values.add(
970978
fromRawObject(
971979
elementType,
@@ -997,14 +1005,15 @@ else if ( elementType.getJavaTypeDescriptor().getJavaTypeClass().isEnum()
9971005
private SelectableMapping getJdbcValueSelectable(int jdbcValueSelectableIndex) {
9981006
if ( orderMapping != null ) {
9991007
final int numberOfAttributeMappings = embeddableMappingType.getNumberOfAttributeMappings();
1000-
final int size = numberOfAttributeMappings + ( embeddableMappingType.isPolymorphic() ? 1 : 0 );
1008+
final int size = numberOfAttributeMappings + (embeddableMappingType.isPolymorphic() ? 1 : 0);
10011009
int count = 0;
10021010
for ( int i = 0; i < size; i++ ) {
10031011
final ValuedModelPart modelPart = getEmbeddedPart( embeddableMappingType, orderMapping[i] );
10041012
if ( modelPart.getMappedType() instanceof EmbeddableMappingType embeddableMappingType ) {
10051013
final SelectableMapping aggregateMapping = embeddableMappingType.getAggregateMapping();
10061014
if ( aggregateMapping == null ) {
1007-
final SelectableMapping subSelectable = embeddableMappingType.getJdbcValueSelectable( jdbcValueSelectableIndex - count );
1015+
final SelectableMapping subSelectable = embeddableMappingType.getJdbcValueSelectable(
1016+
jdbcValueSelectableIndex - count );
10081017
if ( subSelectable != null ) {
10091018
return subSelectable;
10101019
}
@@ -1046,7 +1055,7 @@ private static boolean isDoubleQuote(String string, int start, int escapes) {
10461055
if ( escapes == 1 ) {
10471056
return string.charAt( start ) == '"';
10481057
}
1049-
assert ( escapes & 1 ) == 0 : "Only an even number of escapes allowed";
1058+
assert (escapes & 1) == 0 : "Only an even number of escapes allowed";
10501059
final int end = start + escapes;
10511060
if ( end < string.length() ) {
10521061
for ( ; start < end; start += 2 ) {
@@ -1177,7 +1186,8 @@ protected <X> String toString(X value, JavaType<X> javaType, WrapperOptions opti
11771186
return sb.toString();
11781187
}
11791188

1180-
private void serializeStructTo(PostgreSQLAppender appender, Object value, WrapperOptions options) throws SQLException {
1189+
private void serializeStructTo(PostgreSQLAppender appender, Object value, WrapperOptions options)
1190+
throws SQLException {
11811191
serializeDomainValueTo( appender, options, value, '(' );
11821192
appender.append( ')' );
11831193
}
@@ -1296,7 +1306,7 @@ private void serializeConvertedBasicTo(
12961306
byte[].class,
12971307
options
12981308
);
1299-
appender.ensureCanFit( appender.quote + 1 + ( bytes.length << 1 ) );
1309+
appender.ensureCanFit( appender.quote + 1 + (bytes.length << 1) );
13001310
appender.append( '\\' );
13011311
appender.append( '\\' );
13021312
appender.append( 'x' );
@@ -1352,7 +1362,8 @@ private void serializeConvertedBasicTo(
13521362
}
13531363
break;
13541364
default:
1355-
throw new UnsupportedOperationException( "Unsupported JdbcType nested in struct: " + jdbcMapping.getJdbcType() );
1365+
throw new UnsupportedOperationException(
1366+
"Unsupported JdbcType nested in struct: " + jdbcMapping.getJdbcType() );
13561367
}
13571368
}
13581369

@@ -1362,7 +1373,7 @@ private StructAttributeValues getAttributeValues(
13621373
Object[] rawJdbcValues,
13631374
WrapperOptions options) throws SQLException {
13641375
final int numberOfAttributeMappings = embeddableMappingType.getNumberOfAttributeMappings();
1365-
final int size = numberOfAttributeMappings + ( embeddableMappingType.isPolymorphic() ? 1 : 0 );
1376+
final int size = numberOfAttributeMappings + (embeddableMappingType.isPolymorphic() ? 1 : 0);
13661377
final StructAttributeValues attributeValues = new StructAttributeValues(
13671378
numberOfAttributeMappings,
13681379
orderMapping != null ?
@@ -1489,7 +1500,8 @@ else if ( value instanceof java.util.Calendar calendar ) {
14891500
appendAsTimestampWithMillis( appender, calendar, jdbcTimeZone );
14901501
}
14911502
else if ( value instanceof TemporalAccessor temporalAccessor ) {
1492-
appendAsTimestampWithMicros( appender, temporalAccessor, temporalAccessor.isSupported( ChronoField.OFFSET_SECONDS ), jdbcTimeZone );
1503+
appendAsTimestampWithMicros( appender, temporalAccessor,
1504+
temporalAccessor.isSupported( ChronoField.OFFSET_SECONDS ), jdbcTimeZone );
14931505
}
14941506
else {
14951507
appendAsTimestampWithMicros(
@@ -1505,6 +1517,7 @@ else if ( value instanceof TemporalAccessor temporalAccessor ) {
15051517

15061518
appender.append( '"' );
15071519
}
1520+
15081521
private static TimeZone getJdbcTimeZone(WrapperOptions options) {
15091522
return options == null || options.getJdbcTimeZone() == null
15101523
? TimeZone.getDefault()

0 commit comments

Comments
 (0)