Author: fanningpj Date: Tue Jun 18 17:27:49 2024 New Revision: 1918419 URL: http://svn.apache.org/viewvc?rev=1918419&view=rev Log: use isEmpty
Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/QNameSetBuilder.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlException.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlRuntimeException.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/common/NameUtil.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/config/NameSet.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/config/NameSetBuilder.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/inst2xsd/RussianDollStrategy.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/regex/Token.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaAnnotationImpl.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderImpl.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscChecker.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscJavaizer.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscTranslator.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/soap/MimeHeaders.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/FactorImports.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/util/FilerImpl.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/validator/Validator.java xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/values/XmlObjectBase.java xmlbeans/trunk/src/test/java.ignore/drt/drtcases/MarshalTests.java xmlbeans/trunk/src/test/java/compile/scomp/checkin/XmlBeansCompCheckinTests.java xmlbeans/trunk/src/test/java/compile/scomp/detailed/DetailedCompTests.java xmlbeans/trunk/src/test/java/xmlobject/checkin/InstanceValidationTests.java Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/QNameSetBuilder.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/QNameSetBuilder.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/QNameSetBuilder.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/QNameSetBuilder.java Tue Jun 18 17:27:49 2024 @@ -267,7 +267,7 @@ public class QNameSetBuilder implements */ public boolean isAll() { - return _inverted && _includedURIs.size() == 0 && _includedQNames.size() == 0; + return _inverted && _includedURIs.isEmpty() && _includedQNames.isEmpty(); } /** @@ -275,7 +275,7 @@ public class QNameSetBuilder implements */ public boolean isEmpty() { - return !_inverted && _includedURIs.size() == 0 && _includedQNames.size() == 0; + return !_inverted && _includedURIs.isEmpty() && _includedQNames.isEmpty(); } /** @@ -359,7 +359,7 @@ public class QNameSetBuilder implements return false; } - if (includeURIs.size() > 0) + if (!includeURIs.isEmpty()) for (Iterator<QName> i = set2.includedQNamesInExcludedURIs().iterator(); i.hasNext(); ) { if (set1.contains(i.next())) Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlException.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlException.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlException.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlException.java Tue Jun 18 17:27:49 2024 @@ -93,7 +93,7 @@ public class XmlException extends Except */ public XmlError getError ( ) { - if (_errors == null || _errors.size() == 0) + if (_errors == null || _errors.isEmpty()) return null; return _errors.get( 0 ); Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlRuntimeException.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlRuntimeException.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlRuntimeException.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/XmlRuntimeException.java Tue Jun 18 17:27:49 2024 @@ -91,7 +91,7 @@ public class XmlRuntimeException extends */ public XmlError getError ( ) { - if (_errors == null || _errors.size() == 0) + if (_errors == null || _errors.isEmpty()) return null; return _errors.get( 0 ); Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/common/NameUtil.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/common/NameUtil.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/common/NameUtil.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/common/NameUtil.java Tue Jun 18 17:27:49 2024 @@ -500,7 +500,7 @@ public class NameUtil { result.set(result.size() - 1, processFilename(result.get(result.size() - 1))); } - if (result.size() > 0) { + if (!result.isEmpty()) { List<String> splitdns = splitDNS(result.get(0)); result.remove(0); result.addAll(0, splitdns); @@ -575,7 +575,7 @@ public class NameUtil { StringBuilder buf = new StringBuilder(); List<String> words = splitWords(xml_name, useJaxRpcRules); - if (words.size() > 0) { + if (!words.isEmpty()) { if (!Character.isJavaIdentifierStart(words.get(0).charAt(0))) { buf.append("X"); } @@ -608,7 +608,7 @@ public class NameUtil { StringBuilder buf = new StringBuilder(); List<String> words = splitWords(xml_name, useJaxRpcRules); - if (words.size() > 0) { + if (!words.isEmpty()) { String first = words.get(0).toLowerCase(Locale.ROOT); char f = first.charAt(0); if (!Character.isJavaIdentifierStart(f) && fixGeneratedName) { Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/config/NameSet.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/config/NameSet.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/config/NameSet.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/config/NameSet.java Tue Jun 18 17:27:49 2024 @@ -51,7 +51,7 @@ public class NameSet { } static NameSet newInstance(boolean isFinite, Set<String> finiteSet) { - if (finiteSet.size() == 0) { + if (finiteSet.isEmpty()) { if (isFinite) { return NameSet.EMPTY; } else { Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/config/NameSetBuilder.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/config/NameSetBuilder.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/config/NameSetBuilder.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/config/NameSetBuilder.java Tue Jun 18 17:27:49 2024 @@ -54,7 +54,7 @@ public class NameSetBuilder * @return created NameSet */ public NameSet toNameSet() { - if (_finiteSet.size() == 0) { + if (_finiteSet.isEmpty()) { if (_isFinite) { return NameSet.EMPTY; } else { Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/inst2xsd/RussianDollStrategy.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/inst2xsd/RussianDollStrategy.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/inst2xsd/RussianDollStrategy.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/inst2xsd/RussianDollStrategy.java Tue Jun 18 17:27:49 2024 @@ -154,7 +154,7 @@ public class RussianDollStrategy (commentBuff.length() == 0 ? comment : commentBuff.insert(0, comment).toString())); element.setComment(commnetStr); - if (children.size() > 0) { + if (!children.isEmpty()) { // complex content if (collapsedText.length() > 0) { elemType.setContentType(Type.COMPLEX_TYPE_MIXED_CONTENT); @@ -169,7 +169,7 @@ public class RussianDollStrategy try (XmlCursor xcForNamespaces = xc.newCursor()) { xcForNamespaces.toParent(); - if (attributes.size() > 0) { + if (!attributes.isEmpty()) { elemType.setContentType(Type.COMPLEX_TYPE_SIMPLE_CONTENT); Type extendedType = Type.createNamedType( Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/regex/Token.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/regex/Token.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/regex/Token.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/regex/Token.java Tue Jun 18 17:27:49 2024 @@ -741,7 +741,7 @@ class Token implements java.io.Serializa private static final int NONBMP_BLOCK_START = 84; static protected RangeToken getRange(String name, boolean positive) { - if (Token.categories.size() == 0) { + if (Token.categories.isEmpty()) { synchronized (Token.categories) { Token[] ranges = new Token[Token.categoryNames.length]; for (int i = 0; i < ranges.length; i ++) { Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaAnnotationImpl.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaAnnotationImpl.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaAnnotationImpl.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaAnnotationImpl.java Tue Jun 18 17:27:49 2024 @@ -140,7 +140,7 @@ public class SchemaAnnotationImpl implem addNoSchemaAttributes(elem, attrArray); if (ann == null) { - if (attrArray.size() == 0) + if (attrArray.isEmpty()) return null; // no annotation present // no annotation element present, but attributes on the enclosing // element present, so we have an annotation component Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderImpl.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderImpl.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderImpl.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderImpl.java Tue Jun 18 17:27:49 2024 @@ -102,7 +102,7 @@ public class SchemaTypeLoaderImpl extend List<SoftReference<SchemaTypeLoaderImpl>> a = _cachedTypeSystems.get(); // Make sure this entry is at the top of the stack - if (a.size() > 0) { + if (!a.isEmpty()) { SoftReference<SchemaTypeLoaderImpl> t = a.get(0); a.set(0, new SoftReference<>((SchemaTypeLoaderImpl) stl)); a.add(t); Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscChecker.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscChecker.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscChecker.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscChecker.java Tue Jun 18 17:27:49 2024 @@ -426,7 +426,7 @@ public class StscChecker { // we only add the last error, because isParticleValidRestriction may add errors // to the collection that it later changes its mind about, or it may (inadvertently) // forget to describe an error into the collection.... - if (errors.size() == 0) { + if (errors.isEmpty()) { state.error(XmlErrorCodes.COMPLEX_TYPE_RESTRICTION$ELEMENT_OR_MIXED_AND_VALID, null, location); } else { state.getErrorListener().add(errors.get(errors.size() - 1)); @@ -900,7 +900,7 @@ public class StscChecker { particles.add(baseParticleArray[k]); } } - if (particles.size() > 0) { + if (!particles.isEmpty()) { recurseValid = false; errors.add(XmlError.forObject(XmlErrorCodes.PARTICLE_DERIVATION_RECURSE$UNMAPPED_ARE_EMPTIABLE, new Object[]{printParticle(baseModel), printParticle(derivedModel), printParticles(particles)}, context)); Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscJavaizer.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscJavaizer.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscJavaizer.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscJavaizer.java Tue Jun 18 17:27:49 2024 @@ -337,7 +337,7 @@ public class StscJavaizer { // since they don't have another outer class ArrayList<SchemaType> list = new ArrayList<>(); addAnonymousTypesFromRedefinition(outerType, list); - if (list.size() > 0) { + if (!list.isEmpty()) { SchemaType[] temp = new SchemaType[nrOfAnonTypes + list.size()]; list.toArray(temp); System.arraycopy(anonymousTypes, 0, temp, list.size(), nrOfAnonTypes); Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java Tue Jun 18 17:27:49 2024 @@ -245,7 +245,7 @@ public class StscSimpleTypeResolver { List<SchemaTypeImpl> memberImplList = new ArrayList<>(); - if (simpleTypes.length == 0 && (memberTypes == null || memberTypes.size() == 0)) { + if (simpleTypes.length == 0 && (memberTypes == null || memberTypes.isEmpty())) { state.error(XmlErrorCodes.SCHEMA_SIMPLE_TYPE$UNION_HAS_MEMBER_TYPES_OR_SIMPLE_TYPES, null, parseUnion); // recovery: oh well, zero member types is fine. } Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscState.java Tue Jun 18 17:27:49 2024 @@ -1151,7 +1151,7 @@ public class StscState { public static void end() { StscStack stscStack = tl_stscStack.get(); stscStack.pop(); - if (stscStack.stack.size() == 0) { + if (stscStack.stack.isEmpty()) { // this is required to release all the references in this classloader tl_stscStack.remove(); } Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscTranslator.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscTranslator.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscTranslator.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/schema/StscTranslator.java Tue Jun 18 17:27:49 2024 @@ -105,7 +105,7 @@ public class StscTranslator { } } - SchemaTypeImpl t = translateGlobalComplexType(type, targetNamespace, chameleon, redefChain.size() > 0); + SchemaTypeImpl t = translateGlobalComplexType(type, targetNamespace, chameleon, !redefChain.isEmpty()); state.addGlobalType(t, null); SchemaTypeImpl r; // 2. Traverse the List built in step 1 in reverse and add all the @@ -135,7 +135,7 @@ public class StscTranslator { } } - SchemaTypeImpl t = translateGlobalSimpleType(type, targetNamespace, chameleon, redefChain.size() > 0); + SchemaTypeImpl t = translateGlobalSimpleType(type, targetNamespace, chameleon, !redefChain.isEmpty()); state.addGlobalType(t, null); SchemaTypeImpl r; for (int k = redefChain.size() - 1; k >= 0; k--) { @@ -172,7 +172,7 @@ public class StscTranslator { } } - SchemaModelGroupImpl g = translateModelGroup(group, targetNamespace, chameleon, redefChain.size() > 0); + SchemaModelGroupImpl g = translateModelGroup(group, targetNamespace, chameleon, !redefChain.isEmpty()); state.addModelGroup(g, null); SchemaModelGroupImpl r; for (int k = redefChain.size() - 1; k >= 0; k--) { @@ -199,7 +199,7 @@ public class StscTranslator { } } - SchemaAttributeGroupImpl g = translateAttributeGroup(group, targetNamespace, chameleon, redefChain.size() > 0); + SchemaAttributeGroupImpl g = translateAttributeGroup(group, targetNamespace, chameleon, !redefChain.isEmpty()); state.addAttributeGroup(g, null); SchemaAttributeGroupImpl r; for (int k = redefChain.size() - 1; k >= 0; k--) { Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/soap/MimeHeaders.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/soap/MimeHeaders.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/soap/MimeHeaders.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/soap/MimeHeaders.java Tue Jun 18 17:27:49 2024 @@ -144,7 +144,7 @@ public class MimeHeaders { } } - if (vector.size() == 0) { + if (vector.isEmpty()) { return null; } else { String[] as = new String[vector.size()]; Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/FactorImports.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/FactorImports.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/FactorImports.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/FactorImports.java Tue Jun 18 17:27:49 2024 @@ -176,14 +176,14 @@ public class FactorImports { } } - if (schemaDocs.size() == 0) { + if (schemaDocs.isEmpty()) { System.out.println("No schema files found."); System.exit(0); return; } - if (dupeTypeNames.size() + dupeElementNames.size() + dupeAttributeNames.size() + - dupeModelGroupNames.size() + dupeAttrGroupNames.size() == 0) { + if (dupeTypeNames.isEmpty() && dupeElementNames.isEmpty() && dupeAttributeNames.isEmpty() && + dupeModelGroupNames.isEmpty() && dupeAttrGroupNames.isEmpty()) { System.out.println("No duplicate names found."); System.exit(0); return; @@ -197,7 +197,7 @@ public class FactorImports { SchemaDocument commonDoc = SchemaDocument.Factory.parse( "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'/>" ); - if (namespace.length() > 0) { + if (!namespace.isEmpty()) { commonDoc.getSchema().setTargetNamespace(namespace); } commonDoc.getSchema().setElementFormDefault(FormChoice.QUALIFIED); Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java Tue Jun 18 17:27:49 2024 @@ -178,7 +178,7 @@ public class SchemaCodeGenerator { triesRemaining -= 1; } - if (triesRemaining <= 0 || retry.size() == 0) // done? + if (triesRemaining <= 0 || retry.isEmpty()) // done? { triesRemaining = 0; } else { Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/SchemaCompiler.java Tue Jun 18 17:27:49 2024 @@ -203,7 +203,7 @@ public class SchemaCompiler { } } - if (extensions.size() > 0) { + if (!extensions.isEmpty()) { // example: -extensionParms typeMappingFileLocation=d:\types if (cl.getOpt("extensionParms") != null) { Extension e = extensions.get(0); @@ -781,7 +781,7 @@ public class SchemaCompiler { } private static void runExtensions(List<Extension> extensions, SchemaTypeSystem system, File classesDir) { - if (extensions != null && extensions.size() > 0) { + if (extensions != null && !extensions.isEmpty()) { SchemaCompilerExtension sce; Iterator<Extension> i = extensions.iterator(); Map<String, String> extensionParms; Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java Tue Jun 18 17:27:49 2024 @@ -228,9 +228,9 @@ public class TypeHierarchyPrinter { System.out.println(spaces + "+-" + QNameHelper.readable(sType, prefixes) + notes(sType)); Collection<SchemaType> children = childTypes.get(sType); - if (children != null && children.size() > 0) + if (children != null && !children.isEmpty()) { - spaces.append(typesToPrint.size() == 0 || typesToPrint.get(typesToPrint.size() - 1) == null ? " " : "| "); + spaces.append(typesToPrint.isEmpty() || typesToPrint.get(typesToPrint.size() - 1) == null ? " " : "| "); typesToPrint.add(null); typesToPrint.addAll(children); } Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/tool/XMLBean.java Tue Jun 18 17:27:49 2024 @@ -101,7 +101,7 @@ public class XMLBean extends MatchingTas public void execute() throws BuildException { /* VALIDATION */ //required - if (schemas.size() == 0 + if (schemas.isEmpty() && schema == null && fileset.getDir(getProject()) == null) { String msg = "The 'schema' or 'dir' attribute or a nested fileset is required."; @@ -146,7 +146,7 @@ public class XMLBean extends MatchingTas Set<File> xsdList = _extRouter.get(XSD); Set<File> wsdlList = _extRouter.get(WSDL); - if (xsdList.size() + wsdlList.size() == 0) { + if (xsdList.isEmpty() && wsdlList.isEmpty()) { log("Could not find any xsd or wsdl files to process.", Project.MSG_WARN); return; } Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/util/FilerImpl.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/util/FilerImpl.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/util/FilerImpl.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/util/FilerImpl.java Tue Jun 18 17:27:49 2024 @@ -162,7 +162,7 @@ public class FilerImpl implements Filer Diff.readersAsText(sReader, "<generated>", fReader, _file.getName(), diffs); } - if (diffs.size() > 0) { + if (!diffs.isEmpty()) { // Diffs encountered, replace the file on disk with text from the buffer try (Writer fw = writerForFile(_file)) { fw.write(str); Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/validator/Validator.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/validator/Validator.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/validator/Validator.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/validator/Validator.java Tue Jun 18 17:27:49 2024 @@ -755,9 +755,9 @@ public final class Validator } } - List<QName> names = (expectedNames.size() > 0 ? expectedNames : optionalNames); + List<QName> names = expectedNames.isEmpty() ? optionalNames : expectedNames; - if (names.size() > 0) { + if (!names.isEmpty()) { String buf = names.stream().map(QNameHelper::pretty).collect(Collectors.joining(" ")); emitFieldError(event, XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$EXPECTED_DIFFERENT_ELEMENT, new Object[]{names.size(), buf, QNameHelper.pretty(qName)}, @@ -787,9 +787,9 @@ public final class Validator } } - List<QName> names = (expectedNames.size() > 0 ? expectedNames : optionalNames); + List<QName> names = expectedNames.isEmpty() ? optionalNames : expectedNames; - if (names.size() > 0) { + if (!names.isEmpty()) { String buf = names.stream().map(QNameHelper::pretty).collect(Collectors.joining(" ")); emitFieldError(event, XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_ELEMENT, Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/values/XmlObjectBase.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/values/XmlObjectBase.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/values/XmlObjectBase.java (original) +++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/values/XmlObjectBase.java Tue Jun 18 17:27:49 2024 @@ -2611,7 +2611,7 @@ public abstract class XmlObjectBase impl } while (xc.toNextSibling(elementName)); } - if (result.size() == 0) { + if (result.isEmpty()) { return EMPTY_RESULT; } else { return result.toArray(EMPTY_RESULT); @@ -2651,7 +2651,7 @@ public abstract class XmlObjectBase impl } while (xc.toNextSibling()); } - if (result.size() == 0) { + if (result.isEmpty()) { return EMPTY_RESULT; } else { return result.toArray(EMPTY_RESULT); @@ -2713,7 +2713,7 @@ public abstract class XmlObjectBase impl while (xc.toNextAttribute()); } - if (result.size() == 0) { + if (result.isEmpty()) { return EMPTY_RESULT; } else { return result.toArray(EMPTY_RESULT); Modified: xmlbeans/trunk/src/test/java.ignore/drt/drtcases/MarshalTests.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java.ignore/drt/drtcases/MarshalTests.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java.ignore/drt/drtcases/MarshalTests.java (original) +++ xmlbeans/trunk/src/test/java.ignore/drt/drtcases/MarshalTests.java Tue Jun 18 17:27:49 2024 @@ -1638,7 +1638,7 @@ public class MarshalTests extends TestCa inform("doc3-ERROR: " + xmlError); } - Assert.assertTrue(errors.size() > 0); + Assert.assertFalse(errors.isEmpty()); } Modified: xmlbeans/trunk/src/test/java/compile/scomp/checkin/XmlBeansCompCheckinTests.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/compile/scomp/checkin/XmlBeansCompCheckinTests.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/compile/scomp/checkin/XmlBeansCompCheckinTests.java (original) +++ xmlbeans/trunk/src/test/java/compile/scomp/checkin/XmlBeansCompCheckinTests.java Tue Jun 18 17:27:49 2024 @@ -65,9 +65,7 @@ public class XmlBeansCompCheckinTests { @AfterEach public void tearDown() throws Exception { - if (xm_errors.size() > 0) { - xm_errors.clear(); - } + xm_errors.clear(); } @Test Modified: xmlbeans/trunk/src/test/java/compile/scomp/detailed/DetailedCompTests.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/compile/scomp/detailed/DetailedCompTests.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/compile/scomp/detailed/DetailedCompTests.java (original) +++ xmlbeans/trunk/src/test/java/compile/scomp/detailed/DetailedCompTests.java Tue Jun 18 17:27:49 2024 @@ -217,7 +217,7 @@ public class DetailedCompTests { parsedSchema[0] = SchemaDocument.Factory.parse(schema); errors.clear(); typeSystem = XmlBeans.compileXsd(parsedSchema, null, opts); - assertTrue(errors.size() == 0, "Expected no errors or warnings"); + assertTrue(errors.isEmpty(), "Expected no errors or warnings"); SchemaType docType = typeSystem.findDocumentType(new QName("", "root")); SchemaType type = docType.getElementProperty(new QName("", "root")).getType(). getAttributeProperty(new QName("", "att")).getType(); @@ -268,7 +268,7 @@ public class DetailedCompTests { assertEquals(docType, parsedDoc.schemaType(), "Did not find the root element in the Schema"); errors.clear(); parsedDoc.validate(opts); - assertTrue(errors.size() == 0, "Expected no validation errors"); + assertTrue(errors.isEmpty(), "Expected no validation errors"); // System.out.println(xml); } } Modified: xmlbeans/trunk/src/test/java/xmlobject/checkin/InstanceValidationTests.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/checkin/InstanceValidationTests.java?rev=1918419&r1=1918418&r2=1918419&view=diff ============================================================================== --- xmlbeans/trunk/src/test/java/xmlobject/checkin/InstanceValidationTests.java (original) +++ xmlbeans/trunk/src/test/java/xmlobject/checkin/InstanceValidationTests.java Tue Jun 18 17:27:49 2024 @@ -76,7 +76,7 @@ public class InstanceValidationTests { List<XmlError> errors = performValidation(schemas, invalid); assertNotNull(errors); - assertTrue(errors.size() > 0); + assertFalse(errors.isEmpty()); for (Object error : errors) { XmlValidationError xmlValError = (XmlValidationError) error; @@ -137,7 +137,7 @@ public class InstanceValidationTests { "</empRecords>"; List<XmlError> errors = performValidation(schemas, xmlInstance); assertNotNull(errors); - assertTrue(errors.size() > 0); + assertFalse(errors.isEmpty()); for (Object error : errors) { XmlValidationError xmlValError = (XmlValidationError) error; @@ -199,7 +199,7 @@ public class InstanceValidationTests { List<XmlError> errors = performValidation(schemas, xmlInstance); assertNotNull(errors); - assertTrue(errors.size() > 0); + assertFalse(errors.isEmpty()); Iterator<XmlError> it = errors.iterator(); assertTrue(it.hasNext()); @@ -331,7 +331,7 @@ public class InstanceValidationTests { "</empRecords>"; List<XmlError> errors = performValidation(schemas, xmlInstance); assertNotNull(errors); - assertTrue(errors.size() > 0); + assertFalse(errors.isEmpty()); for (Object error : errors) { XmlValidationError xmlValError = (XmlValidationError) error; @@ -372,7 +372,7 @@ public class InstanceValidationTests { List<XmlError> errors = performValidation(schemas, invalid); assertNotNull(errors); - assertTrue(errors.size() > 0); + assertFalse(errors.isEmpty()); for (XmlError error : errors) { assertEquals(error.getMessage(), "Expected element 'a@http://openuri.org/bobschema' instead of 'q@http://openuri.org/bobschema' here in element foo@http://openuri.org/bobschema"); @@ -431,7 +431,7 @@ public class InstanceValidationTests { "</empRecords>"; List<XmlError> errors = performValidation(schemas, xmlInstance); assertNotNull(errors); - assertTrue(errors.size() > 0); + assertFalse(errors.isEmpty()); for (XmlError error : errors) { assertEquals(error.getMessage(), "Expected attribute: employee in element person"); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org