|
Lines 1-11
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2011 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2013 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 |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* This is an implementation of an early-draft specification developed under the Java |
|
|
9 |
* Community Process (JCP) and is made available for testing and evaluation purposes |
| 10 |
* only. The code is not compatible with any specification of the JCP. |
| 11 |
* |
| 12 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
13 |
* IBM Corporation - initial API and implementation |
| 10 |
*******************************************************************************/ |
14 |
*******************************************************************************/ |
| 11 |
|
15 |
|
|
Lines 13-23
Link Here
|
| 13 |
|
17 |
|
| 14 |
import org.eclipse.jdt.core.IJavaElement; |
18 |
import org.eclipse.jdt.core.IJavaElement; |
| 15 |
import org.eclipse.jdt.core.JavaCore; |
19 |
import org.eclipse.jdt.core.JavaCore; |
|
|
20 |
import org.eclipse.jdt.internal.compiler.ast.Argument; |
| 21 |
import org.eclipse.jdt.internal.compiler.ast.LambdaExpression; |
| 16 |
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; |
22 |
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; |
| 17 |
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; |
23 |
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; |
| 18 |
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding; |
24 |
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding; |
| 19 |
import org.eclipse.jdt.internal.compiler.lookup.RawTypeBinding; |
25 |
import org.eclipse.jdt.internal.compiler.lookup.RawTypeBinding; |
| 20 |
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; |
26 |
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; |
|
|
27 |
import org.eclipse.jdt.internal.compiler.lookup.SyntheticMethodBinding; |
| 21 |
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; |
28 |
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; |
| 22 |
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; |
29 |
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; |
| 23 |
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; |
30 |
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; |
|
Lines 123-128
Link Here
|
| 123 |
return this.annotations = AnnotationBinding.NoAnnotations; |
130 |
return this.annotations = AnnotationBinding.NoAnnotations; |
| 124 |
} |
131 |
} |
| 125 |
|
132 |
|
|
|
133 |
private int getActualStart(SyntheticMethodBinding sam, int length) { |
| 134 |
int start = 0; |
| 135 |
LambdaExpression lambda = sam.lambda; |
| 136 |
Argument[] arguments = null; |
| 137 |
if (lambda != null && (arguments = lambda.arguments) != null) { |
| 138 |
start = length - arguments.length; |
| 139 |
} |
| 140 |
return start; |
| 141 |
} |
| 142 |
|
| 126 |
/** |
143 |
/** |
| 127 |
* @see IMethodBinding#getDeclaringClass() |
144 |
* @see IMethodBinding#getDeclaringClass() |
| 128 |
*/ |
145 |
*/ |
|
Lines 175-189
Link Here
|
| 175 |
if (length == 0) { |
192 |
if (length == 0) { |
| 176 |
return this.parameterTypes = NO_TYPE_BINDINGS; |
193 |
return this.parameterTypes = NO_TYPE_BINDINGS; |
| 177 |
} else { |
194 |
} else { |
| 178 |
ITypeBinding[] paramTypes = new ITypeBinding[length]; |
195 |
int start = this.binding.isSynthetic() ? getActualStart((SyntheticMethodBinding) this.binding, length) : 0; |
| 179 |
for (int i = 0; i < length; i++) { |
196 |
ITypeBinding[] paramTypes = new ITypeBinding[length - start]; |
|
|
197 |
for (int i = start; i < length; i++) { |
| 180 |
final TypeBinding parameterBinding = parameters[i]; |
198 |
final TypeBinding parameterBinding = parameters[i]; |
| 181 |
if (parameterBinding != null) { |
199 |
if (parameterBinding != null) { |
| 182 |
ITypeBinding typeBinding = this.resolver.getTypeBinding(parameterBinding); |
200 |
ITypeBinding typeBinding = this.resolver.getTypeBinding(parameterBinding); |
| 183 |
if (typeBinding == null) { |
201 |
if (typeBinding == null) { |
| 184 |
return this.parameterTypes = NO_TYPE_BINDINGS; |
202 |
return this.parameterTypes = NO_TYPE_BINDINGS; |
| 185 |
} |
203 |
} |
| 186 |
paramTypes[i] = typeBinding; |
204 |
paramTypes[i - start] = typeBinding; |
| 187 |
} else { |
205 |
} else { |
| 188 |
// log error |
206 |
// log error |
| 189 |
StringBuffer message = new StringBuffer("Report method binding where a parameter is null:\n"); //$NON-NLS-1$ |
207 |
StringBuffer message = new StringBuffer("Report method binding where a parameter is null:\n"); //$NON-NLS-1$ |