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 236060 Details for
Bug 417017
[1.8] Incorrect parameters in resolved method binding for LambdaExpression
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed Patch
Fix-for-Bug-417017-18-Incorrect-parameters-in-resolv.patch (text/plain), 5.42 KB, created by
Manoj N Palat
on 2013-10-03 02:09:00 EDT
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Manoj N Palat
Created:
2013-10-03 02:09:00 EDT
Size:
5.42 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java >index 8078766..43b79e1 100644 >--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java >+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java >@@ -2645,6 +2645,37 @@ > typeBinding = type.resolveBinding(); > assertFalse("A Functional interface", typeBinding.isFunctionalInterface()); > } >+ /** >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=399793 >+ * >+ * @throws JavaModelException >+ */ >+ public void test417017() throws JavaModelException { >+ this.workingCopy = getWorkingCopy("/Converter18/src/test417017/X.java", >+ true/* resolve */); >+ String contents = "package test417017;" >+ + "interface I {\n" >+ + " int foo(int x);\n" >+ + "}\n" >+ + "public class X {\n" >+ + " void fun(int a) {\n" >+ +" I i1 = x1-> x1;\n" >+ +" I i2 = xxx-> {\n" >+ +" i1.foo(a);\n" >+ +" return xxx;\n" >+ +" };\n" >+ +" }\n" >+ +"}\n"; >+ CompilationUnit cu = (CompilationUnit) buildAST(contents, this.workingCopy); >+ TypeDeclaration typedeclaration = (TypeDeclaration) getASTNode(cu, 1); >+ MethodDeclaration methodDeclaration = typedeclaration.getMethods()[0]; >+ VariableDeclarationFragment vdf= (VariableDeclarationFragment) ((VariableDeclarationStatement) methodDeclaration.getBody().statements().get(1)).fragments().get(0); >+ LambdaExpression lambda= (LambdaExpression) vdf.getInitializer(); >+ List parameters = lambda.parameters(); >+ assertTrue("Incorrect Number of parameters", parameters.size() == 1); >+ ITypeBinding[] parameterTypes= lambda.resolveMethodBinding().getParameterTypes(); >+ assertTrue("Incorrect Number of parameter type", parameterTypes.length == 1); >+ } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=413942 > // also refer https://bugs.eclipse.org/bugs/show_bug.cgi?id=413569 > public void testBug413942() throws JavaModelException { >diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java >index 534984d..d4294f2 100644 >--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java >+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java >@@ -1,11 +1,15 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2011 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 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 > * http://www.eclipse.org/legal/epl-v10.html > * >- * Contributors: >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+* Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ > >@@ -13,11 +17,14 @@ > > import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.JavaCore; >+import org.eclipse.jdt.internal.compiler.ast.Argument; >+import org.eclipse.jdt.internal.compiler.ast.LambdaExpression; > import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; > import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; > import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding; > import org.eclipse.jdt.internal.compiler.lookup.RawTypeBinding; > import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; >+import org.eclipse.jdt.internal.compiler.lookup.SyntheticMethodBinding; > import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; > import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; > import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; >@@ -123,6 +130,16 @@ > return this.annotations = AnnotationBinding.NoAnnotations; > } > >+ private int getActualStart(SyntheticMethodBinding sam, int length) { >+ int start = 0; >+ LambdaExpression lambda = sam.lambda; >+ Argument[] arguments = null; >+ if (lambda != null && (arguments = lambda.arguments) != null) { >+ start = length - arguments.length; >+ } >+ return start; >+ } >+ > /** > * @see IMethodBinding#getDeclaringClass() > */ >@@ -175,15 +192,16 @@ > if (length == 0) { > return this.parameterTypes = NO_TYPE_BINDINGS; > } else { >- ITypeBinding[] paramTypes = new ITypeBinding[length]; >- for (int i = 0; i < length; i++) { >+ int start = this.binding instanceof SyntheticMethodBinding ? getActualStart((SyntheticMethodBinding) this.binding, length) : 0; >+ ITypeBinding[] paramTypes = new ITypeBinding[length - start]; >+ for (int i = start; i < length; i++) { > final TypeBinding parameterBinding = parameters[i]; > if (parameterBinding != null) { > ITypeBinding typeBinding = this.resolver.getTypeBinding(parameterBinding); > if (typeBinding == null) { > return this.parameterTypes = NO_TYPE_BINDINGS; > } >- paramTypes[i] = typeBinding; >+ paramTypes[i - start] = typeBinding; > } else { > // log error > StringBuffer message = new StringBuffer("Report method binding where a parameter is null:\n"); //$NON-NLS-1$
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 417017
:
235490
|
235788
|
236060
|
236064
|
236088