/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Reports all unacknowledged customizations as errors.
*
* <p>
* Since we scan the whole content tree, we use this to check for unused
* <tt>xmime:expectedContentTypes</tt> attributes. TODO: if we find this kind of error checks more
* common, use the visitors so that we don't have to mix everything in one class.
*
* @author
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/
class UnusedCustomizationChecker extends BindingComponent implements XSVisitor, XSSimpleTypeVisitor {
/**
* Runs the check.
*/
void run() {
schema(s);
run( s.getAttGroupDecls() );
run( s.getAttributeDecls() );
run( s.getComplexTypes() );
run( s.getElementDecls() );
run( s.getModelGroupDecls() );
run( s.getNotations() );
run( s.getSimpleTypes() );
}
}
c.visit(this);
}
/**
* Checks unused customizations on this component
* and returns true if this is the first time this
* component is checked.
*/
if( !visitedComponents.add(c) )
return false; // already processed
return true;
}
return; // no such attribute
if(c instanceof XSParticle)
return; // particles get the same foreign attributes as local element decls,
// so we need to skip them
if(!stb.isAcknowledgedXmimeContentTypes(c)) {
// this is not used
}
}
if( !decl.isAcknowledged() ) {
decl.getLocation(),
);
c.getLocator(),
// mark it as acknowledged to avoid
// duplicated error messages.
}
check(d,c);
}
}
}
}
// don't need to check the base type -- it must be global, thus
// it is covered already
}
}
}
}
}
}
}
}
}
}
}
}
if(check(simpleType))
}
}
}
}
}
}
}
}
}
}
}