You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by kristian marinkovic <kr...@gmail.com> on 2011/04/24 23:40:28 UTC

Plastic: nondeterministic PlasticManager behavior

Hi,

i'm taking a deep dive into plastic and came across a behavior i cannot explain.

If i create a ClassInstantiator from a PlasticManager that was created
with the transformers and packages in the constructor, i get the
PlasticClass in my transformer where i can e.g. assert that the class
under test has only one method. But if i instantiate a PlasticManager
with the empty constructor and call createClass() with the class under
test and the transformer, the transformer will always return an empty
list if i ask the PlasticClass for the number of methods. Can somebody
explain why?

g,
kris

public class PlasticManagerExperiment
{
	private final PlasticClassTransformer transformer = new
PlasticClassTransformer()
	{
		@Override
		public void transform(PlasticClass plasticClass)
		{
			assert plasticClass.getMethods().size() == 1;
		}
	};
	
	@Test
	public void instantiate_without_packages()
	{
		PlasticManager m = new PlasticManager();
		
		m.createClass(ClassUnderTest.class, transformer);
	}
	
	@Test
	public void instantiate_with_packages()
	{
		PlasticManager m = new
PlasticManager(Thread.currentThread().getContextClassLoader(),
				new StandardDelegate(transformer),
				new HashSet<String>(Arrays.asList(ClassUnderTest.class.getPackage().getName())));
		
		m.getClassInstantiator(ClassUnderTest.class.getName());
		
	}
}

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org