Hi,

this is nearly impossible because its not an Entity which makes the problem 
here. Its a package. I have no idea how to unit test that. Perhaps you can try 
creating 
a simple package with JAXB generated classes in it and try to reproduce:

1) create a very simple XSD file
2) run the JAXB compiler via ANT (then you should have some classes in 
myweirdpackage)

    <target name="JAXBCompiling" description="Compile main source tree java 
files">
        <taskdef name="xjc" classname="com.sun.tools.xjc.XJC2Task" 
classpathref="toolingclasspath"/>

        <xjc schema="my.xsd" destdir="${src.dir}"  
package="domain.myweirdpackage"/>
  </target>

3) put at least one Entity in domain package (parent of myweirdpackage)
4) run the MetaModel compiling step

Does this help?

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 23.03.2011 um 20:45 schrieb Rick Curtis:

> Marc -
> 
> Give this[1] patch a shot. If you can help me come up with a test Entity
> model that exposes this problem I have a pretty good chance of being able to
> get it into 2.1.1.
> 
> [1]
> http://people.apache.org/~curtisr7/patches/annotation_processor_patch.jar
> 
> Thanks,
> Rick
> 
> On Wed, Mar 23, 2011 at 11:29 AM, Marc Logemann <l...@logemann.org> wrote:
> 
>> +1 for the patch on AnnotationProcessor6 for the 2.1.x release line.
>> Of course this would make my life easier. I could drop my own variant.
>> I always like using framework classes instead of patched-own-versions.
>> 
>> ---
>> regards
>> Marc Logemann
>> http://www.logemann.org
>> http://www.logentis.de
>> 
>> 
>> 
>> 
>> Am 23.03.2011 um 17:20 schrieb Rick Curtis:
>> 
>>>> BTW it was a bit of a mess to create my own version of this class
>> because
>>> SourceAnnotationHandler.class has a lot of package private methods which
>> are
>>> used by AnnotationProcessor6. So i also needed to clone that class too.
>>> grrrr. :-)
>>> I could easily create a patch to put on top of the existing
>>> AnnotationProcessor6 if that would make your life easier? (You're running
>>> 2.1.x right?)
>>> 
>>>> I am quite sure that there are not that much people out there using the
>>> MetaModel feature at all. Because first you need to use Criteria API
>> which
>>> is probably also not THAT widespreaded so far. This could be the reason
>> why
>>> this bug is not mentioned somewhere.
>>> +1
>>> 
>>> Thanks,
>>> Rick
>>> 
>>> On Wed, Mar 23, 2011 at 11:03 AM, Marc Logemann <l...@logemann.org> wrote:
>>> 
>>>> Hi,
>>>> 
>>>> hope i could help a bit in researching this. For now i will use my own
>>>> variant of AnnotationProcessor6.
>>>> 
>>>> BTW it was a bit of a mess to create my own version of this class
>> because
>>>> SourceAnnotationHandler.class has a lot of package private methods which
>> are
>>>> used by AnnotationProcessor6. So i also needed to clone that class too.
>>>> grrrr. :-)
>>>> 
>>>> I am quite sure that there are not that much people out there using the
>>>> MetaModel feature at all. Because first you need to use Criteria API
>> which
>>>> is probably also not THAT widespreaded so far. This could be the reason
>> why
>>>> this bug is not mentioned somwhere.
>>>> 
>>>> But software development is crazy. You start using Criteria API because
>> its
>>>> somewhat typesafe in conjunction with MetaModel and now you are fighting
>>>> with AnnotationProcessor. Not really where we make our money. But on the
>>>> other hand its a challenge to find out why things break.
>>>> 
>>>> ---
>>>> regards
>>>> Marc Logemann
>>>> http://www.logemann.org
>>>> http://www.logentis.de
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Am 23.03.2011 um 16:55 schrieb Rick Curtis:
>>>> 
>>>>> Yes that seems reasonable. I'll get that taken care of sometime this
>>>>> afternoon.
>>>>> 
>>>>> I'd like to get another JIRA opened up to investigate the JAXB
>>>>> packageElements problem....
>>>>> 
>>>>> Thanks,
>>>>> Rick
>>>>> 
>>>>> On Wed, Mar 23, 2011 at 10:51 AM, Marc Logemann <l...@logemann.org>
>> wrote:
>>>>> 
>>>>>> For the time being, how about the following fix in openjpa trunk:
>>>>>> 
>>>>>> /**
>>>>>>  * The entry point for java compiler.
>>>>>>  */
>>>>>>  @Override
>>>>>> public boolean process(Set<? extends TypeElement> annos,
>>>>>> RoundEnvironment roundEnv) {
>>>>>>     if (active && !roundEnv.processingOver()) {
>>>>>>         Set<? extends Element> elements = roundEnv.getRootElements();
>>>>>>         for (Element e : elements) {
>>>>>>              if (e instanceof TypeElement)
>>>>>>                 process((TypeElement) e);
>>>>>>         }
>>>>>>     }
>>>>>>     return true;
>>>>>> }
>>>>>> 
>>>>>> 
>>>>>> We simply ignore "PackageElement", "ExecutableElement",
>>>>>> "TypeParameterElement" and "VariableElement". (These are the other
>>>>>> Subinterfaces of Element)
>>>>>> 
>>>>>> With this we dont get into trouble and we have time to elaborate on
>> the
>>>>>> real problem. roundEnv.getRootElements() simply can return also
>>>>>> PackageElements. Why this is only the case for this package with JAXB
>>>> file
>>>>>> is something which one need to research. Thats definitely something in
>>>> the
>>>>>> javax.annotation.processing area of the JDK. But there  must be a
>> reason
>>>>>> that getRootElements() returns Element and not TypeElement ;-)
>>>>>> 
>>>>>> ---
>>>>>> regards
>>>>>> Marc Logemann
>>>>>> http://www.logemann.org
>>>>>> http://www.logentis.de
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> Am 23.03.2011 um 16:41 schrieb Rick Curtis:
>>>>>> 
>>>>>>>> 
>>>>>>>>> still a bit clueless
>>>>>>>> 
>>>>>>> 
>>>>>>> Me too. I just started digging into some of the annotation processor
>>>> code
>>>>>> to
>>>>>>> see if I can learn something today.... So when you swallowed the
>>>>>> exception
>>>>>>> everything worked fine?
>>>>>>> 
>>>>>>> Thanks,
>>>>>>> Rick
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>> 
>> 

Reply via email to