Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 204285 Details for
Bug 359362
FUP of bug 349326: Resource leak on non-Closeable resource.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
enhanced fix
Bug_359362.patch (text/plain), 6.72 KB, created by
Stephan Herrmann
on 2011-09-29 08:24:04 EDT
(
hide
)
Description:
enhanced fix
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2011-09-29 08:24:04 EDT
Size:
6.72 KB
patch
obsolete
>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 8c38c58..f72aa69 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 @@ > " 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 @@ > " } 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/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java >index 2bd50bc..115bf83 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 @@ > 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 e463960..995f30e 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 @@ > 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 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 375ebec..01f369e 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 @@ > 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 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; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 359362
:
204267
| 204285