Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

petite problem: when invoke addBean will throw MalformedParametersException #770

Closed
uyong opened this issue Sep 1, 2020 · 4 comments
Closed
Assignees

Comments

@uyong
Copy link

uyong commented Sep 1, 2020

hello, when i use petite ioc, occur error: MalformedParametersException: Invalid parameter name "".

method invoke trace is:

MethodResolver.resolve()
#ReferencesResolver.readAllReferencesFromAnnotation()
#Executable.getParameters().

use under code can easy recurrent:

public class BeanA {
        public void test() {
             Map map = new HashMap();
             new Thread(() -> System.out.print(map));
        }
}

invoke BeanContainer.addBean(BeanAObjcet).

i found because it has a lambda method caused, so i modify class "Methods#inspectMethods()", and add "method.isSynthetic()" check.

@uyong uyong changed the title petite problem: when registerBean will throw MalformedParametersException petite problem: when addBean will throw MalformedParametersException Sep 1, 2020
@uyong uyong changed the title petite problem: when addBean will throw MalformedParametersException petite problem: when invoke addBean will throw MalformedParametersException Sep 1, 2020
@igr igr self-assigned this Sep 1, 2020
@igr igr added the jodd-petite label Sep 1, 2020
@igr igr added the bug label Sep 15, 2020
@igr
Copy link
Member

igr commented Sep 15, 2020

Not sure if I follow?

This works:

class SyntheticTest {

	public static class BeanA {
		public void test() {
			final Map map = new HashMap();
			new Thread(() -> System.out.print(map));
		}
	}

	@Test
	void synthTest() {
		final PetiteContainer pc = new PetiteContainer();
		pc.addBean("foo", new BeanA());
		pc.getBean("foo");
	}
}

@uyong uyong closed this as completed Sep 29, 2020
@uyong
Copy link
Author

uyong commented Sep 29, 2020

Not sure if I follow?

This works:

class SyntheticTest {

	public static class BeanA {
		public void test() {
			final Map map = new HashMap();
			new Thread(() -> System.out.print(map));
		}
	}

	@Test
	void synthTest() {
		final PetiteContainer pc = new PetiteContainer();
		pc.addBean("foo", new BeanA());
		pc.getBean("foo");
	}
}

Yes, you are right

@uyong uyong reopened this Sep 29, 2020
@igr
Copy link
Member

igr commented Jan 6, 2021

May I close this?

@igr
Copy link
Member

igr commented Mar 1, 2021

Closing :)

@igr igr closed this as completed Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants