View | Details | Raw Unified | Return to bug 359362 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java (-3 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 334-340 Link Here
334
		"	this.socket.setTcpNoDelay(true);\n" +
334
		"	this.socket.setTcpNoDelay(true);\n" +
335
		"	server.close();\n" +
335
		"	server.close();\n" +
336
		"\n" +
336
		"\n" +
337
		"	DataInputStream in = new DataInputStream(this.socket.getInputStream());\n" +
337
		"	final DataInputStream in = new DataInputStream(this.socket.getInputStream());\n" +
338
		"	final DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());\n" +
338
		"	final DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());\n" +
339
		"	while (true) {\n" +
339
		"	while (true) {\n" +
340
		"		final String className = in.readUTF();\n" +
340
		"		final String className = in.readUTF();\n" +
Lines 354-360 Link Here
354
		"					} catch (IOException e1) {\n" +
354
		"					} catch (IOException e1) {\n" +
355
		"						// ignore\n" +
355
		"						// ignore\n" +
356
		"					}\n" +
356
		"					}\n" +
357
		"				}\n" +
357
		"				} finally {\n" +
358
		"                   try {\n" +
359
		"					    in.close();\n" +
360
		"					    out.close();\n" +
361
		"                   } catch (IOException ioex) {}\n" +
362
		"               }\n" +
358
		"			}\n" +
363
		"			}\n" +
359
		"		};\n" +
364
		"		};\n" +
360
		"		thread.start();\n" +
365
		"		thread.start();\n" +
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java (-1 / +8 lines)
Lines 7-13 Link Here
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contribution for bug 349326 - [1.7] new warning for missing try-with-resources
10
 *     Stephan Herrmann - Contributions for
11
 *     							bug 349326 - [1.7] new warning for missing try-with-resources
12
 *     							bug 359362 - FUP of bug 349326: Resource leak on non-Closeable resource
11
 *******************************************************************************/
13
 *******************************************************************************/
12
package org.eclipse.jdt.internal.compiler.lookup;
14
package org.eclipse.jdt.internal.compiler.lookup;
13
15
Lines 184-189 Link Here
184
	final int BOXING = 0x200;
186
	final int BOXING = 0x200;
185
	final int UNBOXING = 0x400;
187
	final int UNBOXING = 0x400;
186
188
189
	/**
190
	 * Marks a type whose type bits have not yet been initialized.
191
	 * @see ReferenceBinding#hasTypeBit(int)
192
	 */
193
	final int BitUninitialized = 0x8000000;
187
	/** 
194
	/** 
188
	 * Marks all sub-types of java.lang.AutoCloseable.
195
	 * Marks all sub-types of java.lang.AutoCloseable.
189
	 * @see ReferenceBinding#hasTypeBit(int)
196
	 * @see ReferenceBinding#hasTypeBit(int)
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java (-4 / +6 lines)
Lines 10-15 Link Here
10
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for
10
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for
11
 *     							bug 282152 - [1.5][compiler] Generics code rejected by Eclipse but accepted by javac
11
 *     							bug 282152 - [1.5][compiler] Generics code rejected by Eclipse but accepted by javac
12
 *     							bug 349326 - [1.7] new warning for missing try-with-resources
12
 *     							bug 349326 - [1.7] new warning for missing try-with-resources
13
 *     							bug 359362 - FUP of bug 349326: Resource leak on non-Closeable resource
13
 *******************************************************************************/
14
 *******************************************************************************/
14
package org.eclipse.jdt.internal.compiler.lookup;
15
package org.eclipse.jdt.internal.compiler.lookup;
15
16
Lines 44-50 Link Here
44
		this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat type var as public
45
		this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat type var as public
45
		this.tagBits |= TagBits.HasTypeVariable;
46
		this.tagBits |= TagBits.HasTypeVariable;
46
		this.environment = environment;
47
		this.environment = environment;
47
		this.typeBits = -1;
48
		this.typeBits = TypeIds.BitUninitialized;
48
	}
49
	}
