gpt4 book ai didi

Update of XJC / Jakarta causes `Map otherAttributes` to be generated, which subsequently causes runtime issues(XJC/Jakarta的更新导致生成`Map其他属性`,这随后会导致运行时问题)

转载 作者:bug小助手 更新时间:2023-10-28 13:04:49 27 4
gpt4 key购买 nike



Upgrading to jakarta caused some issues for me.

升级到雅加达给我带来了一些问题。


I'm using the following maven plugin:

我正在使用以下maven插件:


<groupId>org.patrodyne.jvnet</groupId>
<artifactId>hisrc-higherjaxb40-maven-plugin</artifactId>

And I use episodal compilation (have libraries). Suddenly I'm facing the following problem:

并且我使用episodal编译(有库)。突然间,我面临着以下问题:


Can't have @XmlAnyAttribute when a base class has it already.
this problem is related to the following location:
at @jakarta.xml.bind.annotation.XmlAnyAttribute()

Closer inspection reveals that XJC suddenly generates the following field:

更仔细的检查发现,XJC突然生成了以下字段:


        @XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<>();


which it did not generate before. How can I disable this?

这是它以前没有产生的。如何禁用此功能?


更多回答

Please provide an MRE.

请提供MRE。

Hi Rick.. missed your request in my holiday period. We've got a temp fix (overriding selectively generated classes with binding). I'll try to make MRE.

嗨,瑞克..在我的假期错过了你的请求。我们有一个临时修复(用绑定覆盖选择性生成的类)。我会试着做MRE的。

MRE: github.com/sjaakd/jreproducer_jaxb .. However for some reason it does not yet show the same behaviourruntime. It does generate the troublesome 'otherAttributes'. I'll see if I can add more to the xsd to trigger the fault

Mre:githorb.com/sjaakd/jreProducer_jaxb.然而,由于某些原因,它还没有显示出相同的运行时行为。它确实会生成麻烦的“其他属性”。我会看看是否可以向xsd添加更多内容来触发错误

Managed to reproduce. But I guess the problem is in JAXB / XJC. See also: github.com/eclipse-ee4j/jaxb-ri/issues/1735

成功地繁殖了。但我想问题出在JAXB/XJC中。另见:githorb.com/eclipse-ee4j/jaxb-ri/Issues/1735

优秀答案推荐

As stated in the comments, the root cause is in JAXB-RI, see #1735, #1356 and #1146.

如评论所述,根本原因在JAXB-RI,见#1735、#1356和#1146。


However, the next release (no ETA) of hisrc-basicjaxb will include a new XJC plugin named fixOtherAttributes. This plugin iterates over the XJC class outlines and removes duplicate otherAttributes field(s) together with their associated @XmlAnyAttribute, getter and setter methods.

然而,hisrc-basicjaxb的下一个版本(无预计值)将包含一个名为fix OtherAttributes的新XJC插件。该插件遍历xjc类大纲,并删除重复的therAttributes字段(S)及其关联的@XmlAnyAttribute、getter和setter方法。



Note: This plugin requires JAR(s) from previous episodes be added, as dependencies, to the XJC classpath. In particular, configured as dependencies in the Maven plugin used to run XJC. Reflection is used to detect the original otherAttributes field from the previous episode's JAR(s). For a sample configuration, see hisrc-basicjaxb:higher/tests/episodes/b/pom.xml.



Disclaimer: I am the maintainer for the hisrc-basicjaxb project.

免责声明:我是hisrc-basicjaxb项目的维护者。


更多回答

Thanks Rick. I spotted that you were the maintainer. Really appreciate that you took over the good work. Thanks for your effort. I'll keep an eye out for the plugin.

谢谢瑞克我发现你是维护者。很感谢你接手了这份工作。谢谢你的努力。我会留意插件的。

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com