diff options
author | Stephan Herrmann | 2011-09-29 13:00:37 +0000 |
---|---|---|
committer | Stephan Herrmann | 2011-09-29 13:00:37 +0000 |
commit | 247dd2da1a649afa18a4b7387fd9cbdf69c251eb (patch) | |
tree | eaeeaf68d1268325520f3114d4d7fa748789ebea | |
parent | 283ea669e65ae7c25e43949f506630d59e6cdb74 (diff) | |
download | eclipse.jdt.core-247dd2da1a649afa18a4b7387fd9cbdf69c251eb.tar.gz eclipse.jdt.core-247dd2da1a649afa18a4b7387fd9cbdf69c251eb.tar.xz eclipse.jdt.core-247dd2da1a649afa18a4b7387fd9cbdf69c251eb.zip |
resource.
5 files changed, 33 insertions, 14 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java index 8c38c58d14..f72aa69040 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -334,7 +334,7 @@ private String getVerifyTestsCode() { " this.socket.setTcpNoDelay(true);\n" + " server.close();\n" + "\n" + - " DataInputStream in = new DataInputStream(this.socket.getInputStream());\n" + + " final DataInputStream in = new DataInputStream(this.socket.getInputStream());\n" + " final DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());\n" + " while (true) {\n" + " final String className = in.readUTF();\n" + @@ -354,7 +354,12 @@ private String getVerifyTestsCode() { " } catch (IOException e1) {\n" + " // ignore\n" + " }\n" + - " }\n" + + " } finally {\n" + + " try {\n" + + " in.close();\n" + + " out.close();\n" + + " } catch (IOException ioex) {}\n" + + " }\n" + " }\n" + " };\n" + " thread.start();\n" + diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html index a6597efc71..2066a8c757 100644 --- a/org.eclipse.jdt.core/buildnotes_jdt-core.html +++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html @@ -52,7 +52,9 @@ Eclipse SDK 3.8.0 - %date% - 3.8.0 M3 <h2>What's new in this drop</h2> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=348186">348186</a> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=359362">359362</a> +FUP of bug 349326: Resource leak on non-Closeable resource. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=348186">348186</a> [compiler] Improve wording for the warning for masked/hidden catch block <br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=355838">355838</a> [compiler] ecj compiles the code that javac6 rejects diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java index 2bd50bc5d0..115bf8339d 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java @@ -7,7 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation - * Stephan Herrmann - Contribution for bug 349326 - [1.7] new warning for missing try-with-resources + * Stephan Herrmann - Contributions for + * bug 349326 - [1.7] new warning for missing try-with-resources + * bug 359362 - FUP of bug 349326: Resource leak on non-Closeable resource *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; @@ -184,6 +186,11 @@ public interface TypeIds { final int BOXING = 0x200; final int UNBOXING = 0x400; + /** + * Marks a type whose type bits have not yet been initialized. + * @see ReferenceBinding#hasTypeBit(int) + */ + final int BitUninitialized = 0x8000000; /** * Marks all sub-types of java.lang.AutoCloseable. * @see ReferenceBinding#hasTypeBit(int) diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java index e463960ab3..995f30e7c1 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java @@ -10,6 +10,7 @@ * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for * bug 282152 - [1.5][compiler] Generics code rejected by Eclipse but accepted by javac * bug 349326 - [1.7] new warning for missing try-with-resources + * bug 359362 - FUP of bug 349326: Resource leak on non-Closeable resource *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; @@ -44,7 +45,7 @@ public class TypeVariableBinding extends ReferenceBinding { this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat type var as public this.tagBits |= TagBits.HasTypeVariable; this.environment = environment; - this.typeBits = -1; + this.typeBits = TypeIds.BitUninitialized; } /** @@ -311,14 +312,15 @@ public class TypeVariableBinding extends ReferenceBinding { } public boolean hasTypeBit(int bit) { - if (this.typeBits == -1) { + if (this.typeBits == TypeIds.BitUninitialized) { // initialize from bounds this.typeBits = 0; - if (this.superclass != null) + if (this.superclass != null && this.superclass.hasTypeBit(~TypeIds.BitUninitialized)) this.typeBits |= this.superclass.typeBits; if (this.superInterfaces != null) for (int i = 0, l = this.superInterfaces.length; i < l; i++) - this.typeBits |= this.superInterfaces[i].typeBits; + if (this.superInterfaces[i].hasTypeBit(~TypeIds.BitUninitialized)) + this.typeBits |= this.superInterfaces[i].typeBits; } return (this.typeBits & bit) != 0; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java index 375ebece67..01f369e259 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java @@ -7,7 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation - * Stephan Herrmann - Contribution for bug 349326 - [1.7] new warning for missing try-with-resources + * Stephan Herrmann - Contribution for + * bug 349326 - [1.7] new warning for missing try-with-resources + * bug 359362 - FUP of bug 349326: Resource leak on non-Closeable resource *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; @@ -55,7 +57,7 @@ public class WildcardBinding extends ReferenceBinding { if (bound instanceof UnresolvedReferenceBinding) ((UnresolvedReferenceBinding) bound).addWrapper(this, environment); this.tagBits |= TagBits.HasUnresolvedTypeVariables; // cleared in resolve() - this.typeBits = -1; + this.typeBits = TypeIds.BitUninitialized; } public int kind() { @@ -423,14 +425,15 @@ public class WildcardBinding extends ReferenceBinding { } public boolean hasTypeBit(int bit) { - if (this.typeBits == -1) { + if (this.typeBits == TypeIds.BitUninitialized) { // initialize from upper bounds this.typeBits = 0; - if (this.superclass != null) + if (this.superclass != null && this.superclass.hasTypeBit(~TypeIds.BitUninitialized)) this.typeBits |= this.superclass.typeBits; if (this.superInterfaces != null) for (int i = 0, l = this.superInterfaces.length; i < l; i++) - this.typeBits |= this.superInterfaces[i].typeBits; + if (this.superInterfaces[i].hasTypeBit(~TypeIds.BitUninitialized)) + this.typeBits |= this.superInterfaces[i].typeBits; } return (this.typeBits & bit) != 0; } |