49
50
50
	/**
51
	/**
Lines 311-324 Link Here
311
	}
312
	}
312
313
313
	public boolean hasTypeBit(int bit) {
314
	public boolean hasTypeBit(int bit) {
314
		if (this.typeBits == -1) {
315
		if (this.typeBits == TypeIds.BitUninitialized) {
315
			// initialize from bounds
316
			// initialize from bounds
316
			this.typeBits = 0;
317
			this.typeBits = 0;
317
			if (this.superclass != null)
318
			if (this.superclass != null && this.superclass.hasTypeBit(~TypeIds.BitUninitialized))
318
				this.typeBits |= this.superclass.typeBits;
319
				this.typeBits |= this.superclass.typeBits;
319
			if (this.superInterfaces != null)
320
			if (this.superInterfaces != null)
320
				for (int i = 0, l = this.superInterfaces.length; i < l; i++)
321
				for (int i = 0, l = this.superInterfaces.length; i < l; i++)
321
					this.typeBits |= this.superInterfaces[i].typeBits;
322
					if (this.superInterfaces[i].hasTypeBit(~TypeIds.BitUninitialized))
323
						this.typeBits |= this.superInterfaces[i].typeBits;
322
		}
324
		}
323
		return (this.typeBits & bit) != 0;
325
		return (this.typeBits & bit) != 0;
324
	}
326
	}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java (-5 / +8 lines)
Lines 7-13 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contribution for bug 349326 - [1.7] new warning for missing try-with-resources
10
 *     Stephan Herrmann - Contribution for
11
 *     							bug 349326 - [1.7] new warning for missing try-with-resources
12
 *     							bug 359362 - FUP of bug 349326: Resource leak on non-Closeable resource
11
 *******************************************************************************/
13
 *******************************************************************************/
12
package org.eclipse.jdt.internal.compiler.lookup;
14
package org.eclipse.jdt.internal.compiler.lookup;
13
15
Lines 55-61 Link Here
55
		if (bound instanceof UnresolvedReferenceBinding)
57
		if (bound instanceof UnresolvedReferenceBinding)
56
			((UnresolvedReferenceBinding) bound).addWrapper(this, environment);
58
			((UnresolvedReferenceBinding) bound).addWrapper(this, environment);
57
		this.tagBits |=  TagBits.HasUnresolvedTypeVariables; // cleared in resolve()
59
		this.tagBits |=  TagBits.HasUnresolvedTypeVariables; // cleared in resolve()
58
		this.typeBits = -1;
60
		this.typeBits = TypeIds.BitUninitialized;
59
	}
61
	}
60
62
61
	public int kind() {
63
	public int kind() {
Lines 423-436 Link Here
423
	}
425
	}
424
426
425
	public boolean hasTypeBit(int bit) {
427
	public boolean hasTypeBit(int bit) {
426
		if (this.typeBits == -1) {
428
		if (this.typeBits == TypeIds.BitUninitialized) {
427
			// initialize from upper bounds
429
			// initialize from upper bounds
428
			this.typeBits = 0;
430
			this.typeBits = 0;
429
			if (this.superclass != null)
431
			if (this.superclass != null && this.superclass.hasTypeBit(~TypeIds.BitUninitialized))
430
				this.typeBits |= this.superclass.typeBits;
432
				this.typeBits |= this.superclass.typeBits;
431
			if (this.superInterfaces != null)
433
			if (this.superInterfaces != null)
432
				for (int i = 0, l = this.superInterfaces.length; i < l; i++)
434
				for (int i = 0, l = this.superInterfaces.length; i < l; i++)
433
					this.typeBits |= this.superInterfaces[i].typeBits;
435
					if (this.superInterfaces[i].hasTypeBit(~TypeIds.BitUninitialized))
436
						this.typeBits |= this.superInterfaces[i].typeBits;
434
		}
437
		}
435
		return (this.typeBits & bit) != 0;
438
		return (this.typeBits & bit) != 0;
436
	}
439
	}

Return to bug 359362