Browse Source

Polishing

pull/26558/head
Juergen Hoeller 5 years ago
parent
commit
9f1e822f3e
  1. 4
      settings.gradle
  2. 6
      spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java
  3. 6
      spring-context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java
  4. 9
      spring-context/src/test/java/org/springframework/context/annotation/EnableLoadTimeWeavingTests.java

4
settings.gradle

@ -10,8 +10,8 @@ include "spring-aop"
include "spring-aspects" include "spring-aspects"
include "spring-beans" include "spring-beans"
include "spring-context" include "spring-context"
include "spring-context-support"
include "spring-context-indexer" include "spring-context-indexer"
include "spring-context-support"
include "spring-core" include "spring-core"
include "kotlin-coroutines" include "kotlin-coroutines"
project(':kotlin-coroutines').projectDir = file('spring-core/kotlin-coroutines') project(':kotlin-coroutines').projectDir = file('spring-core/kotlin-coroutines')
@ -26,8 +26,8 @@ include "spring-oxm"
include "spring-test" include "spring-test"
include "spring-tx" include "spring-tx"
include "spring-web" include "spring-web"
include "spring-webmvc"
include "spring-webflux" include "spring-webflux"
include "spring-webmvc"
include "spring-websocket" include "spring-websocket"
include "framework-bom" include "framework-bom"
include "integration-tests" include "integration-tests"

6
spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -41,10 +41,10 @@ public class TypeMismatchException extends PropertyAccessException {
private String propertyName; private String propertyName;
@Nullable @Nullable
private transient Object value; private final transient Object value;
@Nullable @Nullable
private Class<?> requiredType; private final Class<?> requiredType;
/** /**

6
spring-context/src/main/java/org/springframework/validation/beanvalidation/SpringValidatorAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -179,7 +179,7 @@ public class SpringValidatorAdapter implements SmartValidator, javax.validation.
} }
} }
else { else {
// got no BindingResult - can only do standard rejectValue call // Got no BindingResult - can only do standard rejectValue call
// with automatic extraction of the current field value // with automatic extraction of the current field value
errors.rejectValue(field, errorCode, errorArgs, violation.getMessage()); errors.rejectValue(field, errorCode, errorArgs, violation.getMessage());
} }
@ -386,7 +386,7 @@ public class SpringValidatorAdapter implements SmartValidator, javax.validation.
return (type != null ? this.targetValidator.unwrap(type) : (T) this.targetValidator); return (type != null ? this.targetValidator.unwrap(type) : (T) this.targetValidator);
} }
catch (ValidationException ex) { catch (ValidationException ex) {
// ignore if just being asked for plain Validator // Ignore if just being asked for plain JSR-303 Validator
if (javax.validation.Validator.class == type) { if (javax.validation.Validator.class == type) {
return (T) this.targetValidator; return (T) this.targetValidator;
} }

9
spring-context/src/test/java/org/springframework/context/annotation/EnableLoadTimeWeavingTests.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -40,7 +40,7 @@ public class EnableLoadTimeWeavingTests {
@Test @Test
public void control() { public void control() {
GenericXmlApplicationContext ctx = GenericXmlApplicationContext ctx =
new GenericXmlApplicationContext(getClass(), "EnableLoadTimeWeavingTests-context.xml"); new GenericXmlApplicationContext(getClass(), "EnableLoadTimeWeavingTests-context.xml");
ctx.getBean("loadTimeWeaver", LoadTimeWeaver.class); ctx.getBean("loadTimeWeaver", LoadTimeWeaver.class);
} }
@ -73,9 +73,11 @@ public class EnableLoadTimeWeavingTests {
verify(loadTimeWeaver).addTransformer(isA(ClassFileTransformer.class)); verify(loadTimeWeaver).addTransformer(isA(ClassFileTransformer.class));
} }
@Configuration @Configuration
@EnableLoadTimeWeaving(aspectjWeaving=AspectJWeaving.DISABLED) @EnableLoadTimeWeaving(aspectjWeaving=AspectJWeaving.DISABLED)
static class EnableLTWConfig_withAjWeavingDisabled implements LoadTimeWeavingConfigurer { static class EnableLTWConfig_withAjWeavingDisabled implements LoadTimeWeavingConfigurer {
@Override @Override
public LoadTimeWeaver getLoadTimeWeaver() { public LoadTimeWeaver getLoadTimeWeaver() {
return mock(LoadTimeWeaver.class); return mock(LoadTimeWeaver.class);
@ -85,6 +87,7 @@ public class EnableLoadTimeWeavingTests {
@Configuration @Configuration
@EnableLoadTimeWeaving(aspectjWeaving=AspectJWeaving.AUTODETECT) @EnableLoadTimeWeaving(aspectjWeaving=AspectJWeaving.AUTODETECT)
static class EnableLTWConfig_withAjWeavingAutodetect implements LoadTimeWeavingConfigurer { static class EnableLTWConfig_withAjWeavingAutodetect implements LoadTimeWeavingConfigurer {
@Override @Override
public LoadTimeWeaver getLoadTimeWeaver() { public LoadTimeWeaver getLoadTimeWeaver() {
return mock(LoadTimeWeaver.class); return mock(LoadTimeWeaver.class);
@ -94,9 +97,11 @@ public class EnableLoadTimeWeavingTests {
@Configuration @Configuration
@EnableLoadTimeWeaving(aspectjWeaving=AspectJWeaving.ENABLED) @EnableLoadTimeWeaving(aspectjWeaving=AspectJWeaving.ENABLED)
static class EnableLTWConfig_withAjWeavingEnabled implements LoadTimeWeavingConfigurer { static class EnableLTWConfig_withAjWeavingEnabled implements LoadTimeWeavingConfigurer {
@Override @Override
public LoadTimeWeaver getLoadTimeWeaver() { public LoadTimeWeaver getLoadTimeWeaver() {
return mock(LoadTimeWeaver.class); return mock(LoadTimeWeaver.class);
} }
} }
} }

Loading…
Cancel
Save