test and fix for bug in repo method parameter checking
this lead to a TCK failure Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
d44f48bcd2
commit
526ab68264
|
@ -18,7 +18,7 @@ import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsStr
|
|||
*/
|
||||
public class EgTest extends CompilationTest {
|
||||
@Test
|
||||
@WithClasses({ Publisher.class, Author.class, Address.class, Book.class, Library.class, Bookshop.class })
|
||||
@WithClasses({ Publisher.class, Author.class, Address.class, Book.class, Library.class, Bookshop.class, Publishers.class })
|
||||
public void test() {
|
||||
System.out.println( getMetaModelSourceAsString( Author.class ) );
|
||||
System.out.println( getMetaModelSourceAsString( Book.class ) );
|
||||
|
@ -26,6 +26,7 @@ public class EgTest extends CompilationTest {
|
|||
System.out.println( getMetaModelSourceAsString( Book.class, true ) );
|
||||
System.out.println( getMetaModelSourceAsString( Library.class ) );
|
||||
System.out.println( getMetaModelSourceAsString( Bookshop.class ) );
|
||||
System.out.println( getMetaModelSourceAsString( Publishers.class ) );
|
||||
assertMetamodelClassGeneratedFor( Author.class, true );
|
||||
assertMetamodelClassGeneratedFor( Book.class, true );
|
||||
assertMetamodelClassGeneratedFor( Publisher.class, true );
|
||||
|
@ -34,5 +35,6 @@ public class EgTest extends CompilationTest {
|
|||
assertMetamodelClassGeneratedFor( Publisher.class );
|
||||
assertMetamodelClassGeneratedFor( Library.class );
|
||||
assertMetamodelClassGeneratedFor( Bookshop.class );
|
||||
assertMetamodelClassGeneratedFor( Publishers.class );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package org.hibernate.processor.test.data.eg;
|
||||
|
||||
import jakarta.data.repository.BasicRepository;
|
||||
import jakarta.data.repository.Repository;
|
||||
|
||||
@Repository
|
||||
public interface Publishers extends BasicRepository<Publisher,Long> {
|
||||
}
|
|
@ -1875,6 +1875,10 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
parameterType = typeVariable.getUpperBound();
|
||||
// INTENTIONAL FALL-THROUGH
|
||||
case DECLARED:
|
||||
if ( types.isSameType( parameterType, attributeType) ) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
final TypeElement list = context.getTypeElementForFullyQualifiedName(LIST);
|
||||
if ( types.isSameType( parameterType, types.getDeclaredType( list, attributeType) ) ) {
|
||||
return true;
|
||||
|
@ -1883,6 +1887,7 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
parameterTypeError( entityType, param, attributeType );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
case ARRAY:
|
||||
if ( !types.isSameType( parameterType, types.getArrayType(attributeType) ) ) {
|
||||
parameterTypeError( entityType, param, attributeType );
|
||||
|
|
Loading…
Reference in New Issue