Skip to content

Commit be19c9c

Browse files
authored
Throw UnsupportedOperationException when default lazy method is called (#330)
instead of warning log
1 parent 36a6447 commit be19c9c

17 files changed

+17
-68
lines changed

scripts/generate-args.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,7 @@ $(cat <<EOD
325325
* @since 0.10.0
326326
*/
327327
default ${class}<$(echo $(for j in `seq 1 ${i}`;do echo -n "A${j}, ";done) | sed 's/,$//'), Supplier<X>> lazy() {
328-
// WARNING:: The default implementation is not really lazy!
329-
java.util.logging.Logger.getLogger(${class}.class.getName())
330-
.warning("the default implementation of lazy() is called which is not really lazy!");
331-
return this.andThen(x -> () -> x);
328+
throw new UnsupportedOperationException("lazy is not implemented!");
332329
}
333330
334331
default Validated<X> validate(${args}) {

src/main/java/am/ik/yavi/arguments/Arguments10Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,7 @@ default <A> Arguments1Validator<A, X> compose(
7979
* @since 0.10.0
8080
*/
8181
default Arguments10Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, Supplier<X>> lazy() {
82-
// WARNING:: The default implementation is not really lazy!
83-
java.util.logging.Logger.getLogger(Arguments10Validator.class.getName()).warning(
84-
"the default implementation of lazy() is called which is not really lazy!");
85-
return this.andThen(x -> () -> x);
82+
throw new UnsupportedOperationException("lazy is not implemented!");
8683
}
8784

8885
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

src/main/java/am/ik/yavi/arguments/Arguments11Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ default <A> Arguments1Validator<A, X> compose(
8181
* @since 0.10.0
8282
*/
8383
default Arguments11Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, Supplier<X>> lazy() {
84-
// WARNING:: The default implementation is not really lazy!
85-
java.util.logging.Logger.getLogger(Arguments11Validator.class.getName()).warning(
86-
"the default implementation of lazy() is called which is not really lazy!");
87-
return this.andThen(x -> () -> x);
84+
throw new UnsupportedOperationException("lazy is not implemented!");
8885
}
8986

9087
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

src/main/java/am/ik/yavi/arguments/Arguments12Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ default <A> Arguments1Validator<A, X> compose(
8181
* @since 0.10.0
8282
*/
8383
default Arguments12Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, Supplier<X>> lazy() {
84-
// WARNING:: The default implementation is not really lazy!
85-
java.util.logging.Logger.getLogger(Arguments12Validator.class.getName()).warning(
86-
"the default implementation of lazy() is called which is not really lazy!");
87-
return this.andThen(x -> () -> x);
84+
throw new UnsupportedOperationException("lazy is not implemented!");
8885
}
8986

9087
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

src/main/java/am/ik/yavi/arguments/Arguments13Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ default <A> Arguments1Validator<A, X> compose(
8282
* @since 0.10.0
8383
*/
8484
default Arguments13Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, Supplier<X>> lazy() {
85-
// WARNING:: The default implementation is not really lazy!
86-
java.util.logging.Logger.getLogger(Arguments13Validator.class.getName()).warning(
87-
"the default implementation of lazy() is called which is not really lazy!");
88-
return this.andThen(x -> () -> x);
85+
throw new UnsupportedOperationException("lazy is not implemented!");
8986
}
9087

9188
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

src/main/java/am/ik/yavi/arguments/Arguments14Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ default <A> Arguments1Validator<A, X> compose(
8383
* @since 0.10.0
8484
*/
8585
default Arguments14Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, Supplier<X>> lazy() {
86-
// WARNING:: The default implementation is not really lazy!
87-
java.util.logging.Logger.getLogger(Arguments14Validator.class.getName()).warning(
88-
"the default implementation of lazy() is called which is not really lazy!");
89-
return this.andThen(x -> () -> x);
86+
throw new UnsupportedOperationException("lazy is not implemented!");
9087
}
9188

9289
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

src/main/java/am/ik/yavi/arguments/Arguments15Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ default <A> Arguments1Validator<A, X> compose(
8383
* @since 0.10.0
8484
*/
8585
default Arguments15Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, Supplier<X>> lazy() {
86-
// WARNING:: The default implementation is not really lazy!
87-
java.util.logging.Logger.getLogger(Arguments15Validator.class.getName()).warning(
88-
"the default implementation of lazy() is called which is not really lazy!");
89-
return this.andThen(x -> () -> x);
86+
throw new UnsupportedOperationException("lazy is not implemented!");
9087
}
9188

9289
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

src/main/java/am/ik/yavi/arguments/Arguments16Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ default <A> Arguments1Validator<A, X> compose(
8484
* @since 0.10.0
8585
*/
8686
default Arguments16Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, Supplier<X>> lazy() {
87-
// WARNING:: The default implementation is not really lazy!
88-
java.util.logging.Logger.getLogger(Arguments16Validator.class.getName()).warning(
89-
"the default implementation of lazy() is called which is not really lazy!");
90-
return this.andThen(x -> () -> x);
87+
throw new UnsupportedOperationException("lazy is not implemented!");
9188
}
9289

9390
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

src/main/java/am/ik/yavi/arguments/Arguments1Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,7 @@ default <A> Arguments1Validator<A, X> compose(
103103
* @since 0.10.0
104104
*/
105105
default Arguments1Validator<A1, Supplier<X>> lazy() {
106-
// WARNING:: The default implementation is not really lazy!
107-
java.util.logging.Logger.getLogger(Arguments1Validator.class.getName()).warning(
108-
"the default implementation of lazy() is called which is not really lazy!");
109-
return this.andThen(x -> () -> x);
106+
throw new UnsupportedOperationException("lazy is not implemented!");
110107
}
111108

112109
default Validated<X> validate(@Nullable A1 a1) {

src/main/java/am/ik/yavi/arguments/Arguments2Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ default <A> Arguments1Validator<A, X> compose(
7272
* @since 0.10.0
7373
*/
7474
default Arguments2Validator<A1, A2, Supplier<X>> lazy() {
75-
// WARNING:: The default implementation is not really lazy!
76-
java.util.logging.Logger.getLogger(Arguments2Validator.class.getName()).warning(
77-
"the default implementation of lazy() is called which is not really lazy!");
78-
return this.andThen(x -> () -> x);
75+
throw new UnsupportedOperationException("lazy is not implemented!");
7976
}
8077

8178
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2) {

src/main/java/am/ik/yavi/arguments/Arguments3Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ default <A> Arguments1Validator<A, X> compose(
7373
* @since 0.10.0
7474
*/
7575
default Arguments3Validator<A1, A2, A3, Supplier<X>> lazy() {
76-
// WARNING:: The default implementation is not really lazy!
77-
java.util.logging.Logger.getLogger(Arguments3Validator.class.getName()).warning(
78-
"the default implementation of lazy() is called which is not really lazy!");
79-
return this.andThen(x -> () -> x);
76+
throw new UnsupportedOperationException("lazy is not implemented!");
8077
}
8178

8279
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3) {

src/main/java/am/ik/yavi/arguments/Arguments4Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ default <A> Arguments1Validator<A, X> compose(
7373
* @since 0.10.0
7474
*/
7575
default Arguments4Validator<A1, A2, A3, A4, Supplier<X>> lazy() {
76-
// WARNING:: The default implementation is not really lazy!
77-
java.util.logging.Logger.getLogger(Arguments4Validator.class.getName()).warning(
78-
"the default implementation of lazy() is called which is not really lazy!");
79-
return this.andThen(x -> () -> x);
76+
throw new UnsupportedOperationException("lazy is not implemented!");
8077
}
8178

8279
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

src/main/java/am/ik/yavi/arguments/Arguments5Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,7 @@ default <A> Arguments1Validator<A, X> compose(
7474
* @since 0.10.0
7575
*/
7676
default Arguments5Validator<A1, A2, A3, A4, A5, Supplier<X>> lazy() {
77-
// WARNING:: The default implementation is not really lazy!
78-
java.util.logging.Logger.getLogger(Arguments5Validator.class.getName()).warning(
79-
"the default implementation of lazy() is called which is not really lazy!");
80-
return this.andThen(x -> () -> x);
77+
throw new UnsupportedOperationException("lazy is not implemented!");
8178
}
8279

8380
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

src/main/java/am/ik/yavi/arguments/Arguments6Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,7 @@ default <A> Arguments1Validator<A, X> compose(
7878
* @since 0.10.0
7979
*/
8080
default Arguments6Validator<A1, A2, A3, A4, A5, A6, Supplier<X>> lazy() {
81-
// WARNING:: The default implementation is not really lazy!
82-
java.util.logging.Logger.getLogger(Arguments6Validator.class.getName()).warning(
83-
"the default implementation of lazy() is called which is not really lazy!");
84-
return this.andThen(x -> () -> x);
81+
throw new UnsupportedOperationException("lazy is not implemented!");
8582
}
8683

8784
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

src/main/java/am/ik/yavi/arguments/Arguments7Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,7 @@ default <A> Arguments1Validator<A, X> compose(
7878
* @since 0.10.0
7979
*/
8080
default Arguments7Validator<A1, A2, A3, A4, A5, A6, A7, Supplier<X>> lazy() {
81-
// WARNING:: The default implementation is not really lazy!
82-
java.util.logging.Logger.getLogger(Arguments7Validator.class.getName()).warning(
83-
"the default implementation of lazy() is called which is not really lazy!");
84-
return this.andThen(x -> () -> x);
81+
throw new UnsupportedOperationException("lazy is not implemented!");
8582
}
8683

8784
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

src/main/java/am/ik/yavi/arguments/Arguments8Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,7 @@ default <A> Arguments1Validator<A, X> compose(
7878
* @since 0.10.0
7979
*/
8080
default Arguments8Validator<A1, A2, A3, A4, A5, A6, A7, A8, Supplier<X>> lazy() {
81-
// WARNING:: The default implementation is not really lazy!
82-
java.util.logging.Logger.getLogger(Arguments8Validator.class.getName()).warning(
83-
"the default implementation of lazy() is called which is not really lazy!");
84-
return this.andThen(x -> () -> x);
81+
throw new UnsupportedOperationException("lazy is not implemented!");
8582
}
8683

8784
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

src/main/java/am/ik/yavi/arguments/Arguments9Validator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,7 @@ default <A> Arguments1Validator<A, X> compose(
7979
* @since 0.10.0
8080
*/
8181
default Arguments9Validator<A1, A2, A3, A4, A5, A6, A7, A8, A9, Supplier<X>> lazy() {
82-
// WARNING:: The default implementation is not really lazy!
83-
java.util.logging.Logger.getLogger(Arguments9Validator.class.getName()).warning(
84-
"the default implementation of lazy() is called which is not really lazy!");
85-
return this.andThen(x -> () -> x);
82+
throw new UnsupportedOperationException("lazy is not implemented!");
8683
}
8784

8885
default Validated<X> validate(@Nullable A1 a1, @Nullable A2 a2, @Nullable A3 a3,

0 commit comments

Comments
 (0)