This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 178426 - Replace <schema2beans> with annotation processor
Summary: Replace <schema2beans> with annotation processor
Status: RESOLVED FIXED
Alias: None
Product: ide
Classification: Unclassified
Component: Schema2Beans (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal (vote)
Assignee: Jesse Glick
URL: http://hg.netbeans.org/prototypes/rev...
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks: 174846
  Show dependency tree
 
Reported: 2009-12-10 06:51 UTC by Jesse Glick
Modified: 2009-12-18 14:41 UTC (History)
4 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Current patch (216.85 KB, patch)
2009-12-10 19:49 UTC, Jesse Glick
Details | Diff
Latest, possibly final, patch (255.99 KB, patch)
2009-12-14 10:28 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2009-12-10 06:51:21 UTC
Advantages: simpler build scripts, easier usage from Maven, easier versioning using build/generated, better dependency behavior.
Comment 1 Jesse Glick 2009-12-10 14:37:44 UTC
Works fine for hibernate module. I can't do anything with j2ee.dd as it is because its build script uses Ant's <replace> to adjust signatures of the generated classes after S2B has run. Probably this should be fixed in the MDD (if necessary, enhancing S2B to be able to specify this).
Comment 2 Jesse Glick 2009-12-10 19:48:40 UTC
While I will probably add a couple more miscellaneous attributes to the annotation corresponding to existing Ant task attributes which I find to be in use as I go through remaining modules, I think this is ready to review.
Comment 3 Jesse Glick 2009-12-10 19:49:21 UTC
Created attachment 92401 [details]
Current patch

 .hgignore                                                                                                     |   15 
 apisupport.project/src/org/netbeans/modules/apisupport/project/NbModuleProject.java                           |   12 
 apisupport.project/src/org/netbeans/modules/apisupport/project/queries/ClassPathProviderImpl.java             |   37 
 apisupport.project/src/org/netbeans/modules/apisupport/project/queries/SourceForBinaryImpl.java               |   31 
 apisupport.project/test/unit/src/org/netbeans/modules/apisupport/project/queries/SourceForBinaryImplTest.java |   16 
 hibernate/build.xml                                                                                           |   73 -
 hibernate/src/org/netbeans/modules/hibernate/cfg/model/package-info.java                                      |   52 +
 hibernate/src/org/netbeans/modules/hibernate/mapping/model/package-info.java                                  |   52 +
 hibernate/src/org/netbeans/modules/hibernate/reveng/model/package-info.java                                   |   52 +
 j2ee.dd.webservice/build.xml                                                                                  |   71 -
 j2ee.dd.webservice/src/org/netbeans/modules/j2ee/dd/impl/webservices/model_1_1/package-info.java              |   62 +
 j2ee.dd.webservice/src/org/netbeans/modules/j2ee/dd/impl/webservices/model_1_2/package-info.java              |   62 +
 j2ee.jboss4/build.xml                                                                                         |   84 -
 j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/config/gen/package-info.java                                 |  101 ++
 j2ee.persistence/build.xml                                                                                    |   95 -
 j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/dd/orm/model_1_0/package-info.java                 |   55 +
 j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/dd/orm/model_2_0/package-info.java                 |   55 +
 j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/dd/persistence/model_1_0/package-info.java         |   54 +
 j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/dd/persistence/model_2_0/package-info.java         |   54 +
 j2ee.sun.dd/build.xml                                                                                         |  495 ----------
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/api/cmp/package-info.java                                    |   50 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/app/model_1_3_0/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/app/model_1_4_0/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/app/model_5_0_0/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/app/model_6_0_0/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/client/model_1_3_0/package-info.java                    |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/client/model_1_4_0/package-info.java                    |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/client/model_1_4_1/package-info.java                    |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/client/model_5_0_0/package-info.java                    |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/client/model_6_0_0/package-info.java                    |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/cmp/model_1_0/package-info.java                         |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/cmp/model_1_1/package-info.java                         |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/cmp/model_1_2/package-info.java                         |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/common/model_2_1_0/package-info.java                    |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/common/model_2_1_1/package-info.java                    |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/common/model_3_0_0/package-info.java                    |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/ejb/model_2_0_0/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/ejb/model_2_1_0/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/ejb/model_2_1_1/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/ejb/model_3_0_0/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/ejb/model_3_0_1/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/ejb/model_3_1_0/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/web/model_2_3_0/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/web/model_2_4_0/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/web/model_2_4_1/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/web/model_2_5_0/package-info.java                       |   54 +
 j2ee.sun.dd/src/org/netbeans/modules/j2ee/sun/dd/impl/web/model_3_0_0/package-info.java                       |   54 +
 j2eeserver/build.xml                                                                                          |   55 -
 j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/gen/nbd/package-info.java                            |   51 +
 nbbuild/antsrc/org/netbeans/nbbuild/CustomJavac.java                                                          |    7 
 nbbuild/javadoctools/links.xml                                                                                |    1 
 nbbuild/javadoctools/properties.xml                                                                           |    1 
 nbbuild/javadoctools/replaces.xml                                                                             |    1 
 schema2beans/anttask/build.xml                                                                                |   82 -
 schema2beans/build.xml                                                                                        |   55 -
 schema2beans/dev/build.xml                                                                                    |  138 --
 schema2beans/dev/manifest.mf                                                                                  |    7 
 schema2beans/nbproject/project.properties                                                                     |    6 
 schema2beans/nbproject/project.xml                                                                            |    8 
 schema2beans/src/org/netbeans/modules/s2banttask/Schema2BeansAntTask.java                                     |    3 
 schema2beans/src/org/netbeans/modules/schema2beans/Schema2Beans.java                                          |  164 +++
 schema2beans/src/org/netbeans/modules/schema2beansdev/DocDefParser.java                                       |   21 
 schema2beans/src/org/netbeans/modules/schema2beansdev/EntityParser.java                                       |   18 
 schema2beans/src/org/netbeans/modules/schema2beansdev/Schema2BeansProcessor.java                              |  206 ++++
 64 files changed, 2634 insertions(+), 1172 deletions(-)
Comment 4 David Konecny 2009-12-13 15:45:25 UTC
re. "j2ee.dd uses Ant's <replace>" - it does because it was not possible to express requirements for generation via MDD files. Or maybe it was but nobody could figure out how to do that after reading MDD documentation. And because schema2beans is not really maintained or developed it was just hacked via <replace>. Somehow my impression was that s2b is dead. j2ee.dd will be needed in next decade but with each release of Java EE more and more configuration is moved to annotations so its less and less important.
Comment 5 Petr Jiricka 2009-12-14 03:10:33 UTC
Right - see bug 160049 on more background on introducing the Ant <replace>.
Comment 6 Jesse Glick 2009-12-14 08:19:23 UTC
Well I am just leaving j2ee.dd alone; the Ant task still works as before (you only need the regular module JAR in the taskdef CP).


S2B does not seem "dead" judging by the number of modules that still use it:

fgrep -l schema2beans {,contrib/}*/{build.xml,nbproject/project.xml}

You could try to deprecate it, limit access to specific friends, and try to remove some of the usages, but this seems like it could be a big project. I'm not sure what the replacement would be - JAXB? XOM? A Groovy internal DSL?
Comment 7 Jesse Glick 2009-12-14 09:42:54 UTC
websvc.jaxrpc also does some postprocessing of results - in this case fairly minor and could perhaps be done in the MDD file, I don't know.
Comment 8 Jesse Glick 2009-12-14 10:28:30 UTC
Created attachment 92551 [details]
Latest, possibly final, patch
Comment 9 Jesse Glick 2009-12-14 10:29:51 UTC
There are also a bunch of modules in contrib which I would probably try to convert after this patch is in main.
Comment 10 Jesse Glick 2009-12-17 09:49:48 UTC
core-main #8ef29befd159
Comment 11 Jesse Glick 2009-12-17 14:30:46 UTC
Converting contrib/j2ee.geronimo2 does not seem to work, perhaps due to a bug in s2b: the generated code has

	public DependencyType(int options)
	{
		super(comparators, runtimeVersion);

which does not compile, compared to what used to be checked in:

	public DependencyType(int options)
	{
		super(options);
Comment 12 scanti 2009-12-17 14:47:42 UTC
I do not know if this is the same problem but once I have commited a patch that fixed a similar problem in schema2beans.
Probably it was not applied.
https://netbeans.org/bugzilla/show_bug.cgi?id=157807
Comment 13 Jesse Glick 2009-12-17 15:13:01 UTC
contrib/j2ee.blueprints is also difficult to make work since nbcatalog.dtd is extracted from a ZIP file; the annotation processor expects it to be in the source path.
Comment 14 Jesse Glick 2009-12-17 15:16:17 UTC
contrib #5b7c153cea34 will fix j2ee.oc4j and j2ee.sun.ws7.
Comment 15 Quality Engineering 2009-12-17 23:52:11 UTC
Integrated into 'main-golden', will be available in build *200912180200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/8ef29befd159
User: Jesse Glick <jglick@netbeans.org>
Log: Issue #178426: Replace <schema2beans> with annotation processor.
To support this, enhance harness & apisupport to handle generated sources.
Comment 16 Jesse Glick 2009-12-18 14:41:31 UTC
Ignore "cannot find symbol" errors referring to model classes printed before the annotation processor has run; arguably a javac bug that these are displayed.