by aster0id · 2y ago · 0 comments
Like C (alongside C++) and UNIX, JavaScript and Web, CLR and C#, JVM and Java are designed together, and have first class tooling in all Java IDEs.
private Map<String, Client> clients;
public Map<String, Client> getClients() {
return clients;
}
public void setClients(Map<String, Client> clients) {
this.clients = clients;
}
Kotlin's approach, where you declare and instantiate a property, and the getter/setter/backing storage are synthesized for you, is vastly preferable to me: public var clients = emptyMap<String, Client>()Setters are needed in exceedingly rarely circumstances.
Just saying, kotlin wasn't just a more aesthetically pleasing java, there were some deeper benefits as far as i can tell.
$ kotlin
Welcome to Kotlin version 1.6.10 (JRE 21.0.1+12-Debian-2)
Type :help for help, :quit for quit
>>> val b=ByteArray(1);
>>> b[0] == 0;
error: operator '==' cannot be applied to 'Byte' and 'Int'
b[0] == 0;
^
$ jshell
| Welcome to JShell -- Version 21.0.1
| For an introduction type: /help intro
jshell> byte[] ba={0}
ba ==> byte[1] { 0 }
jshell> ba[0]==0
$2 ==> true
upd: formatMy main reason for using it for my personal hobby projects is because I prefer another IDE.
And Kotlin is only supported by IntelliJ, which I admit is a really good ide, but not my favorite.
I am happy to be wrong now though.
Edit, this is a good step forward, here is the list from NetBeans, the "Toyota Hilux" of IDEs and my favorite:
Language Feature Support Status
File type recognition √
Project type
Semantic syntax highlighting √
Formatting √
Braces matching √
Code completion √
Error Hints/Fixes/Suggestions
Code templates
Refactoring
Debugging
At the pace this is moving now I don't know what will stop me from only using Kotlin in the feature.Code completion
Linting
Semantic highlighting
Debugging
Go-to-definition
Signature help
Hover
Formatting
Document symbols
Find references