diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/collectionbasictype/CollectionAsBasicTypeTest.java b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/collectionbasictype/CollectionAsBasicTypeTest.java index 10b436c510..b00743c4da 100644 --- a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/collectionbasictype/CollectionAsBasicTypeTest.java +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/collectionbasictype/CollectionAsBasicTypeTest.java @@ -76,14 +76,21 @@ public class CollectionAsBasicTypeTest extends CompilationTest { @TestForIssue(jiraKey = "HHH-12338") @WithClasses({PhoneBook.class}) public void testMapType() throws ClassNotFoundException, NoSuchFieldException { - assertMetamodelClassGeneratedFor(PhoneBook.class); + assertMetamodelClassGeneratedFor( PhoneBook.class ); assertAttributeTypeInMetaModelFor( PhoneBook.class, "phones", - PhoneBook.class.getDeclaredField("phones").getGenericType(), + PhoneBook.class.getDeclaredField( "phones" ).getGenericType(), "Wrong meta model type" ); } + + @Test + @TestForIssue(jiraKey = "HHH-14724") + @WithClasses({ Like.class, ConcreteLike.class }) + public void testIntersectionType() { + assertMetamodelClassGeneratedFor( ConcreteLike.class ); + } } diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/collectionbasictype/ConcreteLike.java b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/collectionbasictype/ConcreteLike.java new file mode 100644 index 0000000000..7cbb14ea8e --- /dev/null +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/collectionbasictype/ConcreteLike.java @@ -0,0 +1,15 @@ +package org.hibernate.jpamodelgen.test.collectionbasictype; + +import javax.persistence.Entity; + +@Entity(name = "ConcreteLike") +public class ConcreteLike extends Like { + + @Override + public Reference getObject() { + return new Reference<>(); + } + + public static class Target implements Like.I1, Like.I2 { + } +} diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/collectionbasictype/Like.java b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/collectionbasictype/Like.java new file mode 100644 index 0000000000..a7f12494a3 --- /dev/null +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/collectionbasictype/Like.java @@ -0,0 +1,29 @@ +package org.hibernate.jpamodelgen.test.collectionbasictype; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; + +/** + * @author Thomas Heigl + */ +@Entity +@Inheritance(strategy = InheritanceType.SINGLE_TABLE) +public abstract class Like { + + @Id + private Long id; + + public abstract Reference getObject(); + + interface I1 { + } + + interface I2 { + } + + public static class Reference { + } + +}