Hi,
I thought I was going to showcase how to compose with the JDK classes,
but to my disappointment the JVM comes in and is not happy about that;
Caused by: java.lang.SecurityException: Prohibited package name: java.util
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:479)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:625)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at
org.qi4j.runtime.composite.FragmentClassLoader.findClass(FragmentClassLoader.java:144)
...
So, this is from the fact that a subclass of HashMap is attempted, and
which the FragmentClassLoader tries to put into the same package
(java.util) as its parent.
I tried to modify this, and simply add "qi4j." in front of any
generated JDK subclasses, but then a VerifyError shows up;
java.lang.VerifyError: (class: qi4j/java/util/HashMap_Stub, method:
<init> signature: (I)V) Register 1 contains wrong type
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getDeclaredConstructors(Class.java:1836)
at
org.qi4j.runtime.composite.ConstructorsModel.<init>(ConstructorsModel.java:72)
at org.qi4j.runtime.composite.MixinModel.<init>(MixinModel.java:60)
...
which I think is related to the bytecodes representing classloaders
and methods also contains the name of the class they belong to.
I couldn't figure out how this works in the FragmentClassLoader, and
anyone with strong interest in bytecode generation may want to help
out.
I have added a testcase (@Ignore) to show what I am trying to achieve,
called MapOverrideTest.
Cheers
--
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java
I live here; http://tinyurl.com/3xugrbk
I work here; http://tinyurl.com/6a2pl4j
I relax here; http://tinyurl.com/2cgsug
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev