public boolean run()

in bug986/src/main/java/org/apache/cxf/xjc/bug986/Bug986Plugin.java [71:104]


    public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) {
        // kind of a bogus thing to have to do to workaround bug:
        // https://java.net/jira/browse/JAXB-986
        LOG.fine("Running Bug986Plugin plugin.");
        for (ClassOutline classOutline : outline.getClasses()) {
            Map<String, JFieldVar> fields = classOutline.implClass.fields();
            for (JFieldVar field : fields.values()) {
                Collection<JAnnotationUse> annotations = getAnnotations(field);
                List<JAnnotationUse> toRemove = new ArrayList<JAnnotationUse>();
                for (JAnnotationUse j : annotations) {
                    if (XmlSchemaType.class.getName().equals(getAnnotationClass(j).fullName())) {
                        JAnnotationValue st = getAnnotationMember(j, "name");
                        StringWriter sw = new StringWriter();
                        st.generate(new JFormatter(sw));
                        if ("\"anySimpleType\"".equals(sw.toString())) {
                            if (field.type().fullName().startsWith("java.util.List")) {
                                //if it's a list of non-string types, we have to remove
                                if (!field.type().fullName().contains("<java.lang.String>")) {
                                    toRemove.add(j);
                                }
                            } else if (!"java.lang.String".equals(field.type().fullName())) {
                                //if it's not a list and it's not a string, we have to remove
                                toRemove.add(j);
                            }
                        }
                    }
                }
                for (JAnnotationUse j : toRemove) {
                    annotations.remove(j);
                }
            }
        }
        return true;
    }