-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Generate override methods when parent's parameters have a differ…
…ent signature
- Loading branch information
1 parent
0801dfd
commit 1482036
Showing
8 changed files
with
170 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...yinterpreter/src/main/java/ai/timefold/jpyinterpreter/test/TestdataExtendedInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package ai.timefold.jpyinterpreter.test; | ||
|
||
import ai.timefold.jpyinterpreter.types.PythonString; | ||
import ai.timefold.jpyinterpreter.types.numeric.PythonInteger; | ||
|
||
/** | ||
* Not a real interface; in main sources instead of test sources | ||
* so a Python test can use it. | ||
*/ | ||
public interface TestdataExtendedInterface { | ||
PythonString stringMethod(PythonString name); | ||
|
||
PythonInteger intMethod(PythonInteger value); | ||
|
||
static String getString(TestdataExtendedInterface instance, String name) { | ||
return instance.stringMethod(PythonString.valueOf(name)).value; | ||
} | ||
|
||
static int getInt(TestdataExtendedInterface instance, int value) { | ||
return instance.intMethod(PythonInteger.valueOf(value)).value.intValue(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
python/jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/util/OverrideMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ai.timefold.jpyinterpreter.util; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
/** | ||
* Marks a generated method as an override implementation. | ||
* Needed since {@link Override} is not retained at runtime. | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface OverrideMethod { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.