Skip to content

Commit d3f3b5b

Browse files
committed
Fixes a bug introduced in the latest commit.
Constructors' signature were incorrectly computed, adding the declaring class in the signature itself.
1 parent a962a94 commit d3f3b5b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

msi.gama.core/src/msi/gaml/types/Signature.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
********************************************************************************************************/
1010
package msi.gaml.types;
1111

12+
import java.lang.reflect.Constructor;
1213
import java.lang.reflect.Executable;
1314
import java.lang.reflect.Modifier;
1415
import java.util.ArrayList;
@@ -60,7 +61,9 @@ public Signature(final Executable method) {
6061
} else {
6162
List<IType<?>> types = new ArrayList();
6263
Class[] classes = method.getParameterTypes();
63-
if (!Modifier.isStatic(method.getModifiers())) { types.add(Types.get(method.getDeclaringClass())); }
64+
boolean isStatic = Modifier.isStatic(method.getModifiers());
65+
boolean isConstructor = method instanceof Constructor;
66+
if (!isStatic && !isConstructor) { types.add(Types.get(method.getDeclaringClass())); }
6467
for (Class c : classes) { if (c != IScope.class) { types.add(Types.get(c)); } }
6568
list = types.toArray(new IType[types.size()]);
6669
}

0 commit comments

Comments
 (0)