You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2016/11/28 15:34:33 UTC
svn commit: r1771762 - in /sis/branches/JDK8/core:
sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/
sis-utility/src/main/java/org/apache/sis/internal/system/
sis-utility/src/main/java/org/apache/sis/internal/util/
Author: desruisseaux
Date: Mon Nov 28 15:34:32 2016
New Revision: 1771762
URL: http://svn.apache.org/viewvc?rev=1771762&view=rev
Log:
Javadoc formatting and add assertions. No significant change in this commit.
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Providers.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySynchronizedIterator.java
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Providers.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Providers.java?rev=1771762&r1=1771761&r2=1771762&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Providers.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Providers.java [UTF-8] Mon Nov 28 15:34:32 2016
@@ -43,7 +43,7 @@ public final class Providers extends Laz
/**
* Caches a new element, possibly substituting the created instance by a previously created instance.
*
- * @param element The element to add to the cache.
+ * @param element the element to add to the cache.
*/
@Override
protected void cache(OperationMethod element) {
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java?rev=1771762&r1=1771761&r2=1771762&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java [UTF-8] Mon Nov 28 15:34:32 2016
@@ -67,9 +67,9 @@ public final class DefaultFactories exte
/**
* Returns {@code true} if the default factory of the given type is the given instance.
*
- * @param <T> The interface type.
- * @param type The interface type.
- * @param factory The factory implementation to test.
+ * @param <T> the interface type.
+ * @param type the interface type.
+ * @param factory the factory implementation to test.
* @return {@code true} if the given factory implementation is the default instance.
*/
public static synchronized <T> boolean isDefaultInstance(final Class<T> type, final T factory) {
@@ -81,9 +81,9 @@ public final class DefaultFactories exte
* This method gives preference to Apache SIS implementation of factories if present.
* This is a temporary mechanism while we are waiting for a real dependency injection mechanism.
*
- * @param <T> The interface type.
- * @param type The interface type.
- * @return A factory implementing the given interface, or {@code null} if none.
+ * @param <T> the interface type.
+ * @param type the interface type.
+ * @return a factory implementing the given interface, or {@code null} if none.
*/
public static synchronized <T> T forClass(final Class<T> type) {
T factory = type.cast(FACTORIES.get(type));
@@ -124,9 +124,9 @@ public final class DefaultFactories exte
* Returns a factory which is guaranteed to be present. If the factory is not found,
* this will be considered a configuration error (corrupted JAR files of incorrect classpath).
*
- * @param <T> The interface type.
- * @param type The interface type.
- * @return A factory implementing the given interface.
+ * @param <T> the interface type.
+ * @param type the interface type.
+ * @return a factory implementing the given interface.
*
* @since 0.6
*/
@@ -143,11 +143,11 @@ public final class DefaultFactories exte
* Returns a factory of the given type, making sure that it is an implementation of the given class.
* Use this method only when we know that Apache SIS registers only one implementation of a given service.
*
- * @param <T> The interface type.
- * @param <I> The requested implementation class.
- * @param type The interface type.
- * @param impl The requested implementation class.
- * @return A factory implementing the given interface.
+ * @param <T> the interface type.
+ * @param <I> the requested implementation class.
+ * @param type the interface type.
+ * @param impl the requested implementation class.
+ * @return a factory implementing the given interface.
*
* @since 0.6
*/
@@ -165,9 +165,9 @@ public final class DefaultFactories exte
* The default is the current thread {@linkplain Thread#getContextClassLoader() context class loader},
* provided that it can access at least the Apache SIS stores.
*
- * @param <T> The compile-time value of {@code service} argument.
- * @param service The interface or abstract class representing the service.
- * @return A new service loader for the given service type.
+ * @param <T> the compile-time value of {@code service} argument.
+ * @param service the interface or abstract class representing the service.
+ * @return a new service loader for the given service type.
*
* @since 0.8
*/
@@ -196,7 +196,7 @@ public final class DefaultFactories exte
* <p>The intend of this method is to ensure that {@link ServiceLoader#load(Class)} will find the
* Apache SIS services even in an environment that defined an unsuitable context class loader.</p>
*
- * @return The context class loader if suitable, or another class loader otherwise.
+ * @return the context class loader if suitable, or another class loader otherwise.
* @throws SecurityException if this method is not allowed to get the current thread
* context class loader or one of its parent.
*
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java?rev=1771762&r1=1771761&r2=1771762&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java [UTF-8] Mon Nov 28 15:34:32 2016
@@ -18,15 +18,13 @@ package org.apache.sis.internal.util;
import java.util.List;
import java.util.Arrays;
+import java.util.Objects;
import java.util.Iterator;
import java.util.ServiceLoader;
import java.util.NoSuchElementException;
import org.apache.sis.util.Workaround;
import org.apache.sis.internal.system.DefaultFactories;
-// Branch-specific imports
-import java.util.Objects;
-
/**
* An immutable set built from an iterator, which will be filled only when needed.
@@ -58,9 +56,8 @@ public class LazySet<E> extends SetOfUnk
private final Class<E> service;
/**
- * The iterator to use for filling this set, or {@code null} if the iteration did not started yet
- * or is finished. Those two cases can be distinguished by looking whether the {@link #cachedElements}
- * array is null or not.
+ * The iterator to use for filling this set, or {@code null} if the iteration did not started yet or is finished.
+ * Those two cases can be distinguished by looking whether the {@link #cachedElements} array is null or not.
*
* @see #sourceIterator()
*/
@@ -82,11 +79,10 @@ public class LazySet<E> extends SetOfUnk
private int numCached;
/**
- * Constructs a set to be filled by the elements from the specified source. Iteration will starts
- * only when first needed, and at most one iteration will be performed (unless {@link #reload()}
- * is invoked).
+ * Constructs a set to be filled by the elements from the specified source. Iteration will start only when
+ * first needed, and at most one iteration will be performed (unless {@link #reload()} is invoked).
*
- * @param service the type of service to request with {@link ServiceLoader}, or {@code null} if unknown.
+ * @param service the type of service to request with {@link ServiceLoader}.
*/
public LazySet(final Class<E> service) {
Objects.requireNonNull(service);
@@ -139,7 +135,7 @@ public class LazySet<E> extends SetOfUnk
*/
@SuppressWarnings("unchecked")
private boolean createCache() {
- cachedElements = initialValues(); // No need to clone.
+ cachedElements = initialValues(); // No need to clone.
if (cachedElements != null) {
numCached = cachedElements.length;
if (numCached != 0) {
@@ -229,6 +225,7 @@ public class LazySet<E> extends SetOfUnk
* negative index and for skipped elements.</p>
*/
final boolean exists(final int index) {
+ assert index <= numCached : index;
return (index < numCached) || canPullMore();
}
@@ -239,6 +236,8 @@ public class LazySet<E> extends SetOfUnk
* @return the element at the requested index.
*/
final E get(final int index) {
+ assert numCached <= cachedElements.length : numCached;
+ assert index <= numCached : index;
if (index >= numCached) {
if (canPullMore()) {
cache(sourceIterator.next());
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySynchronizedIterator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySynchronizedIterator.java?rev=1771762&r1=1771761&r2=1771762&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySynchronizedIterator.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySynchronizedIterator.java [UTF-8] Mon Nov 28 15:34:32 2016
@@ -58,7 +58,7 @@ public final class LazySynchronizedItera
* Creates a new iterator over all elements returned by the given providers.
* Null elements in the given array will be ignored.
*
- * @param providers The providers of iterators. This array is <strong>not</strong> cloned.
+ * @param providers the providers of iterators. This array is <strong>not</strong> cloned.
*/
public LazySynchronizedIterator(final Iterable<? extends E>[] providers) {
this.providers = providers;