we changed Iterable -> List in Data spec

This commit is contained in:
Gavin King 2024-03-23 12:21:18 +01:00
parent c7504d4ada
commit b7038b2294
2 changed files with 14 additions and 22 deletions

View File

@ -40,16 +40,13 @@ public interface BookAuthorRepository {
void insertBooks0(Book[] books);
@Insert
void insertBooks1(Iterable<Book> books);
void insertBooks1(List<Book> books);
@Insert
void insertBooks2(Set<Book> books);
List<Book> insertBooks2(List<Book> books);
@Insert
List<Book> insertBooks3(List<Book> books);
@Insert
Book[] insertBooks4(Book[] books);
Book[] insertBooks3(Book[] books);
@Find
Book book(String isbn);
@ -61,7 +58,7 @@ public interface BookAuthorRepository {
Book[] books(@By("isbn") String[] isbns);
@Find
List<Book> booksWithPages(Iterable<Integer> pages);
List<Book> booksWithPages(List<Integer> pages);
@Find
List<Book> booksWithPages(int pages);
@ -196,7 +193,4 @@ public interface BookAuthorRepository {
@Update
Book edit(Book book);
@Insert
Iterable<Book> createAll(Iterable<Book> books);
}

View File

@ -64,7 +64,6 @@ import static java.beans.Introspector.decapitalize;
import static java.lang.Boolean.FALSE;
import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.toList;
import static javax.lang.model.element.ElementKind.CLASS;
import static javax.lang.model.util.ElementFilter.fieldsIn;
import static javax.lang.model.util.ElementFilter.methodsIn;
import static org.hibernate.internal.util.StringHelper.qualify;
@ -1176,9 +1175,8 @@ public class AnnotationMetaEntity extends AnnotationMeta {
//INTENTIONAL FALL THROUGH
case DECLARED:
final DeclaredType declaredType = (DeclaredType) parameterType;
final Elements elements = context.getElementUtils();
if ( types.isAssignable( declaredType,
types.erasure( elements.getTypeElement(ITERABLE).asType() ) )
final TypeElement typeElement = (TypeElement) declaredType.asElement();
if ( typeElement.getQualifiedName().contentEquals(LIST)
&& !declaredType.getTypeArguments().isEmpty() ) {
final TypeMirror elementType = types.erasure( declaredType.getTypeArguments().get(0) );
return elementType.getKind() == TypeKind.DECLARED ? (DeclaredType) elementType : null;
@ -1792,7 +1790,7 @@ public class AnnotationMetaEntity extends AnnotationMeta {
*/
private boolean checkParameterType(TypeElement entityType, VariableElement param, TypeMirror attributeType) {
final Types types = context.getTypeUtils();
if ( entityType.getKind() == CLASS ) { // do no checks if the entity type is a type variable
// if ( entityType.getKind() == CLASS ) { // do no checks if the entity type is a type variable
TypeMirror parameterType = parameterType( param );
if ( types.isSameType( parameterType, attributeType ) ) {
return false;
@ -1809,8 +1807,8 @@ public class AnnotationMetaEntity extends AnnotationMeta {
parameterType = typeVariable.getUpperBound();
// INTENTIONAL FALL-THROUGH
case DECLARED:
final TypeElement iterable = context.getTypeElementForFullyQualifiedName(ITERABLE);
if ( types.isAssignable( parameterType, types.getDeclaredType( iterable, attributeType) ) ) {
final TypeElement list = context.getTypeElementForFullyQualifiedName(LIST);
if ( types.isSameType( parameterType, types.getDeclaredType( list, attributeType) ) ) {
return true;
}
else {
@ -1836,10 +1834,10 @@ public class AnnotationMetaEntity extends AnnotationMeta {
}
}
}
}
else {
return false;
}
// }
// else {
// return false;
// }
}
private void parameterTypeError(TypeElement entityType, VariableElement param, TypeMirror attributeType) {