square / javapoet

A Java API for generating .java source files.
Apache License 2.0
10.83k stars 1.38k forks source link

AnnotationSpec#get(Annotation) fails on member with type long #993

Closed Tim203 closed 10 months ago

Tim203 commented 10 months ago

AnnotationSpec.Builder#addMemberForValue(String, Object) works perfectly for other special cases like adding F for floats as the default is double. However it seems like the special case for longs has been forgotten. The default is int, and when a number doesn't fit in an int the compiler will say: integer number too large. L should be added to long types, just like F is added to floats, to prevent this error.