I was writing some new BDD tests and extending my framework slightly. I wrote a scenario and was repeatedly running it to flesh out the steps and get further. Eventually I ran into this error:
org.picocontainer.injectors.AbstractInjector$NotConcreteRegistrationException: Bad Access: '[B' is not instantiable
at org.picocontainer.injectors.AbstractInjector.checkConcrete(AbstractInjector.java:86)
at org.picocontainer.injectors.AbstractInjector.<init>(AbstractInjector.java:67)
at org.picocontainer.injectors.SingleMemberInjector.<init>(SingleMemberInjector.java:43)
at org.picocontainer.injectors.ConstructorInjector.<init>(ConstructorInjector.java:104)
at org.picocontainer.injectors.ConstructorInjection.createComponentAdapter(ConstructorInjection.java:59)
at org.picocontainer.injectors.AdaptingInjection.defaultInjectionAdapter(AdaptingInjection.java:121)
at org.picocontainer.injectors.AdaptingInjection.createComponentAdapter(AdaptingInjection.java:107)
at org.picocontainer.behaviors.AbstractBehaviorFactory.createComponentAdapter(AbstractBehaviorFactory.java:44)
at org.picocontainer.behaviors.Caching.createComponentAdapter(Caching.java:46)
at org.picocontainer.DefaultPicoContainer.addComponent(DefaultPicoContainer.java:536)
at org.picocontainer.DefaultPicoContainer.addComponent(DefaultPicoContainer.java:501)
at org.picocontainer.DefaultPicoContainer.addComponent(DefaultPicoContainer.java:488)
at cucumber.runtime.java.picocontainer.PicoFactory.start(PicoFactory.java:18)
at cucumber.runtime.java.JavaBackend.buildWorld(JavaBackend.java:76)
at cucumber.runtime.Runtime.buildBackendWorlds(Runtime.java:115)
In CucumberScenario method:
@Override
public void run(Formatter formatter, Reporter reporter, Runtime runtime) {
runtime.buildBackendWorlds(reporter);
runtime.runBeforeHooks(reporter, tagsAndInheritedTags());
In the buildBackendWorlds method, in the debugger, I see a list of all step classes in the ObjectFactory. Most of them I recognize, as I wrote them, but also in this list are:
[B
[I
[C
How did I get these strange "[B" and "[I" classes in my list of step classes? I guess this notation represents arrays of primitive types (byte, int, char), but PicoContainier is complaining and I don't know how they got in my step class list. I must have screwed something up in my editing, but I'm not sure what? I thought the only classes listed here should be ones that will be created when StepClasses are instantiated, by finding matching patterns in the classes on the glue classpath...?
Thanks for any help or pointers.
Bill
I guess this notation represents arrays of primitive types (byte, int, char), but PicoContainier is complaining and I don't know how they got in my step class list. I must have screwed something up in my editing, but I'm not sure what? I thought the only classes listed here should be ones that will be created when StepClasses are instantiated, by finding matching patterns in the classes on the glue classpath...?
Thanks for any help or pointers.
Bill
--
-- Rules --
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Thanks, Aslak. Indeed, you were correct, though via a roundabout manner. One of my steps classes has a constructor like this:
public DrlcSteps(World aWorld, IngestFileSteps ingestFileSteps, UserFileIngestHelper ingestHelper) {
The UserFileIngestHelper constructor then looked like this:
public UserFileIngestHelper(Tnop aTnop)
Finally, the Tnop class had two constructors:
public Tnop() {
…
public Tnop(String machineDomainName) {
…
The second one was indeed a recent change. I am curious how PicoContainer works here, though. How did it decide to use the second constructor? I thought PicoContainer would try to use the zero-argument constructor by default.
I fixed this problem by removing this second constructor and changing my step to access the Tnop created by the PicoContainer and then calling a method to set the machine name.
This was very enlightening. The PicoContainer just keeps going down the constructor chain and doesn't treat a String argument any different from a MyStepsClass argument. I wonder if it is possible to recognize this situation and give a better error message, but I have no good ideas at the moment.
Instead of analyzing the code by inspection, one can discover problems like this by setting a breakpoint on the addClass and addConstructorDependencies methods of the PicoFactory and follow the flow.
Thanks again, Aslak!
Bill