Code formatting
This commit is contained in:
@@ -18,12 +18,12 @@
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- Runs in the compiler so dependencies should stick to the bare minimum -->
|
||||
<!-- Compile (should stick to the bare minimum) -->
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
||||
@@ -207,8 +207,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
|
||||
|
||||
private void processLombokTypes(String prefix, TypeElement element,
|
||||
TypeElementMembers members, Map<String, Object> fieldValues) {
|
||||
for (Map.Entry<String, VariableElement> entry : members.getFields()
|
||||
.entrySet()) {
|
||||
for (Map.Entry<String, VariableElement> entry : members.getFields().entrySet()) {
|
||||
String name = entry.getKey();
|
||||
VariableElement field = entry.getValue();
|
||||
if (!isLombokField(field, element)) {
|
||||
@@ -241,10 +240,10 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
|
||||
}
|
||||
|
||||
private boolean hasLombokSetter(VariableElement field, TypeElement element) {
|
||||
return !field.getModifiers().contains(Modifier.FINAL) && (
|
||||
hasAnnotation(field, LOMBOK_SETTER_ANNOTATION)
|
||||
|| hasAnnotation(element, LOMBOK_SETTER_ANNOTATION)
|
||||
|| hasAnnotation(element, LOMBOK_DATA_ANNOTATION));
|
||||
return !field.getModifiers().contains(Modifier.FINAL)
|
||||
&& (hasAnnotation(field, LOMBOK_SETTER_ANNOTATION)
|
||||
|| hasAnnotation(element, LOMBOK_SETTER_ANNOTATION) || hasAnnotation(
|
||||
element, LOMBOK_DATA_ANNOTATION));
|
||||
}
|
||||
|
||||
private void processNestedTypes(String prefix, TypeElement element,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.boot.configurationprocessor;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.annotation.processing.SupportedAnnotationTypes;
|
||||
import javax.annotation.processing.SupportedSourceVersion;
|
||||
import javax.lang.model.SourceVersion;
|
||||
@@ -24,10 +25,9 @@ import javax.lang.model.SourceVersion;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationsample.lombok.LombokSimpleDataProperties;
|
||||
import org.springframework.boot.configurationsample.lombok.LombokExplicitProperties;
|
||||
import org.springframework.boot.configurationsample.lombok.LombokSimpleDataProperties;
|
||||
import org.springframework.boot.configurationsample.lombok.LombokSimpleProperties;
|
||||
import org.springframework.boot.configurationsample.method.EmptyTypeMethodConfig;
|
||||
import org.springframework.boot.configurationsample.method.InvalidMethodConfig;
|
||||
@@ -307,20 +307,17 @@ public class ConfigurationMetadataAnnotationProcessorTests {
|
||||
assertSimpleLombokProperties(metadata, LombokExplicitProperties.class, "explicit");
|
||||
}
|
||||
|
||||
private void assertSimpleLombokProperties(ConfigurationMetadata metadata, Class<?> source, String prefix) {
|
||||
private void assertSimpleLombokProperties(ConfigurationMetadata metadata,
|
||||
Class<?> source, String prefix) {
|
||||
assertThat(metadata, containsGroup(prefix).fromSource(source));
|
||||
assertThat(metadata, not(containsProperty(prefix + ".id")));
|
||||
assertThat(
|
||||
metadata,
|
||||
containsProperty(prefix + ".name", String.class)
|
||||
.fromSource(source)
|
||||
assertThat(metadata,
|
||||
containsProperty(prefix + ".name", String.class).fromSource(source)
|
||||
.withDescription("Name description."));
|
||||
assertThat(metadata, containsProperty(prefix + ".description"));
|
||||
assertThat(metadata, containsProperty(prefix + ".counter"));
|
||||
assertThat(metadata,
|
||||
containsProperty(prefix + ".number").fromSource(source)
|
||||
.withDefaultValue(is(0))
|
||||
.withDeprecated());
|
||||
assertThat(metadata, containsProperty(prefix + ".number").fromSource(source)
|
||||
.withDefaultValue(is(0)).withDeprecated());
|
||||
assertThat(metadata, containsProperty(prefix + ".items"));
|
||||
assertThat(metadata, not(containsProperty(prefix + ".ignored")));
|
||||
}
|
||||
@@ -331,7 +328,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
|
||||
return processor.getMetadata();
|
||||
}
|
||||
|
||||
@SupportedAnnotationTypes({"*"})
|
||||
@SupportedAnnotationTypes({ "*" })
|
||||
@SupportedSourceVersion(SourceVersion.RELEASE_6)
|
||||
private static class TestConfigurationMetadataAnnotationProcessor extends
|
||||
ConfigurationMetadataAnnotationProcessor {
|
||||
|
||||
@@ -38,22 +38,28 @@ public class LombokExplicitProperties {
|
||||
/**
|
||||
* Name description.
|
||||
*/
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@Setter
|
||||
private String name;
|
||||
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@Setter
|
||||
private String description;
|
||||
|
||||
@Getter @Setter
|
||||
@Getter
|
||||
@Setter
|
||||
private Integer counter;
|
||||
|
||||
@Deprecated @Getter @Setter
|
||||
@Deprecated
|
||||
@Getter
|
||||
@Setter
|
||||
private Integer number = 0;
|
||||
|
||||
@Getter
|
||||
private final List<String> items = new ArrayList<String>();
|
||||
|
||||
// Should be ignored if no annotation is set
|
||||
@SuppressWarnings("unused")
|
||||
private String ignored;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user