From 965b7816621f1ed67308c923eed61c492936427e Mon Sep 17 00:00:00 2001 From: Eric Milles Date: Thu, 6 Sep 2018 20:00:58 -0500 Subject: [PATCH] Fix for #394: transfer parameter names from declaration to binding --- .../jdt/internal/compiler/lookup/MethodScope.java | 10 ++++++++++ .../jdt/internal/compiler/lookup/MethodScope.java | 10 ++++++++++ .../jdt/internal/compiler/lookup/MethodScope.java | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/jdt-patch/e47/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java b/jdt-patch/e47/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java index 28421ccfba..b1667e8516 100644 --- a/jdt-patch/e47/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java +++ b/jdt-patch/e47/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java @@ -1,3 +1,4 @@ +// GROOVY PATCHED /******************************************************************************* * * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials @@ -391,7 +392,13 @@ MethodBinding createMethod(AbstractMethodDeclaration method) { Argument[] argTypes = method.arguments; int argLength = argTypes == null ? 0 : argTypes.length; if (argLength > 0) { + // GROOVY add + method.binding.parameterNames = new char[argLength][]; + // GROOVY end Argument argument = argTypes[--argLength]; + // GROOVY add + method.binding.parameterNames[argLength] = argument.name; + // GROOVY end if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) method.binding.modifiers |= ClassFileConstants.AccVarargs; if (CharOperation.equals(argument.name, ConstantPool.This)) { @@ -399,6 +406,9 @@ MethodBinding createMethod(AbstractMethodDeclaration method) { } while (--argLength >= 0) { argument = argTypes[argLength]; + // GROOVY add + method.binding.parameterNames[argLength] = argument.name; + // GROOVY end if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) problemReporter().illegalVararg(argument, method); if (CharOperation.equals(argument.name, ConstantPool.This)) { diff --git a/jdt-patch/e48/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java b/jdt-patch/e48/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java index b401d53e3b..a488cb151b 100644 --- a/jdt-patch/e48/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java +++ b/jdt-patch/e48/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java @@ -1,3 +1,4 @@ +// GROOVY PATCHED /******************************************************************************* * * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials @@ -392,7 +393,13 @@ MethodBinding createMethod(AbstractMethodDeclaration method) { Argument[] argTypes = method.arguments; int argLength = argTypes == null ? 0 : argTypes.length; if (argLength > 0) { + // GROOVY add + method.binding.parameterNames = new char[argLength][]; + // GROOVY end Argument argument = argTypes[--argLength]; + // GROOVY add + method.binding.parameterNames[argLength] = argument.name; + // GROOVY end if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) method.binding.modifiers |= ClassFileConstants.AccVarargs; if (CharOperation.equals(argument.name, ConstantPool.This)) { @@ -400,6 +407,9 @@ MethodBinding createMethod(AbstractMethodDeclaration method) { } while (--argLength >= 0) { argument = argTypes[argLength]; + // GROOVY add + method.binding.parameterNames[argLength] = argument.name; + // GROOVY end if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) problemReporter().illegalVararg(argument, method); if (CharOperation.equals(argument.name, ConstantPool.This)) { diff --git a/jdt-patch/e49/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java b/jdt-patch/e49/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java index b401d53e3b..a488cb151b 100644 --- a/jdt-patch/e49/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java +++ b/jdt-patch/e49/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java @@ -1,3 +1,4 @@ +// GROOVY PATCHED /******************************************************************************* * * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials @@ -392,7 +393,13 @@ MethodBinding createMethod(AbstractMethodDeclaration method) { Argument[] argTypes = method.arguments; int argLength = argTypes == null ? 0 : argTypes.length; if (argLength > 0) { + // GROOVY add + method.binding.parameterNames = new char[argLength][]; + // GROOVY end Argument argument = argTypes[--argLength]; + // GROOVY add + method.binding.parameterNames[argLength] = argument.name; + // GROOVY end if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) method.binding.modifiers |= ClassFileConstants.AccVarargs; if (CharOperation.equals(argument.name, ConstantPool.This)) { @@ -400,6 +407,9 @@ MethodBinding createMethod(AbstractMethodDeclaration method) { } while (--argLength >= 0) { argument = argTypes[argLength]; + // GROOVY add + method.binding.parameterNames[argLength] = argument.name; + // GROOVY end if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) problemReporter().illegalVararg(argument, method); if (CharOperation.equals(argument.name, ConstantPool.This)) {