UseBulkOperationInspection: register BulkMethodInfo via extension points; JPA classes extracted

This commit is contained in:
Tagir Valeev
2016-12-30 17:42:52 +07:00
parent aced865af2
commit 38db92f734
20 changed files with 309 additions and 196 deletions

View File

@@ -1,15 +0,0 @@
// "Replace iteration with bulk 'CrudRepository.save' call" "true"
package org.springframework.data.repository;
import java.io.Serializable;
interface CrudRepository<T,ID extends Serializable> {
<S extends T> Iterable<S> save(Iterable<S> entities);
<S extends T> S save(S entity);
}
public class Main {
public void test(CrudRepository<CharSequence, Integer> repo, Iterable<String> stringsToSave) {
repo.save(stringsToSave);
}
}

View File

@@ -1,16 +0,0 @@
// "Replace iteration with bulk 'CrudRepository.save' call" "true"
package org.springframework.data.repository;
import java.io.Serializable;
import java.util.Arrays;
interface CrudRepository<T,ID extends Serializable> {
<S extends T> Iterable<S> save(Iterable<S> entities);
<S extends T> S save(S entity);
}
public class Main {
public void test(CrudRepository<CharSequence, Integer> repo, String[] stringsToSave) {
repo.save(Arrays.asList(stringsToSave));
}
}

View File

@@ -1,16 +0,0 @@
// "Replace iteration with bulk 'CrudRepository.save' call" "true"
package org.springframework.data.repository;
import java.io.Serializable;
import java.util.List;
interface CrudRepository<T,ID extends Serializable> {
<S extends T> Iterable<S> save(Iterable<S> entities);
<S extends T> S save(S entity);
}
public class Main {
public void test(CrudRepository<Iterable<String>, Integer> repo, Iterable<List<String>> stringsToSave) {
repo.save(stringsToSave);
}
}

View File

@@ -0,0 +1,13 @@
// "Replace iteration with bulk 'TestClass.test' call" "true"
package testpackage;
interface TestClass<T> {
<S extends T> Iterable<S> test(Iterable<S> entities);
<S extends T> S test(S entity);
}
public class Main {
public void test(TestClass<CharSequence> repo, Iterable<String> stringsToSave) {
repo.test(stringsToSave);
}
}

View File

@@ -0,0 +1,15 @@
// "Replace iteration with bulk 'TestClass.test' call" "true"
package testpackage;
import java.util.*;
interface TestClass<T> {
<S extends T> Iterable<S> test(Iterable<S> entities);
<S extends T> S test(S entity);
}
public class Main {
public void test(TestClass<CharSequence> repo, String[] stringsToSave) {
repo.test(Arrays.asList(stringsToSave));
}
}

View File

@@ -0,0 +1,15 @@
// "Replace iteration with bulk 'TestClass.test' call" "true"
package testpackage;
import java.util.*;
interface TestClass<T> {
<S extends T> Iterable<S> test(Iterable<S> entities);
<S extends T> S test(S entity);
}
public class Main {
public void test(TestClass<Iterable<String>> repo, Iterable<List<String>> stringsToSave) {
repo.test(stringsToSave);
}
}

View File

@@ -1,15 +0,0 @@
// "Replace iteration with bulk 'CrudRepository.save' call" "true"
package org.springframework.data.repository;
import java.io.Serializable;
interface CrudRepository<T,ID extends Serializable> {
<S extends T> Iterable<S> save(Iterable<S> entities);
<S extends T> S save(S entity);
}
public class Main {
public void test(CrudRepository<CharSequence, Integer> repo, Iterable<String> stringsToSave) {
stringsToSave.forEach(<caret>repo::save);
}
}

View File

@@ -1,16 +0,0 @@
// "Replace iteration with bulk 'CrudRepository.save' call" "true"
package org.springframework.data.repository;
import java.io.Serializable;
import java.util.Arrays;
interface CrudRepository<T,ID extends Serializable> {
<S extends T> Iterable<S> save(Iterable<S> entities);
<S extends T> S save(S entity);
}
public class Main {
public void test(CrudRepository<CharSequence, Integer> repo, String[] stringsToSave) {
Arrays.stream(stringsToSave).forEach(<caret>repo::save);
}
}

View File

@@ -1,16 +0,0 @@
// "Replace iteration with bulk 'CrudRepository.save' call" "false"
package org.springframework.data.repository;
import java.io.Serializable;
import java.util.List;
interface CrudRepository<T,ID extends Serializable> {
<S extends T> Iterable<S> save(Iterable<S> entities);
<S extends T> S save(S entity);
}
public class Main {
public void test(CrudRepository<CharSequence, Integer> repo, Iterable<List<String>> stringsToSave) {
stringsToSave.forEach(<caret>repo::save);
}
}

View File

@@ -1,16 +0,0 @@
// "Replace iteration with bulk 'CrudRepository.save' call" "true"
package org.springframework.data.repository;
import java.io.Serializable;
import java.util.List;
interface CrudRepository<T,ID extends Serializable> {
<S extends T> Iterable<S> save(Iterable<S> entities);
<S extends T> S save(S entity);
}
public class Main {
public void test(CrudRepository<Iterable<String>, Integer> repo, Iterable<List<String>> stringsToSave) {
stringsToSave.forEach(<caret>repo::save);
}
}

View File

@@ -0,0 +1,13 @@
// "Replace iteration with bulk 'TestClass.test' call" "true"
package testpackage;
interface TestClass<T> {
<S extends T> Iterable<S> test(Iterable<S> entities);
<S extends T> S test(S entity);
}
public class Main {
public void test(TestClass<CharSequence> repo, Iterable<String> stringsToSave) {
stringsToSave.forEach(<caret>repo::test);
}
}

View File

@@ -0,0 +1,15 @@
// "Replace iteration with bulk 'TestClass.test' call" "true"
package testpackage;
import java.util.*;
interface TestClass<T> {
<S extends T> Iterable<S> test(Iterable<S> entities);
<S extends T> S test(S entity);
}
public class Main {
public void test(TestClass<CharSequence> repo, String[] stringsToSave) {
Arrays.stream(stringsToSave).forEach(<caret>repo::test);
}
}

View File

@@ -0,0 +1,15 @@
// "Replace iteration with bulk 'TestClass.test' call" "false"
package testpackage;
import java.util.*;
interface TestClass<T> {
<S extends T> Iterable<S> test(Iterable<S> entities);
<S extends T> S test(S entity);
}
public class Main {
public void test(TestClass<CharSequence> repo, Iterable<List<String>> stringsToSave) {
stringsToSave.forEach(<caret>repo::test);
}
}

View File

@@ -0,0 +1,15 @@
// "Replace iteration with bulk 'TestClass.test' call" "true"
package testpackage;
import java.util.*;
interface TestClass<T> {
<S extends T> Iterable<S> test(Iterable<S> entities);
<S extends T> S test(S entity);
}
public class Main {
public void test(TestClass<Iterable<String>> repo, Iterable<List<String>> stringsToSave) {
stringsToSave.forEach(<caret>repo::test);
}
}