Hacker News new | ask | show | jobs
by hnthroaway1926 2648 days ago
Break out the line into multiple lines...

String s = customer.getName().firstName;

service.withName(s);

2 comments

So the answer is rewrite your code to work around tooling deficiencies?

I'd prefer this be fixed in the JVM, so you can decide to write your code in the way that's most readable, and not be forced to write it a certain way because the tools suck.

Yes, this is what I'll need to do every time, which is crazy to adapt your code to the tools and then back again.

And it's even

   val n = customer.getName()
   val f = n.firstName
   service.withname(f)
Gladly with Some/None NPEs happen seldom with Scala but they do from interfacing with Java libs from time to time.