diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java index a5a31c203f..a7424a1ecb 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java @@ -196,6 +196,20 @@ class ConfigurationClassParser { processConfigurationClass(new ConfigurationClass(metadata, beanName)); } + /** + * Validate each {@link ConfigurationClass} object. + * @see ConfigurationClass#validate + */ + public void validate() { + for (ConfigurationClass configClass : this.configurationClasses.keySet()) { + configClass.validate(this.problemReporter); + } + } + + public Set getConfigurationClasses() { + return this.configurationClasses.keySet(); + } + protected void processConfigurationClass(ConfigurationClass configClass) throws IOException { if (this.conditionEvaluator.shouldSkip(configClass.getMetadata(), ConfigurationPhase.PARSE_CONFIGURATION)) { @@ -389,6 +403,7 @@ class ConfigurationClassParser { return beanMethods; } + /** * Process the given @PropertySource annotation metadata. * @param propertySource metadata for the @PropertySource annotation found @@ -464,6 +479,7 @@ class ConfigurationClassParser { this.propertySourceNames.add(name); } + /** * Returns {@code @Import} class, considering all meta-annotations. */ @@ -596,30 +612,15 @@ class ConfigurationClassParser { return false; } - - /** - * Validate each {@link ConfigurationClass} object. - * @see ConfigurationClass#validate - */ - public void validate() { - for (ConfigurationClass configClass : this.configurationClasses.keySet()) { - configClass.validate(this.problemReporter); - } - } - - public Set getConfigurationClasses() { - return this.configurationClasses.keySet(); - } - - ImportRegistry getImportRegistry() { return this.importStack; } + /** * Factory method to obtain a {@link SourceClass} from a {@link ConfigurationClass}. */ - public SourceClass asSourceClass(ConfigurationClass configurationClass) throws IOException { + private SourceClass asSourceClass(ConfigurationClass configurationClass) throws IOException { AnnotationMetadata metadata = configurationClass.getMetadata(); if (metadata instanceof StandardAnnotationMetadata) { return asSourceClass(((StandardAnnotationMetadata) metadata).getIntrospectedClass()); @@ -630,7 +631,7 @@ class ConfigurationClassParser { /** * Factory method to obtain a {@link SourceClass} from a {@link Class}. */ - public SourceClass asSourceClass(Class classType) throws IOException { + SourceClass asSourceClass(Class classType) throws IOException { try { // Sanity test that we can read annotations, if not fall back to ASM classType.getAnnotations(); @@ -645,8 +646,8 @@ class ConfigurationClassParser { /** * Factory method to obtain {@link SourceClass}s from class names. */ - public Collection asSourceClasses(String[] classNames) throws IOException { - List annotatedClasses = new ArrayList<>(); + private Collection asSourceClasses(String[] classNames) throws IOException { + List annotatedClasses = new ArrayList<>(classNames.length); for (String className : classNames) { annotatedClasses.add(asSourceClass(className)); } @@ -656,7 +657,7 @@ class ConfigurationClassParser { /** * Factory method to obtain a {@link SourceClass} from a class name. */ - public SourceClass asSourceClass(String className) throws IOException { + SourceClass asSourceClass(String className) throws IOException { if (className.startsWith("java")) { // Never use ASM for core java types try { diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java index 2593799c5b..f64f8fa07f 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the 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. @@ -172,7 +172,7 @@ public class AnnotatedElementUtils { */ public static Set getMetaAnnotationTypes(AnnotatedElement element, String annotationName) { Assert.notNull(element, "AnnotatedElement must not be null"); - Assert.hasLength(annotationName, "annotationName must not be null or empty"); + Assert.hasLength(annotationName, "'annotationName' must not be null or empty"); return getMetaAnnotationTypes(element, AnnotationUtils.getAnnotation(element, annotationName)); } @@ -232,7 +232,7 @@ public class AnnotatedElementUtils { */ public static boolean hasMetaAnnotationTypes(AnnotatedElement element, String annotationName) { Assert.notNull(element, "AnnotatedElement must not be null"); - Assert.hasLength(annotationName, "annotationName must not be null or empty"); + Assert.hasLength(annotationName, "'annotationName' must not be null or empty"); return hasMetaAnnotationTypes(element, null, annotationName); } @@ -290,7 +290,7 @@ public class AnnotatedElementUtils { */ public static boolean isAnnotated(AnnotatedElement element, String annotationName) { Assert.notNull(element, "AnnotatedElement must not be null"); - Assert.hasLength(annotationName, "annotationName must not be null or empty"); + Assert.hasLength(annotationName, "'annotationName' must not be null or empty"); return Boolean.TRUE.equals(searchWithGetSemantics(element, null, annotationName, alwaysTrueAnnotationProcessor)); } @@ -373,7 +373,7 @@ public class AnnotatedElementUtils { public static AnnotationAttributes getMergedAnnotationAttributes(AnnotatedElement element, String annotationName, boolean classValuesAsString, boolean nestedAnnotationsAsMap) { - Assert.hasLength(annotationName, "annotationName must not be null or empty"); + Assert.hasLength(annotationName, "'annotationName' must not be null or empty"); AnnotationAttributes attributes = searchWithGetSemantics(element, null, annotationName, new MergedAnnotationAttributesProcessor(classValuesAsString, nestedAnnotationsAsMap)); AnnotationUtils.postProcessAnnotationAttributes(element, attributes, classValuesAsString, nestedAnnotationsAsMap); diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/ResponseStatus.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/ResponseStatus.java index 8843eb1266..148a354d32 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/ResponseStatus.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/ResponseStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the 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. @@ -50,9 +50,9 @@ import org.springframework.http.HttpStatus; * * @author Arjen Poutsma * @author Sam Brannen + * @since 3.0 * @see org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver * @see javax.servlet.http.HttpServletResponse#sendError(int, String) - * @since 3.0 */ @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME)