Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,5 @@ subprojects {
}

task wrapper(type: Wrapper) {
gradleVersion = '2.9'
gradleVersion = '4.8.1'
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sat Nov 28 17:57:26 CST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip
72 changes: 42 additions & 30 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.Map;
import java.util.TreeMap;

import javax.lang.model.element.Element;
import javax.lang.model.element.TypeParameterElement;

public class JsonObjectHolder {
Expand All @@ -23,6 +24,7 @@ public class JsonObjectHolder {
public final TypeName parentTypeName;
public final List<? extends TypeParameterElement> parentTypeParameters;
public final List<String> parentUsedTypeParameters;
public final Element enclosingElement;
public final FieldDetectionPolicy fieldDetectionPolicy;
public final FieldNamingPolicy fieldNamingPolicy;
public final boolean serializeNullObjects;
Expand Down Expand Up @@ -64,6 +66,7 @@ private JsonObjectHolder(JsonObjectHolderBuilder builder) {
parentTypeName = builder.parentTypeName;
parentTypeParameters = builder.parentTypeParameters;
parentUsedTypeParameters = builder.parentUsedTypeParameters;
enclosingElement = builder.enclosingElement;
fieldDetectionPolicy = builder.fieldDetectionPolicy;
fieldNamingPolicy = builder.fieldNamingPolicy;
serializeNullObjects = builder.serializeNullObjects;
Expand All @@ -79,6 +82,7 @@ public static class JsonObjectHolderBuilder {
private TypeName parentTypeName;
private List<? extends TypeParameterElement> parentTypeParameters;
private List<String> parentUsedTypeParameters;
private Element enclosingElement;
private FieldDetectionPolicy fieldDetectionPolicy;
private FieldNamingPolicy fieldNamingPolicy;
private boolean serializeNullObjects;
Expand Down Expand Up @@ -120,6 +124,11 @@ public JsonObjectHolderBuilder setParentUsedTypeParameters(List<String> parentUs
return this;
}

public JsonObjectHolderBuilder setEnclosingElement(Element enclosingElement) {
this.enclosingElement = enclosingElement;
return this;
}

public JsonObjectHolderBuilder setFieldDetectionPolicy(FieldDetectionPolicy fieldDetectionPolicy) {
this.fieldDetectionPolicy = fieldDetectionPolicy;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public String getJavaClassFile() {
private TypeSpec getTypeSpec() {
TypeSpec.Builder builder = TypeSpec.classBuilder(mJsonObjectHolder.injectedClassName).addModifiers(Modifier.PUBLIC, Modifier.FINAL);

builder.addOriginatingElement(mJsonObjectHolder.enclosingElement);

builder.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class).addMember("value", "\"unsafe,unchecked\"").build());

builder.superclass(ParameterizedTypeName.get(ClassName.get(JsonMapper.class), mJsonObjectHolder.objectTypeName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ private void processJsonObjectAnnotation(Element element, Map<String, JsonObject
List<? extends TypeParameterElement> parentTypeParameters = new ArrayList<>();
List<String> parentUsedTypeParameters = new ArrayList<>();
TypeName parentClassName = null;
Element enclosingElement = element.getEnclosingElement();

TypeMirror superclass = typeElement.getSuperclass();
if (superclass.getKind() != TypeKind.NONE) {
Expand Down Expand Up @@ -116,6 +117,7 @@ private void processJsonObjectAnnotation(Element element, Map<String, JsonObject
.setParentTypeName(parentClassName)
.setParentTypeParameters(parentTypeParameters)
.setParentUsedTypeParameters(parentUsedTypeParameters)
.setEnclosingElement(enclosingElement)
.setFieldDetectionPolicy(annotation.fieldDetectionPolicy())
.setFieldNamingPolicy(annotation.fieldNamingPolicy())
.setSerializeNullObjects(annotation.serializeNullObjects())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.bluelinelabs.logansquare.processor.JsonAnnotationProcessor,aggregating