Commit 6d93573d authored by Phillip Webb's avatar Phillip Webb

Merge branch '1.5.x'

parents ba6be4f2 8e783cda
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -75,7 +75,8 @@ class DuplicateJsonObjectContextCustomizerFactory implements ContextCustomizerFa
}
private void logDuplicateJsonObjectsWarning(List<URL> jsonObjects) {
StringBuilder message = new StringBuilder(String.format("%n%nFound multiple occurrences of"
StringBuilder message = new StringBuilder(
String.format("%n%nFound multiple occurrences of"
+ " org.json.JSONObject on the class path:%n%n"));
for (URL jsonObject : jsonObjects) {
message.append(String.format("\t%s%n", jsonObject));
......
......@@ -19,7 +19,6 @@ package org.springframework.boot.configurationprocessor;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -188,14 +187,14 @@ class TypeUtils {
return getQualifiedName(enclosingElement) + "$"
+ type.asElement().getSimpleName().toString();
}
StringBuilder sb = new StringBuilder();
sb.append(getQualifiedName(type.asElement()));
StringBuilder name = new StringBuilder();
name.append(getQualifiedName(type.asElement()));
if (!type.getTypeArguments().isEmpty()) {
List<String> parameters = type.getTypeArguments().stream()
.map(TypeMirror::toString).collect(Collectors.toList());
sb.append("<").append(String.join(",", parameters)).append(">");
name.append(
"<" + type.getTypeArguments().stream().map(TypeMirror::toString)
.collect(Collectors.joining(",")) + ">");
}
return sb.toString();
return name.toString();
}
@Override
......
......@@ -277,12 +277,12 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test
public void parseArrayConfig() throws Exception {
ConfigurationMetadata metadata = compile(SimpleArrayProperties.class);
assertThat(metadata).has(Metadata.withGroup("array")
.ofType(SimpleArrayProperties.class));
assertThat(metadata).has(Metadata.withProperty("array.primitive",
"java.lang.Integer[]"));
assertThat(metadata).has(Metadata.withProperty("array.simple",
"java.lang.String[]"));
assertThat(metadata)
.has(Metadata.withGroup("array").ofType(SimpleArrayProperties.class));
assertThat(metadata)
.has(Metadata.withProperty("array.primitive", "java.lang.Integer[]"));
assertThat(metadata)
.has(Metadata.withProperty("array.simple", "java.lang.String[]"));
assertThat(metadata).has(Metadata.withProperty("array.inner",
"org.springframework.boot.configurationsample.simple.SimpleArrayProperties$Holder[]"));
assertThat(metadata).has(Metadata.withProperty("array.name-to-integer",
......@@ -503,8 +503,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test
public void wildcardTypes() throws IOException {
ConfigurationMetadata metadata = compile(WildcardConfig.class);
assertThat(metadata).has(Metadata.withGroup("wildcard")
.ofType(WildcardConfig.class));
assertThat(metadata)
.has(Metadata.withGroup("wildcard").ofType(WildcardConfig.class));
assertThat(metadata).has(Metadata.withProperty("wildcard.string-to-number")
.ofType("java.util.Map<java.lang.String,? extends java.lang.Number>")
.fromSource(WildcardConfig.class));
......
......@@ -89,6 +89,7 @@ public class SimpleCollectionProperties {
public static class Holder<T> {
@SuppressWarnings("unused")
private T target;
public void setTarget(T target) {
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
......@@ -27,7 +26,6 @@
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
......
......@@ -44,8 +44,8 @@ public class ConfigurationProcessorIntegrationTests {
"META-INF/spring-configuration-metadata.json");
assertThat(resource.exists()).isTrue();
// Make sure the right file is detected
assertThat(resource.getURL().toString()).contains(
"spring-boot-configuration-processor-tests");
assertThat(resource.getURL().toString())
.contains("spring-boot-configuration-processor-tests");
repository = ConfigurationMetadataRepositoryJsonBuilder
.create(resource.getInputStream()).build();
......@@ -53,8 +53,8 @@ public class ConfigurationProcessorIntegrationTests {
@Test
public void extractTypeFromAnnotatedGetter() {
ConfigurationMetadataProperty property = repository.getAllProperties().get(
"annotated.name");
ConfigurationMetadataProperty property = repository.getAllProperties()
.get("annotated.name");
assertThat(property).isNotNull();
assertThat(property.getType()).isEqualTo("java.lang.String");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment