258 points · by todsacerdoti · 4y ago · 297 comments
It sounds like a good idea, but I can imagine lots of downstream breakage, some of it not immediately obvious, with apps that make bad assumptions.
Edit: The risks section of the linked doc above does explain some of that, and there is some notable risk.
You're not wrong, which is probably why they did it in this release.
JDK 17 was an LTS release, and 18 isn't. The next LTS will be JDK 21 in September 2023:
* https://www.oracle.com/java/technologies/java-se-support-roa...
This presumably gives folks times to adjust before jumping between LTSes in production.
It doesn’t mean enabling Java 18 on Production on day 1, but certainly it means adding a Java 18 compiler to your CI, running tests using Java 18, etc.
[1] https://www.reddit.com/r/java/comments/o0m6g8/the_state_of_p...
[1]: https://tschatzl.github.io/2022/03/14/jdk18-g1-parallel-gc-c...
This changes the default charset of the Java APIs to UTF-8.
I read that the Java 8's JVM's internal string representation is UTF-16 [0][1]. Is that still the case after JEP400?
[0] https://docs.oracle.com/javase/8/docs/technotes/guides/intl/...
JEP400 is about I/O, previous to this change when you create something like a FileWriter without specifying the charset the platform default would be used. For a long time this has been recognized as a common foot gun, hence this change to a default that is more likely to be what the developer actually wants.
UTF-32 (with no BMP concept) doubles the memory usage of most international text and quadruples the memory usage of ASCII text (which is the most common), yet characters outside the BMP are barely used outside of emoji.
Native UTF-8 in memory makes character indexing a non-constant time operation, which would bite people badly in cases where they've written a loop over the indexes. This is of course the point at which you say, ah but what is a character exactly. If you go down this route you end up with Swift and Emoji Flag Calculus classes. The string APIs become incredibly convoluted or inefficient for the common cases. It hardly seems worth any kind of backwards compatibility break for this.
So Java does the pragmatic thing: String can switch between 8 or 16 bits per "character" and this is basically always good enough. If you care about woring with emoji or Egyptian hieroglyphs in memory, then you either have to deal with combining characters or just bite the bullet and decode to UTF-32.
> ...JVM's internal string representation is UTF-16
Hasn't been try for a while. They switched to using a byte array internally for storage, plus an encoding. Currently that's either UTF-16 or Latin 1, unless compact strings are disabled in which case it's all UTF-16.
Latin 1 has the special property that each of its fixed-width code units maps onto a single UTF-16 code unit. It is for that reason alone that CharSequence implementors can use it as an alternative to UTF-16. Imagine trying to implement `char charAt(int index)` if you're backed by a UTF-8 byte array (or UTF-32, for that matter)!
From a programmer's perspective, Java is pretty much as UTF-16 as ever.
I generally like the idea to use UTF-8 strings, but if they didn't want to break string indexing, the indexing would take O(str.length)...
edit: per comments below, Oracle's Java is open-source too these days.
Oracle also has their own build of the JDK which is not GPL. That is free to use in commercial software as well, under their "No-Fee Terms and Conditions"
For reference I double checked here: https://www.oracle.com/java/technologies/downloads/
Side note: Avoid EBS at all costs if you can, unless you like spending money on consultants and like crappy obfuscated processes.
Most of the big vendors are running the TCK tests to certify compatibility as well.
OpenJDK is reference one build from the source which is then taken by vendors and tweaked and built.
https://en.wikipedia.org/wiki/Google_LLC_v._Oracle_America,_....
I think it'll be very atypical for a companies who doesn't use any of the Oracle product to use proprietary Oracle Java and pay for the support
its fully certified and production ready. And most importantly - official Docker image https://hub.docker.com/_/amazoncorretto
Even oracle JDK does not come with a supported, official image
https://www.azul.com/downloads/?package=jdk#download-openjdk
[1] https://www.oracle.com/java/technologies/javase/jdk-faqs.htm...
I'm speaking as someone who spent the last 6 years focused on frontend web technology.
But to throw another onto the pile, Java being statically compiled makes it a lot easier to comprehend a larger codebase that you didn't necessarily write yourself. The history of dynamically-typed languages is basically getting to a certain critical size and realizing there's some merit to a well-defined, compiler-checkable code interface and then retconning it in - this happened with Facebook (Hack-lang), with Typescript/CoffeeScript (Google), and I think there's one for Python now too.
So yeah, basically people like Java because it's fast and versatile, because it's got a Pythonesque amount of stuff already written for it, and because it's got features that are oriented towards bigger teams with more turnover/etc that make it practical for business reasons.
cough Microsoft did Typescript, actually
That's kind of downplaying it right? Outside of "native" languages like C, C++, Rust, fortran, Java blows everything else out of the water.
Also, 'performance' isn't really an issue once you are past 'good enough'.
I don't think most devs are worried about Java/Node/Python/Golang performance on the backend for most apps. Obviously not always the case, but in most instances, it's not a primary concern.
Frankly, these days, when I think about 'performance' I think about 'developer performance!'. Java downsides in that its bureaucratic by convention, but at least it's super solid and reliable. I really, really wish it were a bight lighter however.
But that is what I think OP means. It isn't top tier performance, but it is in the second tier which I wouldn't argue for qualifying for "relatively good".
FWIW I find that languages tend to fall into a couple rough performance groups:
- Native at about x1 performance: C, C++, Rust, Fortran
- Compiled GC at about 2x performance: Java, Go, Haskell, Lisp
- Dynamic at 20-50x native performance: Python, Ruby...
JS is a weird one that varies a lot depending on your workload and can sometimes look similar to compiled GC performance.
Yeah, I'd agree (with the sibling as well). Obviously native code is faster but Java is about as fast as it gets for a managed language. It's massively fast (these days) in comparison to, say, Ruby. Python manages to do relatively OK by throwing away any sense of threading and the synchronization of internals that might entail but it's still significantly slower than Java.
Speaking of which that's another advantage of Java. Threading works basically as expected, and now it's even got modern promise/future APIs. Python's "just clone all your memory and do everything through IPC" is super clunky in comparison.
In many cases, that's also inherited by other JVM languages, and interop is really cool there too. You can use Java libraries in your Scala/Kotlin/etc, or call those routines from your Java code. It's not just one language, it's all the languages on one engine, and they all run decently fast for what they are.
C#/DotNet is really fast too (I would say faster than Java if anything) and it's pretty similar to Java in most ways. Bytecode, JITed, static typing, etc. They also got the second-mover advantage, to see all the things Java did wrong and fix them - like checked exceptions, or the clone() interface. On the other hand, at least as of 10 years or so ago, the tooling was absolutely primitive compared to what's out there for JVM stuff (and at the time it was all tied to Windows). Maybe that's changed with Roslyn but they're coming from behind, and Java has been around for a long time and it's tough to overcome that inertia.
1. GC is an enormous productivity improvement for applications whose performance characteristics can afford it. Seriously, I can't think of a single programming language feature/concept/technology that makes a bigger difference in developer velocity than memory safety and GC.
2. Static types are also a large productivity improvement for developers comfortable using them and the kinds of projects that benefit from them (large, multi-dev, multi-year).
3. Imperative and object-oriented. Java is imperative in the small, which is familiar to most developers and seems to strike a balance of letting developers write correct code with good performance. Java is OOP in the large and for many classes of applications, that's been a wildly successful way of organizing code and lowering the cognitive overhead.
4. Path dependence. The past largely determines the present. We don't reset all of our technology choices and start from scratch at the beginning of each fiscal quarter, so the languages that were widely used tend to stay the languages widely used.
Java was the first heavily engineering and marketed language that featured GC, static types, and OOP, so it got big and continues to stay big.
I also think it's a pretty decent language. The things people don't criticize about Java are mostly complaints about a certain style of programming in the 90s and less the language itself.
(assuming that's a typo there, the things people don't like/the things people criticize?)
I disagree on that point, I think the language itself was a problem. Java 6 and prior were very very verbose and very very slow. I think that really changed with JDK 7/8, but the java we know today isn't the java of the 90s.
Even then, to some extent that problem hasn't gone away, it's just been papered over with frameworks and library code. Like honestly even as a java dev, I couldn't tell you off the top of my head the exact code to open a file, read each of the lines, and then close everything, or the right way to open a JNP connection to RabbitMQ or something. Anything touching files or sockets is still an absolute nightmare of boilerplate code, inputstreams, filestreams, printwriters, try/catch, and mother. fucking. IOException. thrown everywhere. But you don't care, because you just call Apache commons-io or Spring RestTemplate.
And that has contributed to some criticism of its own. Spring tends to turn into architecture-astronaut crap, like everyone's favorite AbstractSingletonProxyFactoryBean.
> Java was the first heavily engineering and marketed language that featured GC, static types, and OOP, so it got big and continues to stay big.
The other quiet boost that people don't talk about is Android. Tons of libraries get written with the intent of being used in some android app somewhere, but you can use that equally much on desktop/server. It really really helps the rapid-prototyping aspect of Java that ~half the smartphones in the world are running Android.
var lines = Files.lines(Paths.get("file.txt"));
or if you want to be extremely cautious: try (var lines = Files.lines(Paths.get("file.txt"))) {
}
I agree about IOException though. It's the bane of my existence :) The amount of times I have to rethrow UncheckedIOException is far too high.Oops, yes, sorry.
> Java 6 and prior were very very verbose and very very slow.
It's kind of verbose, when looking at it from today's perspective, but at the time I didn't think it was that bad. I think they deliberately tried to be less cryptic and more wordy than C/C++ (which can often be impenatrable). I think they overcorrected for that, but I don't think the language is interolerably verbose.
Performance was definitely bad until Lars Bak and company showed up and wrote HotSpot. But almost every managed language at the time had poor performance. It was certainly painfully slow compared to C and C++ but... what wasn't?
> I couldn't tell you off the top of my head the exact code to open a file, read each of the lines, and then close everything, or the right way to open a JNP connection to RabbitMQ or something.
I mean, I couldn't tell you how to do that off the top of my head in just about any language. Except C. But, of course, the code I would write for C off the top of my head is simple and wrong because it doesn't handle all of the various ways IO can fail.
Networking and file systems are honestly just kind of grungy. You can paper over it with simple APIs but what you end up with is code that looks pretty but can fail in obscure ways.
> try/catch, and mother. fucking. IOException. thrown everywhere.
Yeah, checked exceptions were simply a mistake. I don't fault them for trying to fit exceptions into the static type system. It was a cool, ambitious idea. At the time, no one really had a sense of how the ecosystem would settle around using exceptions. In practice, it ended up being more trouble than it's worth.
> The other quiet boost that people don't talk about is Android.
Android is definitely keeping it popular these days, but Java was huge because of server development before Android came along.
Free-as-in-beer?
JVM performance is generally fine, and the language prevents you from introducing whole classes of memory safety bugs. You can still shoot yourself in the foot with native (JNI) extensions, but the decent performance of the JVM makes developers use JNI far less frequently than, say, Python or Ruby devs reach for compiled libraries.
JVM byte code decompilation is fairly trivial, so tools for the security scanning of artifacts are cheaper and more fully featured than similar tools for scanning machine code.
this has been the case in the past, but Java is gritting its teeth and making some breaking changes in the JDK11/16/18 era.
libraries that mess with the unsafe/internal namespaces are the most prominent example - there are a ton of legacy libraries that are going to break from that change unless updated - but there's also a big push for modules and for classes to encapsulate themselves more strongly.
Then why do I have to have multiple JVMs installed, which I need to go through via trial-and-error, if I'm given some random java application?
You don't. Almost any Java program written ever will run on Java 18.
There are occasionally breaking changes but most old jars out there will run fine in the latest runtime, so the answer to your question is going to depend on how squirrely your use case is.
Using the JVM doesn't mean you're limited to Java anymore, and hasn't for a long time. I have built software for the JVM for the past 6+ years nearly exclusively in Clojure with only a few moments where I needed to dip down into Java proper.
No language is perfect of course, the point isn't to start a war. I don't personally use Java for my own projects anymore but I can see why it's very attractive.
1. Catch, log and rethrow, or
2. Wrap as a runtime exception (so you don’t have to change every method signature up to main())
Sure, there’s option 3: catch and handle… but this is used 1/50 times, and the ergonomics of (2) overwhelm the utility of this.
BTW, vavr is nice. Just, “run it all” and optimize for the golden path. If there’s an error account for it locally.
Of course you catch and handle errors. Or at the very least you must think about whether it makes sense to handle an error on the current abstraction level that you are on, which means you must always consider option 3. Only if you decide that it's not possible or doesn't make sense to handle it ("I am too lazy" is not a reason to not handle it!) you decide whether you need to throw it one level up the stack. And if doing that is the sensible thing, you think about whether you want to make the exception part of the API of whatever you currently write or not. If you want to, you throw the exception without doing anything (most of the time you don't even log it, because you understand that the receiver at the end, the one who finally handles it, is responsible of logging it, otherwise you get multiple logs of the same exception written out just because someone sprinkled logging into several abstraction layers). If you want to hide the exception type somehow, you wrap it in a more fitting exception that's explicitly or implicitly part of the API of whatever you're writing, and throw that one. That can, but doesn't have to be, a runtime exception.
I really don't get what's so hard about exception handling. Java's exceptions are a pretty good analog to how one must model proper error handling in multi-layered software applications anyway, regardless of the programming model used to implement it.
This is not as useless as it sounds. You can analyse the logs and find out why these exceptions are occurring. A lot of times these lead you to subtle bugs which you might not have noticed otherwise.
Returning an Either<Result, Error> is pretty much the same thing conceptually. Either you propagate the error or you handle it.
Some complain about verbosity. It's really a non-issue particularly in a modern IDE and not worth making a language decision over.
Not everything has to be new and sexy.
I understand though, that in more recent versions of Java this is taken care of for you.
myService.getSomething().var
and press tab, it will autocomplete it to
Something something = myService.getSomething()
Java also supposedly runs on everything. And, you could as well write Android apps in it.
if (str1 == str2) {
// oops
}The tricky one is numbers.
Integer == int // fine
int == int // fine
numVarOne == numVarTwo // Uh-oh
In that third example you better make sure they aren’t both boxed objects or BigDecimals.
I’ve almost never seen the string one for some reason. It’s always boxed numbers.
Again, a good IDE is worth a ton.
The good news is that a linter trivially detects this bug.
I mean by that same logic, Javascript will confuse you as well because `{} != {}`, or C++ because of pointer mechanisms and custom operators.
Boolean.getBoolean, however, now that is a proper Java land mine.
The competition includes languages like Rust, Go, Haskell or Erlang. Most of these lack the languages that you'll find on the JVM, so it really is a question of what you are trying to do. Go is certainly interesting in some places, especially if you want a binary that is entirely self sufficient. Each of these languages is interesting, though of course one has to wonder about hiring, whereas finding developers who've worked on the JVM is easy enough.
It also has an ecosystem of tooling to monitor and profile built both into the JDKs and by teams across Silicon Valley (eg first class bazel support).
I’m in one of these companies now, and while I’m certainly productive using Java, it’s also got huge downside in the community which these companies don’t really care about.
Never have I seen so much cargo cult practice. The ecosystem isn’t great, with hard to google docs and everything pointing you to a poorly written baeldung article.
Java gets no one excited. And, it gets no one fired.
I think you’ve got to meet your customer where they are, and if you can ship Java desktop apps, and they’re happy… keep going.
But you’re not shipping apps to their iPhones using Java. It’s either JS or Swift.
And, on Android it’s JS or Kotlin.
So the common target is JS.
But yeah, I guess i first started using Django ~2008 if I recall correctly, and switched over to Pyramid in 2010. Since then, I've used many other frameworks – in Python, Ruby, JS, C#, Java, and Go. Regardless of the language, I always try and go closer to the metal when I can.
I think your assessment about the others being potentially worse is fair: they're all bad in their own ways. I think it just takes time (and experience across many different teams) to develop good taste.
* It's very fault tolerant. In almost every case C++ would mushroom cloud, Java can walk it off. It's easy to write code that cleans itself up on error. try-with-resources is great.
* Modern JVM JIT and GC are pretty damn good, and the tooling is great.
* It's very boring and stable. I see this as the killer feature. Cool is a conserved quantity. It's extremely hard to write cool software in a cool language, as that attracts cool developers too busy getting cool jobs to maintain their cool framework you depended on. There's a lot of mature high quality libraries available. APIs are stable, stuff very seldom breaks. You can often use code that's 10-15 years old just fine. This has changed a bit lately, but it's still extremely reliable.
There are drawbacks as well, primarily memory mapping files is difficult, some of the aforementioned libraries are a bit bloated as well and overall the language sort of encourages large complicated solutions to simple problems.
Personally I prefer c#, but a lot of places already were using Java in significant ways before c# became good (IMO 2.0ish) and saw no reason to change.
For a simple hello world it is below 0.1s.
Slow startup time is a problem in automated testing of big codebases - when you aim to test the whole codebase, but each test alone does not stress any code path hard enough for the hotspot compiler to kick in. So basically most of your Java code in testing runs in interpreted mode, which is like 20x-100x slower than properly compiled and optimized C/C++/Rust.
IMO
Java had so many marketing crazes that it's crazy. I still remember the "Java mobile game" fad from a dozen of years ago - Java this, Java that, Java for phone, Java for toaster...
At some point, the public mind starts to associate "programming" with Java. Since there were (and probably always will be, unless we evolve into utopia) hordes of job-desperate people who would do anything to feed themselves and their families, a lot of them hear about Java, start programming in Java and develop their whole world around Java. Java helps them with this by providing this huge, Java-centric ecosystem which gives you everything you ever need to do whatever you want to do.
Of course, there is also the fact that Java is a managed environment and makes it a lot harder for programmers to write broken code, which makes large-scale programming possible even if all you have is a horde of mediocre programmers. But then again, that property is not unique to Java.
People laugh at the cute "Java runs on four billion devices!" tagline but back in 1995 if you weren't doing Java, you were a last-century coder. It was so pervasive Brendan Eich even renamed his strange scheme-smalltalk mashup "JavaScript".
(Also, Scheme-Self, not Scheme-Smalltalk.)
Twenty-five years ago
Hype is not reason why "a major Silicon Valley company that's migrating their backend to it".
I suppose there are many Java enthusiasts on here.
For most traditional Java frameworks (like Spring or Quarkus), Kotlin has long been a first class citizen (support, documentation, custom Kotlin extension functions, etc.) and probably the easier language to use when you are starting out with those frameworks. And of course on Android, it has long replaced Java as the default language.
On the server server-side, Spring has done so much work on integrating with Kotlin in the last five years that you are probably not doing yourself any favors if you choose not to use that. Kotlin DSL support is just a killer feature here. Spring has really embraced that and they've added nice Kotlin DSLs for pretty much everything that matters. No more builders. No more endless function chaining. No more annotation magic (or at least a lot less of it).
- Compiler performance, especially of mixed Java/Kotlin compilation, is spotty.
- Support and tooling maturity is way behind Java. I'm trying to use it with Bazel, but the support lags far behind the Java equivalents.
- Interop with Java libraries that use annotations or interfaces is maddening.
- Perhaps a matter of taste, but the `var` keyword is a blight, even in Java.
- for all the complaints about "== vs .equals" and that sort of thing, these are by now incredibly well understood pitfalls that are generally checked by static analysis, sometimes even at compile time now by e.g. ErrorProne
In the early days, when it seemed like Java development might stall because of legal hell, Kotlin was a breath of fresh air. But today now, Java is clearly on a path to cannibalize Kotlin's most valuable features. Record classes and pattern matching obviate the biggest draws of Kotlin, while maintaining the buttoned-up, no-fun-but-extremely-pragmatic rigor of the Java language.
Once the glow started to fade, I was left with a very boring, familiar question: what am I really gaining by using this new tool? Is it worth the cost? and on my list of problems I deal with daily as a Java developer, the problems addressed by Kotlin are now so far down on the list that it's not worth dealing with even the tooling friction imo. For me, anyways.
https://www.infoq.com/news/2022/03/jrebel-report-2022
Hardly a successor of anything outside Google's ecosystem.
I work in Go currently and although I see the positives, I'd be less inclined to unleash a bunch of mid-level devs using Go to create a huge codebase.
If I could have my way, personally, I'd go for one of the other fun JVM langs out there... but that's just me having fun.
Why?
I wish.
As opposed to what developers that aren't cheap? Node.js? PHP? C#? Python? I have no idea what developer you're talking about here. Do you think JEE developers are cheap?
- Java has great ecosystem support
- JVM is very performant
- Java has well understood quirks
- Reasonably mature build system
- Good deploy story
I wouldn’t use Java for a web server but I like it very much for many other things.
I think Scala + Play does a good job for JVM web frameworks but I’d use a Typescript thing (or just Rails)
There are downsides to Java. Bit and byte manipulation are annoying, for instance. But I’m still happy with it.
From a business standpoint, there are lots and lots of Java programmers out there. Of course that doesn't reflect anything about the average skill of those programmers..
If you're like me and you sort of get sad when your program uses more than 64mb when idle because it feels wasteful, then yeah that overhead is pretty gnarly.
"But we have servers with hundreds of gigs of ram!" you might respond - and sure, we do, but having resources doesn't mean you have to use them. It is better to write small fast efficient programs than extravagant enterprise stuff.
Python and node are both great but mostly just wrap C libraries, so If openssl or your database driver has a bug your fancy interpreted/sandboxed language does not help.
Java has existed a long time and developers have had time to reimplement many popular protocols and libraries. This can sometimes cause few % points of performance, but you get stability and the excellent monitoring&debugging.
For example, if I need to accept images from the internet I would use Java since there are pure java image libraries that cannot be exploited with unexpected data. At most it fails and everything is cleaned up.
There are 3rd party libraries and integrations for _everything_ and it's comparatively easy to find skilled developers with years of experience.
So it boils down to: do the people like static typing or not.
Contrary to the Silicon Valley popular opinion, these languages are incredibly productive and run much of the world, with code running in all of the Fortune 500 companies down to small businesses and even your phones.
A trivially easy replacement would be Kotlin, it compiles to the same VM (and additionally webassembly), it is designed and implemented by one of the leading IDE vendors, it can trivially call and be called from Java, it has tons of zero-cost syntactic sugar that covers the inhumane verbosity that Java buries you under till your eyes bleed and your hands scream. A well-designed language, what should have been all along.
I think at least some of my dependencies still rely on reflection features that are limited by Java 9.
Not OP by the way
If you want to write shared Java libs that work on both client/server, you need to stick to Java 8.
Plus most code probably handles this poorly. I suspect it will often result in exceptions opening new files or connection which are just caught and retried forever, resulting in your server locking up after some period of time. If you are lucky it just crashes and restarts. (The ultimate garbage collection.)
"I call it my billion-dollar mistake. It was the invention of the null reference in 1965. At that time, I was designing the first comprehensive type system for references in an object oriented language (ALGOL W). My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years. In recent years, a number of program analysers like PREfix and PREfast in Microsoft have been used to check references, and give warnings if there is a risk they may be non-null. More recent programming languages like Spec# have introduced declarations for non-null references. This is the solution, which I rejected in 1965." -- Tony Hoare
Let's give credit to C# and Dart for fixing this, and bring shame to Java and Go for not doing so.
* https://www.oracle.com/java/technologies/java-se-support-roa...
I believe JetBrains use Swing and their stuff is pretty great.
Currently fully FRP UI is quite popular (Jetpack Compose, ReactJS etc) but frankly whenever I've read such codebases I've been somewhat unimpressed. You can make JavaFX work that way with a bit of extra utility code, and there are places where that approach makes sense, but fundamentally a well engineered OOP UI toolkit is in its element. The functional reactive approach seems to create quite a few problems. Whether it creates as many as it solves, I reserve judgement as I haven't had a chance to write a large GUI app since they came out. Still, I've written a lot of them in the past and would definitely be tempted to stick with JavaFX despite having worked through the Jetpack Compose tutorials.
(note: jfx-central is itself a JavaFX app, again running with JPro to be projected over the web, but you can also download it and run it locally).
Java 9-17 adds some major language features, but they're not so major that you'd really need a whole book. You could look up the individual JDK release notes and see what each release changed.
[0] https://www.oreilly.com/library/view/effective-java/97801346...
Hopefully Panama delivers one day.
Android 13 is surprisingly adopting more Java 11 features, most likely because they need compatibility with Java libraries that have moved beyond the Android Java subset.
static void testStringOrNull(Object o) {
switch (o) {
case null, String s -> System.out.println("String: " + s);
}
}
I would never have believed you. And while it's not Elixir-level pattern matching, it's not toothless either. This is valid pattern matching code too: static void testTriangle(Shape s) {
switch (s) {
case Triangle t && (t.calculateArea() > 100) ->
System.out.println("Large triangle");
default ->
System.out.println("A shape, possibly a small triangle");
}
}
[1]: https://openjdk.java.net/jeps/420[1]: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...