File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
src/main/java/com/github/pagehelper Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ public PageInfo() {
120120 *
121121 * @param list
122122 */
123- public PageInfo (List <T > list ) {
123+ public PageInfo (List <? extends T > list ) {
124124 this (list , DEFAULT_NAVIGATE_PAGES );
125125 }
126126
@@ -130,7 +130,7 @@ public PageInfo(List<T> list) {
130130 * @param list page结果
131131 * @param navigatePages 页码数量
132132 */
133- public PageInfo (List <T > list , int navigatePages ) {
133+ public PageInfo (List <? extends T > list , int navigatePages ) {
134134 super (list );
135135 if (list instanceof Page ) {
136136 Page page = (Page ) list ;
@@ -162,11 +162,11 @@ public PageInfo(List<T> list, int navigatePages) {
162162 }
163163 }
164164
165- public static <T > PageInfo <T > of (List <T > list ) {
165+ public static <T > PageInfo <T > of (List <? extends T > list ) {
166166 return new PageInfo <T >(list );
167167 }
168168
169- public static <T > PageInfo <T > of (List <T > list , int navigatePages ) {
169+ public static <T > PageInfo <T > of (List <? extends T > list , int navigatePages ) {
170170 return new PageInfo <T >(list , navigatePages );
171171 }
172172
Original file line number Diff line number Diff line change @@ -40,16 +40,17 @@ public class PageSerializable<T> implements Serializable {
4040 public PageSerializable () {
4141 }
4242
43- public PageSerializable (List <T > list ) {
44- this .list = list ;
43+ @ SuppressWarnings ("unchecked" )
44+ public PageSerializable (List <? extends T > list ) {
45+ this .list = (List <T >) list ;
4546 if (list instanceof Page ){
46- this .total = ((Page )list ).getTotal ();
47+ this .total = ((Page <?> )list ).getTotal ();
4748 } else {
4849 this .total = list .size ();
4950 }
5051 }
5152
52- public static <T > PageSerializable <T > of (List <T > list ){
53+ public static <T > PageSerializable <T > of (List <? extends T > list ){
5354 return new PageSerializable <T >(list );
5455 }
5556
You can’t perform that action at this time.
0 commit comments