diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AbstractConfigurationClassProcessor.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AbstractConfigurationClassProcessor.java index 95bef486f06..0d9c08c0bee 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AbstractConfigurationClassProcessor.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AbstractConfigurationClassProcessor.java @@ -43,7 +43,7 @@ import org.springframework.config.java.Configuration; * @see ConfigurationClassPostProcessor */ public abstract class AbstractConfigurationClassProcessor { - + /** * Used to register any problems detected with {@link Configuration} or {@link Bean} * declarations. For instance, a Bean method marked as {@literal final} is illegal @@ -62,7 +62,7 @@ public abstract class AbstractConfigurationClassProcessor { * @see #processConfigBeanDefinitions() */ protected abstract BeanDefinitionRegistry getConfigurationBeanDefinitions(boolean includeAbstractBeanDefs); - + /** * Create and return a new {@link ConfigurationParser}, allowing for customization of * type (ASM/JDT/Reflection) as well as providing specialized ClassLoader during @@ -70,7 +70,7 @@ public abstract class AbstractConfigurationClassProcessor { * @see #processConfigBeanDefinitions() */ protected abstract ConfigurationParser createConfigurationParser(); - + /** * Validate the given model and handle any errors. Implementations may choose to throw * {@link BeanDefinitionParsingException}, or in the case of tooling register problems @@ -78,7 +78,7 @@ public abstract class AbstractConfigurationClassProcessor { * @param configModel {@link ConfigurationModel} to validate */ protected abstract void validateModel(ConfigurationModel configModel); - + /** * Override the default {@link ProblemReporter}. * @param problemReporter custom problem reporter @@ -86,14 +86,14 @@ public abstract class AbstractConfigurationClassProcessor { protected final void setProblemReporter(ProblemReporter problemReporter) { this.problemReporter = problemReporter; } - + /** * Get the currently registered {@link ProblemReporter}. */ protected final ProblemReporter getProblemReporter() { return problemReporter; } - + /** * Build and validate a {@link ConfigurationModel} based on the registry of * {@link Configuration} classes provided by {@link #getConfigurationBeanDefinitions}, @@ -105,28 +105,28 @@ public abstract class AbstractConfigurationClassProcessor { */ protected final BeanDefinitionRegistry processConfigBeanDefinitions() { BeanDefinitionRegistry configBeanDefs = getConfigurationBeanDefinitions(false); - + // return an empty registry immediately if no @Configuration classes were found if(configBeanDefs.getBeanDefinitionCount() == 0) return configBeanDefs; - + // populate a new ConfigurationModel by parsing each @Configuration classes ConfigurationParser parser = createConfigurationParser(); - - for(String beanName : configBeanDefs.getBeanDefinitionNames()) { - BeanDefinition beanDef = configBeanDefs.getBeanDefinition(beanName); - String className = beanDef.getBeanClassName(); - - parser.parse(className, beanName); - } - + + for(String beanName : configBeanDefs.getBeanDefinitionNames()) { + BeanDefinition beanDef = configBeanDefs.getBeanDefinition(beanName); + String className = beanDef.getBeanClassName(); + + parser.parse(className, beanName); + } + ConfigurationModel configModel = parser.getConfigurationModel(); - + // validate the ConfigurationModel validateModel(configModel); - + // read the model and create bean definitions based on its content - return new ConfigurationModelBeanDefinitionReader().loadBeanDefinitions(configModel); - } + return new ConfigurationModelBeanDefinitionReader().loadBeanDefinitions(configModel); + } } diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AddAnnotationAdapter.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AddAnnotationAdapter.java index 7e5a9c7ef38..bea701f5b11 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AddAnnotationAdapter.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AddAnnotationAdapter.java @@ -53,8 +53,8 @@ class AddAnnotationAdapter extends ClassAdapter { * Ensures that the version of the resulting class is Java 5 or better. */ @Override - public void visit(int version, int access, String name, String signature, String superName, - String[] interfaces) { + public void visit(int version, int access, String name, String signature, + String superName, String[] interfaces) { int v = (version & 0xFF) < Constants.V1_5 ? Constants.V1_5 : version; cv.visit(v, access, name, signature, superName, interfaces); } @@ -83,8 +83,7 @@ class AddAnnotationAdapter extends ClassAdapter { } @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, - String[] exceptions) { + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { addAnnotation(); return cv.visitMethod(access, name, desc, signature, exceptions); } diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AnnotationAdapter.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AnnotationAdapter.java index 9dcb38725cc..2722ba9806b 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AnnotationAdapter.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AnnotationAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AsmUtils.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AsmUtils.java index 41e02e6cdc5..e161a5b2665 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AsmUtils.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/AsmUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -109,8 +109,6 @@ class AsmUtils { * * @param bytes byte array that will be provided as input to the new ClassReader * instance. - * - * @return */ public static ClassReader newClassReader(byte[] bytes) { return new ClassReader(bytes); @@ -129,8 +127,7 @@ class AsmUtils { try { return new ClassReader(is); } catch (IOException ex) { - throw new RuntimeException("An unexpected exception occurred while creating ASM ClassReader: " - + ex); + throw new RuntimeException("An unexpected exception occurred while creating ASM ClassReader: " + ex); } finally { try { is.close(); diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanDefinitionRegistrar.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanDefinitionRegistrar.java index 8fbbd11f090..eeef64639f3 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanDefinitionRegistrar.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanDefinitionRegistrar.java @@ -1,3 +1,18 @@ +/* + * Copyright 2002-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.config.java.support; import java.lang.reflect.Method; diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanMethod.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanMethod.java index d2d03e53ad1..5006bdb5d7b 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanMethod.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -140,8 +140,8 @@ final class BeanMethod { @Override public String toString() { String returnTypeName = returnType == null ? "" : returnType.getSimpleName(); - return String.format("%s: name=%s; returnType=%s; modifiers=%d", getClass().getSimpleName(), name, - returnTypeName, modifiers); + return format("%s: name=%s; returnType=%s; modifiers=%d", + getClass().getSimpleName(), name, returnTypeName, modifiers); } @Override @@ -187,24 +187,24 @@ final class BeanMethod { /** {@link Bean} methods must be non-private in order to accommodate CGLIB. */ public class PrivateMethodError extends Problem { public PrivateMethodError() { - super(format("method '%s' may not be private", getName()), new Location(new FileSystemResource("/dev/null"))); + super(format("method '%s' may not be private", getName()), + new Location(new FileSystemResource("/dev/null"))); } } /** {@link Bean} methods must be non-final in order to accommodate CGLIB. */ public class FinalMethodError extends Problem { public FinalMethodError() { - super(format("method '%s' may not be final. remove the final modifier to continue", getName()), new Location(new FileSystemResource("/dev/null"))); + super(format("method '%s' may not be final. remove the final modifier to continue", getName()), + new Location(new FileSystemResource("/dev/null"))); } } - + public class InvalidScopedProxyDeclarationError extends Problem { public InvalidScopedProxyDeclarationError(BeanMethod method) { - super( - String.format("method %s contains an invalid annotation declaration: scoped proxies " - + "cannot be created for singleton/prototype beans", method.getName()), - new Location(new FileSystemResource("/dev/null")) - ); + super(format("method %s contains an invalid annotation declaration: scoped proxies " + + "cannot be created for singleton/prototype beans", method.getName()), + new Location(new FileSystemResource("/dev/null"))); } } diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanMethodInterceptor.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanMethodInterceptor.java index c76cc978e9f..8b8b53c1b8f 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanMethodInterceptor.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanMethodInterceptor.java @@ -59,7 +59,7 @@ class BeanMethodInterceptor implements BeanFactoryAware, MethodInterceptor { * existence of this bean object. */ public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { - + // determine the name of the bean String beanName; // check to see if the user has explicitly set the bean name @@ -83,8 +83,8 @@ class BeanMethodInterceptor implements BeanFactoryAware, MethodInterceptor { // we have an already existing cached instance of this bean -> retrieve it Object cachedBean = beanFactory.getBean(beanName); if (log.isInfoEnabled()) - log.info(format("Returning cached singleton object [%s] for @Bean method %s.%s", cachedBean, - method.getDeclaringClass().getSimpleName(), beanName)); + log.info(format("Returning cached singleton object [%s] for @Bean method %s.%s", + cachedBean, method.getDeclaringClass().getSimpleName(), beanName)); return cachedBean; } diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanRegistrar.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanRegistrar.java index 39756f7a8f8..2ba7af8b64d 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanRegistrar.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/BeanRegistrar.java @@ -1,3 +1,18 @@ +/* + * Copyright 2002-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.config.java.support; import static java.lang.String.*; @@ -24,12 +39,10 @@ import org.springframework.core.annotation.AnnotationUtils; import org.springframework.util.Assert; -// TODO: SJC-242 document BeanHandler -// TODO: SJC-242 make package-private class BeanRegistrar implements BeanDefinitionRegistrar { private static final Log logger = LogFactory.getLog(BeanRegistrar.class); - + /** Prefix used when registering the target object for a scoped proxy. */ private static final String TARGET_NAME_PREFIX = "scopedTarget."; @@ -41,7 +54,6 @@ class BeanRegistrar implements BeanDefinitionRegistrar { return AnnotationUtils.findAnnotation(method, Bean.class) != null; } - // TODO: SJC-242 method too long public void register(BeanMethod method, BeanDefinitionRegistry registry) { RootBeanDefinition beanDef = new ConfigurationClassBeanDefinition(); @@ -51,7 +63,7 @@ class BeanRegistrar implements BeanDefinitionRegistrar { beanDef.setFactoryMethodName(method.getName()); Bean bean = method.getRequiredAnnotation(Bean.class); - + // TODO: prune defaults //Configuration defaults = configClass.getMetadata(); @@ -119,7 +131,7 @@ class BeanRegistrar implements BeanDefinitionRegistrar { // is this method annotated with @Scope(scopedProxy=...)? if (scope != null && scope.proxyMode() != ScopedProxyMode.NO) { RootBeanDefinition targetDef = beanDef; - // + // Create a scoped proxy definition for the original bean name, // "hiding" the target bean in an internal target definition. String targetBeanName = resolveHiddenScopedProxyBeanName(beanName); diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClass.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClass.java index a7a6dcdd2b7..39c99872b03 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClass.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -15,7 +15,6 @@ */ package org.springframework.config.java.support; - import static java.lang.String.*; import java.lang.annotation.Annotation; @@ -147,7 +146,6 @@ final class ConfigurationClass extends ModelClass { return this; } - public ConfigurationClass setDeclaringClass(ConfigurationClass configurationClass) { this.declaringClass = configurationClass; return this; @@ -190,7 +188,6 @@ final class ConfigurationClass extends ModelClass { method.validate(problemReporter); } - @Override public String toString() { return format("%s; modifiers=%d; methods=%s", super.toString(), modifiers, methods); @@ -252,23 +249,22 @@ final class ConfigurationClass extends ModelClass { /** Configuration classes must be annotated with {@link Configuration @Configuration}. */ public class NonAnnotatedConfigurationError extends Problem { public NonAnnotatedConfigurationError() { - super( - format("%s was provided as a Java Configuration class but was not annotated with @%s. " - + "Update the class definition to continue.", getSimpleName(), Configuration.class - .getSimpleName()), - new Location(new FileSystemResource("/dev/null")) + super(format("%s was provided as a Java Configuration class but was not annotated with @%s. " + + "Update the class definition to continue.", + getSimpleName(), Configuration.class.getSimpleName()), + new Location(new FileSystemResource("/dev/null")) ); } } + /** Configuration classes must be non-final to accommodate CGLIB subclassing. */ public class FinalConfigurationError extends Problem { public FinalConfigurationError() { - super( - format("@%s class may not be final. Remove the final modifier to continue.", - Configuration.class.getSimpleName()), - new Location(new FileSystemResource("/dev/null")) + super(format("@%s class may not be final. Remove the final modifier to continue.", + Configuration.class.getSimpleName()), + new Location(new FileSystemResource("/dev/null")) ); } } diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClassMethodVisitor.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClassMethodVisitor.java index 3f0222f2af7..94616ecb703 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClassMethodVisitor.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClassMethodVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -60,7 +60,7 @@ class ConfigurationClassMethodVisitor extends MethodAdapter { * @param modifiers modifiers for this method */ public ConfigurationClassMethodVisitor(ConfigurationClass configClass, String methodName, - String methodDescriptor, int modifiers, ClassLoader classLoader) { + String methodDescriptor, int modifiers, ClassLoader classLoader) { super(AsmUtils.EMPTY_VISITOR); this.configClass = configClass; @@ -133,12 +133,12 @@ class ConfigurationClassMethodVisitor extends MethodAdapter { // detect whether the return type is an interface newClassReader(convertClassNameToResourcePath(returnType.getName()), classLoader).accept( - new ClassAdapter(AsmUtils.EMPTY_VISITOR) { - @Override - public void visit(int arg0, int arg1, String arg2, String arg3, String arg4, String[] arg5) { - returnType.setInterface((arg1 & Opcodes.ACC_INTERFACE) == Opcodes.ACC_INTERFACE); - } - }, false); + new ClassAdapter(AsmUtils.EMPTY_VISITOR) { + @Override + public void visit(int arg0, int arg1, String arg2, String arg3, String arg4, String[] arg5) { + returnType.setInterface((arg1 & Opcodes.ACC_INTERFACE) == Opcodes.ACC_INTERFACE); + } + }, false); return returnType; } diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClassPostProcessor.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClassPostProcessor.java index c6baf9dc41a..76bfd3a1fe9 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClassPostProcessor.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClassPostProcessor.java @@ -161,8 +161,8 @@ public class ConfigurationClassPostProcessor extends AbstractConfigurationClassP String enhancedClassName = enhancer.enhance(configClassName); if (logger.isDebugEnabled()) - logger.debug(format("Replacing bean definition '%s' existing class name '%s' with enhanced class name '%s'", - beanName, configClassName, enhancedClassName)); + logger.debug(format("Replacing bean definition '%s' existing class name '%s' " + + "with enhanced class name '%s'", beanName, configClassName, enhancedClassName)); beanDef.setBeanClassName(enhancedClassName); } diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClassVisitor.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClassVisitor.java index 11c018b4964..6830c67cd4e 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClassVisitor.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationClassVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -22,8 +22,6 @@ import static org.springframework.util.ClassUtils.*; import java.lang.annotation.Annotation; import java.util.HashMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.ClassAdapter; import org.objectweb.asm.ClassReader; @@ -40,7 +38,6 @@ import org.springframework.config.java.Configuration; */ class ConfigurationClassVisitor extends ClassAdapter { - private static final Log log = LogFactory.getLog(ConfigurationClassVisitor.class); private static final String OBJECT_DESC = convertClassNameToResourcePath(Object.class.getName()); private final ConfigurationClass configClass; @@ -63,15 +60,16 @@ class ConfigurationClassVisitor extends ClassAdapter { @Override public void visitSource(String sourceFile, String debug) { - String resourcePath = convertClassNameToResourcePath(configClass.getName()).substring(0, - configClass.getName().lastIndexOf('.') + 1).concat(sourceFile); + String resourcePath = + convertClassNameToResourcePath(configClass.getName()) + .substring(0, configClass.getName().lastIndexOf('.') + 1).concat(sourceFile); configClass.setSource(resourcePath); } @Override public void visit(int classVersion, int modifiers, String classTypeDesc, String arg3, - String superTypeDesc, String[] arg5) { + String superTypeDesc, String[] arg5) { visitSuperType(superTypeDesc); configClass.setName(convertResourcePathToClassName(classTypeDesc)); diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationEnhancer.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationEnhancer.java index 03ad6b51056..8c5c8a5e7a6 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationEnhancer.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationEnhancer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -67,9 +67,10 @@ class ConfigurationEnhancer { if (iter.next().accepts(candidateMethod)) return i; - throw new IllegalStateException(format("No registrar is capable of " - + "handling method [%s]. Perhaps you forgot to add a catch-all registrar?", - candidateMethod.getName())); + throw new IllegalStateException( + format("No registrar is capable of handling method [%s]. " + + "Perhaps you forgot to add a catch-all registrar?", + candidateMethod.getName())); } }; @@ -98,10 +99,9 @@ class ConfigurationEnhancer { }); callbackInstances.add(new MethodInterceptor() { - public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) - throws Throwable { - return null; - } + public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { + return null; + } }); @@ -127,8 +127,8 @@ class ConfigurationEnhancer { subclass = nestOneClassDeeperIfAspect(superclass, subclass); if (log.isInfoEnabled()) - log.info(format("Successfully enhanced %s; enhanced class name is: %s", configClassName, subclass - .getName())); + log.info(format("Successfully enhanced %s; enhanced class name is: %s", + configClassName, subclass.getName())); return subclass.getName(); } @@ -193,8 +193,7 @@ class ConfigurationEnhancer { @Override protected byte[] transform(byte[] b) throws Exception { ClassWriter writer = new ClassWriter(false); - ClassAdapter adapter = new AddAnnotationAdapter(writer, - "Lorg/aspectj/lang/annotation/Aspect;"); + ClassAdapter adapter = new AddAnnotationAdapter(writer, "Lorg/aspectj/lang/annotation/Aspect;"); ClassReader reader = new ClassReader(b); reader.accept(adapter, false); return writer.toByteArray(); diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationModel.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationModel.java index 45a2de9d484..1fa5b9c2c79 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationModel.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -26,7 +26,6 @@ import org.springframework.config.java.Configuration; import org.springframework.core.io.FileSystemResource; - /** * An abstract representation of a set of user-provided "Configuration classes", usually but * not necessarily annotated with {@link Configuration @Configuration}. The model is @@ -163,11 +162,9 @@ final class ConfigurationModel { public class EmptyModelError extends Problem { public EmptyModelError() { - super( - format("Configuration model was empty. Make sure at least one " - + "@%s class has been specified.", Configuration.class.getSimpleName()), - new Location(new FileSystemResource("/dev/null")) - ); + super(format("Configuration model was empty. Make sure at least one " + + "@%s class has been specified.", Configuration.class.getSimpleName()), + new Location(new FileSystemResource("/dev/null"))); } } diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationModelBeanDefinitionReader.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationModelBeanDefinitionReader.java index d5df4db948d..e0cd8c1ab24 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationModelBeanDefinitionReader.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationModelBeanDefinitionReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -69,8 +69,7 @@ class ConfigurationModelBeanDefinitionReader { /** * Reads a particular {@link ConfigurationClass}, registering bean definitions for the - * class itself, all its {@link Bean} methods and all its {@link Extension} - * annotations. + * class itself, all its {@link Bean} methods */ private void loadBeanDefinitionsForConfigurationClass(ConfigurationClass configClass) { doLoadBeanDefinitionForConfigurationClass(configClass); @@ -90,18 +89,6 @@ class ConfigurationModelBeanDefinitionReader { */ private void doLoadBeanDefinitionForConfigurationClass(ConfigurationClass configClass) { - // TODO: prune support for @Required -// Configuration metadata = configClass.getMetadata(); -// if (metadata.checkRequired() == true) { -// RootBeanDefinition requiredAnnotationPostProcessor = new RootBeanDefinition(); -// Class beanClass = RequiredAnnotationBeanPostProcessor.class; -// String beanName = beanClass.getName() + "#0"; -// requiredAnnotationPostProcessor.setBeanClass(beanClass); -// requiredAnnotationPostProcessor -// .setResourceDescription("ensures @Required methods have been invoked"); -// registry.registerBeanDefinition(beanName, requiredAnnotationPostProcessor); -// } - GenericBeanDefinition configBeanDef = new GenericBeanDefinition(); configBeanDef.setBeanClassName(configClass.getName()); @@ -111,11 +98,9 @@ class ConfigurationModelBeanDefinitionReader { // and potentially has PropertyValues and ConstructorArgs) if (registry.containsBeanDefinition(configBeanName)) { if (log.isInfoEnabled()) - log.info(format( - "Copying property and constructor arg values from existing bean definition for " - + "@Configuration class %s to new bean definition", configBeanName)); - AbstractBeanDefinition existing = - (AbstractBeanDefinition) registry.getBeanDefinition(configBeanName); + log.info(format("Copying property and constructor arg values from existing bean definition for " + + "@Configuration class %s to new bean definition", configBeanName)); + AbstractBeanDefinition existing = (AbstractBeanDefinition) registry.getBeanDefinition(configBeanName); configBeanDef.setPropertyValues(existing.getPropertyValues()); configBeanDef.setConstructorArgumentValues(existing.getConstructorArgumentValues()); configBeanDef.setResource(existing.getResource()); @@ -127,14 +112,12 @@ class ConfigurationModelBeanDefinitionReader { registry.registerBeanDefinition(configBeanName, configBeanDef); } - /** * Reads a particular {@link BeanMethod}, registering bean definitions with * {@link #registry} based on its contents. */ private void loadBeanDefinitionsForModelMethod(BeanMethod method) { new BeanRegistrar().register(method, registry); - //method.getRegistrar().register(method, registry); } // @SuppressWarnings("unchecked") @@ -170,5 +153,4 @@ class ConfigurationModelBeanDefinitionReader { // } // } - } diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationParser.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationParser.java index eae57a5b9fd..a71cc995154 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationParser.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -76,7 +76,7 @@ public class ConfigurationParser { } public ConfigurationModel getConfigurationModel() { - return model; - } + return model; + } } diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ModelClass.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ModelClass.java index 26f25570d36..929e44ac5ce 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ModelClass.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ModelClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -27,7 +27,6 @@ import org.springframework.util.ClassUtils; * * @author Chris Beams */ -// TODO: Consider eliminating in favor of just ConfigurationClass class ModelClass implements BeanMetadataElement { private String name; @@ -161,3 +160,5 @@ class ModelClass implements BeanMetadataElement { } } + +// TODO: Consider eliminating in favor of just ConfigurationClass diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationArrayVisitor.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationArrayVisitor.java index 3de8a35644a..93d2e3ec69b 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationArrayVisitor.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationArrayVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -22,16 +22,11 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Array; import java.util.ArrayList; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.objectweb.asm.AnnotationVisitor; -/** TODO: JAVADOC */ class MutableAnnotationArrayVisitor extends AnnotationAdapter { - private static final Log log = LogFactory.getLog(MutableAnnotationArrayVisitor.class); - private final ArrayList values = new ArrayList(); private final MutableAnnotation mutableAnno; private final String attribName; diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationInvocationHandler.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationInvocationHandler.java index fef0de4c231..9531ec4b145 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationInvocationHandler.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationInvocationHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -30,7 +30,6 @@ import org.springframework.util.ReflectionUtils; import org.springframework.util.StringUtils; -/** TODO: JAVADOC */ final class MutableAnnotationInvocationHandler implements InvocationHandler { private final Class annoType; diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationUtils.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationUtils.java index 73b85624997..6aa09a15021 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationUtils.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -19,7 +19,6 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Proxy; -/** TODO: JAVADOC */ class MutableAnnotationUtils { /** diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationVisitor.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationVisitor.java index 4a8d6b889e6..384e6059219 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationVisitor.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/MutableAnnotationVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -21,8 +21,6 @@ import static org.springframework.config.java.support.Util.*; import java.lang.annotation.Annotation; import java.lang.reflect.Field; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.Type; import org.springframework.util.Assert; @@ -33,8 +31,6 @@ import org.springframework.util.Assert; */ class MutableAnnotationVisitor implements AnnotationVisitor { - private static final Log log = LogFactory.getLog(MutableAnnotationVisitor.class); - protected final MutableAnnotation mutableAnno; private final ClassLoader classLoader; diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/Util.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/Util.java index 659a6eb2553..ab5e20ecf68 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/support/Util.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/Util.java @@ -1,3 +1,18 @@ +/* + * Copyright 2002-2009 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.config.java.support; import static java.lang.String.*; @@ -20,10 +35,6 @@ import sun.security.x509.Extension; * * @author Chris Beams */ -// TODO: SJC-242 general - check cycles with s101 -// TODO: SJC-242 general - check tabs & spaces -// TODO: SJC-242 general - check apache header -// TODO: SJC-242 rename, repackage, document class Util { private static final Log log = LogFactory.getLog(Util.class); @@ -158,8 +169,8 @@ class Util { InputStream is = classLoader.getResourceAsStream(classFileName); if (is == null) - throw new RuntimeException(new FileNotFoundException("Class file [" + classFileName - + "] not found")); + throw new RuntimeException( + new FileNotFoundException("Class file [" + classFileName + "] not found")); return is; }