Skip to content

Commit

Permalink
Fixes a bug introduced in the latest commit.
Browse files Browse the repository at this point in the history
Constructors' signature were incorrectly computed, adding the declaring
class in the signature itself.
  • Loading branch information
AlexisDrogoul committed Jan 24, 2022
1 parent a962a94 commit d3f3b5b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion msi.gama.core/src/msi/gaml/types/Signature.java
Expand Up @@ -9,6 +9,7 @@
********************************************************************************************************/
package msi.gaml.types;

import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
Expand Down Expand Up @@ -60,7 +61,9 @@ public Signature(final Executable method) {
} else {
List<IType<?>> types = new ArrayList();
Class[] classes = method.getParameterTypes();
if (!Modifier.isStatic(method.getModifiers())) { types.add(Types.get(method.getDeclaringClass())); }
boolean isStatic = Modifier.isStatic(method.getModifiers());
boolean isConstructor = method instanceof Constructor;
if (!isStatic && !isConstructor) { types.add(Types.get(method.getDeclaringClass())); }
for (Class c : classes) { if (c != IScope.class) { types.add(Types.get(c)); } }
list = types.toArray(new IType[types.size()]);
}
Expand Down

0 comments on commit d3f3b5b

Please sign in to comment.