@@ -0,0 +1,2498 @@
+package io.github.classgraph.json;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0A%0Aimport java.lang.annotation.Retention;%0Aimport java.lang.annotation.RetentionPolicy;%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport io.github.classgraph.ClassGraph;%0Aimport io.github.classgraph.ScanResult;%0Aimport nonapi.io.github.classgraph.json.JSONDeserializer;%0Aimport nonapi.io.github.classgraph.json.JSONSerializer;%0A%0A/**%0A */%0A@SuppressWarnings(%22unused%22)%0Apublic class AnnotationDefaultVals %7B%0A    @Retention(RetentionPolicy.RUNTIME)%0A    @interface MyAnnotation %7B%0A        String msg() default %22hello%22;%0A    %7D%0A%0A    @MyAnnotation%0A    class MyClass %7B%0A    %7D%0A%0A    /**%0A     * Test serialize then deserialize scan result.%0A     */%0A    @Test%0A    public void testSerializeThenDeserializeWithAnnotation() %7B%0A        // Get URL base for overriding classpath (otherwise the JSON representation of the ScanResult won't be%0A        // the same after the first and second deserialization, because overrideClasspath is set by the first%0A        // serialization for consistency.)%0A        final String classfileURL = getClass().getClassLoader()%0A                .getResource(AnnotationDefaultVals.class.getName().replace('.', '/') + %22.class%22).toString();%0A        final String classpathBase = classfileURL.substring(0,%0A                classfileURL.length() - (AnnotationDefaultVals.class.getName().length() + 6));%0A        try (ScanResult scanResult = new ClassGraph().overrideClasspath(classpathBase)%0A                .acceptPackagesNonRecursive(AnnotationDefaultVals.class.getPackage().getName())%0A                .ignoreClassVisibility().enableAllInfo().scan()) %7B%0A            assertThat(scanResult.getClassInfo(MyClass.class.getName()).getAnnotationInfo().get(0)%0A                    .getDefaultParameterValues().get(0).getValue()).isEqualTo(%22hello%22);%0A            final int indent = 2;%0A            final String scanResultJSON = scanResult.toJSON(indent);%0A            final ScanResult scanResultDeserialized = ScanResult.fromJSON(scanResultJSON);%0A            final String scanResultReserializedJSON = scanResultDeserialized.toJSON(indent);%0A            assertThat(scanResultReserializedJSON).isEqualTo(scanResultJSON);%0A            assertThat(scanResultDeserialized.getClassInfo(MyClass.class.getName()).getAnnotationInfo().get(0)%0A                    .getDefaultParameterValues().get(0).getValue()).isEqualTo(%22hello%22);%0A        %7D%0A    %7D%0A%7D%0A

Test preservation of annotation default vals across serialization (#584)