Skip to content

Commit c626f62

Browse files
authored
Merge pull request #370 from jbgi/backports/5.x
Changes from 4.x
2 parents 1650c3a + 6dd03d7 commit c626f62

25 files changed

Lines changed: 129 additions & 118 deletions

File tree

build.gradle

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ buildscript {
1818
dependencies {
1919
classpath "com.ofg:uptodate-gradle-plugin:$uptodateVersion"
2020
}
21+
22+
wrapper {
23+
gradleVersion = "4.10.2"
24+
distributionType = Wrapper.DistributionType.ALL
25+
}
2126
}
2227

2328
if (JavaVersion.current().isJava8Compatible()) {
@@ -111,23 +116,10 @@ subprojects {
111116
}
112117
}
113118

114-
jacocoTestReport {
115-
additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
116-
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
117-
classDirectories = files(sourceSets.main.output)
118-
reports {
119-
html.enabled = true
120-
xml.enabled = true
121-
csv.enabled = false
122-
}
123-
}
124-
125-
task coverage(dependsOn: ["test", "jacocoTestReport"]) << {}
126-
127119
}
128120

129121
task coverage(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
130-
dependsOn = subprojects.coverage
122+
dependsOn = subprojects*.test
131123
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
132124
// We only care about coverage of:
133125
def projectForFoverage = ["core", "quickcheck", "java-core"]
@@ -148,6 +140,10 @@ configure(subprojects.findAll { it.name != "props-core" }) {
148140

149141
sourceCompatibility = "1.8"
150142

143+
javadoc {
144+
options.addBooleanOption('html5', true)
145+
}
146+
151147
task javadocJar(type: Jar, dependsOn: "javadoc") {
152148
classifier = 'javadoc'
153149
from "build/docs/javadoc"
@@ -186,14 +182,14 @@ configure(subprojects.findAll { it.name != "props-core" }) {
186182
}
187183

188184
// Output MANIFEST.MF statically so eclipse can see it for plugin development
189-
task eclipsePluginManifest(dependsOn: jar) << {
185+
task eclipsePluginManifest(dependsOn: jar) doLast {
190186
file("META-INF").mkdirs()
191187
jar.manifest.writeTo(file("META-INF/MANIFEST.MF"))
192188
}
193189

194190
eclipseProject.dependsOn eclipsePluginManifest
195191
}
196192

197-
task env << {
193+
task env doLast {
198194
println System.getenv()
199195
}

core/src/main/java/fj/Function.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -778,47 +778,47 @@ public static <A, B> F<B, A> join(final F<B, F<B, A>> f) {
778778

779779
/**
780780
* Partial application of the second argument to the supplied function to get a function of type
781-
* <tt>A -> C</tt>. Same as <tt>flip(f).f(b)</tt>.
781+
* {@code A -> C}. Same as {@code flip(f).f(b)}.
782782
*
783783
* @param f The function to partially apply.
784784
* @param b The value to apply to the function.
785-
* @return A new function based on <tt>f</tt> with its second argument applied.
785+
* @return A new function based on {@code f} with its second argument applied.
786786
*/
787787
public static <A, B, C> F<A, C> partialApply2(final F<A, F<B, C>> f, final B b) {
788788
return a -> uncurryF2(f).f(a, b);
789789
}
790790

791791
/**
792792
* Partial application of the third argument to the supplied function to get a function of type
793-
* <tt>A -> B -> D</tt>.
793+
* {@code A -> B -> D}.
794794
*
795795
* @param f The function to partially apply.
796796
* @param c The value to apply to the function.
797-
* @return A new function based on <tt>f</tt> with its third argument applied.
797+
* @return A new function based on {@code f} with its third argument applied.
798798
*/
799799
public static <A, B, C, D> F<A, F<B, D>> partialApply3(final F<A, F<B, F<C, D>>> f, final C c) {
800800
return a -> b -> uncurryF3(f).f(a, b, c);
801801
}
802802

803803
/**
804804
* Partial application of the fourth argument to the supplied function to get a function of type
805-
* <tt>A -> B -> C -> E</tt>.
805+
* {@code A -> B -> C -> E}.
806806
*
807807
* @param f The function to partially apply.
808808
* @param d The value to apply to the function.
809-
* @return A new function based on <tt>f</tt> with its fourth argument applied.
809+
* @return A new function based on {@code f} with its fourth argument applied.
810810
*/
811811
public static <A, B, C, D, E> F<A, F<B, F<C, E>>> partialApply4(final F<A, F<B, F<C, F<D, E>>>> f, final D d) {
812812
return a -> b -> c -> uncurryF4(f).f(a, b, c, d);
813813
}
814814

815815
/**
816816
* Partial application of the fifth argument to the supplied function to get a function of type
817-
* <tt>A -> B -> C -> D -> F$</tt>.
817+
* {@code A -> B -> C -> D -> F$}.
818818
*
819819
* @param f The function to partially apply.
820820
* @param e The value to apply to the function.
821-
* @return A new function based on <tt>f</tt> with its fifth argument applied.
821+
* @return A new function based on {@code f} with its fifth argument applied.
822822
*/
823823
public static <A, B, C, D, E, F$> F<A, F<B, F<C, F<D, F$>>>> partialApply5(final F<A, F<B, F<C, F<D, F<E, F$>>>>> f,
824824
final E e) {
@@ -827,11 +827,11 @@ public static <A, B, C, D, E> F<A, F<B, F<C, E>>> partialApply4(final F<A, F<B,
827827

828828
/**
829829
* Partial application of the sixth argument to the supplied function to get a function of type
830-
* <tt>A -> B -> C -> D -> E -> G</tt>.
830+
* {@code A -> B -> C -> D -> E -> G}.
831831
*
832832
* @param f The function to partially apply.
833833
* @param f$ The value to apply to the function.
834-
* @return A new function based on <tt>f</tt> with its sixth argument applied.
834+
* @return A new function based on {@code f} with its sixth argument applied.
835835
*/
836836
public static <A, B, C, D, E, F$, G> F<A, F<B, F<C, F<D, F<E, G>>>>> partialApply6(
837837
final F<A, F<B, F<C, F<D, F<E, F<F$, G>>>>>> f, final F$ f$) {
@@ -840,11 +840,11 @@ public static <A, B, C, D, E> F<A, F<B, F<C, E>>> partialApply4(final F<A, F<B,
840840

841841
/**
842842
* Partial application of the seventh argument to the supplied function to get a function of type
843-
* <tt>A -> B -> C -> D -> E -> F$ -> H</tt>.
843+
* {@code A -> B -> C -> D -> E -> F$ -> H}.
844844
*
845845
* @param f The function to partially apply.
846846
* @param g The value to apply to the function.
847-
* @return A new function based on <tt>f</tt> with its seventh argument applied.
847+
* @return A new function based on {@code f} with its seventh argument applied.
848848
*/
849849
public static <A, B, C, D, E, F$, G, H> F<A, F<B, F<C, F<D, F<E, F<F$, H>>>>>> partialApply7(
850850
final F<A, F<B, F<C, F<D, F<E, F<F$, F<G, H>>>>>>> f, final G g) {
@@ -853,11 +853,11 @@ public static <A, B, C, D, E> F<A, F<B, F<C, E>>> partialApply4(final F<A, F<B,
853853

854854
/**
855855
* Partial application of the eigth argument to the supplied function to get a function of type
856-
* <tt>A -> B -> C -> D -> E -> F$ -> G -> I</tt>.
856+
* {@code A -> B -> C -> D -> E -> F$ -> G -> I}.
857857
*
858858
* @param f The function to partially apply.
859859
* @param h The value to apply to the function.
860-
* @return A new function based on <tt>f</tt> with its eigth argument applied.
860+
* @return A new function based on {@code f} with its eigth argument applied.
861861
*/
862862
public static <A, B, C, D, E, F$, G, H, I> F<A, F<B, F<C, F<D, F<E, F<F$, F<G, I>>>>>>> partialApply8(
863863
final F<A, F<B, F<C, F<D, F<E, F<F$, F<G, F<H, I>>>>>>>> f, final H h) {

core/src/main/java/fj/Monoid.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public A zero() {
246246
/**
247247
* Returns a value summed <code>n</code> times (<code>a + a + ... + a</code>).
248248
* The default definition uses peasant multiplication, exploiting
249-
* associativity to only require `O(log n)` uses of
249+
* associativity to only require {@code O(log n)} uses of
250250
* {@link #sum(Object, Object)}.
251251
*
252252
* @param n multiplier

core/src/main/java/fj/P1.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ public static <A> F<P1<A>, A> __1() {
4242
/**
4343
* Promote any function to a transformation between P1s.
4444
*
45-
* @deprecated As of release 4.5, use {@link #map_}
45+
* @deprecated As of release 4.5, use {@link #map_}
4646
* @param f A function to promote to a transformation between P1s.
4747
* @return A function promoted to operate on P1s.
4848
*/
49+
@Deprecated
4950
public static <A, B> F<P1<A>, P1<B>> fmap(final F<A, B> f) {
5051
return map_(f);
5152
}

core/src/main/java/fj/Semigroup.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public F<A, F<A, A>> sum() {
134134
/**
135135
* Returns a value summed <code>n + 1</code> times (
136136
* <code>a + a + ... + a</code>) The default definition uses peasant
137-
* multiplication, exploiting associativity to only require `O(log n)` uses of
137+
* multiplication, exploiting associativity to only require {@code O(log n)} uses of
138138
* {@link #sum(Object, Object)}.
139139
*
140140
* @param n multiplier
@@ -527,8 +527,9 @@ public NonEmptyList<A> sum(NonEmptyList<A> nea, F0<Stream<NonEmptyList<A>>> neas
527527
* A semigroup for optional values.
528528
* @deprecated since 4.7. Use {@link #firstOptionSemigroup()}.
529529
*
530-
** @return A semigroup for optional values.
530+
* @return A semigroup for optional values.
531531
*/
532+
@Deprecated
532533
public static <A> Semigroup<Option<A>> optionSemigroup() {
533534
return firstOptionSemigroup();
534535
}

core/src/main/java/fj/control/Trampoline.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public <R> R fold(final F<Normal<A>, R> n,
4343
return gs.f(this);
4444
}
4545

46-
// The monadic bind constructs a new Codense whose subcomputation is still `sub`, and Kleisli-composes the
46+
// The monadic bind constructs a new Codense whose subcomputation is still {@code sub}, and Kleisli-composes the
4747
// continuations.
4848
public <B> Trampoline<B> bind(final F<A, Trampoline<B>> f) {
4949
return codense(sub, o -> suspend(() -> cont.f(o).bind(f)));
@@ -110,7 +110,7 @@ private static <A, B> Codense<B> codense(final Normal<A> a, final F<A, Trampolin
110110
}
111111

112112
/**
113-
* @return The first-class version of `pure`.
113+
* @return The first-class version of {@code pure}.
114114
*/
115115
public static <A> F<A, Trampoline<A>> pure() {
116116
return Trampoline::pure;
@@ -148,7 +148,7 @@ public static <A> Trampoline<A> suspend(final P1<Trampoline<A>> a) {
148148

149149

150150
/**
151-
* @return The first-class version of `suspend`.
151+
* @return The first-class version of {@code suspend}.
152152
*/
153153
public static <A> F<P1<Trampoline<A>>, Trampoline<A>> suspend_() {
154154
return Trampoline::suspend;
@@ -175,21 +175,21 @@ public final <B> Trampoline<B> map(final F<A, B> f) {
175175
}
176176

177177
/**
178-
* @return The first-class version of `bind`.
178+
* @return The first-class version of {@code bind}.
179179
*/
180180
public static <A, B> F<F<A, Trampoline<B>>, F<Trampoline<A>, Trampoline<B>>> bind_() {
181181
return f -> a -> a.bind(f);
182182
}
183183

184184
/**
185-
* @return The first-class version of `map`.
185+
* @return The first-class version of {@code map}.
186186
*/
187187
public static <A, B> F<F<A, B>, F<Trampoline<A>, Trampoline<B>>> map_() {
188188
return f -> a -> a.map(f);
189189
}
190190

191191
/**
192-
* @return The first-class version of `resume`.
192+
* @return The first-class version of {@code resume}.
193193
*/
194194
public static <A> F<Trampoline<A>, Either<P1<Trampoline<A>>, A>> resume_() {
195195
return Trampoline::resume;

core/src/main/java/fj/data/Enumerator.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818

1919
/**
2020
* Abstracts over a type that may have a successor and/or predecessor value. This implies ordering for that type. A user
21-
* may construct an enumerator with an optimised version for <code>plus</code>, otherwise a default is implemented using
21+
* may construct an enumerator with an optimised version for {@code plus}, otherwise a default is implemented using
2222
* the given successor/predecessor implementations.
2323
* <p/>
2424
* For any enumerator e, the following laws must satisfy:
2525
* <ul>
26-
* <li>forall a. e.successor(a).forall(\t -> e.predecessor(t).forall(\z -> z == a))</li>
27-
* <li>forall a. e.predecessor(a).forall(\t -> e.successor(t).forall(\z -> z == a))</li>
28-
* <li>e.max().forall(\t -> e.successor(t).isNone)</li>
29-
* <li>e.min().forall(\t -> e.predecessor(t).isNone)</li>
30-
* <li>forall a n. e.plus(a, 0) == Some(a)</li>
31-
* <li>forall a n | n > 0. e.plus(a, n) == e.plus(a, n - 1)</li>
32-
* <li>forall a n | n < 0. e.plus(a, n) == e.plus(a, n + 1)</li>
26+
* <li>{@code forall a. e.successor(a).forall(\t -> e.predecessor(t).forall(\z -> z == a))}</li>
27+
* <li>{@code forall a. e.predecessor(a).forall(\t -> e.successor(t).forall(\z -> z == a))}</li>
28+
* <li>{@code e.max().forall(\t -> e.successor(t).isNone)}</li>
29+
* <li>{@code e.min().forall(\t -> e.predecessor(t).isNone)}</li>
30+
* <li>{@code forall a n. e.plus(a, 0) == Some(a)}</li>
31+
* <li>{@code forall a n | n > 0. e.plus(a, n) == e.plus(a, n - 1)}</li>
32+
* <li>{@code forall a n | n < 0. e.plus(a, n) == e.plus(a, n + 1)}</li>
3333
* </ul>
3434
*
3535
* @version %build.number%

core/src/main/java/fj/data/Java.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,7 @@ public static <A> F<ArrayList<A>, List<A>> ArrayList_List() {
14201420
*
14211421
* @return A function that converts Java lists to lists.
14221422
*/
1423+
@Deprecated
14231424
public static <A> F<java.util.List<A>, List<A>> JUList_List() {
14241425
return Java::JavaList_List;
14251426
}

core/src/main/java/fj/data/Tree.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,10 @@ public Stream<A> f(final Tree<A> t, final P1<Stream<A>> xs) {
134134
}
135135

136136
/**
137+
* <pre>{@code
137138
* flatten :: Tree a -> [a]
138139
* flatten t = squish t []
140+
* }</pre>
139141
* where squish (Node x ts) xs = x:Prelude.foldr squish xs ts
140142
* Puts the elements of the tree into a Stream, in pre-order.
141143
*
@@ -346,4 +348,4 @@ public int length() {
346348
return 1 + subForest._1().map(Tree::length).foldLeft((acc, i) -> acc + i, 0);
347349
}
348350

349-
}
351+
}

core/src/main/java/fj/data/hlist/HPre.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static HFalse hFalse() {
5757
}
5858

5959
/**
60-
* Type-level boolean conjunction. A value of this type represents evidence that AB -> C
60+
* Type-level boolean conjunction. A value of this type represents evidence that {@code AB -> C}
6161
*
6262
* @param <A> A boolean
6363
* @param <B> A boolean
@@ -92,7 +92,7 @@ public static HAnd<HTrue, HTrue, HTrue> hAnd(final HTrue a, final HTrue b) {
9292
}
9393

9494
/**
95-
* Type-level boolean disjunction. A value of this type represents evidence that A+B -> C
95+
* Type-level boolean disjunction. A value of this type represents evidence that {@code A+B -> C}
9696
*
9797
* @param <A> A boolean
9898
* @param <B> A boolean

0 commit comments

Comments
 (0)