Only expose ASM-driven method order if the methods match
Issue: SPR-14505
(cherry picked from commit 253060c)
			
			
This commit is contained in:
		
							parent
							
								
									155bbb8466
								
							
						
					
					
						commit
						f7c3b814e3
					
				| 
						 | 
				
			
			@ -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.
 | 
			
		||||
| 
						 | 
				
			
			@ -366,15 +366,20 @@ class ConfigurationClassParser {
 | 
			
		|||
				AnnotationMetadata asm =
 | 
			
		||||
						this.metadataReaderFactory.getMetadataReader(original.getClassName()).getAnnotationMetadata();
 | 
			
		||||
				Set<MethodMetadata> asmMethods = asm.getAnnotatedMethods(Bean.class.getName());
 | 
			
		||||
				Set<MethodMetadata> reflectionMethods = beanMethods;
 | 
			
		||||
				beanMethods = new LinkedHashSet<MethodMetadata>();
 | 
			
		||||
				for (MethodMetadata asmMethod : asmMethods) {
 | 
			
		||||
					for (MethodMetadata reflectionMethod : reflectionMethods) {
 | 
			
		||||
						if (reflectionMethod.getMethodName().equals(asmMethod.getMethodName())) {
 | 
			
		||||
							beanMethods.add(reflectionMethod);
 | 
			
		||||
							break;
 | 
			
		||||
				if (asmMethods.size() >= beanMethods.size()) {
 | 
			
		||||
					Set<MethodMetadata> selectedMethods = new LinkedHashSet<MethodMetadata>(asmMethods.size());
 | 
			
		||||
					for (MethodMetadata asmMethod : asmMethods) {
 | 
			
		||||
						for (MethodMetadata beanMethod : beanMethods) {
 | 
			
		||||
							if (beanMethod.getMethodName().equals(asmMethod.getMethodName())) {
 | 
			
		||||
								selectedMethods.add(beanMethod);
 | 
			
		||||
								break;
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					if (selectedMethods.size() == beanMethods.size()) {
 | 
			
		||||
						// All reflection-detected methods found in ASM method set -> proceed
 | 
			
		||||
						beanMethods = selectedMethods;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			catch (IOException ex) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue