From 1b4455050c16aa178cb4fac02087cf4ffb571a76 Mon Sep 17 00:00:00 2001 From: Brian Zhang Date: Tue, 21 Apr 2020 22:27:29 -0700 Subject: [PATCH 1/4] Support incremental annotation processing Move parser map generation logic to new aggregating annotation processor (JsonObjectParserMapProcessor) --- .../json/annotations/JsonParserPartition.java | 2 +- .../json/annotations/codegen/JsonParser.java | 12 ++ gradle.properties | 2 +- .../json/codegen/AutoparseJsonProcessor.java | 78 +-------- .../codegen/JsonObjectParserGenerator.java | 21 ++- .../codegen/JsonObjectParserMapProcessor.java | 148 ++++++++++++++++++ .../JsonObjectParserTableGenerator.java | 11 +- .../gradle/incremental.annotation.processors | 2 + .../javax.annotation.processing.Processor | 3 +- 9 files changed, 199 insertions(+), 80 deletions(-) create mode 100644 core/src/main/java/com/workday/autoparse/json/annotations/codegen/JsonParser.java create mode 100644 processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserMapProcessor.java create mode 100644 processor/src/main/resources/META-INF/gradle/incremental.annotation.processors diff --git a/core/src/main/java/com/workday/autoparse/json/annotations/JsonParserPartition.java b/core/src/main/java/com/workday/autoparse/json/annotations/JsonParserPartition.java index 900b7fe..c609124 100644 --- a/core/src/main/java/com/workday/autoparse/json/annotations/JsonParserPartition.java +++ b/core/src/main/java/com/workday/autoparse/json/annotations/JsonParserPartition.java @@ -50,7 +50,7 @@ * @author nathan.taylor * @since 2015-02-27 */ -@Retention(RetentionPolicy.SOURCE) +@Retention(RetentionPolicy.CLASS) @Target(ElementType.PACKAGE) public @interface JsonParserPartition { diff --git a/core/src/main/java/com/workday/autoparse/json/annotations/codegen/JsonParser.java b/core/src/main/java/com/workday/autoparse/json/annotations/codegen/JsonParser.java new file mode 100644 index 0000000..d92ec4e --- /dev/null +++ b/core/src/main/java/com/workday/autoparse/json/annotations/codegen/JsonParser.java @@ -0,0 +1,12 @@ +package com.workday.autoparse.json.annotations.codegen; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.TYPE) +public @interface JsonParser { + String[] value(); +} diff --git a/gradle.properties b/gradle.properties index 67a6a1c..58fa9b7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=0.2 +VERSION_NAME=0.3 GROUP=com.workday POM_PACKAGING=jar diff --git a/processor/src/main/java/com/workday/autoparse/json/codegen/AutoparseJsonProcessor.java b/processor/src/main/java/com/workday/autoparse/json/codegen/AutoparseJsonProcessor.java index a6ca3ce..9f4cf32 100644 --- a/processor/src/main/java/com/workday/autoparse/json/codegen/AutoparseJsonProcessor.java +++ b/processor/src/main/java/com/workday/autoparse/json/codegen/AutoparseJsonProcessor.java @@ -9,7 +9,6 @@ import com.workday.autoparse.json.annotations.DiscrimValue; import com.workday.autoparse.json.annotations.JsonObject; -import com.workday.autoparse.json.annotations.JsonParserPartition; import com.workday.autoparse.json.annotations.JsonPostCreateChild; import com.workday.autoparse.json.annotations.JsonSelfValues; import com.workday.autoparse.json.annotations.JsonValue; @@ -18,22 +17,20 @@ import com.workday.autoparse.json.parser.NoJsonObjectParser; import com.workday.meta.AnnotationUtils; import com.workday.meta.MetaTypeNames; -import com.workday.meta.PackageTree; + +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; -import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; -import javax.lang.model.util.ElementFilter; import javax.tools.Diagnostic; -import java.io.IOException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; /** * This is is the root of the code generation. It scans through every class annotated with {@link JsonObject} and @@ -46,8 +43,6 @@ */ public class AutoparseJsonProcessor extends AbstractProcessor { - private Map partitionComponents = new HashMap<>(); - @Override public Set getSupportedAnnotationTypes() { Set types = new HashSet<>(); @@ -72,10 +67,6 @@ public boolean process(Set annotations, RoundEnvironment Set elements = roundEnv.getElementsAnnotatedWith(JsonObject.class); - Set partitionPackageElements = ElementFilter.packagesIn( - roundEnv.getElementsAnnotatedWith(JsonParserPartition.class)); - - PackageTree packageTree = new PackageTree(processingEnv.getElementUtils(), partitionPackageElements); final Set classesRequiringGeneratedParsers = new HashSet<>(); final Map classNameToParserNameMap = new HashMap<>(); @@ -90,24 +81,13 @@ public void get() { String customParserCanonicalName = customParserClassMirror.toString(); String classQualifiedName = MetaTypeNames.constructTypeName((TypeElement) element); - String codeClassQualifiedName = ((TypeElement) element).getQualifiedName().toString(); - - PackageElement matchingPackage = packageTree.getMatchingPackage(element); - PartitionComponentInfo partitionComponentInfo = getPartitionComponentInfoForPackage(matchingPackage); if (isCustomParser(customParserCanonicalName)) { - addElementToMap((TypeElement) element, partitionComponentInfo.discrimValueToClassWithCustomParserMap); classNameToParserNameMap.put(classQualifiedName, customParserCanonicalName); - partitionComponentInfo.codeClassNameToParserNameMap.put(codeClassQualifiedName, - customParserCanonicalName); } else { - addElementToMap((TypeElement) element, - partitionComponentInfo.discrimValueToClassRequiringGeneratedParserMap); String parserQualifiedName = classQualifiedName + GeneratedClassNames.PARSER_SUFFIX; classNameToParserNameMap.put(classQualifiedName, parserQualifiedName); classesRequiringGeneratedParsers.add((TypeElement) element); - partitionComponentInfo.codeClassNameToParserNameMap.put(codeClassQualifiedName, parserQualifiedName); - } } @@ -115,41 +95,13 @@ public void get() { generateClassParser(classElement, classNameToParserNameMap); } - generateParserMaps(); return true; } - private PartitionComponentInfo getPartitionComponentInfoForPackage(PackageElement packageElement) { - PartitionComponentInfo partitionComponentInfo = partitionComponents.get(packageElement); - if (partitionComponentInfo == null) { - partitionComponentInfo = new PartitionComponentInfo(); - partitionComponents.put(packageElement, partitionComponentInfo); - } - return partitionComponentInfo; - } - private boolean isCustomParser(String parserName) { return !NoJsonObjectParser.class.getCanonicalName().equals(parserName); } - private void addElementToMap(TypeElement element, Map map) { - JsonObject annotation = element.getAnnotation(JsonObject.class); - for (String discrimValue : annotation.value()) { - if (StringUtils.isBlank(discrimValue)) { - processingEnv.getMessager() - .printMessage(Diagnostic.Kind.ERROR, "Discrimination values cannot be blank.", element); - } else { - TypeElement previousValue = map.put(discrimValue, element); - if (previousValue != null) { - String errorMessage = String.format("%s and %s both tried to map to discrimination value \"%s\"", - element.getQualifiedName(), previousValue.getQualifiedName(), - discrimValue); - processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, errorMessage, element); - } - } - } - } - private void generateClassParser(TypeElement classElement, Map classNameToParserNameMap) { try { new JsonObjectParserGenerator(processingEnv, classElement, classNameToParserNameMap).generateParser(); @@ -158,22 +110,4 @@ private void generateClassParser(TypeElement classElement, Map c } } - - private void generateParserMaps() { - for (Map.Entry packageMapEntry : partitionComponents.entrySet()) { - final PackageElement packageElement = packageMapEntry.getKey(); - final PartitionComponentInfo partitionComponentInfo = packageMapEntry.getValue(); - try { - new InstanceUpdaterTableGenerator(processingEnv, partitionComponentInfo.codeClassNameToParserNameMap, - packageElement).generateTable(); - new JsonObjectParserTableGenerator(processingEnv, - partitionComponentInfo - .discrimValueToClassRequiringGeneratedParserMap, - partitionComponentInfo.discrimValueToClassWithCustomParserMap, - packageElement).generateParserMap(); - } catch (IOException e) { - processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, e.getMessage()); - } - } - } } diff --git a/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserGenerator.java b/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserGenerator.java index fe5148a..307eaae 100644 --- a/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserGenerator.java +++ b/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserGenerator.java @@ -9,9 +9,11 @@ import com.squareup.javawriter.JavaWriter; import com.workday.autoparse.json.annotations.DiscrimValue; +import com.workday.autoparse.json.annotations.JsonObject; import com.workday.autoparse.json.annotations.JsonPostCreateChild; import com.workday.autoparse.json.annotations.JsonSelfValues; import com.workday.autoparse.json.annotations.JsonValue; +import com.workday.autoparse.json.annotations.codegen.JsonParser; import com.workday.autoparse.json.context.ContextHolder; import com.workday.autoparse.json.context.GeneratedClassNames; import com.workday.autoparse.json.context.JsonParserContext; @@ -40,6 +42,7 @@ import javax.tools.JavaFileObject; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -52,6 +55,7 @@ import java.util.Locale; import java.util.Map; import java.util.Set; +import java.util.function.Function; /** * Generates code for {@link JsonObjectParser}s. @@ -142,7 +146,7 @@ private Collection getDiscriminationValueAssignmentPatterns(ValueAssigne public void generateParser() throws IOException { String parserName = MetaTypeNames.constructTypeName(classElement, GeneratedClassNames.PARSER_SUFFIX); - JavaFileObject sourceFile = processingEnv.getFiler().createSourceFile(parserName); + JavaFileObject sourceFile = processingEnv.getFiler().createSourceFile(parserName, classElement); JavaWriter writer = new JavaWriter(sourceFile.openWriter()); writer.setIndent(" "); @@ -150,6 +154,20 @@ public void generateParser() throws IOException { writer.emitImports(getStandardImports()); writer.emitEmptyLine(); + JsonObject jsonObject = classElement.getAnnotation(JsonObject.class); + if (jsonObject != null) { + Object[] values = Arrays + .stream(jsonObject.value()) + .map(new Function() { + @Override + public Object apply(String data) { + return JavaWriter.stringLiteral(data); + } + }) + .toArray(); + writer.emitAnnotation("JsonParser", values); + } + parsedClassName = writer.compressType(classElement.getQualifiedName().toString()); String jsonObjectParserInterfaceName = JavaWriter.type(JsonObjectParser.class, parsedClassName); String fromMapUpdaterInterfaceName = JavaWriter.type(InstanceUpdater.class, parsedClassName); @@ -209,6 +227,7 @@ private Set getStandardImports() { results.add(IOException.class.getCanonicalName()); results.add(Map.class.getCanonicalName()); results.add(MapValueGetter.class.getCanonicalName()); + results.add(JsonParser.class.getCanonicalName()); return results; } diff --git a/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserMapProcessor.java b/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserMapProcessor.java new file mode 100644 index 0000000..7acb0b3 --- /dev/null +++ b/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserMapProcessor.java @@ -0,0 +1,148 @@ +package com.workday.autoparse.json.codegen; + +import com.workday.autoparse.json.annotations.JsonObject; +import com.workday.autoparse.json.annotations.JsonParserPartition; +import com.workday.autoparse.json.annotations.codegen.JsonParser; +import com.workday.autoparse.json.context.GeneratedClassNames; +import com.workday.autoparse.json.parser.NoJsonObjectParser; +import com.workday.autoparse.json.utils.CollectionUtils; +import com.workday.meta.AnnotationUtils; +import com.workday.meta.MetaTypeNames; +import com.workday.meta.PackageTree; + +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.RoundEnvironment; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Element; +import javax.lang.model.element.PackageElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.ElementFilter; +import javax.tools.Diagnostic; + +public class JsonObjectParserMapProcessor extends AbstractProcessor { + + private Map partitionComponents = new HashMap<>(); + + private Set partitionPackageElements = new HashSet<>(); + + @Override + public Set getSupportedAnnotationTypes() { + return CollectionUtils.newHashSet( + JsonParserPartition.class.getCanonicalName(), + JsonObject.class.getCanonicalName(), + JsonParser.class.getCanonicalName() + ); + } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latestSupported(); + } + + @Override + public boolean process(Set set, RoundEnvironment roundEnvironment) { + if (set == null || set.isEmpty()) { + return false; + } + + final Set elements = roundEnvironment.getElementsAnnotatedWith(JsonObject.class); + if (elements.isEmpty()) { + return false; + } + + Set partitionPackageElementsInRound = ElementFilter.packagesIn(roundEnvironment.getElementsAnnotatedWith(JsonParserPartition.class)); + if (!partitionPackageElementsInRound.isEmpty()) { + partitionPackageElements.addAll(partitionPackageElementsInRound); + } + + PackageTree packageTree = new PackageTree(processingEnv.getElementUtils(), partitionPackageElements); + + for (final Element element : elements) { + TypeMirror customParserClassMirror = AnnotationUtils.getClassTypeMirrorFromAnnotationValue( + new AnnotationUtils.Getter() { + @Override + public void get() { + element.getAnnotation(JsonObject.class).parser(); + } + }); + + String customParserCanonicalName = customParserClassMirror.toString(); + String classQualifiedName = MetaTypeNames.constructTypeName((TypeElement) element); + String codeClassQualifiedName = ((TypeElement) element).getQualifiedName().toString(); + + PackageElement matchingPackage = packageTree.getMatchingPackage(element); + PartitionComponentInfo partitionComponentInfo = getPartitionComponentInfoForPackage(matchingPackage); + + if (isCustomParser(customParserCanonicalName)) { + addElementToMap((TypeElement) element, partitionComponentInfo.discrimValueToClassWithCustomParserMap); + partitionComponentInfo.codeClassNameToParserNameMap.put(codeClassQualifiedName, + customParserCanonicalName); + } else { + addElementToMap((TypeElement) element, + partitionComponentInfo.discrimValueToClassRequiringGeneratedParserMap); + String parserQualifiedName = classQualifiedName + GeneratedClassNames.PARSER_SUFFIX; + partitionComponentInfo.codeClassNameToParserNameMap.put(codeClassQualifiedName, parserQualifiedName); + + } + } + + generateParserMaps(); + return true; + } + + private PartitionComponentInfo getPartitionComponentInfoForPackage(PackageElement packageElement) { + PartitionComponentInfo partitionComponentInfo = partitionComponents.get(packageElement); + if (partitionComponentInfo == null) { + partitionComponentInfo = new PartitionComponentInfo(); + partitionComponents.put(packageElement, partitionComponentInfo); + } + return partitionComponentInfo; + } + + private boolean isCustomParser(String parserName) { + return !NoJsonObjectParser.class.getCanonicalName().equals(parserName); + } + + private void addElementToMap(TypeElement element, Map map) { + JsonObject annotation = element.getAnnotation(JsonObject.class); + for (String discrimValue : annotation.value()) { + if (StringUtils.isBlank(discrimValue)) { + processingEnv.getMessager() + .printMessage(Diagnostic.Kind.ERROR, "Discrimination values cannot be blank.", element); + } else { + TypeElement previousValue = map.put(discrimValue, element); + if (previousValue != null) { + String errorMessage = String.format("%s and %s both tried to map to discrimination value \"%s\"", + element.getQualifiedName(), previousValue.getQualifiedName(), + discrimValue); + processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, errorMessage, element); + } + } + } + } + + private void generateParserMaps() { + for (Map.Entry packageMapEntry : partitionComponents.entrySet()) { + final PackageElement packageElement = packageMapEntry.getKey(); + final PartitionComponentInfo partitionComponentInfo = packageMapEntry.getValue(); + try { + new InstanceUpdaterTableGenerator(processingEnv, partitionComponentInfo.codeClassNameToParserNameMap, + packageElement).generateTable(); + new JsonObjectParserTableGenerator(processingEnv, + partitionComponentInfo + .discrimValueToClassRequiringGeneratedParserMap, + partitionComponentInfo.discrimValueToClassWithCustomParserMap, + packageElement).generateParserMap(); + } catch (IOException e) { + processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, e.getMessage()); + } + } + } +} diff --git a/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserTableGenerator.java b/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserTableGenerator.java index c40477f..76bee26 100644 --- a/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserTableGenerator.java +++ b/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserTableGenerator.java @@ -26,6 +26,7 @@ import java.util.Set; import javax.annotation.processing.ProcessingEnvironment; +import javax.lang.model.element.Element; import javax.lang.model.element.Modifier; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; @@ -71,7 +72,11 @@ public void generateParserMap() throws IOException { GeneratedClassNames .CLASS_JSON_OBJECT_PARSER_TABLE); - JavaFileObject sourceFile = processingEnv.getFiler().createSourceFile(qualifiedClassName); + Map parserMap = new HashMap<>(); + parserMap.putAll(discrimValueToClassRequiringGeneratedParserMap); + parserMap.putAll(discrimValueToClassWithCustomParserMap); + + JavaFileObject sourceFile = processingEnv.getFiler().createSourceFile(qualifiedClassName, parserMap.values().toArray(new Element[parserMap.size()])); JavaWriter writer = new JavaWriter(sourceFile.openWriter()); writer.emitPackage(packageName); @@ -121,9 +126,7 @@ private void writeMapField(JavaWriter writer) throws IOException { for (Map.Entry entry : discrimValueToClassRequiringGeneratedParserMap.entrySet()) { String discriminationValue = entry.getKey(); - String parserQualifiedName = MetaTypeNames.constructTypeName(entry.getValue(), - GeneratedClassNames - .PARSER_SUFFIX); + String parserQualifiedName = MetaTypeNames.constructTypeName(entry.getValue(), GeneratedClassNames.PARSER_SUFFIX); writer.emitStatement("MAP.put(\"%s\", %s.INSTANCE)", discriminationValue, parserQualifiedName); diff --git a/processor/src/main/resources/META-INF/gradle/incremental.annotation.processors b/processor/src/main/resources/META-INF/gradle/incremental.annotation.processors new file mode 100644 index 0000000..2d069db --- /dev/null +++ b/processor/src/main/resources/META-INF/gradle/incremental.annotation.processors @@ -0,0 +1,2 @@ +com.workday.autoparse.json.codegen.AutoparseJsonProcessor,isolating +com.workday.autoparse.json.codegen.JsonObjectParserMapProcessor,aggregating diff --git a/processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor index 4887c2e..19c4baa 100644 --- a/processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor +++ b/processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor @@ -1 +1,2 @@ -com.workday.autoparse.json.codegen.AutoparseJsonProcessor \ No newline at end of file +com.workday.autoparse.json.codegen.AutoparseJsonProcessor +com.workday.autoparse.json.codegen.JsonObjectParserMapProcessor From af551cc17732d8c342067ce3acf1f30dc4840129 Mon Sep 17 00:00:00 2001 From: Brian Zhang Date: Wed, 6 May 2020 13:54:29 -0700 Subject: [PATCH 2/4] Revert version bump --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 58fa9b7..67a6a1c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=0.3 +VERSION_NAME=0.2 GROUP=com.workday POM_PACKAGING=jar From 08cdc6312a9d25703160df56653a8ae6cb2deb31 Mon Sep 17 00:00:00 2001 From: Brian Zhang Date: Thu, 7 May 2020 16:28:38 -0700 Subject: [PATCH 3/4] Fix code style --- .../json/codegen/JsonObjectParserMapProcessor.java | 3 ++- .../json/codegen/JsonObjectParserTableGenerator.java | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserMapProcessor.java b/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserMapProcessor.java index 7acb0b3..a249764 100644 --- a/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserMapProcessor.java +++ b/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserMapProcessor.java @@ -57,7 +57,8 @@ public boolean process(Set set, RoundEnvironment roundEnv return false; } - Set partitionPackageElementsInRound = ElementFilter.packagesIn(roundEnvironment.getElementsAnnotatedWith(JsonParserPartition.class)); + Set partitionPackageElementsInRound = + ElementFilter.packagesIn(roundEnvironment.getElementsAnnotatedWith(JsonParserPartition.class)); if (!partitionPackageElementsInRound.isEmpty()) { partitionPackageElements.addAll(partitionPackageElementsInRound); } diff --git a/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserTableGenerator.java b/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserTableGenerator.java index 76bee26..a1a9614 100644 --- a/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserTableGenerator.java +++ b/processor/src/main/java/com/workday/autoparse/json/codegen/JsonObjectParserTableGenerator.java @@ -76,7 +76,8 @@ public void generateParserMap() throws IOException { parserMap.putAll(discrimValueToClassRequiringGeneratedParserMap); parserMap.putAll(discrimValueToClassWithCustomParserMap); - JavaFileObject sourceFile = processingEnv.getFiler().createSourceFile(qualifiedClassName, parserMap.values().toArray(new Element[parserMap.size()])); + JavaFileObject sourceFile = processingEnv.getFiler() + .createSourceFile(qualifiedClassName, parserMap.values().toArray(new Element[parserMap.size()])); JavaWriter writer = new JavaWriter(sourceFile.openWriter()); writer.emitPackage(packageName); @@ -126,7 +127,8 @@ private void writeMapField(JavaWriter writer) throws IOException { for (Map.Entry entry : discrimValueToClassRequiringGeneratedParserMap.entrySet()) { String discriminationValue = entry.getKey(); - String parserQualifiedName = MetaTypeNames.constructTypeName(entry.getValue(), GeneratedClassNames.PARSER_SUFFIX); + String parserQualifiedName = MetaTypeNames.constructTypeName(entry.getValue(), + GeneratedClassNames.PARSER_SUFFIX); writer.emitStatement("MAP.put(\"%s\", %s.INSTANCE)", discriminationValue, parserQualifiedName); From 65a0d0cd1cb48f1f0b0c55fe055b9ab52fcad645 Mon Sep 17 00:00:00 2001 From: Brian Zhang Date: Thu, 7 May 2020 16:36:49 -0700 Subject: [PATCH 4/4] Bump version to 0.4 --- .circleci/config.yml | 2 +- gradle.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d81582a..32c7321 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,4 @@ -version: 0.3 +version: 0.4 jobs: build: working_directory: ~/autoparse-json diff --git a/gradle.properties b/gradle.properties index f07644c..7cbf50b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=0.3 +VERSION_NAME=0.4 GROUP=com.workday POM_PACKAGING=jar @@ -16,4 +16,4 @@ POM_DEVELOPER_NAME=Nathan Taylor POM_DESCRIPTION=A java library built specifically for Android that uses code generation to parse JSON into custom objects in your project. -android.useAndroidX=true \ No newline at end of file +android.useAndroidX=true