Skip to content

Commit 9895e44

Browse files
committed
Polishing
1 parent 643a68f commit 9895e44

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

spring-core/src/main/java/org/springframework/util/MimeTypeUtils.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,7 +31,6 @@
3131
import java.util.stream.Collectors;
3232

3333
import org.springframework.lang.Nullable;
34-
import org.springframework.util.MimeType.SpecificityComparator;
3534

3635
/**
3736
* Miscellaneous {@link MimeType} utility methods.
@@ -52,7 +51,7 @@ public abstract class MimeTypeUtils {
5251
/**
5352
* Comparator used by {@link #sortBySpecificity(List)}.
5453
*/
55-
public static final Comparator<MimeType> SPECIFICITY_COMPARATOR = new SpecificityComparator<>();
54+
public static final Comparator<MimeType> SPECIFICITY_COMPARATOR = new MimeType.SpecificityComparator<>();
5655

5756
/**
5857
* Public constant mime type that includes all media ranges (i.e. "&#42;/&#42;").
@@ -154,10 +153,10 @@ public abstract class MimeTypeUtils {
154153
*/
155154
public static final String TEXT_XML_VALUE = "text/xml";
156155

156+
157157
@Nullable
158158
private static volatile Random random;
159159

160-
161160
static {
162161
ALL = MimeType.valueOf(ALL_VALUE);
163162
APPLICATION_JSON = MimeType.valueOf(APPLICATION_JSON_VALUE);
@@ -263,6 +262,7 @@ public static List<MimeType> parseMimeTypes(String mimeTypes) {
263262
.map(MimeTypeUtils::parseMimeType).collect(Collectors.toList());
264263
}
265264

265+
266266
/**
267267
* Tokenize the given comma-separated string of {@code MimeType} objects
268268
* into a {@code List<String>}. Unlike simple tokenization by ",", this
@@ -318,7 +318,6 @@ public static String toString(Collection<? extends MimeType> mimeTypes) {
318318
return builder.toString();
319319
}
320320

321-
322321
/**
323322
* Sorts the given list of {@code MimeType} objects by specificity.
324323
* <p>Given two mime types:

spring-expression/src/main/java/org/springframework/expression/spel/ast/InlineMap.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ public InlineMap(int pos, SpelNodeImpl... args) {
4747

4848

4949
/**
50-
* If all the components of the list are constants, or lists/maps that themselves
50+
* If all the components of the map are constants, or lists/maps that themselves
5151
* contain constants, then a constant list can be built to represent this node.
5252
* This will speed up later getValue calls and reduce the amount of garbage created.
5353
*/
@@ -70,14 +70,14 @@ else if (child instanceof InlineMap) {
7070
break;
7171
}
7272
}
73-
else if (!((c%2)==0 && (child instanceof PropertyOrFieldReference))) {
73+
else if (!(c % 2 == 0 && child instanceof PropertyOrFieldReference)) {
7474
isConstant = false;
7575
break;
7676
}
7777
}
7878
}
7979
if (isConstant) {
80-
Map<Object,Object> constantMap = new LinkedHashMap<>();
80+
Map<Object, Object> constantMap = new LinkedHashMap<>();
8181
int childCount = getChildCount();
8282
for (int c = 0; c < childCount; c++) {
8383
SpelNode keyChild = getChild(c++);
@@ -159,9 +159,9 @@ public boolean isConstant() {
159159

160160
@SuppressWarnings("unchecked")
161161
@Nullable
162-
public Map<Object,Object> getConstantValue() {
162+
public Map<Object, Object> getConstantValue() {
163163
Assert.state(this.constant != null, "No constant");
164-
return (Map<Object,Object>) this.constant.getValue();
164+
return (Map<Object, Object>) this.constant.getValue();
165165
}
166166

167167
}

spring-expression/src/main/java/org/springframework/expression/spel/ast/ValueRef.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,8 +24,8 @@
2424
/**
2525
* Represents a reference to a value. With a reference it is possible to get or set the
2626
* value. Passing around value references rather than the values themselves can avoid
27-
* incorrect duplication of operand evaluation. For example in 'list[index++]++' without a
28-
* value reference for 'list[index++]' it would be necessary to evaluate list[index++]
27+
* incorrect duplication of operand evaluation. For example in 'list[index++]++' without
28+
* a value reference for 'list[index++]' it would be necessary to evaluate list[index++]
2929
* twice (once to get the value, once to determine where the value goes) and that would
3030
* double increment index.
3131
*
@@ -103,7 +103,8 @@ public TypedValue getValue() {
103103

104104
@Override
105105
public void setValue(@Nullable Object newValue) {
106-
throw new SpelEvaluationException(this.node.pos, SpelMessage.NOT_ASSIGNABLE, this.node.toStringAST());
106+
throw new SpelEvaluationException(
107+
this.node.getStartPosition(), SpelMessage.NOT_ASSIGNABLE, this.node.toStringAST());
107108
}
108109

109110
@Override

0 commit comments

Comments
 (0)