/** * Makes sure that the zero is positive. We do that in order to workaround a JDK 6 to 8 bug, where * {@link AffineTransform#hashCode()} is inconsistent with {@link AffineTransform#equals(Object)} * if there is zeros of opposite sign. * * <p>The inconsistency is in the use of {@link Double#doubleToLongBits(double)} for hash code and * {@code ==} for testing equality. The former is sensitive to the sign of 0 while the later is not.</p> */ @Workaround(library="JDK", version="8") // Last verified in 1.8.0_05. private static double pz(final double value) { return (value != 0) ? value : 0; }
/** * Makes sure that the zero is positive. We do that in order to workaround a JDK 6 to 8 bug, where * {@link AffineTransform#hashCode()} is inconsistent with {@link AffineTransform#equals(Object)} * if there is zeros of opposite sign. * * <p>The inconsistency is in the use of {@link Double#doubleToLongBits(double)} for hash code and * {@code ==} for testing equality. The former is sensitive to the sign of 0 while the later is not.</p> */ @Workaround(library="JDK", version="8") // Last verified in 1.8.0_05. private static double pz(final double value) { return (value != 0) ? value : 0; }
/** * Work around for RFE #4093999 in Sun's bug database * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.7") private static ParameterDescriptor<?>[] addAxisLengths(final ParameterDescriptor<?>[] parameters) { final ParameterDescriptor<?>[] ext = new ParameterDescriptor<?>[parameters.length + 2]; ext[0] = MapProjection.SEMI_MAJOR; ext[1] = MapProjection.SEMI_MINOR; System.arraycopy(parameters, 0, ext, 2, parameters.length); return ext; }
/** * Work around for RFE #4093999 in Sun's bug database * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.7") private static ParameterDescriptor<?>[] addAxisLengths(final ParameterDescriptor<?>[] parameters) { final ParameterDescriptor<?>[] ext = new ParameterDescriptor<?>[parameters.length + 2]; ext[0] = MapProjection.SEMI_MAJOR; ext[1] = MapProjection.SEMI_MINOR; System.arraycopy(parameters, 0, ext, 2, parameters.length); return ext; }
/** * Workaround for RFE #4093999 * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.8") private static short key(final Object[] parameters) { final short key; switch (parameters.length) { case 1: key = Errors.Keys.UnexpectedEndOfString_1; break; case 2: key = Errors.Keys.UnparsableStringForClass_2; break; case 3: key = Errors.Keys.UnparsableStringForClass_3; break; default: throw new AssertionError(); } return key; }
/** * Workaround for RFE #4093999 * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.8") private static short key(final Object[] parameters) { final short key; switch (parameters.length) { case 1: key = Errors.Keys.UnexpectedEndOfString_1; break; case 2: key = Errors.Keys.UnparsableStringForClass_2; break; case 3: key = Errors.Keys.UnparsableStringForClass_3; break; default: throw new AssertionError(); } return key; }
/** * Returns the region or timeframe in which this reference system is valid, or {@code null} if unspecified. * * @return area or region or timeframe in which this (coordinate) reference system is valid, or {@code null}. * * @see org.apache.sis.metadata.iso.extent.DefaultExtent */ @Override @XmlElement(name = "domainOfValidity") // For an unknown reason, JAXB does not take the adapter declared in package-info for this particular property. @Workaround(library = "JDK", version = "1.8") @XmlJavaTypeAdapter(EX_Extent.class) public Extent getDomainOfValidity() { return domainOfValidity; }
/** * Returns the region or timeframe in which this reference system is valid, or {@code null} if unspecified. * * @return area or region or timeframe in which this (coordinate) reference system is valid, or {@code null}. * * @see org.apache.sis.metadata.iso.extent.DefaultExtent */ @Override @XmlElement(name = "domainOfValidity") // For an unknown reason, JAXB does not take the adapter declared in package-info for this particular property. @Workaround(library = "JDK", version = "1.8") @XmlJavaTypeAdapter(EX_Extent.class) public Extent getDomainOfValidity() { return domainOfValidity; }
/** * Create an instance of {@code JAXBElement<AbstractGMLType>}}. * The type declared in the method signature should be {@code AbstractGMLType}. * However it is declared here as {@code Object} in order to avoid a dependency * toward the GML module. * * @param value the GML {@code AbstractGMLType} value to wrap. * @return the wrapped value. */ @Workaround(library = "JAXB", version = "2.1") @XmlElementDecl(name = "AbstractGML", namespace = Namespaces.GML, substitutionHeadName = "AbstractObject", substitutionHeadNamespace = Namespaces.GML) // Not necessary according javadoc, but appears to be in practice (JAXB 2.1 bug?) public JAXBElement<Object> createAbstractGML(final Object value) { return new JAXBElement<>(AbstractGML_QNAME, Object.class, null, value); }
/** * Create an instance of {@code JAXBElement<AbstractGeometryType>}}. * The type declared in the method signature should be {@code AbstractGeometryType}. * However it is declared here as {@code Object} in order to avoid a dependency * toward the GML module. * * @param value the {@code AbstractGeometryType} value to wrap. * @return the wrapped value. */ @Workaround(library = "JAXB", version = "2.1") @XmlElementDecl(name = "AbstractGeometry", namespace = Namespaces.GML, substitutionHeadName = "AbstractGML", substitutionHeadNamespace = Namespaces.GML) // Not necessary according javadoc, but appears to be in practice (JAXB 2.1 bug?) public JAXBElement<Object> createAbstractGeometry(final Object value) { return new JAXBElement<>(AbstractGeometry_QNAME, Object.class, null, value); } }
/** * Create an instance of {@code JAXBElement<AbstractGMLType>}}. * The type declared in the method signature should be {@code AbstractGMLType}. * However it is declared here as {@code Object} in order to avoid a dependency * toward the GML module. * * @param value the GML {@code AbstractGMLType} value to wrap. * @return the wrapped value. */ @Workaround(library = "JAXB", version = "2.1") @XmlElementDecl(name = "AbstractGML", namespace = Namespaces.GML, substitutionHeadName = "AbstractObject", substitutionHeadNamespace = Namespaces.GML) // Not necessary according javadoc, but appears to be in practice (JAXB 2.1 bug?) public JAXBElement<Object> createAbstractGML(final Object value) { return new JAXBElement<>(AbstractGML_QNAME, Object.class, null, value); }
/** * Create an instance of {@code JAXBElement<AbstractGeometryType>}}. * The type declared in the method signature should be {@code AbstractGeometryType}. * However it is declared here as {@code Object} in order to avoid a dependency * toward the GML module. * * @param value the {@code AbstractGeometryType} value to wrap. * @return the wrapped value. */ @Workaround(library = "JAXB", version = "2.1") @XmlElementDecl(name = "AbstractGeometry", namespace = Namespaces.GML, substitutionHeadName = "AbstractGML", substitutionHeadNamespace = Namespaces.GML) // Not necessary according javadoc, but appears to be in practice (JAXB 2.1 bug?) public JAXBElement<Object> createAbstractGeometry(final Object value) { return new JAXBElement<>(AbstractGeometry_QNAME, Object.class, null, value); } }
/** * Workaround for RFE #4093999 * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.8") private LocalizedParseException(final Locale locale, final Class<?> type, final CharSequence text, final int offset, final int errorOffset) { this(locale, parameters(type, text, offset, Math.max(offset, errorOffset)), errorOffset); }
/** * Workaround for RFE #4093999 * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.8") private DataStoreException(final Locale locale, final Object[] params) { this(locale, IOUtilities.errorMessageKey(params), params); }
/** * Workaround for RFE #4093999 * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.8") private LocalizedParseException(final Locale locale, final Object[] parameters, final int errorOffset) { this(locale, key(parameters), parameters, errorOffset); }
/** * Workaround for RFE #4093999 * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.8") private DataStoreException(final Locale locale, final Object[] params) { this(locale, IOUtilities.errorMessageKey(params), params); }
/** * Work around for RFE #4093999 in Sun's bug database * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.8") private static Initializer initializer(final OperationMethod method, final Parameters parameters) { final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class); roles.put(ParameterRole.CENTRAL_MERIDIAN, CENTRAL_MERIDIAN); roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING); roles.put(ParameterRole.FALSE_NORTHING, FALSE_NORTHING); return new Initializer(method, parameters, roles, Initializer.AUTHALIC_RADIUS); }
/** * Workaround for RFE #4093999 * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.8") private LocalizedParseException(final Locale locale, final Class<?> type, final CharSequence text, final int offset, final int errorOffset) { this(locale, parameters(type, text, offset, Math.max(offset, errorOffset)), errorOffset); }
/** * Work around for RFE #4093999 in Sun's bug database * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.7") private static Initializer initializer(final OperationMethod method, final Parameters parameters) { final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class); roles.put(ParameterRole.CENTRAL_MERIDIAN, LONGITUDE_OF_ORIGIN); roles.put(ParameterRole.SCALE_FACTOR, SCALE_FACTOR); roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING); roles.put(ParameterRole.FALSE_NORTHING, FALSE_NORTHING); return new Initializer(method, parameters, roles, (byte) 0); }
/** * Work around for RFE #4093999 in Sun's bug database * ("Relax constraint on placement of this()/super() call in constructors"). */ @Workaround(library="JDK", version="1.7") private static EnumSet<Option> options() { final EnumSet<Option> options = MetadataCommand.options(); options.remove(Option.TIMEZONE); options.remove(Option.FORMAT); return options; }