Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2010 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 10-15
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.internal.compiler.lookup; |
11 |
package org.eclipse.jdt.internal.compiler.lookup; |
12 |
|
12 |
|
|
|
13 |
import java.lang.ref.WeakReference; |
14 |
import java.util.Map; |
15 |
import java.util.WeakHashMap; |
13 |
import org.eclipse.jdt.internal.compiler.ast.Wildcard; |
16 |
import org.eclipse.jdt.internal.compiler.ast.Wildcard; |
14 |
|
17 |
|
15 |
/** |
18 |
/** |
Lines 20-25
Link Here
|
20 |
*/ |
23 |
*/ |
21 |
public class ParameterizedMethodBinding extends MethodBinding { |
24 |
public class ParameterizedMethodBinding extends MethodBinding { |
22 |
|
25 |
|
|
|
26 |
private static Map getClassMethodBindingCache; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=300734 |
23 |
protected MethodBinding originalMethod; |
27 |
protected MethodBinding originalMethod; |
24 |
|
28 |
|
25 |
/** |
29 |
/** |
Lines 249-255
Link Here
|
249 |
* The type of x.getClass() is substituted from 'Class<? extends Object>' into: 'Class<? extends raw(X)> |
253 |
* The type of x.getClass() is substituted from 'Class<? extends Object>' into: 'Class<? extends raw(X)> |
250 |
*/ |
254 |
*/ |
251 |
public static ParameterizedMethodBinding instantiateGetClass(TypeBinding receiverType, MethodBinding originalMethod, Scope scope) { |
255 |
public static ParameterizedMethodBinding instantiateGetClass(TypeBinding receiverType, MethodBinding originalMethod, Scope scope) { |
252 |
ParameterizedMethodBinding method = new ParameterizedMethodBinding(); |
256 |
ParameterizedMethodBinding method; |
|
|
257 |
if (getClassMethodBindingCache != null) { |
258 |
WeakReference w = (WeakReference) getClassMethodBindingCache.get(receiverType); |
259 |
if (w != null) { |
260 |
method = (ParameterizedMethodBinding) w.get(); |
261 |
if (method != null) { |
262 |
return method; |
263 |
} |
264 |
} |
265 |
} |
266 |
method = new ParameterizedMethodBinding(); |
253 |
method.modifiers = originalMethod.modifiers; |
267 |
method.modifiers = originalMethod.modifiers; |
254 |
method.selector = originalMethod.selector; |
268 |
method.selector = originalMethod.selector; |
255 |
method.declaringClass = originalMethod.declaringClass; |
269 |
method.declaringClass = originalMethod.declaringClass; |
Lines 268-273
Link Here
|
268 |
if ((method.returnType.tagBits & TagBits.HasMissingType) != 0) { |
282 |
if ((method.returnType.tagBits & TagBits.HasMissingType) != 0) { |
269 |
method.tagBits |= TagBits.HasMissingType; |
283 |
method.tagBits |= TagBits.HasMissingType; |
270 |
} |
284 |
} |
|
|
285 |
if (getClassMethodBindingCache == null) { |
286 |
getClassMethodBindingCache = new WeakHashMap(); |
287 |
} |
288 |
getClassMethodBindingCache.put(receiverType, new WeakReference(method)); // method refers back to key |
271 |
return method; |
289 |
return method; |
272 |
} |
290 |
} |
273 |
|
291 |
|