Skip to content

[#1314] open some too restrictive methods usefull in XJC plugins dev#1860

Open
laurentschoelens wants to merge 1 commit intoeclipse-ee4j:masterfrom
laurentschoelens:gh-1314
Open

[#1314] open some too restrictive methods usefull in XJC plugins dev#1860
laurentschoelens wants to merge 1 commit intoeclipse-ee4j:masterfrom
laurentschoelens:gh-1314

Conversation

@laurentschoelens
Copy link
Copy Markdown
Contributor

@laurentschoelens laurentschoelens commented Sep 30, 2025

Fixes #1314

  • add new static method _new for JAnnotationUse in order to create new instance
  • add new method addProperty(index, prop) on CClassInfo to specify index of property when adding a property on a class (and do the missing setParent call)

@laurentschoelens
Copy link
Copy Markdown
Contributor Author

@lukasj for review please. Thanks

Copy link
Copy Markdown
Member

@lukasj lukasj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the use-case for these changes? They look wrong/unnecessary to me.

Note that:

  • codemodel has almost no public constructor and all elements can be created either through static <component>.new... or by calling appropriate method on the element being modeled
  • there is no public setParent in the XJC model

so both changes would bring inconsistency to current APIs

@laurentschoelens
Copy link
Copy Markdown
Contributor Author

@lukasj
Copy link
Copy Markdown
Member

lukasj commented Feb 10, 2026

there seems to be CClassInfo which one can pass to that method and call cclassInfo.addProperty(...) - isn't that what is wanted?

@laurentschoelens
Copy link
Copy Markdown
Contributor Author

addProperty

Maybe we should add a addProperty with index property for that kind of usage but it could be done this way indeed

@laurentschoelens
Copy link
Copy Markdown
Contributor Author

what is the use-case for these changes? They look wrong/unnecessary to me.

Note that:

* codemodel has almost no public constructor and all elements can be created either through static `<component>.new...` or by calling appropriate method on the element being modeled

* there is no public `setParent` in the XJC model

so both changes would bring inconsistency to current APIs

updated PR according to your remarks

@laurentschoelens laurentschoelens marked this pull request as ready for review February 13, 2026 07:24
- add new static method _new for JAnnotationUse in order to create new instance
- add new method addProperty(index, prop) on CClassInfo to specify index of property when adding a property on a class (and setParent)
Copy link
Copy Markdown
Member

@lukasj lukasj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • changes in CClassInfo look good
  • can you remind me why is _new(JClass clazz): JAnnotationUse needed? Every element which can be annotated already has annotate method producing the instance of JAnnotationUse (see JAnnotatable interface)

@laurentschoelens
Copy link
Copy Markdown
Contributor Author

  • changes in CClassInfo look good
  • can you remind me why is _new(JClass clazz): JAnnotationUse needed? Every element which can be annotated already has annotate method producing the instance of JAnnotationUse (see JAnnotatable interface)

The initial issue was to open the JAnnotationUse constructor, that's why I came with that _new method here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codemodel enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XJC class visibility too restrictive

2 participants