Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Element with null parent #80

Open
bertramn opened this issue Mar 3, 2017 · 1 comment
Open

Element with null parent #80

bertramn opened this issue Mar 3, 2017 · 1 comment

Comments

@bertramn
Copy link

bertramn commented Mar 3, 2017

Just wondering if this method of adding the property to the ClassInfo will construct a valid ElementProperty?

https://github.com/highsource/jaxb2-basics/blob/master/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/simplify/SimplifyPlugin.java#L167

The source of com.sun.tools.xjc.model.CClassInfo suggests that one should call addProperty for it to be setup correctly. The setParent method on CPropertyInfo is package scoped and hence cannot be called outside.

    public void addProperty(CPropertyInfo prop) {
        if(prop.ref().isEmpty())
            // this property isn't contributing anything
            // this happens when you try to map an empty sequence to a property
            return;
        prop.setParent(this);
        properties.add(prop);
    }
@highsource
Copy link
Owner

Maybe you're right and parent is not initialized correctly. But still, the plugin works so far. :) So probably this parent is not used much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants