mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 15:49:33 +00:00
Compare commits
1 Commits
v0.20.0
...
maxsumrall
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56ed83bf49 |
@@ -146,6 +146,10 @@
|
||||
<artifactId>value-annotations</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jooq</groupId>
|
||||
<artifactId>jooq</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jspecify</groupId>
|
||||
<artifactId>jspecify</artifactId>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package tech.picnic.errorprone.refasterrules;
|
||||
|
||||
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
||||
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
||||
import java.util.stream.Stream;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.ResultQuery;
|
||||
import tech.picnic.errorprone.refaster.annotation.Description;
|
||||
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
|
||||
|
||||
@OnlineDocumentation
|
||||
final class JooqRules {
|
||||
private JooqRules() {}
|
||||
|
||||
/** Prefer eagerly fetching data over (lazy) streaming to avoid potentially leaking resources. */
|
||||
@Description(
|
||||
"Prefer eagerly fetching data over (lazy) streaming to avoid potentially leaking resources.")
|
||||
static final class ResultQueryFetchStream {
|
||||
@BeforeTemplate
|
||||
Stream<?> before(ResultQuery<? extends Record> resultQuery) {
|
||||
return resultQuery.stream();
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
Stream<?> after(ResultQuery<? extends Record> resultQuery) {
|
||||
return resultQuery.fetch().stream();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@ final class RefasterRulesTest {
|
||||
ImmutableSortedMultisetRules.class,
|
||||
ImmutableSortedSetRules.class,
|
||||
IntStreamRules.class,
|
||||
JooqRules.class,
|
||||
JUnitRules.class,
|
||||
JUnitToAssertJRules.class,
|
||||
LongStreamRules.class,
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package tech.picnic.errorprone.refasterrules;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
import org.jooq.impl.DSL;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class JooqRulesTest implements RefasterRuleCollectionTestCase {
|
||||
Stream<?> testResultQueryFetchStream() {
|
||||
return DSL.select().stream();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package tech.picnic.errorprone.refasterrules;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
import org.jooq.impl.DSL;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class JooqRulesTest implements RefasterRuleCollectionTestCase {
|
||||
Stream<?> testResultQueryFetchStream() {
|
||||
return DSL.select().fetch().stream();
|
||||
}
|
||||
}
|
||||
7
pom.xml
7
pom.xml
@@ -368,6 +368,11 @@
|
||||
<artifactId>value-annotations</artifactId>
|
||||
<version>2.9.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jooq</groupId>
|
||||
<artifactId>jooq</artifactId>
|
||||
<version>3.16.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jspecify</groupId>
|
||||
<artifactId>jspecify</artifactId>
|
||||
@@ -1178,6 +1183,8 @@
|
||||
| BSD 3-clause
|
||||
| BSD License 3
|
||||
| Eclipse Distribution License (New BSD License)
|
||||
| Eclipse Distribution License - v 1.0
|
||||
| EDL 1.0
|
||||
| New BSD License
|
||||
</licenseMerge>
|
||||
<licenseMerge>
|
||||
|
||||
Reference in New Issue
Block a user