Skip to content

Commit 60be031

Browse files
committed
Last minute housekeeping and small improvement (after refactoring internal code to open source)
+ More comments - javadoc error (again >) * Java 8 fix * 0.9.15 everywhere * small typo-bug in Wrap.doubleToLongFunctionDef
1 parent 85118ae commit 60be031

File tree

12 files changed

+33
-26
lines changed

12 files changed

+33
-26
lines changed

jOOL-java-8/build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id 'idea'
44
id 'maven-publish'
55
//id 'net.ltgt.errorprone' version '+'
6-
//id "org.checkerframework" version '+'
6+
//id 'org.checkerframework' version '+'
77
//id 'io.franzbecker.gradle-lombok' version '+'
88
}
99

@@ -27,12 +27,12 @@ gradle.projectsEvaluated {
2727
tasks.withType(JavaCompile).configureEach {
2828
options.encoding = 'UTF-8'
2929
options.compilerArgs.addAll(['-Xlint:all', '-parameters', '-g', '-Xmaxwarns', '999'])
30-
//options.release = 8 // javac --release 7..18+
30+
//options.release.set(8) // javac --release 7..18+ (instead of toolchain)
3131
options.deprecation = true
32-
//options.annotationProcessorPath = configurations.errorprone
32+
// options.annotationProcessorPath = configurations.errorprone
3333

3434
// options.errorprone {
35-
// enabled = true
35+
// enabled = true // <<<!!! You can disable Error-Prone here!
3636
// disableWarningsInGeneratedCode = true
3737
// excludedPaths = ".*/build/gen.*/.*"
3838
// //disable("ParameterName") disable("UnusedVariable") errorproneArgs = ["--illegal-access=warn"]
@@ -51,23 +51,25 @@ publishing {
5151
tasks.withType(GenerateModuleMetadata) {
5252
enabled = false // don't generate Gradle's json metadata
5353
}
54-
54+
// generate -src and -javadoc .jars
5555
// https://docs.gradle.org/current/userguide/publishing_maven.html
5656
java {
5757
withSourcesJar()
5858
withJavadocJar()
5959
}
6060

6161
dependencies {
62-
//errorprone "com.google.errorprone:error_prone_core:latest.release"
62+
// errorprone "com.google.errorprone:error_prone_core:latest.release"
6363
//implementation 'org.checkerframework:checker-qual:3.+'
6464

6565
testImplementation 'junit:junit:4.+'
6666
//testImplementation 'org.mockito:mockito-inline:+'
6767
//testImplementation "com.google.truth:truth:+"
6868
//testImplementation "com.google.truth.extensions:truth-java8-extension:+"
69+
6970
testRuntimeOnly 'org.slf4j:slf4j-api:2.+'
7071
testRuntimeOnly 'org.slf4j:slf4j-simple:2.+'
72+
7173
testRuntimeOnly 'org.apache.logging.log4j:log4j-api:2.+'
7274
testRuntimeOnly 'org.apache.logging.log4j:log4j-core:2.+'
7375
}

jOOL-java-8/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<groupId>org.jooq</groupId>
1414
<artifactId>jool-java-8</artifactId>
15-
<version>0.9.14</version>
15+
<version>0.9.15</version>
1616
<packaging>bundle</packaging>
1717

1818
<name>jOOL</name>

jOOL-java-8/src/main/java/org/jooq/lambda/Loops.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static void loop (long numberOfRepetitions, Runnable body) {
3131
/**
3232
Simple while-loop (numberOfRepetitions .. 0].
3333
<pre>{@code}
34-
while (numberOfRepetitions-- > 0)
34+
while (numberOfRepetitions-- &gt; 0)
3535
body.accept(numberOfRepetitions);
3636
}</pre>
3737
*/

jOOL-java-8/src/main/java/org/jooq/lambda/Wrap.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ public static DoubleToIntFunction doubleToIntFunctionDef (CheckedDoubleToIntFunc
603603

604604

605605
public static DoubleToLongFunction doubleToLongFunction (CheckedDoubleToLongFunction unsafeFunction, BiFunction<Double,Throwable,Long> handler) {
606-
return (value) -> {
606+
return (double value) -> {
607607
try {
608608
return unsafeFunction.applyAsLong(value);
609609
} catch (Throwable t) {
@@ -612,8 +612,8 @@ public static DoubleToLongFunction doubleToLongFunction (CheckedDoubleToLongFunc
612612
};
613613
}
614614

615-
public static DoubleToLongFunction doubleToLongFunctionDef (CheckedDoubleToLongFunction unsafeFunction, int def) {
616-
return (value) -> {
615+
public static DoubleToLongFunction doubleToLongFunctionDef (CheckedDoubleToLongFunction unsafeFunction, long def) {
616+
return (double value) -> {
617617
try {
618618
return unsafeFunction.applyAsLong(value);
619619
} catch (Throwable t) {

jOOL-java-8/src/test/java/org/jooq/lambda/ExtraMagicTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ public class ExtraMagicTest {
8787
@Test(expected = IOError.class)
8888
public void andThen () {
8989
Error e1 = new Error("test1: → ERROR is OK here!!!");
90-
Unchecked.PRINT_STACK_TRACE.accept(e1);
90+
Wrap.PRINT_STACK_TRACE.accept(e1);
9191

9292
IOError e2 = new IOError(e1);
93-
Consumer<Throwable> c = Unchecked.SILENT_IGNORE
93+
Consumer<Throwable> c = Wrap.SILENT_IGNORE
9494
.andThen((t) -> fail("unreachable. But: " + t));
9595
c.accept(e2);
9696

jOOL-java-8/src/test/java/org/jooq/lambda/LoopsTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,16 @@ public LongSummaryStatisticsP () {}//new
114114
@Test public void testLoopMeasured () {
115115
Tuple4<Long, LongSummaryStatistics, Exception, String> st = loopMeasured(0, null);
116116
System.out.println(st);
117-
assertEquals("LongSummaryStatistics{count=0, sum=0, min=9223372036854775807, average=0,000000, max=-9223372036854775808}", st.v2.toString());
117+
assertEquals("LongSummaryStatistics{count=0, sum=0, min=9223372036854775807, average=0,000000, max=-9223372036854775808}",
118+
st.v2.toString().replace('.',','));
118119
st = loopMeasured(0, null);
119120
assertEquals(0, st.v2.getCount());
120121
st = loopMeasured(-2, null);
121122
assertEquals(0, st.v2.getCount());
122123

123124
st = loopMeasured(1, null);
124-
assertTrue(st.v3.toString().startsWith("java.lang.NullPointerException: Cannot invoke \"java.lang.Runnable.run()\" because \"body\" is null"));
125+
assertTrue(st.toString(),//17: java.lang.NullPointerException: Cannot invoke "java.lang.Runnable.run()" because "body" is null
126+
st.v3 instanceof NullPointerException);
125127
assertEquals(1, st.v2.getCount());
126128

127129
final AtomicLong counter = new AtomicLong();

jOOL/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ gradle.projectsEvaluated {
3030
options.annotationProcessorPath = configurations.errorprone
3131

3232
options.errorprone {
33-
enabled = true
33+
enabled = true // <<<!!! You can disable Error-Prone here!
3434
disableWarningsInGeneratedCode = true
3535
excludedPaths = ".*/build/gen.*/.*"
3636
//disable("ParameterName") disable("UnusedVariable") errorproneArgs = ["--illegal-access=warn"]
@@ -49,6 +49,7 @@ publishing {
4949
tasks.withType(GenerateModuleMetadata) {
5050
enabled = false // don't generate Gradle's json metadata
5151
}
52+
// generate -src and -javadoc .jars
5253
// https://docs.gradle.org/current/userguide/publishing_maven.html
5354
java {
5455
withSourcesJar()
@@ -57,13 +58,13 @@ java {
5758

5859
dependencies {
5960
errorprone "com.google.errorprone:error_prone_core:latest.release"
60-
6161
//implementation 'org.checkerframework:checker-qual:3.+'
6262

6363
testImplementation 'junit:junit:4.+'
6464
//testImplementation 'org.mockito:mockito-inline:+'
6565
//testImplementation "com.google.truth:truth:+"
6666
//testImplementation "com.google.truth.extensions:truth-java8-extension:+"
67+
6768
testRuntimeOnly 'org.slf4j:slf4j-api:2.+'
6869
testRuntimeOnly 'org.slf4j:slf4j-simple:2.+'
6970

jOOL/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<groupId>org.jooq</groupId>
1414
<artifactId>jool</artifactId>
15-
<version>0.9.14</version>
15+
<version>0.9.15</version>
1616
<packaging>bundle</packaging>
1717

1818
<name>jOOL</name>

jOOL/src/main/java/org/jooq/lambda/Loops.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static void loop (long numberOfRepetitions, Runnable body) {
3131
/**
3232
Simple while-loop (numberOfRepetitions .. 0].
3333
<pre>{@code}
34-
while (numberOfRepetitions-- > 0)
34+
while (numberOfRepetitions-- &gt; 0)
3535
body.accept(numberOfRepetitions);
3636
}</pre>
3737
*/

jOOL/src/main/java/org/jooq/lambda/Wrap.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ public static DoubleToIntFunction doubleToIntFunctionDef (CheckedDoubleToIntFunc
603603

604604

605605
public static DoubleToLongFunction doubleToLongFunction (CheckedDoubleToLongFunction unsafeFunction, BiFunction<Double,Throwable,Long> handler) {
606-
return (value) -> {
606+
return (double value) -> {
607607
try {
608608
return unsafeFunction.applyAsLong(value);
609609
} catch (Throwable t) {
@@ -612,8 +612,8 @@ public static DoubleToLongFunction doubleToLongFunction (CheckedDoubleToLongFunc
612612
};
613613
}
614614

615-
public static DoubleToLongFunction doubleToLongFunctionDef (CheckedDoubleToLongFunction unsafeFunction, int def) {
616-
return (value) -> {
615+
public static DoubleToLongFunction doubleToLongFunctionDef (CheckedDoubleToLongFunction unsafeFunction, long def) {
616+
return (double value) -> {
617617
try {
618618
return unsafeFunction.applyAsLong(value);
619619
} catch (Throwable t) {

0 commit comments

Comments
 (0)