Skip to content

Commit ddc8fe4

Browse files
committed
Turn compiler warnings on. Suppress unchecked warnings on methods doing cast
1 parent 305a650 commit ddc8fe4

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ allprojects {
6363

6464
dependencyJunit = "junit:junit:4.12"
6565

66+
displayCompilerWarnings = true
6667
}
6768

6869
version = fjVersion
@@ -86,7 +87,7 @@ subprojects {
8687
}
8788
}
8889

89-
if (false) {
90+
if (displayCompilerWarnings) {
9091
tasks.withType(JavaCompile) {
9192
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
9293
}

core/src/main/java/fj/Try.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class Try {
2121
* @param t A Try0 to promote
2222
* @return A Validation with an Exception on the failure side and its result on the success side.
2323
*/
24+
@SuppressWarnings("unchecked")
2425
static public <A, E extends Exception> P1<Validation<E, A>> f(final Try0<A, E> t) {
2526
return P.lazy(() -> {
2627
try {
@@ -37,6 +38,7 @@ static public <A, E extends Exception> P1<Validation<E, A>> f(final Try0<A, E> t
3738
* @param t A Try1 to promote
3839
* @return A Validation with an Exception on the failure side and its result on the success side.
3940
*/
41+
@SuppressWarnings("unchecked")
4042
static public <A, B, E extends Exception> F<A, Validation<E, B>> f(final Try1<A, B, E> t) {
4143
return a -> {
4244
try {
@@ -53,6 +55,7 @@ static public <A, B, E extends Exception> F<A, Validation<E, B>> f(final Try1<A,
5355
* @param t A Try2 to promote
5456
* @return A Validation with an Exception on the failure side and its result on the success side.
5557
*/
58+
@SuppressWarnings("unchecked")
5659
static public <A, B, C, E extends Exception> F2<A, B, Validation<E, C>> f(final Try2<A, B, C, E> t) {
5760
return (a, b) -> {
5861
try {
@@ -69,6 +72,7 @@ static public <A, B, C, E extends Exception> F2<A, B, Validation<E, C>> f(final
6972
* @param t A Try3 to promote
7073
* @return A Validation with an Exception on the failure side and its result on the success side.
7174
*/
75+
@SuppressWarnings("unchecked")
7276
static public <A, B, C, D, E extends Exception> F3<A, B, C, Validation<E, D>> f(final Try3<A, B, C, D, E> t) {
7377
return (a, b, c) -> {
7478
try {
@@ -85,6 +89,7 @@ static public <A, B, C, D, E extends Exception> F3<A, B, C, Validation<E, D>> f(
8589
* @param t A Try4 to promote
8690
* @return A Validation with an Exception on the failure side and its result on the success side.
8791
*/
92+
@SuppressWarnings("unchecked")
8893
static public <A, B, C, D, E, Z extends Exception> F4<A, B, C, D, Validation<Z, E>> f(final Try4<A, B, C, D, E, Z> t) {
8994
return (a, b, c, d) -> {
9095
try {
@@ -101,6 +106,7 @@ static public <A, B, C, D, E, Z extends Exception> F4<A, B, C, D, Validation<Z,
101106
* @param t A Try5 to promote
102107
* @return A Validation with an Exception on the failure side and its result on the success side.
103108
*/
109+
@SuppressWarnings("unchecked")
104110
static public <A, B, C, D, E, F, Z extends Exception> F5<A, B, C, D, E, Validation<Z, F>> f(final Try5<A, B, C, D, E, F, Z> t) {
105111
return (a, b, c, d, e) -> {
106112
try {
@@ -117,6 +123,7 @@ static public <A, B, C, D, E, F, Z extends Exception> F5<A, B, C, D, E, Validati
117123
* @param t A Try6 to promote
118124
* @return A Validation with an Exception on the failure side and its result on the success side.
119125
*/
126+
@SuppressWarnings("unchecked")
120127
static public <A, B, C, D, E, F, G, Z extends Exception> F6<A, B, C, D, E, F, Validation<Z, G>> f(final Try6<A, B, C, D, E, F, G, Z> t) {
121128
return (a, b, c, d, e, f) -> {
122129
try {
@@ -133,6 +140,7 @@ static public <A, B, C, D, E, F, G, Z extends Exception> F6<A, B, C, D, E, F, Va
133140
* @param t A Try7 to promote
134141
* @return A Validation with an Exception on the failure side and its result on the success side.
135142
*/
143+
@SuppressWarnings("unchecked")
136144
static public <A, B, C, D, E, F, G, H, Z extends Exception> F7<A, B, C, D, E, F, G, Validation<Z, H>> f(final Try7<A, B, C, D, E, F, G, H, Z> t) {
137145
return (a, b, c, d, e, f, g) -> {
138146
try {
@@ -149,6 +157,7 @@ static public <A, B, C, D, E, F, G, H, Z extends Exception> F7<A, B, C, D, E, F,
149157
* @param t A Try8 to promote
150158
* @return A Validation with an Exception on the failure side and its result on the success side.
151159
*/
160+
@SuppressWarnings("unchecked")
152161
public static <A, B, C, D, E, F, G, H, I, Z extends Exception> F8<A, B, C, D, E, F, G, H, Validation<Z, I>> f(final Try8<A, B, C, D, E, F, G, H, I, Z> t) {
153162
return (a, b, c, d, e, f, g, h) -> {
154163
try {

core/src/main/java/fj/TryEffect.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class TryEffect {
1414

1515
private TryEffect(){}
1616

17+
@SuppressWarnings("unchecked")
1718
public static <A, Z extends Exception> P1<Validation<Z, Unit>> f(TryEffect0<Z> t) {
1819
return P.lazy(() -> {
1920
try {
@@ -25,6 +26,7 @@ public static <A, Z extends Exception> P1<Validation<Z, Unit>> f(TryEffect0<Z> t
2526
});
2627
}
2728

29+
@SuppressWarnings("unchecked")
2830
public static <A, Z extends Exception> F<A, Validation<Z, Unit>> f(TryEffect1<A, Z> t) {
2931
return a -> {
3032
try {
@@ -37,6 +39,7 @@ public static <A, Z extends Exception> F<A, Validation<Z, Unit>> f(TryEffect1<A,
3739

3840
}
3941

42+
@SuppressWarnings("unchecked")
4043
public static <A, B, Z extends Exception> F2<A, B, Validation<Z, Unit>> f(TryEffect2<A, B, Z> t) {
4144
return (a, b) -> {
4245
try {
@@ -49,6 +52,7 @@ public static <A, B, Z extends Exception> F2<A, B, Validation<Z, Unit>> f(TryEff
4952

5053
}
5154

55+
@SuppressWarnings("unchecked")
5256
public static <A, B, C, Z extends Exception> F3<A, B, C, Validation<Z, Unit>> f(TryEffect3<A, B, C, Z> t) {
5357
return (a, b, c) -> {
5458
try {
@@ -60,6 +64,7 @@ public static <A, B, C, Z extends Exception> F3<A, B, C, Validation<Z, Unit>> f(
6064
};
6165
}
6266

67+
@SuppressWarnings("unchecked")
6368
public static <A, B, C, D, Z extends Exception> F4<A, B, C, D, Validation<Z, Unit>> f(TryEffect4<A, B, C, D, Z> t) {
6469
return (a, b, c, d) -> {
6570
try {
@@ -71,6 +76,7 @@ public static <A, B, C, D, Z extends Exception> F4<A, B, C, D, Validation<Z, Uni
7176
};
7277
}
7378

79+
@SuppressWarnings("unchecked")
7480
public static <A, B, C, D, E, Z extends Exception> F5<A, B, C, D, E, Validation<Z, Unit>> f(TryEffect5<A, B, C, D, E, Z> t) {
7581
return (a, b, c, d, e) -> {
7682
try {
@@ -82,6 +88,7 @@ public static <A, B, C, D, E, Z extends Exception> F5<A, B, C, D, E, Validation<
8288
};
8389
}
8490

91+
@SuppressWarnings("unchecked")
8592
public static <A, B, C, D, E, $F, Z extends Exception> F6<A, B, C, D, E, $F, Validation<Z, Unit>> f(TryEffect6<A, B, C, D, E, $F, Z> t) {
8693
return (a, b, c, d, e, f) -> {
8794
try {
@@ -93,6 +100,7 @@ public static <A, B, C, D, E, Z extends Exception> F5<A, B, C, D, E, Validation<
93100
};
94101
}
95102

103+
@SuppressWarnings("unchecked")
96104
public static <A, B, C, D, E, $F, G, Z extends Exception> F7<A, B, C, D, E, $F, G, Validation<Z, Unit>> f(TryEffect7<A, B, C, D, E, $F, G, Z> t) {
97105
return (a, b, c, d, e, f, g) -> {
98106
try {
@@ -104,6 +112,7 @@ public static <A, B, C, D, E, Z extends Exception> F5<A, B, C, D, E, Validation<
104112
};
105113
}
106114

115+
@SuppressWarnings("unchecked")
107116
public static <A, B, C, D, E, $F, G, H, Z extends Exception> F8<A, B, C, D, E, $F, G, H, Validation<Z, Unit>> f(TryEffect8<A, B, C, D, E, $F, G, H, Z> t) {
108117
return (a, b, c, d, e, f, g, h) -> {
109118
try {

0 commit comments

Comments
 (0)