MCPcopy Create free account
hub / github.com/GCMiner/GCMiner / object_init

Method object_init

src/main/java/ChainValidatiton/Test.java:66–75  ·  view source on GitHub ↗
(String classname)

Source from the content-addressed store, hash-verified

64 }
65
66 public static <classname> Object object_init(String classname) throws Exception {
67
68 Class<?> target_classname = Class.forName(classname); //返回传入类对应的实例对象
69 Field f = Unsafe.class.getDeclaredField("theUnsafe");
70 f.setAccessible(true);
71 Unsafe unsafe = (Unsafe) f.get(null);
72
73 classname PropertyObject = (classname) unsafe.allocateInstance(target_classname);
74 return PropertyObject;
75 }
76
77 public static void main(String[] args) {
78 ObjectMapper mapper = new ObjectMapper();

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected