openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Logemann>
Subject Re: MetaModel creation with -Aopenjpa.generate=true
Date Wed, 23 Mar 2011 15:38:27 GMT
Puuuh. Its me again.

I am gone the hard route and created my own variant of AnnotationProcesso:

    public boolean process(Set<? extends TypeElement> annos, RoundEnvironment roundEnv)
        if (active && !roundEnv.processingOver()) {
            Set<? extends Element> elements = roundEnv.getRootElements();
            for (Element e : elements) {
                try {
                    System.out.println("Element inside Set --> "+ e);
                    process((TypeElement) e);
                } catch (RuntimeException e1) {
                    System.out.println("Error -->"+ e);
        return true;

with more logging and something strange can be seen:

    [javac] Element inside Set --> de.netversys.carriers.tourline.process.TourlineRoutingBarcode
    [javac] Element inside Set --> de.netversys.carriers.tourline.process.TourlineSenderBarcode
    [javac] Element inside Set --> de.netversys.carriers.bartolini.domain.xml
    [javac] Error -->de.netversys.carriers.bartolini.domain.xml

The "-->" lines is the output before the process() call in the for loop which i coded in

The last line is interessting. This is not a class, this is a package! (with JAXB generated
stuff in it)

Now the error message
java.lang.ClassCastException:$PackageSymbol cannot be cast
to javax.lang.model.element.TypeElement

makes sense because he says something about PackageSymbol. Now more questions comes up than
it solves. Why is this package inside the Element Set ??
Its a normal package under one of my domain packages. But inside this package, there are only
JAXB generated classes.

Perhaps JAXB generated classe with its ObjectFactory stuff is handled differently by the JDK
Annotation framework. But i have other places with JAXB stuff in it. Cant be the issue.

With my program, i get a result of course because i dont leave the process on error ;-) But
this is the solution. 

still a bit clueless

Marc Logemann

Am 23.03.2011 um 15:51 schrieb Rick Curtis:

> Marc -
> Can you narrow down the Entity which is having the problem so we can write a
> unit test?
> Thanks,
> Rick

View raw message