diff --git a/build.gradle b/build.gradle index b386b5d3..c070903d 100644 --- a/build.gradle +++ b/build.gradle @@ -18,6 +18,11 @@ buildscript { dependencies { classpath "com.ofg:uptodate-gradle-plugin:$uptodateVersion" } + + wrapper { + gradleVersion = "4.10.2" + distributionType = Wrapper.DistributionType.ALL + } } if (JavaVersion.current().isJava8Compatible()) { @@ -111,23 +116,10 @@ subprojects { } } - jacocoTestReport { - additionalSourceDirs = files(sourceSets.main.allSource.srcDirs) - sourceDirectories = files(sourceSets.main.allSource.srcDirs) - classDirectories = files(sourceSets.main.output) - reports { - html.enabled = true - xml.enabled = true - csv.enabled = false - } - } - - task coverage(dependsOn: ["test", "jacocoTestReport"]) << {} - } task coverage(type: org.gradle.testing.jacoco.tasks.JacocoReport) { - dependsOn = subprojects.coverage + dependsOn = subprojects*.test executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec") // We only care about coverage of: def projectForFoverage = ["core", "quickcheck", "java-core"] @@ -148,6 +140,10 @@ configure(subprojects.findAll { it.name != "props-core" }) { sourceCompatibility = "1.8" + javadoc { + options.addBooleanOption('html5', true) + } + task javadocJar(type: Jar, dependsOn: "javadoc") { classifier = 'javadoc' from "build/docs/javadoc" @@ -186,7 +182,7 @@ configure(subprojects.findAll { it.name != "props-core" }) { } // Output MANIFEST.MF statically so eclipse can see it for plugin development - task eclipsePluginManifest(dependsOn: jar) << { + task eclipsePluginManifest(dependsOn: jar) doLast { file("META-INF").mkdirs() jar.manifest.writeTo(file("META-INF/MANIFEST.MF")) } @@ -194,6 +190,6 @@ configure(subprojects.findAll { it.name != "props-core" }) { eclipseProject.dependsOn eclipsePluginManifest } -task env << { +task env doLast { println System.getenv() } diff --git a/core/src/main/java/fj/Function.java b/core/src/main/java/fj/Function.java index f95b1c87..995c179d 100644 --- a/core/src/main/java/fj/Function.java +++ b/core/src/main/java/fj/Function.java @@ -778,11 +778,11 @@ public static F join(final F> f) { /** * Partial application of the second argument to the supplied function to get a function of type - * A -> C. Same as flip(f).f(b). + * {@code A -> C}. Same as {@code flip(f).f(b)}. * * @param f The function to partially apply. * @param b The value to apply to the function. - * @return A new function based on f with its second argument applied. + * @return A new function based on {@code f} with its second argument applied. */ public static F partialApply2(final F> f, final B b) { return a -> uncurryF2(f).f(a, b); @@ -790,11 +790,11 @@ public static F partialApply2(final F> f, final B b) /** * Partial application of the third argument to the supplied function to get a function of type - * A -> B -> D. + * {@code A -> B -> D}. * * @param f The function to partially apply. * @param c The value to apply to the function. - * @return A new function based on f with its third argument applied. + * @return A new function based on {@code f} with its third argument applied. */ public static F> partialApply3(final F>> f, final C c) { return a -> b -> uncurryF3(f).f(a, b, c); @@ -802,11 +802,11 @@ public static F> partialApply3(final F>> /** * Partial application of the fourth argument to the supplied function to get a function of type - * A -> B -> C -> E. + * {@code A -> B -> C -> E}. * * @param f The function to partially apply. * @param d The value to apply to the function. - * @return A new function based on f with its fourth argument applied. + * @return A new function based on {@code f} with its fourth argument applied. */ public static F>> partialApply4(final F>>> f, final D d) { return a -> b -> c -> uncurryF4(f).f(a, b, c, d); @@ -814,11 +814,11 @@ public static F>> partialApply4(final FA -> B -> C -> D -> F$. + * {@code A -> B -> C -> D -> F$}. * * @param f The function to partially apply. * @param e The value to apply to the function. - * @return A new function based on f with its fifth argument applied. + * @return A new function based on {@code f} with its fifth argument applied. */ public static F>>> partialApply5(final F>>>> f, final E e) { @@ -827,11 +827,11 @@ public static F>> partialApply4(final FA -> B -> C -> D -> E -> G. + * {@code A -> B -> C -> D -> E -> G}. * * @param f The function to partially apply. * @param f$ The value to apply to the function. - * @return A new function based on f with its sixth argument applied. + * @return A new function based on {@code f} with its sixth argument applied. */ public static F>>>> partialApply6( final F>>>>> f, final F$ f$) { @@ -840,11 +840,11 @@ public static F>> partialApply4(final FA -> B -> C -> D -> E -> F$ -> H. + * {@code A -> B -> C -> D -> E -> F$ -> H}. * * @param f The function to partially apply. * @param g The value to apply to the function. - * @return A new function based on f with its seventh argument applied. + * @return A new function based on {@code f} with its seventh argument applied. */ public static F>>>>> partialApply7( final F>>>>>> f, final G g) { @@ -853,11 +853,11 @@ public static F>> partialApply4(final FA -> B -> C -> D -> E -> F$ -> G -> I. + * {@code A -> B -> C -> D -> E -> F$ -> G -> I}. * * @param f The function to partially apply. * @param h The value to apply to the function. - * @return A new function based on f with its eigth argument applied. + * @return A new function based on {@code f} with its eigth argument applied. */ public static F>>>>>> partialApply8( final F>>>>>>> f, final H h) { diff --git a/core/src/main/java/fj/Monoid.java b/core/src/main/java/fj/Monoid.java index cdb8e746..0c09b558 100644 --- a/core/src/main/java/fj/Monoid.java +++ b/core/src/main/java/fj/Monoid.java @@ -246,7 +246,7 @@ public A zero() { /** * Returns a value summed n times (a + a + ... + a). * The default definition uses peasant multiplication, exploiting - * associativity to only require `O(log n)` uses of + * associativity to only require {@code O(log n)} uses of * {@link #sum(Object, Object)}. * * @param n multiplier diff --git a/core/src/main/java/fj/P1.java b/core/src/main/java/fj/P1.java index 555a28ae..5e627403 100644 --- a/core/src/main/java/fj/P1.java +++ b/core/src/main/java/fj/P1.java @@ -42,10 +42,11 @@ public static F, A> __1() { /** * Promote any function to a transformation between P1s. * - * @deprecated As of release 4.5, use {@link #map_} + * @deprecated As of release 4.5, use {@link #map_} * @param f A function to promote to a transformation between P1s. * @return A function promoted to operate on P1s. */ + @Deprecated public static F, P1> fmap(final F f) { return map_(f); } diff --git a/core/src/main/java/fj/Semigroup.java b/core/src/main/java/fj/Semigroup.java index f626ded7..42f05f5b 100644 --- a/core/src/main/java/fj/Semigroup.java +++ b/core/src/main/java/fj/Semigroup.java @@ -134,7 +134,7 @@ public F> sum() { /** * Returns a value summed n + 1 times ( * a + a + ... + a) The default definition uses peasant - * multiplication, exploiting associativity to only require `O(log n)` uses of + * multiplication, exploiting associativity to only require {@code O(log n)} uses of * {@link #sum(Object, Object)}. * * @param n multiplier @@ -527,8 +527,9 @@ public NonEmptyList sum(NonEmptyList nea, F0>> neas * A semigroup for optional values. * @deprecated since 4.7. Use {@link #firstOptionSemigroup()}. * - ** @return A semigroup for optional values. + * @return A semigroup for optional values. */ + @Deprecated public static Semigroup> optionSemigroup() { return firstOptionSemigroup(); } diff --git a/core/src/main/java/fj/control/Trampoline.java b/core/src/main/java/fj/control/Trampoline.java index 0b6060b1..47fd282b 100644 --- a/core/src/main/java/fj/control/Trampoline.java +++ b/core/src/main/java/fj/control/Trampoline.java @@ -43,7 +43,7 @@ public R fold(final F, R> n, return gs.f(this); } - // The monadic bind constructs a new Codense whose subcomputation is still `sub`, and Kleisli-composes the + // The monadic bind constructs a new Codense whose subcomputation is still {@code sub}, and Kleisli-composes the // continuations. public Trampoline bind(final F> f) { return codense(sub, o -> suspend(() -> cont.f(o).bind(f))); @@ -110,7 +110,7 @@ private static Codense codense(final Normal a, final F F> pure() { return Trampoline::pure; @@ -148,7 +148,7 @@ public static Trampoline suspend(final P1> a) { /** - * @return The first-class version of `suspend`. + * @return The first-class version of {@code suspend}. */ public static F>, Trampoline> suspend_() { return Trampoline::suspend; @@ -175,21 +175,21 @@ public final Trampoline map(final F f) { } /** - * @return The first-class version of `bind`. + * @return The first-class version of {@code bind}. */ public static F>, F, Trampoline>> bind_() { return f -> a -> a.bind(f); } /** - * @return The first-class version of `map`. + * @return The first-class version of {@code map}. */ public static F, F, Trampoline>> map_() { return f -> a -> a.map(f); } /** - * @return The first-class version of `resume`. + * @return The first-class version of {@code resume}. */ public static F, Either>, A>> resume_() { return Trampoline::resume; diff --git a/core/src/main/java/fj/data/Enumerator.java b/core/src/main/java/fj/data/Enumerator.java index 1666d7b2..94f1b2cd 100644 --- a/core/src/main/java/fj/data/Enumerator.java +++ b/core/src/main/java/fj/data/Enumerator.java @@ -18,18 +18,18 @@ /** * Abstracts over a type that may have a successor and/or predecessor value. This implies ordering for that type. A user - * may construct an enumerator with an optimised version for plus, otherwise a default is implemented using + * may construct an enumerator with an optimised version for {@code plus}, otherwise a default is implemented using * the given successor/predecessor implementations. *

* For any enumerator e, the following laws must satisfy: *

    - *
  • forall a. e.successor(a).forall(\t -> e.predecessor(t).forall(\z -> z == a))
  • - *
  • forall a. e.predecessor(a).forall(\t -> e.successor(t).forall(\z -> z == a))
  • - *
  • e.max().forall(\t -> e.successor(t).isNone)
  • - *
  • e.min().forall(\t -> e.predecessor(t).isNone)
  • - *
  • forall a n. e.plus(a, 0) == Some(a)
  • - *
  • forall a n | n > 0. e.plus(a, n) == e.plus(a, n - 1)
  • - *
  • forall a n | n < 0. e.plus(a, n) == e.plus(a, n + 1)
  • + *
  • {@code forall a. e.successor(a).forall(\t -> e.predecessor(t).forall(\z -> z == a))}
  • + *
  • {@code forall a. e.predecessor(a).forall(\t -> e.successor(t).forall(\z -> z == a))}
  • + *
  • {@code e.max().forall(\t -> e.successor(t).isNone)}
  • + *
  • {@code e.min().forall(\t -> e.predecessor(t).isNone)}
  • + *
  • {@code forall a n. e.plus(a, 0) == Some(a)}
  • + *
  • {@code forall a n | n > 0. e.plus(a, n) == e.plus(a, n - 1)}
  • + *
  • {@code forall a n | n < 0. e.plus(a, n) == e.plus(a, n + 1)}
  • *
* * @version %build.number% diff --git a/core/src/main/java/fj/data/Java.java b/core/src/main/java/fj/data/Java.java index 80a5ec43..ae7fcf6a 100644 --- a/core/src/main/java/fj/data/Java.java +++ b/core/src/main/java/fj/data/Java.java @@ -1420,6 +1420,7 @@ public static
F, List> ArrayList_List() { * * @return A function that converts Java lists to lists. */ + @Deprecated public static F, List> JUList_List() { return Java::JavaList_List; } diff --git a/core/src/main/java/fj/data/Tree.java b/core/src/main/java/fj/data/Tree.java index 4b0ce7eb..9eebb932 100644 --- a/core/src/main/java/fj/data/Tree.java +++ b/core/src/main/java/fj/data/Tree.java @@ -134,8 +134,10 @@ public Stream f(final Tree t, final P1> xs) { } /** + *
{@code
    * flatten :: Tree a -> [a]
    * flatten t = squish t []
+   * }
* where squish (Node x ts) xs = x:Prelude.foldr squish xs ts * Puts the elements of the tree into a Stream, in pre-order. * @@ -346,4 +348,4 @@ public int length() { return 1 + subForest._1().map(Tree::length).foldLeft((acc, i) -> acc + i, 0); } -} \ No newline at end of file +} diff --git a/core/src/main/java/fj/data/hlist/HPre.java b/core/src/main/java/fj/data/hlist/HPre.java index 6a2556de..6c6174a4 100644 --- a/core/src/main/java/fj/data/hlist/HPre.java +++ b/core/src/main/java/fj/data/hlist/HPre.java @@ -57,7 +57,7 @@ public static HFalse hFalse() { } /** - * Type-level boolean conjunction. A value of this type represents evidence that AB -> C + * Type-level boolean conjunction. A value of this type represents evidence that {@code AB -> C} * * @param
A boolean * @param A boolean @@ -92,7 +92,7 @@ public static HAnd hAnd(final HTrue a, final HTrue b) { } /** - * Type-level boolean disjunction. A value of this type represents evidence that A+B -> C + * Type-level boolean disjunction. A value of this type represents evidence that {@code A+B -> C} * * @param A boolean * @param A boolean diff --git a/core/src/main/java/fj/data/optic/Iso.java b/core/src/main/java/fj/data/optic/Iso.java index ea9babac..4b41b1ad 100644 --- a/core/src/main/java/fj/data/optic/Iso.java +++ b/core/src/main/java/fj/data/optic/Iso.java @@ -119,10 +119,10 @@ public static Iso iso(final F get, final F reverseGet) * create an {@link Iso} between any type and itself. id is the zero element of optics composition, for all optics o of type O * (e.g. Lens, Iso, Prism, ...): * - *
+   * 
{@code
    *  o composeIso Iso.id == o
    *  Iso.id composeO o == o
-   * 
+ * }
* * (replace composeO by composeLens, composeIso, composePrism, ...) */ diff --git a/core/src/main/java/fj/data/optic/PIso.java b/core/src/main/java/fj/data/optic/PIso.java index e10b47bb..b97b416f 100644 --- a/core/src/main/java/fj/data/optic/PIso.java +++ b/core/src/main/java/fj/data/optic/PIso.java @@ -21,18 +21,18 @@ /** * A {@link PIso} defines an isomorphism between types S, A and B, T: * - *
+ * 
{@code
  *              get                           reverse.get
  *     -------------------->             -------------------->
  *   S                       A         T                       B
  *     <--------------------             <--------------------
  *       reverse.reverseGet                   reverseGet
- * 
+ * }
* - * In addition, if f and g forms an isomorphism between `A` and `B`, i.e. if `f . g = id` and `g . f = id`, then a {@link PIso} - * defines an isomorphism between `S` and `T`: + * In addition, if f and g forms an isomorphism between {@code A} and {@code B}, i.e. if {@code f . g = id} and {@code g . f = id}, then a {@link PIso} + * defines an isomorphism between {@code S} and {@code T}: * - *
+ * 
{@code
  *     S           T                                   S           T
  *     |           |                                   |           |
  *     |           |                                   |           |
@@ -40,7 +40,7 @@
  *     |           |                                   |           |
  *     |     f     |                                   |     g     |
  *     A --------> B                                   A <-------- B
- * 
+ * }
* * A {@link PIso} is also a valid {@link Getter}, {@link Fold}, {@link PLens}, {@link PPrism}, {@link POptional}, * {@link PTraversal} and {@link PSetter} @@ -552,10 +552,10 @@ public PIso reverse() { * create a {@link PIso} between any type and itself. id is the zero element of optics composition, for all optics o of type O * (e.g. Lens, Iso, Prism, ...): * - *
+   * 
{@code
    *  o composeIso Iso.id == o
    *  Iso.id composeO o == o
-   * 
+ * }
* * (replace composeO by composeLens, composeIso, composePrism, ...) */ diff --git a/core/src/main/java/fj/data/optic/PLens.java b/core/src/main/java/fj/data/optic/PLens.java index 971f76ff..4dcad20b 100644 --- a/core/src/main/java/fj/data/optic/PLens.java +++ b/core/src/main/java/fj/data/optic/PLens.java @@ -17,18 +17,20 @@ import fj.data.vector.V2; /** - * A {@link PLens} can be seen as a pair of functions: - `get: S => A` i.e. from an `S`, we can extract an `A` - `set: (B, S) => - * T` i.e. if we replace an `A` by a `B` in an `S`, we obtain a `T` - * - * A {@link PLens} could also be defined as a weaker {@link PIso} where set requires an additional parameter than reverseGet. - * - * {@link PLens} stands for Polymorphic Lens as it set and modify methods change a type `A` to `B` and `S` to `T`. {@link Lens} - * is a {@link PLens} restricted to monomoprhic updates. - * - * A {@link PLens} is also a valid {@link Getter}, {@link Fold}, {@link POptional}, {@link PTraversal} and {@link PSetter} - * + * A {@link PLens} can be seen as a pair of functions:
    + *
  • {@code get: S => A} i.e. from an {@code S}, we can extract an {@code A}
  • + *
  • {@code set: (B, S) => T} i.e. if we replace an {@code A} by a {@code B} in an {@code S}, we obtain a {@code T}
  • + *
+ *

+ * A {@link PLens} could also be defined as a weaker {@link PIso} where set requires an additional parameter than reverseGet.

+ *

+ * {@link PLens} stands for Polymorphic Lens as it set and modify methods change a type {@code A} to {@code B} and {@code S} to {@code T}. {@link Lens} + * is a {@link PLens} restricted to monomoprhic updates.

+ *

+ * A {@link PLens} is also a valid {@link Getter}, {@link Fold}, {@link POptional}, {@link PTraversal} and {@link PSetter}

+ *

* Typically a {@link PLens} or {@link Lens} can be defined between a Product (e.g. case class, tuple, HList) and one of it is - * component. + * component.

* * @param the source of a {@link PLens} * @param the modified source of a {@link PLens} @@ -500,4 +502,4 @@ public F modify(final F f) { } }; } -} \ No newline at end of file +} diff --git a/core/src/main/java/fj/data/optic/POptional.java b/core/src/main/java/fj/data/optic/POptional.java index d35979d8..c70aa4c1 100644 --- a/core/src/main/java/fj/data/optic/POptional.java +++ b/core/src/main/java/fj/data/optic/POptional.java @@ -20,13 +20,15 @@ import fj.data.vector.V2; /** - * A {@link POptional} can be seen as a pair of functions: - `getOrModify: S => T \/ A` - `set : (B, S) => T` - * - * A {@link POptional} could also be defined as a weaker {@link PLens} and weaker {@link PPrism} - * - * {@link POptional} stands for Polymorphic Optional as it set and modify methods change a type `A` to `B` and `S` to `T`. - * {@link Optional} is a {@link POptional} restricted to monomoprhic updates: {{{ type Optional[S, A] = POptional[S, S, A, A] - * }}} + * A {@link POptional} can be seen as a pair of functions:
    + *
  • {@code getOrModify: S => T \/ A}
  • + *
  • {@code set : (B, S) => T}
  • + *
+ *

+ * A {@link POptional} could also be defined as a weaker {@link PLens} and weaker {@link PPrism}

+ *

+ * {@link POptional} stands for Polymorphic Optional as it set and modify methods change a type {@code A} to {@code B} and {@code S} to {@code T}. + * {@link Optional} is a {@link POptional} restricted to monomoprhic updates: {@code type Optional[S, A] = POptional[S, S, A, A]}

* * @param the source of a {@link POptional} * @param the modified source of a {@link POptional} @@ -479,4 +481,4 @@ public F modify(final F f) { }; } -} \ No newline at end of file +} diff --git a/core/src/main/java/fj/data/optic/PPrism.java b/core/src/main/java/fj/data/optic/PPrism.java index c4a65a68..ffa87ba6 100644 --- a/core/src/main/java/fj/data/optic/PPrism.java +++ b/core/src/main/java/fj/data/optic/PPrism.java @@ -19,14 +19,17 @@ import fj.data.vector.V2; /** - * A {@link PPrism} can be seen as a pair of functions: - `getOrModify: S => T \/ A` - `reverseGet : B => T` - * - * A {@link PPrism} could also be defined as a weaker {@link PIso} where get can fail. - * + * A {@link PPrism} can be seen as a pair of functions:
    + *
  • {@code getOrModify: S => T \/ A}
  • + *
  • {@code reverseGet : B => T}
  • + *
+ *

+ * A {@link PPrism} could also be defined as a weaker {@link PIso} where get can fail.

+ *

* Typically a {@link PPrism} or {@link Prism} encodes the relation between a Sum or CoProduct type (e.g. sealed trait) and one - * of it is element. + * of it is element.

* - * {@link PPrism} stands for Polymorphic Prism as it set and modify methods change a type `A` to `B` and `S` to `T`. + * {@link PPrism} stands for Polymorphic Prism as it set and modify methods change a type {@code A} to {@code B} and {@code S} to {@code T}. * {@link Prism} is a {@link PPrism} where the type of target cannot be modified. * * A {@link PPrism} is also a valid {@link Fold}, {@link POptional}, {@link PTraversal} and {@link PSetter} @@ -436,4 +439,4 @@ public Option
getOption(final S s) { }; } -} \ No newline at end of file +} diff --git a/core/src/main/java/fj/data/optic/PSetter.java b/core/src/main/java/fj/data/optic/PSetter.java index 012920cb..13be7739 100644 --- a/core/src/main/java/fj/data/optic/PSetter.java +++ b/core/src/main/java/fj/data/optic/PSetter.java @@ -5,12 +5,14 @@ import fj.data.Either; /** - * A {@link PSetter} is a generalisation of Functor map: - `map: (A => B) => F[A] => F[B]` - `modify: (A => B) => S => - * T` - * - * {@link PSetter} stands for Polymorphic Setter as it set and modify methods change a type `A` to `B` and `S` to `T`. - * - * {@link PTraversal}, {@link POptional}, {@link PPrism}, {@link PLens} and {@link PIso} are valid {@link PSetter} + * A {@link PSetter} is a generalisation of Functor map:
    + *
  • {@code map: (A => B) => F[A] => F[B]}
  • + *
  • {@code modify: (A => B) => S => T}
  • + *
+ *

+ * {@link PSetter} stands for Polymorphic Setter as it set and modify methods change a type {@code A} to {@code B} and {@code S} to {@code T}.

+ *

+ * {@link PTraversal}, {@link POptional}, {@link PPrism}, {@link PLens} and {@link PIso} are valid {@link PSetter}

* * @param the source of a {@link PSetter} * @param the modified source of a {@link PSetter} diff --git a/core/src/main/java/fj/data/optic/PTraversal.java b/core/src/main/java/fj/data/optic/PTraversal.java index ee16760f..6087f707 100644 --- a/core/src/main/java/fj/data/optic/PTraversal.java +++ b/core/src/main/java/fj/data/optic/PTraversal.java @@ -24,9 +24,9 @@ /** * A {@link PTraversal} can be seen as a {@link POptional} generalised to 0 to n targets where n can be infinite. - * - * {@link PTraversal} stands for Polymorphic Traversal as it set and modify methods change a type `A` to `B` and `S` to `T`. - * {@link Traversal} is a {@link PTraversal} restricted to monomoprhic updates. + *

+ * {@link PTraversal} stands for Polymorphic Traversal as it set and modify methods change a type {@code A} to {@code B} and {@code S} to {@code T}. + * {@link Traversal} is a {@link PTraversal} restricted to monomoprhic updates.

* * @param the source of a {@link PTraversal} * @param the modified source of a {@link PTraversal} diff --git a/core/src/test/java/fj/FWFunctionsTest.java b/core/src/test/java/fj/FWFunctionsTest.java index c1f69718..1c034ab9 100644 --- a/core/src/test/java/fj/FWFunctionsTest.java +++ b/core/src/test/java/fj/FWFunctionsTest.java @@ -9,14 +9,14 @@ public class FWFunctionsTest { @Test public void testLift1() { F f = i -> i + 1; - F1W f1w = F1W.lift(f); + F1W f1w = F1W.lift(f); assertThat(f1w.f(1), is(2)); } @Test public void testLift2() { F2 f2 = (i, j) -> i + j; - F2W f2w = F2W.lift(f2); + F2W f2w = F2W.lift(f2); assertThat(f2w.f(1, 2), is(3)); } diff --git a/core/src/test/java/fj/TryEffectTest.java b/core/src/test/java/fj/TryEffectTest.java index bb684fc6..ea92b8f2 100644 --- a/core/src/test/java/fj/TryEffectTest.java +++ b/core/src/test/java/fj/TryEffectTest.java @@ -11,8 +11,7 @@ public class TryEffectTest { @Test public void testTryEffect0Success() { - F> f = - TryEffect.f(TryEffect0::f); + F, Validation> f = TryEffect.f(TryEffect0::f); Validation v = f.f(new AlwaysSucceed0()); assertThat(v.isSuccess(), is(true)); assertThat(v.success(), is(Unit.unit())); @@ -20,8 +19,7 @@ public void testTryEffect0Success() { @Test public void testTryEffect0Fail() { - F> f = - TryEffect.f(TryEffect0::f); + F, Validation> f = TryEffect.f(TryEffect0::f); Validation v = f.f(new AlwaysFail0()); assertThat(v.isFail(), is(true)); assertThat(v.fail(), is(new TryEffectException())); diff --git a/core/src/test/java/fj/control/parallel/StrategyTest.java b/core/src/test/java/fj/control/parallel/StrategyTest.java index ee3b30df..8475b35a 100644 --- a/core/src/test/java/fj/control/parallel/StrategyTest.java +++ b/core/src/test/java/fj/control/parallel/StrategyTest.java @@ -3,6 +3,7 @@ import fj.Ord; import fj.P; import fj.P1; +import fj.Unit; import fj.data.Enumerator; import fj.data.List; import fj.data.Stream; @@ -41,7 +42,7 @@ public void testStrategyExecutor() { public void testStrategyCompletion() { final Stream s = range(Enumerator.intEnumerator, 99, -99, -1); final ExecutorService es = Executors.newFixedThreadPool(10); - final CompletionService cs = new ExecutorCompletionService(es); + final CompletionService cs = new ExecutorCompletionService<>(es); assertThat(s.sort(Ord.intOrd, completionStrategy(cs)), is(s.sort(Ord.intOrd))); } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7a3265ee..29953ea1 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 72c40576..d76b502e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Sat Aug 25 14:20:05 CEST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip diff --git a/props-core/src/test/java/fj/MemoisationTest.java b/props-core/src/test/java/fj/MemoisationTest.java index 65fa83fc..865f76a3 100644 --- a/props-core/src/test/java/fj/MemoisationTest.java +++ b/props-core/src/test/java/fj/MemoisationTest.java @@ -6,6 +6,7 @@ import org.junit.runner.RunWith; import static fj.test.Arbitrary.arbInteger; +import static fj.test.Arbitrary.arbString; import static fj.test.CheckResult.summary; import static fj.test.Property.prop; import static fj.test.Property.property; @@ -25,16 +26,16 @@ public Property test1() { } public Property test1_hardMemo() { - return property(arbInteger, a -> { - P1 t = P.hardMemo(() -> new Integer(a)); + return property(arbString, a -> { + P1 t = P.hardMemo(() -> new String(a)); return prop(t._1() == t._1()).and(prop(t._1().equals(a))); }); } @Test public Property test2() { - return property(arbInteger, arbInteger, (a, b) -> { - P2 t = P.lazy(u -> new Integer(a), u -> new Integer(b)).memo(); + return property(arbString, arbString, (a, b) -> { + P2 t = P.lazy(u -> new String(a), u -> new String(b)).memo(); return prop(t._1().equals(t._1()) && t._1().equals(a) && t._2().equals(t._2()) && t._2().equals(b) ); }); } diff --git a/props-core/src/test/java/fj/data/fingertrees/FingerTreeTest.java b/props-core/src/test/java/fj/data/fingertrees/FingerTreeTest.java index 57e1fae6..b25fff51 100644 --- a/props-core/src/test/java/fj/data/fingertrees/FingerTreeTest.java +++ b/props-core/src/test/java/fj/data/fingertrees/FingerTreeTest.java @@ -42,14 +42,16 @@ void validateOperations(List list) { @Test public void testHeadOption() { assertThat(Empty.emptyIntAddition().headOption(), is(Option.none())); - FingerTree ft = new MakeTree(measured(intAdditionMonoid, Function.constant(1))).single(1); + FingerTree ft = new MakeTree(measured(intAdditionMonoid, Function.constant(1))) + .single(1); assertThat(ft.headOption(), is(Option.some(1))); } @Test public void testUncons() { assertThat(Empty.emptyIntAddition().uncons(0, (h, t) -> h), is(0)); - FingerTree ft = new MakeTree(measured(intAdditionMonoid, Function.constant(1))).single(1); + FingerTree ft = new MakeTree(measured(intAdditionMonoid, Function.constant(1))) + .single(1); assertThat(ft.uncons(0, (h, t) -> h), is(1)); } diff --git a/quickcheck/src/main/java/fj/test/Gen.java b/quickcheck/src/main/java/fj/test/Gen.java index 323995e1..c375874d 100644 --- a/quickcheck/src/main/java/fj/test/Gen.java +++ b/quickcheck/src/main/java/fj/test/Gen.java @@ -33,7 +33,7 @@ * allowing various forms of composition of generators.

A user typically creates an {@link * Arbitrary arbitrary} to return a generator using the 'combinator methods' below. For example, * suppose a class Person: -

+
{@code
 class Person {
   final int age;
   final String name;
@@ -45,23 +45,23 @@ class Person {
     this.male = male;
   }
 }
-
+}
*

In a case like this one, a user may create a generator over Person by * invoking the {@link #bind(F)} methods — in this case, {@link #bind(Gen , Gen , F)} the one * that takes two generator arguments}, since the class has one more than two fields (the bind * method is invoked on a generator adding the extra one to the count as they are composed). The * class fields are of types for which there exist generators (on {@link Gen} so those can be * used to compose a generator for Person:

-
+
{@code
 static Gen<Person> personArbitrary() {
   return arbInteger.bind(arbString(), arbBoolean(),
       // compose the generators
       {int age => {String name => {boolean male => new Person(age, name, male)}}};
 }
-
+}
*

* The example above uses Java 7 closure syntax. Here is the same example using objects instead: -

+
{@code
 static Gen<Person> personArbitrary() {
   return arbInteger.bind(arbString, arbBoolean,
       // compose the generators
@@ -79,7 +79,7 @@ public Person f(final Boolean male) {
         }
       });
 }
-
+}
* * @version %build.number% */