Repository: microsoft/gctoolkit
File: parser/src/main/java/com/microsoft/gctoolkit/parser/UnifiedG1GCParser.java (Java)

Code before:
    }

    /**
     * The trace indicates number of active regions before and after the collection. This is then used to provide an
     * extremely coarse estimate of the amount of live data.
     * @param trace A chunk of GC log that we are attempting to match to a known GC log pattern
     * @param line The log line corresponding to the trace
     */
    public void regionSummary(GCLogTrace trace, String line) {
        RegionSummary summary = trace.regionSummary();
        switch (trace.getGroup(1)) {
            case "Eden":
                forwardReference.setEdenRegionSummary(summary);
                break;
            case "Survivor":
                forwardReference.setSurvivorRegionSummary(summary);
                break;
            case "Old":
                forwardReference.setOldRegionSummary(summary);
                break;
            case "Humongous":
                forwardReference.setHumongousRegionSummary(summary);
                break;
            case "Archive":
                /*
                  Archive Region type is only available in JDK 14 and 17.
                 */
                forwardReference.setArchiveRegionSummary(summary);
                break;
            default:
                notYetImplemented(trace, line);
        }
    }

    public void unifiedMetaData(GCLogTrace trace, String line) {
        if (forwardReference.setMetaspaceOccupancyBeforeCollection(trace.toKBytes(1))) {
            forwardReference.setMetaspaceOccupancyAfterCollection(trace.toKBytes(3));
            forwardReference.setMetaspaceSizeAfterCollection(trace.toKBytes(5));
        }
    }

    public void youngDetails(GCLogTrace trace, String line) {
        forwardReference.setHeapOccupancyBeforeCollection(trace.toKBytes(5));
        forwardReference.setHeapOccupancyAfterCollection(trace.toKBytes(7));
        forwardReference.setHeapSizeAfterCollection(trace.toKBytes(9));
        forwardReference.setDuration(trace.getDurationInSeconds());
    }

    /**
     * Record contains Metaspace broken out to class and non-class space. Since
     * Metaspace = class space + non-class space, we can ignore the non-class space information (for now)

Review comment (suggestion):
```suggestion
                  // Archive Region type is only available in JDK 14 and 17.
```

Code after:
    }

    /**
     * The trace indicates number of active regions before and after the collection. This is then used to provide an
     * extremely coarse estimate of the amount of live data.
     * @param trace A chunk of GC log that we are attempting to match to a known GC log pattern
     * @param line The log line corresponding to the trace
     */
    public void regionSummary(GCLogTrace trace, String line) {
        RegionSummary summary = trace.regionSummary();
        switch (trace.getGroup(1)) {
            case "Eden":
                forwardReference.setEdenRegionSummary(summary);
                break;
            case "Survivor":
                forwardReference.setSurvivorRegionSummary(summary);
                break;
            case "Old":
                forwardReference.setOldRegionSummary(summary);
                break;
            case "Humongous":
                forwardReference.setHumongousRegionSummary(summary);
                break;
            case "Archive":
                // Archive Region type is only available in JDK 14 and 17.
                forwardReference.setArchiveRegionSummary(summary);
                break;
            default:
                notYetImplemented(trace, line);
        }
    }

    public void unifiedMetaData(GCLogTrace trace, String line) {
        if (forwardReference.setMetaspaceOccupancyBeforeCollection(trace.toKBytes(1))) {
            forwardReference.setMetaspaceOccupancyAfterCollection(trace.toKBytes(3));
            forwardReference.setMetaspaceSizeAfterCollection(trace.toKBytes(5));
        }
    }

    public void youngDetails(GCLogTrace trace, String line) {
        forwardReference.setHeapOccupancyBeforeCollection(trace.toKBytes(5));
        forwardReference.setHeapOccupancyAfterCollection(trace.toKBytes(7));
        forwardReference.setHeapSizeAfterCollection(trace.toKBytes(9));
        forwardReference.setDuration(trace.getDurationInSeconds());
    }

    /**
     * Record contains Metaspace broken out to class and non-class space. Since
     * Metaspace = class space + non-class space, we can ignore the non-class space information (for now)
     * The space size before the collection can be determined by inspecting the previous record (ignore for now)
     * @param trace A chunk of GC log that we are attempting to match to a known GC log pattern