Adrian Fish
unread,Oct 15, 2025, 12:10:08 PM (4 days ago) Oct 15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sakai-dev
Hi all,
What are peoples opinions on using type inference in our codebase?
Since Java 10 (Sakai 22+) we've been able to use the var keyword to
declare a variable and assign it a value in one stroke, so:
var userName = new String("Bob");
This, I think, is less cluttered than using the old school:
String userName = new String("Bob");
We know it's a string already. However ...
var userName = api.getUserName();
... doesn't immediately tell you the type. You'd have to look at getUserName().
At the moment, we have our coderabbit rules setup to complain heavily
at the use of type inference.
What do you all think? Should we ban using type inference in our code?
Cheers,
Adrian.