Jochen Wiedmann wrote:

I can't tell you what's wrong, but definitely, there is an error. The ChainGenerator is indeed invoked for interfaces only.

I suggest that you commit your current status into a branch and give me a chance to look into the problem.

Can you take a look at this?

Nacho G. Mac Dowell wrote:

If I use it as-is (not from ant, from maven), then there is a npe because Thread.currentThread().getContextClassLoader() is null. I tried using getClass().getClassLoader() but it then fails with

java.lang.ClassCastException: The controller must be an interface

If I do a JavaSource.toString it is not an interface so what I am thinking is that maybe there is a bug in CompiledClassReflector.

If in CompildeClassReflector#getJavaSource(JavaSourceFactory)

we do the following:

       Class c = getCompiledClass();
JavaSource js = new JavaSourceFactory().newJavaSource(JavaQNameImpl.getInstance(c.getName(), true));
+        if (c.isInterface()) {
+            js.setType(JavaSource.INTERFACE);
+        }
       Method[] methods = c.getMethods();
       for (int i = 0;  i < methods.length;  i++) {
           Method m = methods[i];
           getMethod(js, m);
       }

it works. Maybe more checks might be needed to get it correct. What do you think?


nacho

PD: I think there might be an error in ChainGenerator on method
loadSources(ClassLoader pClassLoader, JavaQName pQName,
                            JavaSourceFactory pFactory,
                            List pSources, Set pNames)

In this method it then calls loadSource like this:

JavaSource js = loadSource(Thread.currentThread().getContextClassLoader(),
                                  pQName.toString(), pFactory);

using a (possibly) different class loader.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to