diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2012-12-28 21:04:54 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2012-12-28 21:04:54 +0000 |
commit | cde3d770016fc1131851d23763c1ce450fba6587 (patch) | |
tree | 06f5b143499cb642087b12ac67e18a00b26d0104 /gnu/xml/validation/xmlschema/XMLSchemaBuilder.java | |
parent | 2190710f0c2ddaa65e55ba4e31bcd200bcc56d64 (diff) | |
download | classpath-cde3d770016fc1131851d23763c1ce450fba6587.tar.gz |
Fix warnings in gnu.xml.validation.*
2012-12-28 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/xml/validation/datatype/AnySimpleType.java:
(AnySimpleType()): Remove unneeded cast.
* gnu/xml/validation/datatype/AtomicSimpleType.java:
(AtomicSimpleType(QName,Set,int,SimpleType,
Annotation)): Add type parameter to Set.
* gnu/xml/validation/datatype/BooleanType.java:
(VALUE_SPACE): Likewise.
* gnu/xml/validation/datatype/DoubleType.java:
(SPECIAL): Likewise.
* gnu/xml/validation/datatype/DurationType.java:
(Duration): Implement Comparable<Duration> not
Comparable.
(Duration.hashCode()): Add @Override.
(Duration.equals(Object)): Likewise.
(Duration.compareTo(Duration)): Likewise and
use specific type, which also fixes issue with
it returning 0 for other objects, rather than
throwing a ClassCastException.
(createValue(String,ValidationContext)): Remove
unused months field. Set duration.years from
years.
* gnu/xml/validation/datatype/FloatType.java:
(SPECIAL): Add type parameter.
* gnu/xml/validation/datatype/GDayType.java,
(GDay): Implement Comparable<GDay> not
Comparable.
(GDay.hashCode()): Add @Override.
(GDay.equals(Object)): Likewise.
(GDay.compareTo(GDay)): Likewise and
use specific type, which also fixes issue with
it returning 0 for other objects, rather than
throwing a ClassCastException.
* gnu/xml/validation/datatype/GMonthDayType.java:
(GMonthDay): Implement Comparable<GMonthDay> not
Comparable.
(GMonthDay.hashCode()): Add @Override.
(GMonthDay.equals(Object)): Likewise.
(GMonthDay.compareTo(GMonthDay)): Likewise and
use specific type, which also fixes issue with
it returning 0 for other objects, rather than
throwing a ClassCastException.
* gnu/xml/validation/datatype/GMonthType.java:
(GMonth): Implement Comparable<GMonth> not
Comparable.
(GMonth.hashCode()): Add @Override.
(GMonth.equals(Object)): Likewise.
(GMonth.compareTo(GMonth)): Likewise and
use specific type, which also fixes issue with
it returning 0 for other objects, rather than
throwing a ClassCastException.
* gnu/xml/validation/datatype/GYearMonthType.java,
(GYearMonth): Implement Comparable<GYearMonth> not
Comparable.
(GYearMonth.hashCode()): Add @Override.
(GYearMonth.equals(Object)): Likewise.
(GYearMonth.compareTo(GYearMonth)): Likewise and
use specific type, which also fixes issue with
it returning 0 for other objects, rather than
throwing a ClassCastException.
* gnu/xml/validation/datatype/GYearType.java,
(GYear): Implement Comparable<GYear> not
Comparable.
(GYear.hashCode()): Add @Override.
(GYear.equals(Object)): Likewise.
(GYear.compareTo(GYear)): Likewise and
use specific type, which also fixes issue with
it returning 0 for other objects, rather than
throwing a ClassCastException.
* gnu/xml/validation/datatype/ListSimpleType.java:
(ListSimpleType(QName,Set,int,SimpleType,Annotation,
SimpleType)): Add type parameter to Set.
* gnu/xml/validation/datatype/MaxExclusiveFacet.java:
(matches(Object)): Use Comparable<Object>.
* gnu/xml/validation/datatype/MaxInclusiveFacet.java:
(matches(Object)): Likewise.
* gnu/xml/validation/datatype/MinExclusiveFacet.java:
(matches(Object)): Likewise.
* gnu/xml/validation/datatype/MinInclusiveFacet.java:
(matches(Object)): Likewise.
* gnu/xml/validation/datatype/SimpleType.java:
(facets): Add type parameter to Set.
(SimpleType(QName,int,Set,int,SimpleType,Annotation)):
Likewise.
(checkValid(String,ValidationContext)): Add type
parameter to Iterator and remove unnecessary cast.
* gnu/xml/validation/datatype/TimeType.java:
(Time): Implement Comparable<Time> not
Comparable.
(Time.hashCode()): Add @Override.
(Time.equals(Object)): Likewise.
(Time.compareTo(Time)): Likewise and
use specific type, which also fixes issue with
it returning 0 for other objects, rather than
throwing a ClassCastException.
* gnu/xml/validation/datatype/TypeBuilder.java:
(TypeBuilder(SimpleType)): Add type parameter.
* gnu/xml/validation/datatype/TypeLibrary.java:
(byName): Likewise.
(static): Likewise.
* gnu/xml/validation/datatype/UnionSimpleType.java:
(memberTypes): Likewise.
(UnionSimpleType(QName,Set,int,SimpleType,Annotation,List)):
Likewise.
(checkValid(String,ValidationContext)): Add type
parameter to Iterator and remove unnecessary cast.
* gnu/xml/validation/relaxng/DataPattern.java:
(params): Add type parameter.
* gnu/xml/validation/relaxng/FullSyntaxBuilder.java:
(VOCABULARY): Likewise.
(STRIPPED_ATTRIBUTES): Likewise.
(PATTERN_ELEMENTS): Likewise.
(EMPTY_STRING_SET): Added as a typesafe replacement for
Collections.EMPTY_SET.
(static): Add type parameters.
(urls): Likewise.
(datatypeLibraries): Likewise.
(parse(Document)): Likewise and remove redundant casts.
(getDefines(Set,Element,Element,boolean)): Add type parameter.
(getElements(Set,Element,Element)): Likewise.
(expandRefs(Set,Element)): Likewise.
(transform(Node)): Remove redundant casts and add type
parameters.
(handleRefs(Node,Node,Node)): Fix logic error found
by compiler. Check should be == null, not != null,
or name will be null when dereferenced.
(getComponents(Node)): Add type parameter.
(forbidDescendants(Node,Set)): Likewise.
(combineNodes(Node,String,String,List)): Likewise
and remove redundant cast.
(getDatatypeLibrary(String)): Add type parameter.
* gnu/xml/validation/relaxng/Grammar.java:
(defines): Add type parameter.
* gnu/xml/validation/xmlschema/ComplexType.java:
(attributeUses): Add type parameter.
(annotations): Likewise.
(ComplexType(QName,boolean,int,int)): Likewise.
* gnu/xml/validation/xmlschema/XMLSchema.java:
(elementDeclarations): Likewise.
(attributeDeclarations): Likewise.
(types): Likewise.
(XMLSchema(String,String,int,int,boolean,boolean)):
Likewise.
* gnu/xml/validation/xmlschema/XMLSchemaBuilder.java:
(parseSimpleType(QName)): Return type from schema if
non-null and add ones returned from typeLibrary before
returning.
(parseSimpleType(Node)): Remove unused variable and replace
with TODO. Add type parameter.
(parseRestriction(Node,ComplexType)): Likewise.
(parseExtension(Node,ComplexType)): Likewise.
* gnu/xml/validation/xmlschema/XMLSchemaValidatorHandler.java:
(context): Add type parameter.
(attributes): Likewise.
(XMLSchemaValidatorHandler(XMLSchema)): Likewise.
(getElementTypeInfo()): Remove redundant cast.
(getAttributeTypeInfo(int)): Likewise.
(isIdAttribute(int)): Likewise.
(isSpecified(int)): Likewise.
(startElement(String,String,String,Attributes)): Likewise.
Signed-off-by: Andrew John Hughes <gnu_andrew@member.fsf.org>
Diffstat (limited to 'gnu/xml/validation/xmlschema/XMLSchemaBuilder.java')
-rw-r--r-- | gnu/xml/validation/xmlschema/XMLSchemaBuilder.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java b/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java index a7bad3129..3cfcfdedb 100644 --- a/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java +++ b/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java @@ -48,6 +48,7 @@ import org.relaxng.datatype.helpers.DatatypeLibraryLoader; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import gnu.xml.validation.datatype.Annotation; +import gnu.xml.validation.datatype.Facet; import gnu.xml.validation.datatype.SimpleType; import gnu.xml.validation.datatype.Type; @@ -525,10 +526,14 @@ class XMLSchemaBuilder throws DatatypeException { SimpleType type = (SimpleType) schema.types.get(typeName); + if (type != null) + return type; if (!XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(typeName.getNamespaceURI())) return null; String localName = typeName.getLocalPart(); - return (SimpleType) typeLibrary.createDatatype(localName); + type = (SimpleType) typeLibrary.createDatatype(localName); + schema.types.put(typeName, type); + return type; } SimpleType parseSimpleType(Node simpleType) @@ -549,10 +554,10 @@ class XMLSchemaBuilder typeFinal = getAttribute(schemaAttrs, "finalDefault"); } } - int typeFinality = parseSimpleTypeDerivationSet(typeFinal); + parseSimpleTypeDerivationSet(typeFinal); // TODO: Make use of typeFinality QName typeName = asQName(getAttribute(attrs, "name"), simpleType); int variety = 0; - Set facets = new LinkedHashSet(); + Set<Facet> facets = new LinkedHashSet<Facet>(); int fundamentalFacets = 0; // TODO SimpleType baseType = null; // TODO Annotation annotation = null; @@ -661,8 +666,7 @@ class XMLSchemaBuilder { NamedNodeMap attrs = restriction.getAttributes(); String base = getAttribute(attrs, "base"); - QName baseType = asQName(base, restriction); - SimpleType simpleType = null; + asQName(base, restriction); // TODO: make use of basetype for (Node child = restriction.getFirstChild(); child != null; child = child.getNextSibling()) { @@ -678,7 +682,7 @@ class XMLSchemaBuilder else if ("simpleType".equals(name)) { type.contentType = XMLSchema.CONTENT_SIMPLE; - simpleType = parseSimpleType(child); + parseSimpleType(child); // TODO: make use of SimpleType } else if ("minExclusive".equals(name)) { @@ -744,7 +748,7 @@ class XMLSchemaBuilder { NamedNodeMap attrs = extension.getAttributes(); String base = getAttribute(attrs, "base"); - QName baseType = asQName(base, extension); + asQName(base, extension); // TODO: make use of basetype for (Node child = extension.getFirstChild(); child != null; child = child.getNextSibling()) { |