117 } 118 119 @SuppressWarnings("all") 120 public static boolean isPrimitive(Class<?> clazz) { 121 return clazz.isPrimitive(); 122 } 123 124 @SuppressWarnings("all") 125 public static Class<?> getSuperClass(Class<?> clazz) { 126 return clazz.getSuperclass(); 127 } 128 129 @SuppressWarnings("all") 130 public static Class<?> getComponentType(Class<?> clazz) { 131 return clazz.getComponentType(); 132 } 133 134 @Test 135 public void testThreadSubstitutions() { 136 testGraph("currentThread"); 137 assertInGraph(testGraph("threadIsInterrupted", "isInterrupted", true), IfNode.class); 138 assertInGraph(testGraph("threadInterrupted", "isInterrupted", true), IfNode.class); 139 140 Thread currentThread = Thread.currentThread(); 141 test("currentThread", currentThread); 142 test("threadIsInterrupted", currentThread); 143 } 144 145 @SuppressWarnings("all") 146 public static boolean currentThread(Thread other) { 147 return Thread.currentThread() == other; 148 } 149 150 @SuppressWarnings("all") 151 public static boolean threadIsInterrupted(Thread thread) { 152 return thread.isInterrupted(); 153 } 154 155 @SuppressWarnings("all") 156 public static boolean threadInterrupted() { 157 return Thread.interrupted(); 158 } 159 160 @Test 161 public void testSystemSubstitutions() { 162 testGraph("systemTime"); 163 testGraph("systemIdentityHashCode"); 164 165 for (Object o : new Object[]{this, new int[5], new String[2][], new Object()}) { 166 test("systemIdentityHashCode", o); 167 } 168 } 169 170 @SuppressWarnings("all") 171 public static long systemTime() { 172 return System.currentTimeMillis() + System.nanoTime(); 173 } 174 175 @SuppressWarnings("all") 176 public static int systemIdentityHashCode(Object obj) { 177 return System.identityHashCode(obj); | 117 } 118 119 @SuppressWarnings("all") 120 public static boolean isPrimitive(Class<?> clazz) { 121 return clazz.isPrimitive(); 122 } 123 124 @SuppressWarnings("all") 125 public static Class<?> getSuperClass(Class<?> clazz) { 126 return clazz.getSuperclass(); 127 } 128 129 @SuppressWarnings("all") 130 public static Class<?> getComponentType(Class<?> clazz) { 131 return clazz.getComponentType(); 132 } 133 134 @Test 135 public void testThreadSubstitutions() { 136 testGraph("currentThread"); 137 Thread currentThread = Thread.currentThread(); 138 test("currentThread", currentThread); 139 } 140 141 @SuppressWarnings("all") 142 public static boolean currentThread(Thread other) { 143 return Thread.currentThread() == other; 144 } 145 146 @Test 147 public void testSystemSubstitutions() { 148 testGraph("systemTime"); 149 testGraph("systemIdentityHashCode"); 150 151 for (Object o : new Object[]{this, new int[5], new String[2][], new Object()}) { 152 test("systemIdentityHashCode", o); 153 } 154 } 155 156 @SuppressWarnings("all") 157 public static long systemTime() { 158 return System.currentTimeMillis() + System.nanoTime(); 159 } 160 161 @SuppressWarnings("all") 162 public static int systemIdentityHashCode(Object obj) { 163 return System.identityHashCode(obj); |