From cbd19153c48b8570a2b46e052e549d82ea316a53 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 22 Feb 2017 16:53:54 +0100 Subject: [PATCH] Polishing --- .../context/annotation/Spr15275Tests.java | 2 +- .../org/springframework/util/StringUtils.java | 26 +++++++++---------- .../core/annotation/AnnotationUtilsTests.java | 3 +-- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/spring-context/src/test/java/org/springframework/context/annotation/Spr15275Tests.java b/spring-context/src/test/java/org/springframework/context/annotation/Spr15275Tests.java index a15c79df00f..28336041cb1 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/Spr15275Tests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/Spr15275Tests.java @@ -216,7 +216,7 @@ public class Spr15275Tests { public Class getObjectType() { return FooInterface.class; } - }; + } protected interface FooInterface { diff --git a/spring-core/src/main/java/org/springframework/util/StringUtils.java b/spring-core/src/main/java/org/springframework/util/StringUtils.java index 60384861a02..b6eb57cac19 100644 --- a/spring-core/src/main/java/org/springframework/util/StringUtils.java +++ b/spring-core/src/main/java/org/springframework/util/StringUtils.java @@ -518,22 +518,20 @@ public abstract class StringUtils { if (!hasLength(str)) { return str; } + char baseChar = str.charAt(0); + char updatedChar; + if (capitalize) { + updatedChar = Character.toUpperCase(baseChar); + } else { - char baseChar = str.charAt(0); - char updatedChar; - if (capitalize) { - updatedChar = Character.toUpperCase(baseChar); - } - else { - updatedChar = Character.toLowerCase(baseChar); - } - if (baseChar == updatedChar) { - return str; - } - char[] chars = str.toCharArray(); - chars[0] = updatedChar; - return new String(chars, 0, chars.length); + updatedChar = Character.toLowerCase(baseChar); + } + if (baseChar == updatedChar) { + return str; } + char[] chars = str.toCharArray(); + chars[0] = updatedChar; + return new String(chars, 0, chars.length); } /** diff --git a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java index 07cd1f103b1..e127215c15a 100644 --- a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-20167the original author or authors. + * Copyright 2002-2017 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. @@ -1985,7 +1985,6 @@ public class AnnotationUtilsTests { static class GroupOfCharsClass { } - @Retention(RetentionPolicy.RUNTIME) @interface AliasForWithMissingAttributeDeclaration {