反射如何越过泛型检查
package com.mayikt.test; import com.mayikt.entity.UserEntity; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; /** * @author 余胜军 * @ClassName Test05 * @qq 644064779 * @addres www.mayikt.com * 微信:yushengjun644 */ public class Test05 { public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { // ArrayList<String> arrayList = new ArrayList<>(); // arrayList.add("mayikt"); //// strings.add(111); // Class<? extends ArrayList> aClass = arrayList.getClass(); // Method addMethod = aClass.getDeclaredMethod("add", Object.class); // addMethod.invoke(arrayList, 1); // System.out.println(arrayList); // arrayList.forEach((t) -> { // System.out.println(t); // }); } }