Skip to content

Commit

Permalink
Fix for #394: transfer parameter names from declaration to binding
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Sep 7, 2018
1 parent e6041f1 commit 965b781
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// GROOVY PATCHED
/*******************************************************************************
* * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
Expand Down Expand Up @@ -391,14 +392,23 @@ 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)) {
problemReporter().illegalThisDeclaration(argument);
}
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)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// GROOVY PATCHED
/*******************************************************************************
* * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
Expand Down Expand Up @@ -392,14 +393,23 @@ 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)) {
problemReporter().illegalThisDeclaration(argument);
}
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)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// GROOVY PATCHED
/*******************************************************************************
* * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
Expand Down Expand Up @@ -392,14 +393,23 @@ 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)) {
problemReporter().illegalThisDeclaration(argument);
}
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)) {
Expand Down

0 comments on commit 965b781

Please sign in to comment.