Community
Participate
Working Groups
Due to thw fix for bug 349326, the following two tests fail: 1)test0147(org.eclipse.jdt.core.tests.dom.ASTConverter15Test) junit.framework.ComparisonFailure: different output. ----------- Expected ------------ ------------ but was ------------ Resource leak: 'next' is never closed 2) test0147(org.eclipse.jdt.core.tests.dom.ASTConverter15JLS4Test) junit.framework.ComparisonFailure: different output. ----------- Expected ------------ ------------ but was ------------ Resource leak: 'next' is never closed Test snippet is as follows import java.lang.Comparable; import java.util.Collection; import java.util.Iterator; public class X { public static <T extends Object & Comparable<? super T>> T min( Collection<? extends T> coll) { Iterator<? extends T> i = coll.iterator(); T candidate = i.next(); while (i.hasNext()) { T next = i.next(); if (next.compareTo(candidate) < 0) candidate = next; } return candidate; } }
In the snippet, 'T' is not a resource of type 'Closeable', yet we get the warning. Stephan, can you take a look? Thanks!
Created attachment 204267 [details] proposed fix Stephan, can you check if this fix is ok? The tests pass with this. Thanks!
Created attachment 204285 [details] enhanced fix (In reply to comment #2) > Created attachment 204267 [details] > proposed fix > > Stephan, can you check if this fix is ok? The tests pass with this. Thanks! The location and idea of your fix is perfect. The underlying issue is that super types of a type variable may have their typeBits still uninitialized at this point. Thus we were passing -1 (marking state uninitialized) down. Rather than filtering out -1 in the end my patch ensures that all super types properly initialized their typeBits before merging bits. For this purpose I changed -1 for uninitialized to an explicit new bit: TypeIds.BitUninitialized. I also changed the corresponding method for WildcardBinding, yet I wouldn't know how to create a test for this, as concrete expressions should never have the type of a wildcard, but rather a capture binding. Also included in this patch: I added close() calls to the class VerifyTests (string constant in TestVerifier) to avoid the new warning in the console output of compiler tests. I'm currently re-running the model tests.
Tests pass with the enhanced fix. Released as commit 247dd2da1a649afa18a4b7387fd9cbdf69c251eb for 3.8 M3.
(In reply to comment #3) Thanks Stephan! For fixing this and the VerifyTests issue. I noticed it recently and was going to fix it :)
Verified for 3.8 M3 using build id: N20111022-2000