You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Epilogue misgenerates code for fields of type BooleanSupplier, IntSupplier, LongSupplier, DoubleSupplier when accessed through a VarHandle.
To Reproduce
Steps to reproduce the behavior:
Try to compile.
...
Compilation failed; see the compiler output below.
C:\Users\jashu\git\Epilogue_Supplier_Bug\build\generated\sources\annotationProcessor\java\main\frc\robot\RobotLogger.java:29: error: no suitable method found for log(String,DoubleSupplier)
dataLogger.log("sup", (java.util.function.DoubleSupplier) $sup.get(object).getAsDouble());
^
method DataLogger.log(String,int) is not applicable
(argument mismatch; DoubleSupplier cannot be converted to int)
method DataLogger.log(String,long) is not applicable
(argument mismatch; DoubleSupplier cannot be converted to long)
method DataLogger.log(String,float) is not applicable
(argument mismatch; DoubleSupplier cannot be converted to float)
method DataLogger.log(String,double) is not applicable
(argument mismatch; DoubleSupplier cannot be converted to double)
method DataLogger.log(String,boolean) is not applicable
(argument mismatch; DoubleSupplier cannot be converted to boolean)
....
method DataLogger.log(String,Enum<?>) is not applicable
(argument mismatch; DoubleSupplier cannot be converted to Enum<?>)
where S#1,S#2,S#3,U are type-variables:
S#1 extends Object declared in method <S#1>log(String,S#1,Struct<S#1>)
S#2 extends Object declared in method <S#2>log(String,S#2[],Struct<S#2>)
S#3 extends Object declared in method <S#3>log(String,Collection<S#3>,Struct<S#3>)
U extends Unit declared in method <U>log(String,Measure<U>,U)
C:\Users\jashu\git\Epilogue_Supplier_Bug\build\generated\sources\annotationProcessor\java\main\frc\robot\RobotLogger.java:29: error: cannot find symbol
dataLogger.log("sup", (java.util.function.DoubleSupplier) $sup.get(object).getAsDouble());
^
symbol: method getAsDouble()
location: class Object
2 errors
The core issue is that the generated code tries to cast to a DoubleSupplier instead of to a double. My guess is this happens because some logic appends .getAsDouble without also noting the change in the cast. The code generated when sup is public does not need to cast.
shueja
changed the title
[epilogue] Generation incorrect for logging private Supplier fields
[epilogue] Generation order of operations incorrect for VarHandle cast with appended Supplier getAs* method
Nov 23, 2024
Describe the bug
Epilogue misgenerates code for fields of type
BooleanSupplier, IntSupplier, LongSupplier, DoubleSupplier
when accessed through a VarHandle.To Reproduce
Steps to reproduce the behavior:
The core issue is that the generated code tries to cast to a DoubleSupplier instead of to a double. My guess is this happens because some logic appends
.getAsDouble
without also noting the change in the cast. The code generated whensup
is public does not need to cast.Expected behavior
Successful compilation, as advertised in WPILib docs.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
WPILib Information:
Project Version: 2025.1.1-beta-2
VS Code Version: 1.95.3
WPILib Extension Version: 2025.1.1-beta-2
C++ Extension Version: 1.22.9
Java Extension Version: 1.36.2024092708
Java Debug Extension Version: 0.58.2024090204
Java Dependencies Extension Version 0.24.0
Java Version: 17
Java Location: C:\Users\Public\wpilib\2025\jdk
Vendor Libraries:
WPILib-New-Commands (1.0.0)
Windows 11
The text was updated successfully, but these errors were encountered: