diff options
Diffstat (limited to 'tests/bugs1920/github_spring_27761/RepositoryAspect.aj')
-rw-r--r-- | tests/bugs1920/github_spring_27761/RepositoryAspect.aj | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/bugs1920/github_spring_27761/RepositoryAspect.aj b/tests/bugs1920/github_spring_27761/RepositoryAspect.aj new file mode 100644 index 000000000..b938d754c --- /dev/null +++ b/tests/bugs1920/github_spring_27761/RepositoryAspect.aj @@ -0,0 +1,35 @@ +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public aspect RepositoryAspect { + Object around(): execution(* JpaRepository.save*(..)) { + System.out.println(thisJoinPoint); + return proceed(); + } + + public static void main(String[] args) { + new RepositoryImpl<String>().saveAll(Arrays.asList("One", "Two", "Three")); + } +} + +interface CrudRepository<T> { + <S extends T> Iterable<S> saveAll(Iterable<S> entities); +} + +/* +interface JpaRepository<T> extends CrudRepository<T> { + @Override + <S extends T> List<S> saveAll(Iterable<S> entities); +} +*/ + +class RepositoryImpl<S> implements JpaRepository<String> { + @Override + public <S extends String> List<S> saveAll(Iterable<S> entities) { + List<S> entityList = new ArrayList<>(); + entities.iterator().forEachRemaining(entityList::add); + System.out.println("Saving " + entityList); + return entityList; + } +} |