From fdd6a89a61a0ae2b144dda7c66d8a71db69b42ee Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 6 Aug 2020 10:13:51 -0700 Subject: [PATCH] Polish --- .../releasescripts/command/DistributeProperties.java | 2 +- .../boot/test/mock/mockito/DefinitionsParser.java | 8 ++------ .../classpath/ModifiedClassPathClassLoader.java | 7 +++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/command/DistributeProperties.java b/ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/command/DistributeProperties.java index 6e56b0763a7..d93737e7496 100644 --- a/ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/command/DistributeProperties.java +++ b/ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/command/DistributeProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2020 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. diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java index a9622acb6ad..dd6591932a7 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java @@ -116,12 +116,8 @@ class DefinitionsParser { } if (types.isEmpty() && element instanceof Field) { Field field = (Field) element; - if (field.getGenericType() instanceof TypeVariable) { - types.add(ResolvableType.forField(field, source)); - } - else { - types.add(ResolvableType.forField(field)); - } + types.add((field.getGenericType() instanceof TypeVariable) ? ResolvableType.forField(field, source) + : ResolvableType.forField(field)); } return types; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/classpath/ModifiedClassPathClassLoader.java b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/classpath/ModifiedClassPathClassLoader.java index 5c1b2faf5e3..b54ee4133f9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/classpath/ModifiedClassPathClassLoader.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/classpath/ModifiedClassPathClassLoader.java @@ -200,12 +200,11 @@ final class ModifiedClassPathClassLoader extends URLClassLoader { RepositorySystem repositorySystem = serviceLocator.getService(RepositorySystem.class); DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); LocalRepository localRepository = new LocalRepository(System.getProperty("user.home") + "/.m2/repository"); + RemoteRepository remoteRepository = new RemoteRepository.Builder("central", "default", + "https://repo.maven.apache.org/maven2").build(); session.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(session, localRepository)); for (int i = 0; i < MAX_RESOLUTION_ATTEMPTS; i++) { - CollectRequest collectRequest = new CollectRequest(null, - Arrays.asList( - new RemoteRepository.Builder("central", "default", "https://repo.maven.apache.org/maven2") - .build())); + CollectRequest collectRequest = new CollectRequest(null, Arrays.asList(remoteRepository)); collectRequest.setDependencies(createDependencies(coordinates)); DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, null); try {