1.system.currentTimeMillis();
使用SystemClock.now()替换。
2.isAssignableFrom();
使用新定义的isAssignableFromForCC()方法替换
/**
* Checks if one {@code Class} can be assigned to a variable of
* another {@code Class}.</p>
* @param cls: the Class to check, may be null
* @param tocls: the Class to try to assign into, returns false if null
* @return
*/
public static boolean isAssignableFromForCC( Class<?> cls, Class<?> tocls) {
return ClassUtils.isAssignable(cls, tocls);// use org.apache.commons.lang3.ClassUtils;
}
3.obj.hashCode()
使用新定义的hashCodeForCC()方法替换
public static int hashCodeForCC(Object obj) {
return ObjectUtils.hashCode(obj);//org.apache.commons.lang3.ObjectUtils;
}
4.getModifiers()
使用新定义的getModifiersForCC()方法替换
public static int getModifiersForCC(Class clazz) {
return ReflectUtils.getClassInfo(clazz).getModifiers();//org.springframework.cglib.core.ReflectUtils;
}
5.Thread.sleep(1000L);
TimeUnit.SECONDS.sleep(1);
6.Thread.currentThread().getContextClassLoader();
ClassUtils.class.getClassLoader();
class Echo { public native void runEcho(); static { System.loadLibrary("echo"); } public static void main(String[] args) { new Echo().runEcho(); } }
#include <jni.h> #include "Echo.h" //the java class above compiled with javah #include <stdio.h> JNIEXPORT void JNICALL Java_Echo_runEcho(JNIEnv *env, jobject obj) { char buf[64]; gets(buf); printf(buf); }
原文:https://www.cnblogs.com/xiaro115/p/14764663.html