Thanks Lucas for the clarification.

On Tuesday, December 1, 2015 at 4:32:33 PM UTC+5:30, Lukas Eder wrote:
>
> With jOOQ 3.7, we added support for Java 8 and thus also for Java 7 
> features, including AutoCloseable. In your case, this is the relevant issue:
> https://github.com/jOOQ/jOOQ/issues/4336
>
> The idea of having AutoCloseable jOOQ queries is that queries are allowed 
> to keep a reference to their underlying PreparedStatement for performance 
> reasons (Query.keepStatement()). In such case, the jOOQ Query must be 
> closed after use.
>
> Between Java 7 and Java 8, the contract on AutoCloseable went from:
>
> *Java 7*
> A resource that *must* be closed when it is no longer needed.
>
> *Java 8*
> It is possible, and in fact common, for a base class to implement 
> AutoCloseable even though not all of its subclasses or instances will hold 
> releasable resources. For code that must operate in complete generality, or 
> when it is known that the AutoCloseable instance requires resource release, 
> it is recommended to use try-with-resources constructions. However, when 
> using facilities such as java.util.stream.Stream that support both 
> I/O-based and non-I/O-based forms, try-with-resources blocks are in general 
> unnecessary when using non-I/O-based forms.
>
> In other words, while this type of warning in Eclipse was formally OK in 
> Java 7, it is not in Java 8. The warning produces lots of false positives. 
> I personally just turned it off entirely for the workspace.
>
> I hope this helps,
> Lukas
>
>
> 2015-11-30 16:26 GMT+01:00 Gokul Krishna Paravasthu <[email protected] 
> <javascript:>>:
>
>> Hi,
>>
>> I was trying to upgrade to jooq 3.7.1 from jooq 3.6.2 and am using 
>> eclipse Mars.1 Release (4.5.1).
>>
>> I have a line of code that looks like.
>>
>> final SelectSelectStep<Record> selectSelectStep = useSelectDistinct ? 
>> dslContext.selectDistinct(selectFields) : dslContext.select(selectFields
>> );
>>
>> Eclipse is reporting a warning 
>>
>> Resource leak: 'selectSelectStep' is never closed.
>>
>> I tried a few variations
>>
>> final SelectSelectStep<Record> selectDistinctStep = dslContext.
>> selectDistinct(selectFields); //no warning
>> final SelectSelectStep<Record> selectNonDistinctStep = dslContext.select(
>> selectFields); // no warning
>> final SelectSelectStep<Record> selectSelectStep = useSelectDistinct ? 
>> dslContext.selectDistinct(selectFields) : dslContext.select(selectFields
>> ); // eclipse warning
>>
>>
>> On the face of it seems like a bug/false positive in the eclipse static 
>> analysis.
>>
>> Has anyone else seen this?
>>
>> Thanks,
>> Gokul.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "jOOQ User Group" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to