This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 422c7f36fe94c93d6d572cee02d7b1a1d4adf4f9 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Sat Dec 31 16:35:51 2022 +0100 Reduce the amount of `@SuppressWarnings("null")` annotations. There is too many false positives for making null check useful. This commit contains opportunistic comment formatting in modified files. Corresponding changes in NetBeans project configuration: - Disable null checks because too many false positives. - Disable other hints that not available in Java 11. --- .../java/org/apache/sis/console/CommandRunner.java | 2 +- .../org/apache/sis/coverage/grid/GridGeometry.java | 1 - .../apache/sis/feature/DefaultAssociationRole.java | 13 +++--- .../java/org/apache/sis/feature/FeatureFormat.java | 5 +-- .../apache/sis/feature/builder/TypeBuilder.java | 1 - .../org/apache/sis/filter/ComparisonFilter.java | 1 - .../sis/internal/jaxb/NonMarshalledAuthority.java | 1 - .../sis/internal/jaxb/lan/LocaleAndCharset.java | 4 +- .../apache/sis/metadata/sql/MetadataWriter.java | 6 +-- .../sis/metadata/iso/extent/ExtentsTest.java | 1 - .../apache/sis/test/xml/DocumentComparator.java | 6 +-- .../org/apache/sis/geometry/AbstractEnvelope.java | 12 ++--- .../org/apache/sis/geometry/CoordinateFormat.java | 5 +-- .../java/org/apache/sis/geometry/Envelopes.java | 3 -- .../org/apache/sis/geometry/GeneralEnvelope.java | 5 +-- .../java/org/apache/sis/geometry/Shapes2D.java | 1 - .../provider/FranceGeocentricInterpolation.java | 5 +-- .../referencing/provider/GeocentricAffine.java | 1 - .../sis/internal/referencing/provider/NADCON.java | 5 +-- .../sis/internal/referencing/provider/NTv2.java | 3 +- .../main/java/org/apache/sis/io/wkt/Formatter.java | 1 - .../apache/sis/io/wkt/GeodeticObjectParser.java | 1 - .../parameter/DefaultParameterDescriptorGroup.java | 1 - .../java/org/apache/sis/parameter/Parameters.java | 1 - .../factory/ConcurrentAuthorityFactory.java | 1 - .../referencing/factory/sql/EPSGDataAccess.java | 1 - .../operation/CoordinateOperationFinder.java | 5 +-- .../sis/referencing/operation/matrix/Matrices.java | 9 ++-- .../transform/DefaultMathTransformFactory.java | 1 - .../sis/referencing/factory/TestFactorySource.java | 1 - .../factory/sql/epsg/DataScriptFormatter.java | 1 - .../main/java/org/apache/sis/math/ArrayVector.java | 21 +++++---- .../src/main/java/org/apache/sis/setup/About.java | 2 +- .../sis/util/collection/DefaultTreeTable.java | 1 - .../sis/util/collection/TreeTableFormat.java | 11 +++-- ide-project/NetBeans/nbproject/cfg_hints.xml | 52 ++++++++++++++++++++++ .../org/apache/sis/storage/geotiff/CRSBuilder.java | 3 +- .../sis/internal/netcdf/ucar/DecoderWrapper.java | 1 - .../apache/sis/storage/netcdf/MetadataReader.java | 1 - .../org/apache/sis/storage/DataStoreRegistry.java | 2 +- .../org/apache/sis/storage/StorageConnector.java | 1 - 41 files changed, 107 insertions(+), 92 deletions(-) diff --git a/application/sis-console/src/main/java/org/apache/sis/console/CommandRunner.java b/application/sis-console/src/main/java/org/apache/sis/console/CommandRunner.java index fb8f2f5cad..1a33bc9e3a 100644 --- a/application/sis-console/src/main/java/org/apache/sis/console/CommandRunner.java +++ b/application/sis-console/src/main/java/org/apache/sis/console/CommandRunner.java @@ -221,7 +221,7 @@ abstract class CommandRunner { console = System.console(); colors = (value != null) ? Option.COLORS.parseBoolean(value) : (console != null) && X364.isAnsiSupported(); } catch (RuntimeException e) { - @SuppressWarnings("null") // 'option' has been assigned in 'get' argument. + @SuppressWarnings("null") // `option` has been assigned in `get` argument. final String name = option.label(); throw new InvalidOptionException(Errors.format(Errors.Keys.IllegalOptionValue_2, name, value), name); } diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java index bfc22b4402..3a2aaf195e 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java +++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java @@ -522,7 +522,6 @@ public class GridGeometry implements LenientComparable, Serializable { * @param rounding controls behavior of rounding from floating point values to integers. * @throws IllegalGridGeometryException if the math transform cannot compute the grid extent or the resolution. */ - @SuppressWarnings("null") public GridGeometry(final PixelInCell anchor, final MathTransform gridToCRS, final Envelope envelope, final GridRoundingMode rounding) { if (gridToCRS == null) { ArgumentChecks.ensureNonNull("envelope", envelope); diff --git a/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java b/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java index cf1d6aac7a..14f98fc51b 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java +++ b/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java @@ -233,14 +233,14 @@ public class DefaultAssociationRole extends FieldType implements FeatureAssociat } else { /* * The feature that we need to resolve is not the one we just created. Maybe we can find - * this desired feature in an association of the 'creating' feature, instead of beeing - * the 'creating' feature itself. This is a little bit unusual, but not illegal. + * this desired feature in an association of the `creating` feature, instead of beeing + * the `creating` feature itself. This is a little bit unusual, but not illegal. */ final List<FeatureType> deferred = new ArrayList<>(); resolved = search(creating, properties, name, deferred); if (resolved == null) { /* - * Did not found the desired FeatureType in the 'creating' instance. + * Did not found the desired FeatureType in the `creating` instance. * Try harder, by searching recursively in associations of associations. */ if (deferred.isEmpty() || (resolved = deepSearch(deferred, name)) == null) { @@ -270,7 +270,6 @@ public class DefaultAssociationRole extends FieldType implements FeatureAssociat * @param deferred where to store {@code FeatureType}s to be eventually used for a deep search. * @return the feature of the given name, or {@code null} if none. */ - @SuppressWarnings("null") private static FeatureType search(final FeatureType feature, Collection<? extends PropertyType> properties, final GenericName name, final List<FeatureType> deferred) { @@ -365,7 +364,7 @@ public class DefaultAssociationRole extends FieldType implements FeatureAssociat public final FeatureType getValueType() { /* * This method shall be final for consistency with other methods in this classes - * which use the 'valueType' field directly. Furthermore, this method is invoked + * which use the `valueType` field directly. Furthermore, this method is invoked * (indirectly) by DefaultFeatureType constructors. */ FeatureType type = valueType; @@ -491,8 +490,8 @@ public class DefaultAssociationRole extends FieldType implements FeatureAssociat @Override public int hashCode() { /* - * Do not use the full 'valueType' object for computing hash code, - * because it may change before and after 'resolve' is invoked. In + * Do not use the full `valueType` object for computing hash code, + * because it may change before and after `resolve` is invoked. In * addition, this avoid infinite recursivity in case of cyclic graph. */ return super.hashCode() + valueType.getName().hashCode(); diff --git a/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java b/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java index 78011cce79..6b55312d79 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java +++ b/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java @@ -307,7 +307,6 @@ public class FeatureFormat extends TabularFormat<Object> { * @throws IOException if an error occurred while writing to the given appendable. */ @Override - @SuppressWarnings("null") // Many false positives in this method. public void format(final Object object, final Appendable toAppendTo) throws IOException { ArgumentChecks.ensureNonNull("object", object); ArgumentChecks.ensureNonNull("toAppendTo", toAppendTo); @@ -629,9 +628,9 @@ format: for (final AttributeType<?> ct : ((AttributeType<?>) Collection<?> cv = CollectionsExt.singletonOrEmpty(ct.getDefaultValue()); if (feature != null) { /* - * Usually, the property 'cp' below is null because all features use the same + * Usually, the property `cp` below is null because all features use the same * characteristic value (for example the same unit of measurement), which is - * given by the default value 'cv'. Nevertheless we have to check if current + * given by the default value `cv`. Nevertheless we have to check if current * feature overrides this characteristic. */ final Property cp = feature.getProperty(propertyType.getName().toString()); diff --git a/core/sis-feature/src/main/java/org/apache/sis/feature/builder/TypeBuilder.java b/core/sis-feature/src/main/java/org/apache/sis/feature/builder/TypeBuilder.java index 475c0272d1..59d7249d4e 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/feature/builder/TypeBuilder.java +++ b/core/sis-feature/src/main/java/org/apache/sis/feature/builder/TypeBuilder.java @@ -433,7 +433,6 @@ public abstract class TypeBuilder implements Localized { * @return element of the given name, or {@code null} if none were found. * @throws IllegalArgumentException if the given name is ambiguous. */ - @SuppressWarnings("null") final <E extends TypeBuilder> E forName(final List<E> types, final String name, final boolean nonAmbiguous) { E best = null; // Best type found so far. E ambiguity = null; // If two types are found at the same depth, the other type. diff --git a/core/sis-feature/src/main/java/org/apache/sis/filter/ComparisonFilter.java b/core/sis-feature/src/main/java/org/apache/sis/filter/ComparisonFilter.java index e7e7540274..5e43ed87d3 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/filter/ComparisonFilter.java +++ b/core/sis-feature/src/main/java/org/apache/sis/filter/ComparisonFilter.java @@ -236,7 +236,6 @@ abstract class ComparisonFilter<R> extends BinaryFunction<R,Object,Object> * @param left the first object to compare. Must be non-null. * @param right the second object to compare. Must be non-null. */ - @SuppressWarnings("null") private boolean evaluate(Object left, Object right) { /* * For numbers, the apply(…) method inherited from parent class will delegate to specialized methods like diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java index 33010e5040..21b6577c93 100644 --- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java +++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java @@ -216,7 +216,6 @@ public final class NonMarshalledAuthority<T> extends CitationConstant.Authority< * * @see #setMarshallable(Collection, Identifier) */ - @SuppressWarnings("null") public static Collection<? extends Identifier> setMarshallables( final Collection<Identifier> identifiers, final Collection<? extends Identifier> newValues) { diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/lan/LocaleAndCharset.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/lan/LocaleAndCharset.java index c465140092..e99f8b7ccb 100644 --- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/lan/LocaleAndCharset.java +++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/lan/LocaleAndCharset.java @@ -350,7 +350,6 @@ public final class LocaleAndCharset implements Node { * @param newValues the new languages. * @return the given map, or a new map if necessary and the given map was null. */ - @SuppressWarnings("null") public static Map<Locale,Charset> setLanguages(Map<Locale,Charset> locales, final Collection<? extends Locale> newValues) { final Charset encoding = (locales != null) ? CollectionsExt.first(locales.values()) : null; if (newValues == null || newValues.isEmpty()) { @@ -369,8 +368,9 @@ public final class LocaleAndCharset implements Node { /* * If an encoding was defined before invocation of this method and is not associated to any * locale specified in `newValues`, preserve that encoding in an entry with null locale. + * Note: `locales` is non-null if `encoding` is non-null. */ - if (encoding != null && !locales.values().contains(encoding)) { // `locales` is non-null if `encoding` is non-null. + if (encoding != null && !locales.values().contains(encoding)) { locales.put(null, encoding); } return locales; diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java index 98223d0a27..e3b70e62e7 100644 --- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java +++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataWriter.java @@ -301,11 +301,11 @@ public class MetadataWriter extends MetadataSource { } /* * We have found a column to add. Check if the column actually needs to be added to the parent table - * (if such parent exists). In most case, the answer is "no" and 'addTo' is equal to 'table'. + * (if such parent exists). In most case, the answer is "no" and `addTo` is equal to `table`. */ String addTo = table; if (helper.dialect.supportsTableInheritance) { - @SuppressWarnings("null") + @SuppressWarnings("null") // `colTables` is initialized in same time than `colTypes`. final Class<?> declaring = colTables.get(column); if (!interfaceType.isAssignableFrom(declaring)) { addTo = getTableName(declaring); @@ -402,7 +402,7 @@ public class MetadataWriter extends MetadataSource { /* * Process all dependencies now. This block may invoke this method recursively. * Once a dependency has been added to the database, the corresponding value in - * the 'asMap' HashMap is replaced by the identifier of the dependency we just added. + * the `asMap` HashMap is replaced by the identifier of the dependency we just added. */ Map<String,FKey> referencedTables = null; for (final Map.Entry<String,Object> entry : asSingletons.entrySet()) { diff --git a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java index 122699462e..6b096f44be 100644 --- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java +++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java @@ -62,7 +62,6 @@ public final class ExtentsTest extends TestCase { * @throws IncommensurableException if a conversion between incompatible units were attempted. */ @Test - @SuppressWarnings("null") public void testGetVerticalRange() throws IncommensurableException { final List<DefaultVerticalExtent> extents = Arrays.asList( new DefaultVerticalExtent( -200, -100, VerticalCRSMock.HEIGHT), diff --git a/core/sis-metadata/src/test/java/org/apache/sis/test/xml/DocumentComparator.java b/core/sis-metadata/src/test/java/org/apache/sis/test/xml/DocumentComparator.java index c5c721665d..a3e568caa3 100644 --- a/core/sis-metadata/src/test/java/org/apache/sis/test/xml/DocumentComparator.java +++ b/core/sis-metadata/src/test/java/org/apache/sis/test/xml/DocumentComparator.java @@ -470,7 +470,6 @@ public class DocumentComparator { * @param expected the node having the expected attributes. * @param actual the node to compare. */ - @SuppressWarnings("null") protected void compareAttributes(final Node expected, final Node actual) { final NamedNodeMap expectedAttributes = expected.getAttributes(); final NamedNodeMap actualAttributes = actual.getAttributes(); @@ -500,7 +499,7 @@ public class DocumentComparator { * └───────────────────┴─────────────────────────────────┴──────────────┴─────────────┘ * * By default, this block is not be executed. However if the user gave us Nodes that are - * not namespace aware, then the 'isIgnored(…)' method will try to parse the node name. + * not namespace aware, then the `isIgnored(…)` method will try to parse the node name. */ name = expAttr.getNodeName(); } @@ -528,7 +527,7 @@ public class DocumentComparator { if (!ignored.isEmpty()) { if (ns == null) { /* - * If there is no namespace, then the 'name' argument should be the qualified name + * If there is no namespace, then the `name` argument should be the qualified name * (with a prefix). Example: "xsi:schemaLocation". We will look first for an exact * name match, then for a match after replacing the local name by "*". */ @@ -754,7 +753,6 @@ public class DocumentComparator { * @param node the node to format. * @param lineSeparator the platform-specific line separator. */ - @SuppressWarnings("null") private static void formatNode(final StringBuilder buffer, final Node node, final String lineSeparator) { if (node == null) { buffer.append("(no node)").append(lineSeparator); diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java index 56998127d3..176be0fbf6 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java @@ -601,7 +601,7 @@ public abstract class AbstractEnvelope extends FormattableObject implements Enve final int dimension = getDimension(); for (int i=0; i!=dimension; i++) { final double span = getUpper(i) - getLower(i); // Do not use getSpan(i). - if (!(span > 0)) { // Use '!' for catching NaN. + if (!(span > 0)) { // Use `!` for catching NaN. if (!isNegative(span)) { return EMPTY; // Span is positive zero. } @@ -651,11 +651,11 @@ public abstract class AbstractEnvelope extends FormattableObject implements Enve } /* * Assign the minimum and maximum coordinate values in the dimension where a wraparound has been found. - * The 'for' loop below iterates only over the 'i' values for which the 'isWrapAround' bit is set to 1. + * The `for` loop below iterates only over the `i` values for which the `isWrapAround` bit is set to 1. */ int mask = 1; // For identifying whether we need to set the lower or the upper coordinate. - @SuppressWarnings("null") - final CoordinateSystem cs = crs.getCoordinateSystem(); // Should not be null at this point. + @SuppressWarnings("null") // CRS should not be null at this point. + final CoordinateSystem cs = crs.getCoordinateSystem(); for (int i; (i = Long.numberOfTrailingZeros(isWrapAround)) != Long.SIZE; isWrapAround &= ~(1L << i)) { final CoordinateSystemAxis axis = cs.getAxis(i); final double min = axis.getMinimumValue(); @@ -699,7 +699,7 @@ public abstract class AbstractEnvelope extends FormattableObject implements Enve return true; } for (int i=0; i<dimension; i++) { - if (!(getSpan(i) > 0)) { // Use '!' in order to catch NaN + if (!(getSpan(i) > 0)) { // Use `!` in order to catch NaN return true; } } @@ -778,7 +778,7 @@ public abstract class AbstractEnvelope extends FormattableObject implements Enve if (isNegative(upper - lower)) { /* * "Crossing the anti-meridian" case: if we reach this point, then the - * [upper...lower] range (note the 'lower' and 'upper' interchanging) + * [upper...lower] range (note the `lower` and `upper` interchanging) * is actually a space outside the envelope and we have checked that * the coordinate value is outside that space. */ diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java index 7ea1996634..8238da32db 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java @@ -966,7 +966,6 @@ public class CoordinateFormat extends CompoundFormat<DirectPosition> { * * @param crs the target CRS in the conversion from ground units to CRS units. */ - @SuppressWarnings("null") private void applyGroundPrecision(final CoordinateReferenceSystem crs) { /* * If the given resolution is linear (for example in metres), compute an equivalent resolution in degrees @@ -1622,13 +1621,13 @@ skipSep: if (i != 0) { throw new LocalizedParseException(getLocale(), key, args, index); } /* - * At this point 'subPos' is set to the beginning of the next coordinate to parse in 'asString'. + * At this point `subPos` is set to the beginning of the next coordinate to parse in `asString`. * Parse the value as a number, angle or date, as determined from the coordinate system axis. */ if (formats != null) { format = formats[i]; } - @SuppressWarnings("null") + @SuppressWarnings("null") // `format` was initially null only if `formats` is non-null. final Object object = format.parseObject(asString, subPos); if (object == null) { /* diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java index 8d829b99bb..4736cef6b6 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java @@ -302,7 +302,6 @@ public final class Envelopes extends Static { * @throws TransformException if the point cannot be transformed * or if a problem occurred while calculating the derivative. */ - @SuppressWarnings("null") static Matrix derivativeAndTransform(final MathTransform transform, final double[] srcPts, final double[] dstPts, final int dstOff, final boolean derivate) throws TransformException { @@ -376,7 +375,6 @@ public final class Envelopes extends Static { * or {@code null} for computing the union of all results instead. * @return the transformed envelope. May be {@code null} if {@code results} was non-null. */ - @SuppressWarnings("null") private static GeneralEnvelope transform(final MathTransform transform, final Envelope envelope, double[] targetPt, final List<GeneralEnvelope> results) throws TransformException { @@ -607,7 +605,6 @@ nextPoint: for (int pointIndex = 0;;) { // Break condition at th * * @since 0.5 */ - @SuppressWarnings("null") public static GeneralEnvelope transform(final CoordinateOperation operation, Envelope envelope) throws TransformException { diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java index 7e84dbf427..5a56f97871 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java @@ -418,7 +418,6 @@ public class GeneralEnvelope extends ArrayEnvelope implements Cloneable, Seriali System.arraycopy(source, srcOffset, coordinates, beginIndex, dimension); System.arraycopy(source, srcOffset + (source.length >>> 1), coordinates, beginIndex + d, dimension); } else { - @SuppressWarnings("null") final DirectPosition lower = envelope.getLowerCorner(); final DirectPosition upper = envelope.getUpperCorner(); for (int i=0; i<dimension; i++) { @@ -845,7 +844,7 @@ public class GeneralEnvelope extends ArrayEnvelope implements Cloneable, Seriali final double max1 = upper.getOrdinate(i); final double span0 = max0 - min0; final double span1 = max1 - min1; - if (isSameSign(span0, span1)) { // Always 'false' if any value is NaN. + if (isSameSign(span0, span1)) { // Always `false` if any value is NaN. /* * First, verify that the two envelopes intersect. * ┌──────────┐ ┌─────────────┐ @@ -1155,7 +1154,7 @@ public class GeneralEnvelope extends ArrayEnvelope implements Cloneable, Seriali final int iUpper = iLower + d; final double lower = coordinates[iLower]; final double upper = coordinates[iUpper]; - if (isNegative(upper - lower)) { // Use 'isNegative' for catching [+0 … -0] range. + if (isNegative(upper - lower)) { // Use `isNegative(…)` for catching [+0 … -0] range. final CoordinateSystemAxis axis = getAxis(crs, i); if (isWrapAround(axis)) { changed = true; diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Shapes2D.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Shapes2D.java index 9e4bddc033..a9bd3c57c8 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Shapes2D.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Shapes2D.java @@ -411,7 +411,6 @@ public final class Shapes2D extends Static { * @see #transform(MathTransform2D, Rectangle2D, Rectangle2D) * @see Envelopes#transform(CoordinateOperation, Envelope) */ - @SuppressWarnings("null") public static Rectangle2D transform(final CoordinateOperation operation, final Rectangle2D envelope, Rectangle2D destination) diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java index caf95df88b..ddb61882f5 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java @@ -365,7 +365,6 @@ public class FranceGeocentricInterpolation extends GeodeticOperation { * @param averages an "average" value for the offset in each dimension, or {@code null} if unknown. * @param scale the factor by which to multiply each compressed value before to add to the average value. */ - @SuppressWarnings("null") static DatumShiftGridFile<Angle,Length> getOrLoad(final Path file, final double[] averages, final double scale) throws FactoryException { @@ -477,7 +476,7 @@ public class FranceGeocentricInterpolation extends GeodeticOperation { Level.WARNING, Errors.Keys.UnsupportedInterpolation_1, interp); record.setLoggerName(Loggers.COORDINATE_OPERATION); Logging.log(FranceGeocentricInterpolation.class, "createMathTransform", record); - // We declare 'createMathTransform' method because it is closer to public API. + // We declare `createMathTransform(…)` method because it is closer to public API. } break; } @@ -528,7 +527,7 @@ public class FranceGeocentricInterpolation extends GeodeticOperation { tZ[p] = -parseFloat(t.nextToken()); final double accuracy = ACCURACY[Math.min(ACCURACY.length - 1, Math.max(0, Integer.parseInt(t.nextToken()) - 1))]; - if (!(accuracy >= grid.accuracy)) { // Use '!' for replacing the initial NaN. + if (!(accuracy >= grid.accuracy)) { // Use `!` for replacing the initial NaN. grid.accuracy = accuracy; } } while ((line = in.readLine()) != null); diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java index cba324290f..bc0a0e21b7 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java @@ -339,7 +339,6 @@ public abstract class GeocentricAffine extends GeodeticOperation { { return null; // Coordinate systems are not two EllipsoidalCS or two CartesianCS. } - @SuppressWarnings("null") int dimension = sourceCS.getDimension(); if (dimension != targetCS.getDimension()) { dimension = 4; // Any value greater than 3 means "mismatched dimensions" for this method. diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java index 7111e2c7a8..0828872fd7 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java @@ -155,7 +155,6 @@ public final class NADCON extends AbstractProvider { * @param latitudeShifts name of the grid file for latitude shifts. * @param longitudeShifts name of the grid file for longitude shifts. */ - @SuppressWarnings("null") static DatumShiftGridFile<Angle,Angle> getOrLoad(final Path latitudeShifts, final Path longitudeShifts) throws FactoryException { @@ -171,7 +170,7 @@ public final class NADCON extends AbstractProvider { final Loader loader; Path file = latitudeShifts; try { - // Note: buffer size must be divisible by the size of 'float' data type. + // Note: buffer size must be divisible by the size of `float` data type. final ByteBuffer buffer = ByteBuffer.allocate(4096).order(ByteOrder.LITTLE_ENDIAN); final FloatBuffer fb = buffer.asFloatBuffer(); try (ReadableByteChannel in = Files.newByteChannel(rlat)) { @@ -445,7 +444,7 @@ public final class NADCON extends AbstractProvider { } /* * Convert seconds to degrees for consistency with the unit declared at the beginning of this method, - * then divide by cell size for consistency with the 'isCellRatio = true' configuration. + * then divide by cell size for consistency with the `isCellRatio = true` configuration. */ for (int i=0; i<array.length; i++) { array[i] /= scale; diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java index be435672eb..108d96fe9e 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java @@ -158,7 +158,6 @@ public final class NTv2 extends AbstractProvider { * @param file name of the datum shift grid file to load. * @param version the expected version (1 or 2). */ - @SuppressWarnings("null") static DatumShiftGridFile<Angle,Angle> getOrLoad(final Class<? extends AbstractProvider> provider, final Path file, final int version) throws FactoryException { @@ -567,7 +566,7 @@ public final class NTv2 extends AbstractProvider { ty[i] = (float) (buffer.getFloat() / dy); // Division by dx and dy because isCellValueRatio = true. tx[i] = (float) (buffer.getFloat() / dx); final double accuracy = Math.min(buffer.getFloat() / dy, buffer.getFloat() / dx); - if (accuracy > 0 && !(accuracy >= data.accuracy)) { // Use '!' for replacing the initial NaN. + if (accuracy > 0 && !(accuracy >= data.accuracy)) { // Use `!` for replacing the initial NaN. data.accuracy = accuracy; // Smallest non-zero accuracy. } } diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java index aced9fad00..f64bef6d26 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java @@ -796,7 +796,6 @@ public class Formatter implements Localized { * A {@code <remark>} can be included within the descriptions of source and target CRS embedded within * a coordinate transformation as well as within the coordinate transformation itself.</blockquote> */ - @SuppressWarnings("null") private void appendComplement(final IdentifiedObject object, final FormattableObject parent, final FormattableObject gp) { isComplement = true; final boolean showIDs; // Whether to format ID[…] elements. diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java index a50cab95e3..5bae69b55b 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java @@ -1882,7 +1882,6 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo * @return the {@code "VerticalCRS"} element as a {@link VerticalCRS} object. * @throws ParseException if the {@code "VerticalCRS"} element cannot be parsed. */ - @SuppressWarnings("null") private SingleCRS parseVerticalCRS(final int mode, final Element parent, final boolean isBaseCRS) throws ParseException { diff --git a/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java b/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java index 7728d40087..d1b3071673 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java @@ -367,7 +367,6 @@ public class DefaultParameterDescriptorGroup extends AbstractParameterDescriptor * @throws ParameterNotFoundException if there is no parameter for the given name. */ @Override - @SuppressWarnings("null") public GeneralParameterDescriptor descriptor(final String name) throws ParameterNotFoundException { // Quick search for an exact match. ArgumentChecks.ensureNonNull("name", name); diff --git a/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java b/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java index 59d38f21a0..c68b6d02c6 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java @@ -414,7 +414,6 @@ public abstract class Parameters implements ParameterValueGroup, Cloneable { * The {@link DefaultParameterValueGroup} subclass will override this method with a more efficient * implementation which avoid creating some deferred parameters. */ - @SuppressWarnings("null") ParameterValue<?> parameterIfExist(final String name) throws ParameterNotFoundException { int i1 = 0, i2 = 0; ParameterValue<?> first = null; diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java index 2bdb38399c..823976a0af 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java @@ -388,7 +388,6 @@ public abstract class ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFa * @return Data Access Object (DAO) to use in {@code createFoo(String)} methods. * @throws FactoryException if the Data Access Object creation failed. */ - @SuppressWarnings("null") private DAO getDataAccess() throws FactoryException { /* * First checks if the current thread is already using a factory. If yes, we will diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java index 7481a76ebd..7985cabf94 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java @@ -2834,7 +2834,6 @@ next: while (r.next()) { * @throws FactoryException if the object creation failed for some other reason. */ @Override - @SuppressWarnings("null") public synchronized CoordinateOperation createCoordinateOperation(final String code) throws NoSuchAuthorityCodeException, FactoryException { diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java index 436735e4d3..c32c92e177 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java @@ -500,16 +500,15 @@ public class CoordinateOperationFinder extends CoordinateOperationRegistry { * for the area of interest.</li> * </ul> * - * <p>This method returns only <em>one</em> step for a chain of concatenated operations (to be built by the caller). + * This method returns only <em>one</em> step for a chain of concatenated operations (to be built by the caller). * But a list is returned because the same step may be implemented by different operation methods. Only one element - * in the returned list should be selected (usually the first one).</p> + * in the returned list should be selected (usually the first one). * * @param sourceCRS input coordinate reference system. * @param targetCRS output coordinate reference system. * @return a coordinate operation from {@code sourceCRS} to {@code targetCRS}. * @throws FactoryException if the operation cannot be constructed. */ - @SuppressWarnings("null") protected List<CoordinateOperation> createOperationStep(final GeodeticCRS sourceCRS, final GeodeticCRS targetCRS) throws FactoryException diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java index b20281f0aa..9e32ade91b 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java @@ -235,7 +235,6 @@ public final class Matrices extends Static { * @param useEnvelopes {@code true} if source and destination envelopes shall be taken in account. * If {@code false}, then source and destination envelopes will be ignored and can be null. */ - @SuppressWarnings("null") private static MatrixSIS createTransform(final Envelope srcEnvelope, final AxisDirection[] srcAxes, final Envelope dstEnvelope, final AxisDirection[] dstAxes, final boolean useEnvelopes) @@ -645,7 +644,7 @@ public final class Matrices extends Static { int targetDimensions = subMatrix.getNumRow(); /* * Get data from the source matrix, together with the error terms if present. - * The 'stride' and 'length' values will be used for computing indices in that array. + * The `stride` and `length` values will be used for computing indices in that array. * The DoubleDouble temporary object is used only if the array contains error terms. */ final int stride = sourceDimensions; @@ -677,7 +676,7 @@ public final class Matrices extends Static { targetDimensions, 1); // Copy some rows of only 1 column. /* * Set the pseudo-diagonal elements on the trailing new dimensions. - * 'diff' is zero for a square matrix and non-zero for rectangular matrix. + * `diff` is zero for a square matrix and non-zero for rectangular matrix. */ final int diff = targetDimensions - sourceDimensions; for (int i=lastColumn - numTrailingCoordinates; i<lastColumn; i++) { @@ -1081,7 +1080,7 @@ public final class Matrices extends Static { if (i == j) { e--; } - if (!(Math.abs(e) <= tolerance)) { // Uses '!' in order to catch NaN values. + if (!(Math.abs(e) <= tolerance)) { // Uses `!` in order to catch NaN values. return false; } } @@ -1275,7 +1274,7 @@ public final class Matrices extends Static { /* * If the number use exponential notation, we will not be allowed to append any zero. * Otherwise we will append some zeros for right-alignment, but without exceeding the - * IEEE 754 'double' accuracy for not giving a false sense of precision. + * IEEE 754 `double` accuracy for not giving a false sense of precision. */ if (element.indexOf('E') < 0) { final int accuracy = -DecimalFunctions.floorLog10(Math.ulp(value)); diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java index be1a205e43..571062d004 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java @@ -1035,7 +1035,6 @@ public class DefaultMathTransformFactory extends AbstractFactory implements Math * * @see #getCompletedParameters() */ - @SuppressWarnings("null") final RuntimeException completeParameters(final DefaultMathTransformFactory factory, OperationMethod method, final ParameterValueGroup userParams) throws FactoryException, IllegalArgumentException { diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java index 34578dad92..b47f3bd7ab 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java @@ -127,7 +127,6 @@ public final class TestFactorySource { * * @throws FactoryException if an error occurred while creating the factory. */ - @SuppressWarnings("null") public static synchronized void createFactory() throws FactoryException { if (!isUnavailable) { EPSGFactory af = factory; diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java index be86f8f9e1..881c63b6df 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java @@ -445,7 +445,6 @@ public final class DataScriptFormatter extends ScriptRunner { /** * Removes the useless "E0" exponents after floating point numbers. */ - @SuppressWarnings("null") private String removeUselessExponents(String line) { StringBuilder cleaned = null; final Matcher matcher = uselessExponentPattern.matcher(line); diff --git a/core/sis-utility/src/main/java/org/apache/sis/math/ArrayVector.java b/core/sis-utility/src/main/java/org/apache/sis/math/ArrayVector.java index fee30e2be6..b92c86a738 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/math/ArrayVector.java +++ b/core/sis-utility/src/main/java/org/apache/sis/math/ArrayVector.java @@ -97,7 +97,6 @@ abstract class ArrayVector<E extends Number> extends Vector implements CheckedCo * or {@code null} if this method cannot do better than the given {@code Vector} instance. * This method shall be invoked only for vector of integer values (this is not verified). */ - @SuppressWarnings("null") static Vector compress(final Vector source, final long min, final long max) { boolean isSigned = (min >= Byte.MIN_VALUE && max <= Byte.MAX_VALUE); if (isSigned || (min >= 0 && max <= 0xFF)) { @@ -144,8 +143,8 @@ abstract class ArrayVector<E extends Number> extends Vector implements CheckedCo static Vector compress(final Vector source, final double tolerance) { if (!Float.class.equals(source.getElementType())) { /* - * For floating point types, verify if values are equivalent to 'float' values. - * There is two different ways to pad extra fraction digits in 'double' values: + * For floating point types, verify if values are equivalent to `float` values. + * There is two different ways to pad extra fraction digits in `double` values: * with zero fraction digits in base 2 representation (the standard Java cast), * or with zero fraction digits in base 10 representation. */ @@ -154,7 +153,7 @@ abstract class ArrayVector<E extends Number> extends Vector implements CheckedCo double v; do if (i >= length) { return new Floats(source.floatValues()); - } while (!(Math.abs((v = source.doubleValue(i++)) - (float) v) > tolerance)); // Use '!' for accepting NaN. + } while (!(Math.abs((v = source.doubleValue(i++)) - (float) v) > tolerance)); // Use `!` for accepting NaN. /* * Same try than above loop, but now using base 10 representation. * This is a more costly computation. @@ -583,7 +582,7 @@ abstract class ArrayVector<E extends Number> extends Vector implements CheckedCo * signed integers. Consequently, we do not need to distinguish the two cases during the loop. */ @Override public final Number increment(final double tolerance) { - if (!(tolerance >= 0 && tolerance < 1)) { // Use '!' for catching NaN. + if (!(tolerance >= 0 && tolerance < 1)) { // Use `!` for catching NaN. return super.increment(tolerance); } int i = array.length; @@ -713,7 +712,7 @@ abstract class ArrayVector<E extends Number> extends Vector implements CheckedCo * signed integers. Consequently, we do not need to distinguish the two cases during the loop. */ @Override public final Number increment(final double tolerance) { - if (!(tolerance >= 0 && tolerance < 1)) { // Use '!' for catching NaN. + if (!(tolerance >= 0 && tolerance < 1)) { // Use `!` for catching NaN. return super.increment(tolerance); } int i = array.length; @@ -728,7 +727,7 @@ abstract class ArrayVector<E extends Number> extends Vector implements CheckedCo return null; } } - // Do not use the ?: operator below since it casts 'asInt' to Long, which is not wanted. + // Do not use the ?: operator below since it casts `asInt` to Long, which is not wanted. if (isSigned) { return asInt; } else { @@ -842,8 +841,8 @@ abstract class ArrayVector<E extends Number> extends Vector implements CheckedCo } /* - * Not worth to override 'increment(double)' because the array cannot be long anyway - * (except if the increment is zero) and the implicit conversion of 'short' to 'int' + * Not worth to override `increment(double)` because the array cannot be long anyway + * (except if the increment is zero) and the implicit conversion of `short` to `int` * performed by Java would make the implementation a little bit more tricky. */ @@ -951,8 +950,8 @@ abstract class ArrayVector<E extends Number> extends Vector implements CheckedCo } /* - * Not worth to override 'increment(double)' because the array cannot be long anyway - * (except if the increment is zero) and the implicit conversion of 'byte' to 'int' + * Not worth to override `increment(double)` because the array cannot be long anyway + * (except if the increment is zero) and the implicit conversion of `byte` to `int` * performed by Java would make the implementation a little bit more tricky. */ diff --git a/core/sis-utility/src/main/java/org/apache/sis/setup/About.java b/core/sis-utility/src/main/java/org/apache/sis/setup/About.java index 9feede5beb..7f84dee8cb 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/setup/About.java +++ b/core/sis-utility/src/main/java/org/apache/sis/setup/About.java @@ -470,7 +470,7 @@ fill: for (int i=0; ; i++) { if (name == null) { name = resources.getString(nameKey); } - @SuppressWarnings("null") + @SuppressWarnings("null") // `section` is non-null because of initially non-null `newSection`. final TreeTable.Node node = section.newChild(); node.setValue(NAME, name); if (children != null) { diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java b/core/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java index 6bf8660220..3ef3214f3d 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java +++ b/core/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java @@ -695,7 +695,6 @@ public class DefaultTreeTable implements TreeTable, Cloneable, Serializable { * @return {@code true} if the two objects are equal, ignoring the parent node. */ @Override - @SuppressWarnings("null") public boolean equals(final Object other) { if (other == this) { return true; diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java b/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java index 019cf0cf71..8eea14fe63 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java +++ b/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java @@ -405,14 +405,13 @@ public class TreeTableFormat extends TabularFormat<TreeTable> { * @throws ParseException if an error occurred while parsing a node value. */ @Override - @SuppressWarnings("null") public TreeTable parse(final CharSequence text, final ParsePosition pos) throws ParseException { final Matcher matcher = getColumnSeparatorMatcher(text); final int length = text.length(); int indexOfLineStart = pos.getIndex(); - int indentationLevel = 0; // Current index in the 'indentations' array. + int indentationLevel = 0; // Current index in the `indentations` array. int[] indentations = new int[16]; // Number of spaces (ignoring drawing characters) for each level. - TreeTable.Node lastNode = null; // Last parsed node, having 'indentation[level]' characters before its content. + TreeTable.Node lastNode = null; // Last parsed node, having `indentation[level]` characters before its content. TreeTable.Node root = null; // First node found while parsing. final DefaultTreeTable table = new DefaultTreeTable(columnIndices != null ? columnIndices : TableColumn.NAME_MAP); final TableColumn<?>[] columns = DefaultTreeTable.getColumns(table.columnIndices); @@ -496,7 +495,7 @@ public class TreeTableFormat extends TabularFormat<TreeTable> { /* * Lower indentation level: go up in the tree until we find the new parent. * Note that lastNode.getParent() should never return null, since only the - * node at 'indentationLevel == 0' has a null parent and we check that case. + * node at `indentationLevel == 0` has a null parent and we check that case. */ if (--indentationLevel < 0) { pos.setErrorIndex(indexOfLineStart); @@ -715,7 +714,7 @@ public class TreeTableFormat extends TabularFormat<TreeTable> { final Format format = getFormat(value.getClass()); if (format instanceof DecimalFormat && Numbers.isFloat(value.getClass())) { final double number = ((Number) value).doubleValue(); - if (number != (int) number) { // Cast to 'int' instead of 'long' as a way to limit to about 2E9. + if (number != (int) number) { // Cast to `int` instead of `long` as a way to limit to about 2E9. /* * The default floating point format uses only 3 fraction digits. We adjust that to the number * of digits required by the number to format. We do that only if no NumberFormat was inferred @@ -810,7 +809,7 @@ public class TreeTableFormat extends TabularFormat<TreeTable> { if (needLineSeparator && lineSeparator != null) { setLineSeparator(lineSeparator + getTreeSymbols(true, isLast[level])); } - format(child, level+1); // 'isLast' must be set before to call this method. + format(child, level+1); // `isLast` must be set before to call this method. } if (lineSeparator != null) { setLineSeparator(lineSeparator); // Restore previous state. diff --git a/ide-project/NetBeans/nbproject/cfg_hints.xml b/ide-project/NetBeans/nbproject/cfg_hints.xml index 4c832fa7d3..bc79ffd6ea 100644 --- a/ide-project/NetBeans/nbproject/cfg_hints.xml +++ b/ide-project/NetBeans/nbproject/cfg_hints.xml @@ -157,5 +157,57 @@ <attribute name="enabled" value="true"/> <attribute name="hintSeverity" value="HINT"/> </node> + <node name="org.netbeans.modules.java.hints.jdk.ConvertToTextBlock"> + <attribute name="enabled" value="false"/> + </node> + <node name="org.netbeans.modules.java.hints.jdk.ConvertTextBlockToString"> + <attribute name="enabled" value="false"/> + </node> + <node name="org.netbeans.modules.java.hints.NoLoggers"> + <attribute name="custom-loggers" value="false"/> + <attribute name="custom-loggers-list" value=""/> + </node> + <node name="org.netbeans.modules.java.hints.errors.ErrorFixesFakeHintCREATE_FINAL_FIELD_CTOR"> + <attribute name="create-final-fields-from-ctor" value="true"/> + </node> + <node name="org.netbeans.modules.java.hints.errors.ErrorFixesFakeHintCREATE_LOCAL_VARIABLE"> + <attribute name="create-local-variables-in-place" value="true"/> + </node> + <node name="org.netbeans.modules.java.hints.jdk.ConvertSwitchToRuleSwitch"> + <attribute name="enabled" value="false"/> + </node> + <node name="org.netbeans.modules.java.hints.jdk.ConvertToNestedRecordPattern"> + <attribute name="enabled" value="false"/> + </node> + <node name="org.netbeans.modules.java.hints.jdk.ConvertToSwitchPatternInstanceOf"> + <attribute name="enabled" value="false"/> + </node> + <node name="org.netbeans.modules.java.hints.errors.ErrorFixesFakeHintSURROUND_WITH_TRY_CATCH"> + <attribute name="surround-try-catch-rethrow" value="false"/> + <attribute name="surround-try-catch-java-util-logging-Logger" value="true"/> + <attribute name="surround-try-catch-rethrow-runtime" value="false"/> + <attribute name="surround-try-catch-org-openide-util-Exceptions" value="true"/> + <attribute name="surround-try-catch-printStackTrace" value="true"/> + </node> + <node name="org.netbeans.modules.java.hints.jdk.ConvertToPatternInstanceOf"> + <attribute name="enabled" value="false"/> + </node> + <node name="org.netbeans.modules.java.hints.jdk.AddUnderscores"> + <attribute name="size-binary" value="4"/> + <attribute name="size-hexadecimal" value="4"/> + <attribute name="size-decimal" value="3"/> + <attribute name="also-with-underscores" value="false"/> + </node> + <node name="org.netbeans.modules.java.hints.jdk.ConvertToRecordPattern"> + <attribute name="enabled" value="false"/> + </node> + <node name="org.netbeans.modules.java.hints.errors.ErrorFixesFakeHintIMPORT_CLASS"> + <attribute name="organize-import-class" value="false"/> + </node> + <node name="org.netbeans.modules.java.hints.bugs.NPECheck"> + <attribute name="unboxing-unknown" value="true"/> + <attribute name="enable-for-fields" value="false"/> + <attribute name="enabled" value="false"/> + </node> </tool> </configuration> diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java index cfcfdbf994..58b39d3af4 100644 --- a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java +++ b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java @@ -464,7 +464,6 @@ final class CRSBuilder extends ReferencingFactoryContainer { * @throws ClassCastException if an object defined by an EPSG code is not of the expected type. * @throws FactoryException if an error occurred during objects creation with the factories. */ - @SuppressWarnings("null") public CoordinateReferenceSystem build(final GeoKeysLoader source) throws FactoryException { try { source.logger = this; @@ -491,7 +490,7 @@ final class CRSBuilder extends ReferencingFactoryContainer { default: invalidValue(GeoKeys.RasterType, code); break; } /* - * First create the main coordinate reference system, as determined by 'ModelType'. + * First create the main coordinate reference system, as determined by `ModelType`. * Then if a vertical CRS exists and the main CRS is not geocentric (in which case * adding a vertical CRS would make no sense), create a three-dimensional compound CRS. */ diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java index 10be35c10f..e29dc154d8 100644 --- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java +++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java @@ -452,7 +452,6 @@ public final class DecoderWrapper extends Decoder implements CancelTask { * @throws DataStoreException if the library of geometric objects is not available. */ @Override - @SuppressWarnings("null") public DiscreteSampling[] getDiscreteSampling(final DataStore lock) throws IOException, DataStoreException { final FeatureDataset features = getFeatureDataSet(); if (features instanceof FeatureDatasetPoint) { diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java b/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java index 28b6494e55..4962e1122e 100644 --- a/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java +++ b/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java @@ -868,7 +868,6 @@ split: while ((start = CharSequences.skipLeadingWhitespaces(value, start, lengt * Adds information about all netCDF variables. This is the {@code <mdb:contentInfo>} element in XML. * This method groups variables by their domains, i.e. variables having the same set of axes are grouped together. */ - @SuppressWarnings("null") private void addContentInfo() { /* * Prepare a list of features and coverages, but without writing metadata now. diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java index 79b018cf20..5ccaaabd59 100644 --- a/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java +++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java @@ -311,7 +311,7 @@ search: for (int ci=0; ci < categories.length; ci++) { } } if (open && selected == null) { - @SuppressWarnings("null") + @SuppressWarnings("null") // `connector` is null only if `selected` is non-null. final String name = connector.getStorageName(); throw new UnsupportedStorageException(null, Resources.Keys.UnknownFormatFor_1, name); } diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java index 4141179c0a..9fcb237b2a 100644 --- a/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java +++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java @@ -1538,7 +1538,6 @@ public class StorageConnector implements Serializable { */ final Map<AutoCloseable,Boolean> toClose = new IdentityHashMap<>(views.size()); for (Coupled c : views.values()) { - @SuppressWarnings("null") Object v = c.view; if (v != view) { if (v instanceof AutoCloseable) {