$ show chewiebug/GCViewer
GCViewer is a mature, monolithic Java desktop application (Swing GUI) and CLI tool for parsing, analyzing, and visualizing garbage collection (GC) logs from a wide range of JVM implementations (Sun/Oracle, IBM, HP, BEA/JRockit, Go, and modern OpenJDK unified logging). Its architecture follows a layered pattern: a family of DataReader implementations parse vendor-specific log formats into a unified GCModel of GC events. This model is then consumed by statistical analysis utilities (DoubleData, RegressionLine) and rendered via Swing charts or exported to CSV/PNG/plain text. The codebase demonstrates strong engineering in its utility classes (NumberParser, HttpUrlConnectionHelper, MonitoredBufferedInputStream) and test infrastructure (extensive real-world log fixtures). However, it suffers from significant technical drift, primarily a Java 8 baseline, alongside accumulated technical debt such as e.printStackTrace() usage, ignored tests, known export bugs, and fragile parser logic. It is actively maintained but carries the weight of supporting two decades of JVM GC log formats.
The LLM identified 5 files worth highlighting for reuse:
A hand-optimized numeric parser (parseInt, parseLong, parseDouble) that handles locale-specific decimal separators (comma/dot) without relying on NumberFormat. It is a self-contained, high-performance utility that can be extracted into any Java project requiring fast, locale-tolerant text-to-number conversion.
A generic statistical accumulator that tracks sum, average, min, max, standard deviation, and variance for a stream of double values. It is completely independent of the GC domain and provides a clean, reusable pattern for online statistical computation in any Java application.
A BufferedInputStream wrapper that fires Java property change events to report read progress. This decouples I/O processing from UI updates, making it a reusable pattern for any long-running stream processing task in an event-driven or Swing application.
A utility class that opens an InputStream from a URL, handling gzip/deflate content encoding, HTTP error responses, and content-length reporting. It provides a clean abstraction over HttpURLConnection and can be reused in any Java application needing to fetch and stream remote resources.
Uses reflection to dynamically integrate with macOS-specific UI features (e.g., full-screen mode, menu bar integration) without compile-time dependencies on Apple's proprietary libraries. This demonstrates a robust pattern for optional platform-specific enhancements in cross-platform Java applications.