#2781 is fixed for jOOQ 3.3 and will be merged to jOOQ 3.2.2. The issue could also arise in tables, e.g. when generating this table:
CREATE TABLE t_2781 ( org text, jooq text ) And generating it into an ORG.JOOQ package (capital letters), or by applying a matcher strategy or other strategy that will lower-case or camel-case field identifiers. jOOQ will now append an underscore to identifiers to avoid such issues. 2013/10/16 Lukas Eder <[email protected]> > Hi Patrik, > > That's a very interesting issue :-) > > I will run this through Stack Overflow to get some deeper understanding of > why the local member shadows the entire package, and how this could be > circumvented: > http://stackoverflow.com/q/19406673/521799 > > If no thorough solution can be found, then I guess I'll have to play > around with static importing INTERNATIONALISATION in the event of a > collision. Another option might be to create a private "companion" class > Language______ (or so), and delegate the getSchema() code to that class. I > have registered #2781 for this. > https://github.com/jOOQ/jOOQ/issues/2781 > > There are two workaround that I can see: > - Generate your code into another package > - Write your generator strategy to rename the "de" enum literal to "de_" > > For the latter, see: > - > http://www.jooq.org/doc/3.2/manual/code-generation/codegen-generatorstrategy/ > - > http://www.jooq.org/doc/3.2/manual/code-generation/codegen-matcherstrategy/ > > Cheers > Lukas > > 2013/10/16 <[email protected]> > > Hi everyone, >> >> I think I found a tiny bug in the enum creation... >> >> >> package de.company.project.internationalisation.enums; >> >> /** >> * This class is generated by jOOQ. >> */ >> @javax.annotation.Generated(value = { "http://www.jooq.org", "3.2.0" >> }, >> comments = "This class is generated by jOOQ") >> @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) >> public enum Language implements org.jooq.EnumType { >> >> .... >> >> cy("cy"), >> >> da("da"), >> >> de("de"), >> >> dz("dz"), >> >> el("el"), >> >> .... >> >> /** >> * {@inheritDoc} >> */ >> @Override >> public org.jooq.Schema getSchema() { >> return >> de.company.project.internationalisation.Internationalisation.INTERNATIONALISATION; >> } >> >> } >> >> Obviously, the code generator creates the package name de.company.... >> which collides with the enum >> value 'de'. The compiler tries to dereference de.company on the enum >> instance, which is not going to work :( >> >> Eclipse complains with 'cannot resolve variable or field' >> >> Any chances to get a workaround for that ? >> Best, >> Patrik >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jOOQ User Group" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
