Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class DuplicateMappingException extends MappingException {
/**
* Enumeration of the types of things that can be duplicated.
*/
public static enum Type {
public enum Type {
/**
* A duplicate entity definition was encountered.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private void addCollectionKey(
PersistenceContext persistenceContext) {
if ( o instanceof PersistentCollection ) {
final CollectionPersister collectionPersister = pluralAttributeMapping.getCollectionDescriptor();
final Object key = ( (AbstractEntityPersister) getPersister() ).getCollectionKey(
final Object key = AbstractEntityPersister.getCollectionKey(
collectionPersister,
getInstance(),
persistenceContext.getEntry( getInstance() ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @deprecated Use the JPA-defined
* {@link jakarta.persistence.CascadeType}
*/
@Deprecated(since = "7")
@Deprecated(since = "7", forRemoval = true)
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Cascade {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
* @see Cascade
*
* @deprecated Use the JPA-defined
* {@link jakarta.persistence.CascadeType}
* {@link jakarta.persistence.CascadeType}.
* This enumeration will be removed to alleviate the
* duplication in naming.
*/
@Deprecated(since = "7")
@Deprecated(since = "7", forRemoval = true)
public enum CascadeType {
/**
* Includes all types listed here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
/**
* A list of {@link Check}s.
*
* @deprecated since {@link Check} is deprecated.
*
* @author Gavin King
*/
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
@Deprecated(since = "7")
public @interface Checks {
Check[] value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
* @see NamedQuery#flushMode
* @see NamedNativeQuery#flushMode
*
* @deprecated use {@link QueryFlushMode}
* @deprecated Use {@link QueryFlushMode}. This enumeration will be removed to alleviate
* the duplication in naming with {@link jakarta.persistence.FlushModeType}.
*/
@Deprecated(since="7")
@Deprecated(since="7", forRemoval = true)
public enum FlushModeType {
/**
* Corresponds to {@link org.hibernate.FlushMode#ALWAYS}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
@Target({PACKAGE, TYPE, METHOD, FIELD})
@Retention(RUNTIME)
@Repeatable(GenericGenerators.class)
@Deprecated(since = "6.5")
@Deprecated(since = "6.5", forRemoval = true)
public @interface GenericGenerator {
/**
* The name of the identifier generator. This is the name that may be specified by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
@Target({PACKAGE, TYPE})
@Retention(RUNTIME)
@Deprecated(since = "6.5")
@Deprecated(since = "6.5", forRemoval = true)
public @interface GenericGenerators {
/**
* The aggregated generators.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
*
* @deprecated use {@link #flush()}
*/
@Deprecated(since = "7")
@Deprecated(since = "7", forRemoval = true)
FlushModeType flushMode() default FlushModeType.PERSISTENCE_CONTEXT;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
*
* @deprecated use {@link #flush()}
*/
@Deprecated(since = "7")
@Deprecated(since = "7", forRemoval = true)
FlushModeType flushMode() default FlushModeType.PERSISTENCE_CONTEXT;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @deprecated Use an {@link Expectation} class instead.
*/
@Deprecated(since = "6.5")
@Deprecated(since = "6.5", forRemoval = true)
public enum ResultCheckStyle {
/**
* No return code checking. Might mean that no checks are required, or that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*
* @deprecated use {@link #verify()} with an {@link Expectation} class
*/
@Deprecated(since = "6.5")
@Deprecated(since = "6.5", forRemoval = true)
ResultCheckStyle check() default ResultCheckStyle.NONE;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
*
* @deprecated use {@link #verify()} with an {@link Expectation} class
*/
@Deprecated(since = "6.5")
@Deprecated(since = "6.5", forRemoval = true)
ResultCheckStyle check() default ResultCheckStyle.NONE;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
*
* @deprecated use {@link #verify()} with an {@link Expectation} class
*/
@Deprecated(since = "6.5")
@Deprecated(since = "6.5", forRemoval = true)
ResultCheckStyle check() default ResultCheckStyle.NONE;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
*
* @deprecated use {@link #verify()} with an {@link Expectation} class
*/
@Deprecated(since = "6.5")
@Deprecated(since = "6.5", forRemoval = true)
ResultCheckStyle check() default ResultCheckStyle.NONE;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public void bind(BatchSize batchSize, MetadataBuildingContext context, Component
@Override
public void bind(BatchSize batchSize, MetadataBuildingContext context, PersistentClass persistentClass, Property property) {
final Value value = property.getValue();
if ( value instanceof Collection ) {
final Collection collection = (Collection) value;
if ( value instanceof Collection collection ) {
collection.setBatchSize( batchSize.size() );
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public void bind(Comment comment, MetadataBuildingContext context, PersistentCla
throw new AnnotationException( "One to many association '" + property.getName()
+ "' was annotated '@Comment'");
}
else if ( value instanceof Collection ) {
Collection collection = (Collection) value;
else if ( value instanceof Collection collection ) {
Table table = collection.getTable();
// by default, the comment goes on the table
if ( on.isEmpty() || table.getName().equalsIgnoreCase( on ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
public class DiscriminatorOptionsBinder implements TypeBinder<DiscriminatorOptions> {
@Override
public void bind(DiscriminatorOptions options, MetadataBuildingContext context, PersistentClass persistentClass) {
if ( persistentClass instanceof RootClass ) {
final RootClass rootClass = (RootClass) persistentClass;
if ( persistentClass instanceof RootClass rootClass ) {
if ( !rootClass.hasDiscriminator() ) {
throw new AnnotationException( "Root entity '" + rootClass.getEntityName()
+ "' is annotated '@DiscriminatorOptions' but has no discriminator column" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,8 @@ public MetadataSources addJar(File jar) {
* processing the contained mapping documents.
*/
public MetadataSources addDirectory(File dir) {
File[] files = dir.listFiles();
if ( files != null && files.length > 0 ) {
final File[] files = dir.listFiles();
if ( files != null ) {
for ( File file : files ) {
if ( file.isDirectory() ) {
addDirectory( file );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ private void addMappingReference(MappingReference mappingReference) {
}

private static CacheRegionDefinition parseCacheRegionDefinition(Object cacheDeclaration) {
if ( cacheDeclaration instanceof JaxbCfgEntityCacheType ) {
final JaxbCfgEntityCacheType jaxbClassCache = (JaxbCfgEntityCacheType) cacheDeclaration;
if ( cacheDeclaration instanceof JaxbCfgEntityCacheType jaxbClassCache ) {
return new CacheRegionDefinition(
CacheRegionDefinition.CacheRegionType.ENTITY,
jaxbClassCache.getClazz(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ public boolean equals(Object o) {
if ( this == o ) {
return true;
}
if ( !( o instanceof Origin ) ) {
if ( !(o instanceof Origin other) ) {
return false;
}

final Origin other = (Origin) o;
return type == other.type
&& Objects.equals( name, other.name );
&& Objects.equals( name, other.name );

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ else if ( source instanceof JaxbHbmMapType map ) {
}
target.setOrderBy( map.getOrderBy() );

transferMapKey( (JaxbHbmMapType) source, target );
transferMapKey( map, target );
target.setClassification( LimitedCollectionClassification.MAP );
}
else if ( source instanceof JaxbHbmIdBagCollectionType ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private StartElement wrap(StartElement startElement) {
// so that the event we ask it to generate for us has the same location info
xmlEventFactory.setLocation( startElement.getLocation() );
return xmlEventFactory.createStartElement(
new QName( MappingXsdSupport.INSTANCE.latestJpaDescriptor().getNamespaceUri(), startElement.getName().getLocalPart() ),
new QName( MappingXsdSupport.latestJpaDescriptor().getNamespaceUri(), startElement.getName().getLocalPart() ),
newElementAttributeList.iterator(),
newNamespaceList.iterator()
);
Expand All @@ -100,7 +100,6 @@ private List<Attribute> mapAttributes(StartElement startElement) {
return mappedAttributes;
}

@SuppressWarnings("unchecked")
private Iterator<Attribute> existingXmlAttributesIterator(StartElement startElement) {
return startElement.getAttributes();
}
Expand Down Expand Up @@ -143,13 +142,12 @@ private List<Namespace> mapNamespaces(Iterator<Namespace> originalNamespaceItera
}

if ( mappedNamespaces.isEmpty() ) {
mappedNamespaces.add( xmlEventFactory.createNamespace( MappingXsdSupport.INSTANCE.latestJpaDescriptor().getNamespaceUri() ) );
mappedNamespaces.add( xmlEventFactory.createNamespace( MappingXsdSupport.latestJpaDescriptor().getNamespaceUri() ) );
}

return mappedNamespaces;
}

@SuppressWarnings("unchecked")
private Iterator<Namespace> existingXmlNamespacesIterator(StartElement startElement) {
return startElement.getNamespaces();
}
Expand All @@ -159,7 +157,7 @@ private Namespace mapNamespace(Namespace originalNamespace) {
// this is a namespace "to map" so map it
return xmlEventFactory.createNamespace(
originalNamespace.getPrefix(),
MappingXsdSupport.INSTANCE.latestJpaDescriptor().getNamespaceUri()
MappingXsdSupport.latestJpaDescriptor().getNamespaceUri()
);
}

Expand All @@ -173,12 +171,11 @@ private XMLEvent wrap(EndElement endElement) {
// so that the event we ask it to generate for us has the same location info
xmlEventFactory.setLocation( endElement.getLocation() );
return xmlEventFactory.createEndElement(
new QName( MappingXsdSupport.INSTANCE.latestJpaDescriptor().getNamespaceUri(), endElement.getName().getLocalPart() ),
new QName( MappingXsdSupport.latestJpaDescriptor().getNamespaceUri(), endElement.getName().getLocalPart() ),
targetNamespaces.iterator()
);
}

@SuppressWarnings("unchecked")
private Iterator<Namespace> existingXmlNamespacesIterator(EndElement endElement) {
return endElement.getNamespaces();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,8 @@ public boolean matches(String publicId, String systemId) {
}

if ( systemId != null ) {
if ( systemId.startsWith( httpBase )
|| systemId.startsWith( httpsBase ) ) {
return true;
}
return systemId.startsWith( httpBase )
|| systemId.startsWith( httpsBase );
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,19 @@ private XMLStreamConstantsUtils() {
* Get the human readable event name for the numeric event id
*/
public static String getEventName(int eventId) {
switch (eventId) {
case XMLStreamConstants.START_ELEMENT:
return "StartElementEvent";
case XMLStreamConstants.END_ELEMENT:
return "EndElementEvent";
case XMLStreamConstants.PROCESSING_INSTRUCTION:
return "ProcessingInstructionEvent";
case XMLStreamConstants.CHARACTERS:
return "CharacterEvent";
case XMLStreamConstants.COMMENT:
return "CommentEvent";
case XMLStreamConstants.START_DOCUMENT:
return "StartDocumentEvent";
case XMLStreamConstants.END_DOCUMENT:
return "EndDocumentEvent";
case XMLStreamConstants.ENTITY_REFERENCE:
return "EntityReferenceEvent";
case XMLStreamConstants.ATTRIBUTE:
return "AttributeBase";
case XMLStreamConstants.DTD:
return "DTDEvent";
case XMLStreamConstants.CDATA:
return "CDATA";
}
return "UNKNOWN_EVENT_TYPE";
return switch ( eventId ) {
case XMLStreamConstants.START_ELEMENT -> "StartElementEvent";
case XMLStreamConstants.END_ELEMENT -> "EndElementEvent";
case XMLStreamConstants.PROCESSING_INSTRUCTION -> "ProcessingInstructionEvent";
case XMLStreamConstants.CHARACTERS -> "CharacterEvent";
case XMLStreamConstants.COMMENT -> "CommentEvent";
case XMLStreamConstants.START_DOCUMENT -> "StartDocumentEvent";
case XMLStreamConstants.END_DOCUMENT -> "EndDocumentEvent";
case XMLStreamConstants.ENTITY_REFERENCE -> "EntityReferenceEvent";
case XMLStreamConstants.ATTRIBUTE -> "AttributeBase";
case XMLStreamConstants.DTD -> "DTDEvent";
case XMLStreamConstants.CDATA -> "CDATA";
default -> "UNKNOWN_EVENT_TYPE";
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,10 @@ public boolean equals(Object o) {
if ( this == o ) {
return true;
}
if ( !( o instanceof IdentifierGeneratorDefinition ) ) {
if ( !(o instanceof IdentifierGeneratorDefinition that) ) {
return false;
}

IdentifierGeneratorDefinition that = (IdentifierGeneratorDefinition) o;
return Objects.equals(name, that.name)
&& Objects.equals(strategy, that.strategy)
&& Objects.equals(parameters, that.parameters);
Expand Down
Loading
Loading