public boolean matches(Method method) { if (!symbol.contains(getMethodName(method))) { return false; } // if (!Modifier.isStatic(method.getModifiers()) && // !symbol.contains(method.getDeclaringClass().getSimpleName())) // return false; parse(); try { if (ref != null) { boolean res = ref.matches(method); if (!res && BridJ.debug) { BridJ.debug( "Symbol " + symbol + " was a good candidate but expected demangled signature " + ref + " did not match the method " + method); } return res; } } catch (Exception ex) { ex.printStackTrace(); } return false; }
void solve() { Thread tcThread = new Thread(tc); // System.out.println("starting client thread"); tcThread.start(); try { tcThread.join(); } catch (Exception e) { e.printStackTrace(); } // System.out.println("joined client thread"); result = SudokuSolver.solve(tc.testcase); success = SudokuSolver.isLegalSolution(result, tc.testcase); }
public boolean matchesDestructor(Class<?> type) { if (!symbol.contains(type.getSimpleName())) { return false; } parse(); try { if (ref != null) { return ref.matchesDestructor(type); } } catch (Exception ex) { ex.printStackTrace(); } return false; }
public boolean matchesConstructor(Type type, java.lang.reflect.Constructor<?> constr) { if (!symbol.contains(Utils.getClass(type).getSimpleName())) { return false; } parse(); try { if (ref != null) { return ref.matchesConstructor(type, constr); } } catch (Exception ex) { ex.printStackTrace(); } return false; }
public void run() { System.out.println("starting " + threadname + " run method on port " + SudokuServer.PORT); System.out.flush(); try { Socket sock = new Socket(hostname, SudokuServer.PORT); PrintWriter dos = new PrintWriter(sock.getOutputStream()); BufferedReader dis = new BufferedReader(new InputStreamReader(sock.getInputStream())); dos.println(testcase); dos.flush(); String response = dis.readLine(); System.out.println( "Client " + threadname + " sent: " + testcase + " received response:" + response); dos.close(); dis.close(); synchronized (sc) { sc.result = response; } } catch (Exception e) { e.printStackTrace(); } System.out.println("finishing " + threadname + " run method"); }
public static void main(String[] args) { // try { //// String s = "?f@@YA?AW4E@@W41@@Z"; // String s = "?f@@YAPADPADPAF1@Z"; // "byte* f(byte*, short*, short*)" // //String s = "?m@C@@SAPAV1@XZ"; // MemberRef mr = new VC9Demangler(null, s).parseSymbol(); // System.out.println(mr); // } catch (DemanglingException ex) { // Logger.getLogger(Demangler.class.getName()).error(null, ex); // } for (String arg : args) { try { System.out.println("VC9: " + new VC9Demangler(null, arg).parseSymbol()); } catch (Exception ex) { ex.printStackTrace(); } try { System.out.println("GCC4: " + new GCC4Demangler(null, arg).parseSymbol()); } catch (Exception ex) { ex.printStackTrace(); } } }
/** Calculates a MD5 digest of the class. */ public String getDigest() { try { if (_className == null || "".equals(_className)) return ""; DynamicClassLoader loader = (DynamicClassLoader) Thread.currentThread().getContextClassLoader(); ClassLoader tmpLoader = loader.getNewTempClassLoader(); Class cl = Class.forName(_className, false, tmpLoader); if (cl == null) return ""; MessageDigest digest = MessageDigest.getInstance("MD5"); addDigest(digest, cl.getName()); addDigest(digest, cl.getModifiers()); Class superClass = cl.getSuperclass(); if (superClass != null) addDigest(digest, superClass.getName()); Class[] interfaces = cl.getInterfaces(); for (int i = 0; i < interfaces.length; i++) addDigest(digest, interfaces[i].getName()); Field[] fields = cl.getDeclaredFields(); Arrays.sort(fields, new FieldComparator()); if (_checkFields) { for (Field field : fields) { if (Modifier.isPrivate(field.getModifiers()) && !_checkPrivate) continue; if (Modifier.isProtected(field.getModifiers()) && !_checkProtected) continue; addDigest(digest, field.getName()); addDigest(digest, field.getModifiers()); addDigest(digest, field.getType().getName()); addDigest(digest, field.getAnnotations()); } } Method[] methods = cl.getDeclaredMethods(); Arrays.sort(methods, new MethodComparator()); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (Modifier.isPrivate(method.getModifiers()) && !_checkPrivate) continue; if (Modifier.isProtected(method.getModifiers()) && !_checkProtected) continue; if (Modifier.isStatic(method.getModifiers()) && !_checkStatic) continue; addDigest(digest, method.getName()); addDigest(digest, method.getModifiers()); addDigest(digest, method.getName()); Class[] param = method.getParameterTypes(); for (int j = 0; j < param.length; j++) addDigest(digest, param[j].getName()); addDigest(digest, method.getReturnType().getName()); Class[] exn = method.getExceptionTypes(); for (int j = 0; j < exn.length; j++) addDigest(digest, exn[j].getName()); addDigest(digest, method.getAnnotations()); } byte[] digestBytes = new byte[256]; int len = digest.digest(digestBytes, 0, digestBytes.length); return digestToBase64(digestBytes, len); } catch (Exception e) { log.log(Level.FINER, e.toString(), e); return ""; } }