- changed status to open
Implement Methods... feature does not work with new Comparator interface
Code Generation is not working for the new Comparator Interface in W’24 (Apex Ref, Release Notes).
Given this very simple (inner) class (API59):
class ContractComparator implements Comparator<Contract> {
}
Pressing the “Implement Methods…” shortcut (^I) inside the class does nothing. Pressing the Code Generation shortcut (^ENTER) and choosing “Implement Methods…” also does nothing.
On the other hand, with this simple (inner) class in the same file:
class ContractComparable implements Comparable {
}
The class declaration line immediately shows a red underline with the message, “Class ContractCombinerBatch.ContractComparable must implement the following methods or be declared abstract: compareTo(Object)”, and pressing ^I inside the class correctly shows the “Select Methods to Implement/Override” dialog.
Comments (3)
-
repo owner -
reporter - changed status to resolved
Right after filing this issue, I implemented the method by hand and then tried to use my new comparator:
contracts.sort(comparator);
This also showed an error, "Method does not exist or incorrect signature: sort(ContractComparator) from the type System.List". This gave me a hint to rebuild my OST, which also fixed the original problem. With a new OST, the empty class shows the "missing method" error, and Code Generation works as it should. Sorry for the false alarm, I'm not sure how I missed regenerating my OST for API59.
-
repo owner Not a problem. Glad it was something simple!
- Log in to comment
Jason, I'm not seeing this behavior. I just did the same thing and this is the resulting code:
Can you confirm that you're on the latest build of IC2 (2.2.9.5) and, if this is confirmed to be happening in that build, please reproduce and send me your
idea.log
file for review?