Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Iterator;
import java.util.NoSuchElementException;

import ai.timefold.solver.core.config.util.ConfigUtils;
import ai.timefold.solver.core.preview.api.domain.variable.declarative.ShadowSources;
Expand All @@ -28,6 +29,9 @@ public boolean hasNext() {

@Override
public PathPart next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
var index = previous.index() + 1;
var name = parts[index];
var isCollection = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1593,7 +1593,13 @@ public static InterfaceDeclaration getInterfaceForInstancePythonFunction(String
pythonParameterTypes[0] = 'L' + instanceInternalClassName + ';';
}

for (int i = 1; i < pythonCompiledFunction.totalArgCount(); i++) {
return getInterfaceDeclaration(pythonCompiledFunction, parameterPythonTypeList, pythonParameterTypes);
}

private static PythonClassTranslator.InterfaceDeclaration getInterfaceDeclaration(
PythonCompiledFunction pythonCompiledFunction, List<PythonLikeType> parameterPythonTypeList,
String[] pythonParameterTypes) {
for (int i = 1; i < pythonParameterTypes.length; i++) {
pythonParameterTypes[i] = 'L' + parameterPythonTypeList.get(i).getJavaTypeInternalName() + ';';
}
String returnType = 'L' + pythonCompiledFunction.getReturnType().map(PythonLikeType::getJavaTypeInternalName)
Expand All @@ -1611,14 +1617,7 @@ public static InterfaceDeclaration getInterfaceForClassPythonFunction(PythonComp
pythonParameterTypes[0] = Type.getDescriptor(PythonLikeType.class);
}

for (int i = 1; i < pythonCompiledFunction.totalArgCount(); i++) {
pythonParameterTypes[i] = 'L' + parameterPythonTypeList.get(i).getJavaTypeInternalName() + ';';
}
String returnType = 'L' + pythonCompiledFunction.getReturnType().map(PythonLikeType::getJavaTypeInternalName)
.orElseGet(() -> getPythonReturnTypeOfFunction(pythonCompiledFunction, true).getJavaTypeInternalName()) + ';';
FunctionSignature functionSignature = new FunctionSignature(returnType, pythonParameterTypes);
return functionSignatureToInterfaceName.computeIfAbsent(functionSignature,
PythonClassTranslator::createInterfaceForFunctionSignature);
return getInterfaceDeclaration(pythonCompiledFunction, parameterPythonTypeList, pythonParameterTypes);
}

public static InterfaceDeclaration createInterfaceForFunctionSignature(FunctionSignature functionSignature) {
Expand Down
Loading