ClassVisitor { public static final String prettyPrint(String _src) { final String n = System.getProperty("line.separator"); final String indent = " "; final StringBuffer b = new StringBuffer(); int lvl = 0; for (int i = 0; i < _src.length(); i++) { char c = _src.charAt(i); switch (c) { case ';': b.append(c).append(n).append(getIndent(indent, lvl)); break; case '{': b.append(c).append(n).append(getIndent(indent, ++lvl)); break; case '}': b.append(c).append(n).append(getIndent(indent, --lvl)); break; default: b.append(c); } } return b.toString(); } ClassVisitor(CtClass _c); Set<ConstructId> getConstructs(); synchronized boolean isInstrumented(); synchronized Set<ConstructId> visitMethods(boolean _instrument); synchronized Set<ConstructId> visitConstructors(boolean _instrument); synchronized void setOriginalArchiveDigest(String _sha1); synchronized void setAppContext(Application _ctx); synchronized void finalizeInstrumentation(); byte[] getBytecode(); synchronized void addBooleanMember(String _field_name, boolean _value, boolean _final); synchronized void addIntMember(String _field_name, boolean _final); String getUniqueMemberName(String _prefix, String _construct_name, boolean _random_part); static String removeParameterQualification(String _string); static String removePackageContext(String _string); JavaId getJavaId(); CtClass getCtClass(); String getArchiveDigest(); synchronized Application getAppContext(); String getQname(); synchronized String getOriginalArchiveDigest(); static final String prettyPrint(String _src);  }
@Test public void testPrettyPrint() { final String src = "try {if(!VUL_TRC_XGETALIGNMENT_635905){Class vul_cls = null;if(vul_cls==null) { try {" + " vul_cls=$0.getClass(); } catch(Exception e) {} }if(vul_cls==null) { try {" + " vul_cls=java.lang.invoke.MethodHandles.lookup().lookupClass(); } catch(Exception" + " e) {} }if(vul_cls==null) { try { vul_cls=$class; } catch(Exception e) {} }final" + " ClassLoader vul_cls_ldr=vul_cls.getClassLoader();java.net.URL vul_cls_res =" + " null;if(vul_cls_ldr!=null)vul_cls_res=vul_cls_ldr.getResource(vul_cls.getName().replace('.'," + " '/') + \".class\");java.util.Map params = new" + " java.util.HashMap();params.put(\"junit\", \"false\");params.put(\"counter\", new" + " Integer(1));VUL_TRC_XGETALIGNMENT_635905=org.eclipse.steady.java.monitor.trace.TraceCollector.callback(\"METHOD\",\"org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTPTabImpl.xgetAlignment()\",vul_cls_ldr,vul_cls_res,\"BF0D37E25A643FD4527731790F174BE26AB74A07\",\"com.acme\",\"vulas-testapp\",\"2.1.0-SNAPSHOT\",params);}}" + " catch(Throwable e) { System.err.println(e.getClass().getName() + \" occured during" + " execution of instrumentation code in JAVA METH" + " [org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTPTabImpl.xgetAlignment()]:" + " \" + e.getMessage()); }"; final String pretty = ClassVisitor.prettyPrint(src); }