CFR 0.151 & lastest master at time of issue: 3d6b0c88835402de40423d13d495bcef07daae72
Compiler
javac 17
Description
Note in the simple example bellow that the local record LocalRecord is defined after its beign used as a generic type to List.
Also note that the listOfRecords varible type was decompiled as ArrayList while it was originally written as List
Example
package example;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String... args) {
record LocalRecord(int abc) { }
List<LocalRecord> listOfRecords = new ArrayList<>();
listOfRecords.add(new LocalRecord(123));
for (LocalRecord r : listOfRecords) {
System.out.println(r.abc());
}
}
}
Decompiles to:
/*
* Decompiled with CFR 0.151.
*/
package example;
import java.util.ArrayList;
public class Main {
public static void main(String ... args) {
ArrayList<LocalRecord> listOfRecords = new ArrayList<LocalRecord>();
record LocalRecord(int abc) {
}
listOfRecords.add(new LocalRecord(123));
for (LocalRecord r : listOfRecords) {
System.out.println(r.abc());
}
}
}
CFR version
CFR 0.151 & lastest master at time of issue: 3d6b0c88835402de40423d13d495bcef07daae72
Compiler
javac 17
Description
Note in the simple example bellow that the local record
LocalRecord
is defined after its beign used as a generic type toList
. Also note that thelistOfRecords
varible type was decompiled asArrayList
while it was originally written asList
Example
Decompiles to: