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 158258 Details for
Bug 300734
Extract temp misses duplicate occurrence.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression test
patch_300734.txt (text/plain), 4.78 KB, created by
Olivier Thomann
on 2010-02-04 23:19:19 EST
(
hide
)
Description:
Proposed fix + regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2010-02-04 23:19:19 EST
Size:
4.78 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java,v >retrieving revision 1.28 >diff -u -r1.28 ParameterizedMethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java 8 Jan 2009 20:51:05 -0000 1.28 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java 5 Feb 2010 04:18:31 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 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 >@@ -10,6 +10,9 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.lookup; > >+import java.lang.ref.WeakReference; >+import java.util.Map; >+import java.util.WeakHashMap; > import org.eclipse.jdt.internal.compiler.ast.Wildcard; > > /** >@@ -20,6 +23,7 @@ > */ > public class ParameterizedMethodBinding extends MethodBinding { > >+ private static Map getClassMethodBindingCache; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=300734 > protected MethodBinding originalMethod; > > /** >@@ -249,7 +253,17 @@ > * The type of x.getClass() is substituted from 'Class<? extends Object>' into: 'Class<? extends raw(X)> > */ > public static ParameterizedMethodBinding instantiateGetClass(TypeBinding receiverType, MethodBinding originalMethod, Scope scope) { >- ParameterizedMethodBinding method = new ParameterizedMethodBinding(); >+ ParameterizedMethodBinding method; >+ if (getClassMethodBindingCache != null) { >+ WeakReference w = (WeakReference) getClassMethodBindingCache.get(receiverType); >+ if (w != null) { >+ method = (ParameterizedMethodBinding) w.get(); >+ if (method != null) { >+ return method; >+ } >+ } >+ } >+ method = new ParameterizedMethodBinding(); > method.modifiers = originalMethod.modifiers; > method.selector = originalMethod.selector; > method.declaringClass = originalMethod.declaringClass; >@@ -268,6 +282,10 @@ > if ((method.returnType.tagBits & TagBits.HasMissingType) != 0) { > method.tagBits |= TagBits.HasMissingType; > } >+ if (getClassMethodBindingCache == null) { >+ getClassMethodBindingCache = new WeakHashMap(); >+ } >+ getClassMethodBindingCache.put(receiverType, new WeakReference(method)); // method refers back to key > return method; > } > >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java,v >retrieving revision 1.291 >diff -u -r1.291 ASTConverter15Test.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 1 Oct 2009 01:18:42 -0000 1.291 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 5 Feb 2010 04:18:36 -0000 >@@ -47,7 +47,7 @@ > } > > static { >-// TESTS_NUMBERS = new int[] { 340 }; >+// TESTS_NUMBERS = new int[] { 341 }; > // TESTS_RANGE = new int[] { 325, -1 }; > // TESTS_NAMES = new String[] {"test0204"}; > } >@@ -10915,4 +10915,25 @@ > assertEquals("Wrong size", "@goto", ((TagElement) tags.get(1)).getTagName()); > checkSourceRange((TagElement) tags.get(1), "@goto new position", contents); > } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=300734 >+ public void test341() throws JavaModelException { >+ String contents = >+ "public class Bug300734 {\n" + >+ " public void foo(String x) {\n" + >+ " x.getClass();\n" + >+ " x.getClass();\n" + >+ " }\n" + >+ "}"; >+ this.workingCopy = getWorkingCopy("/Converter15/src/Bug300734.java", true/*resolve*/); >+ CompilationUnit unit= (CompilationUnit) buildAST( >+ contents, >+ this.workingCopy, >+ true, >+ false, >+ true); >+ MethodDeclaration methodDeclaration = (MethodDeclaration) getASTNode(unit, 0, 0); >+ IMethodBinding methodBinding1 = ((MethodInvocation) ((ExpressionStatement) methodDeclaration.getBody().statements().get(0)).getExpression()).resolveMethodBinding(); >+ IMethodBinding methodBinding2 = ((MethodInvocation) ((ExpressionStatement) methodDeclaration.getBody().statements().get(1)).getExpression()).resolveMethodBinding(); >+ assertTrue("Bindings differ", methodBinding1 == methodBinding2); >+ } > } >\ No newline at end of file
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 300734
:
158163
|
158258
|
158259
|
158418