SlideShare a Scribd company logo
1 of 78
Download to read offline
dr. sc. Branko Mihaljević
dr. sc. Aleksander Radovan
doc. dr. sc. Martin Žagar
HUJAK
www.hujak.hr 1
HUJAK - B. Mihaljević, A. Radovan, M. Žagar
The Best
Java Tools
for Developers
(in 2021)
The most used tools in Java?
• Are we talking about the "developers tools" or best practices as "tools"?
• Well, both!
• Part 1 – Developers Tools for Java
(incl. Platforms and Frameworks)
• Part 2 – The new "tools" in Java
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 2
What do we most commonly/actually use?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 3
Some Surveys
Several relevant surveys taken into consideration:
• JVM Ecosystem Report 2021
by snyk
• 2000 responses in February-March 2021
• 2021 Java Developer Productivity
Report by JRebel
• 876 responses August-November 2020
• The State of Developer Ecosystem
2021 by JetBrains
• 31743 responses
• 2021 Developer Survey
by StackOverflow
• 83052 responses (out of which 58031
professional developers) in May 2021
• CodingGame Developer Survey
2021
• 15000 responses (?)
• Java Survey 2020 by HUJAK 
• 45+ responses in Feb 2020
• THANK YOU 
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 4
Versions of Java
• Java platform versions used in projects?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 5
32%
82%
7% 7%
46%
9% 7%
5%
60%
1%
7%
62%
1% 3% 5%
12%
3%
50%
1% 1%
64%
2% 3%
8%
26%
4% 3%
15%
69%
36%
8%
72%
4% 2%
42%
4% 4%
8%
14%
0%
20%
40%
60%
80%
100%
7 or
older
8 9 10 11 12 13 14 15 16 17
HUJAK
snyk prod.
snyk dev.
JRebel
JetBrains
Which JDK?
• Which Java vendor's JDK do you currently use in production?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 6
44%
28%
23%
16%
9%
7%
22%
59%
6%
10%
4%
0% 20% 40% 60% 80%
AdoptOpenJDK
Oracle OpenJDK
Oracle JDK
Azul Zulu
Amazon Corretto
GraalVM
snyk
JRebel
Other JVM languages
• Other JVM languages in production?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 7
18%
13%
10%
8%
2%
1%
0% 20%
Kotlin
Groovy
Scala
Clojure
JRuby
Other
snyk
2021
Application Server
• What application server do you use on your main application?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 8
66%
19%
18%
15%
14%
6%
6%
61%
9%
5%
17%
5%
4%
4%
28%
0% 20% 40% 60% 80% 100%
Tomcat
JBoss / Wildfly
WebLogic
Jetty
WebSphere
GlassFish
Other
None
JRebel
JetBrains
Web Application Frameworks?
• Which Web application frameworks do you use?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 9
65%
42%
5% 3% 2% 2% 2%
62%
9%
6% 4%
58%
29%
24%
11%
3% 5% 4% 4%
77%
54%
28%
5%
2% 2%
5%
9%
0%
20%
40%
60%
80%
JetBrains
JRebel
snyk
HUJAK
Cloud Platforms
• Cloud platforms and PaaS used?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 10
54%
31%
31%
24%
18%
3%
1,9%
39%
18%
24%
9%
9%
7%
0% 20% 40% 60%
Amazon (AWS)
Google (GCP)
Microsoft (Azure)
Heroku
Digital Ocean
IBM (Cloud or Watson)
Oracle (OCI)
SAP Cloud Platform
Pivotal Cloud Foundry
StackOverflow
JRebel
Top IDEs?
• The TOP 10 IDE Index pypl.github.io/IDE.html
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 11
Rank Language Ratings
1 Visual Studio 31.2%
2 Eclipse 21.9%
3 Visual Studio Code 10.2%
4 IntelliJ 9.0%
… …
7 NetBeans 3.0%
IDEs and Editors
• Which IDEs or editors do you use?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 12
72%
25%
23%
14%
13%
1%
65%
48%
27%
13%
4%
2%
29%
16%
71%
24%
7%
30%
20%
75%
11%
4%
2%
0% 20% 40% 60% 80%
IntelliJ IDEA
Eclipse
VS Code
Vi/Vim/Emacs…
NetBeans
Some Browser-based
Notepad++
Sublime
Some Other
snyk
JRebel
StackOverflow
JetBrains
IDEs for JDK 17
• IntelliJ IDEA 2021.2.1
• Supports Java 17 Sealed Types, Always-strict Floating-point Semantics, and Pattern Matching
for Switch expressions (Preview)
• Also supports Java 16 Records, patterns, local enums and interface, and Text Blocks
• blog.jetbrains.com/idea/2021/09/java-17-and-intellij-idea/
• Eclipse IDE 2021-09 (4.21)
• Supports Java 17, including Pattern Matching for Switch (Preview), Sealed Classes, and more
via Eclipse Marketplace
• Wait for 2021-12 (4.22) for integrated support
• NetBeans 12.5
• With experimental support for JDK 17
• netbeans.apache.org/download/nb125/index.html
• Visual Studio Code
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 13
IDEs for JDK 17 – IntelliJ IDE Example
• Test IntelliJ IDEA 2021.2.1
• More at blog.jetbrains.com/
idea/2021/09/java-17-and-
intellij-idea/
• Watch Learn Java 17 with
IntelliJ IDE by Mala Gupta
• youtu.be/FP0V98S4l9w (31:30)
• Pattern matching for
instanceof
• Pattern matching for switch
• Sealed classes and interfaces
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 14
App Building Tools?
• Tools for building applications?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 15
76%
38%
12%
6%
3%
67%
20%
11%
2%
72%
49%
8%
1%
8%
0% 20% 40% 60% 80%
Maven
Gradle
Ant
Other
None
snyk
JRebel
JetBrains
CI/CD Time and Frequency?
• CI/CD time and commit frequency?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 16
Unit Testing?
• Which unit-testing frameworks do you use?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 17
85%
45%
9%
8%
5%
4%
4%
4%
0% 20% 40% 60% 80%
JUnit
Mockito
PowerMock
TestNG
Spock
EasyMock
JMockit
My own tests
JetBrains
JVM Profilers?
• Which JVM profilers do you regularly use?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 18
26%
20%
11%
10%
4%
3%
1%
3%
44%
0% 20% 40%
Integrated IntelliJ
VisualVM
JProfiler
Java Mission Control
NetBeans profiler
YourKit
async-profiler
My own
None
JetBrains
VM platforms?
• Which VM platform do you use?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 19
57%
42%
27%
12%
4%
12%
0% 20% 40% 60% 80%
Docker
Kubernetes
VMware
Vagrant
Other
N/A
JRebel
What if Stuck?
• What do you do when you get stuck?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 20
90%
80%
49%
40%
46%
40%
12%
10%
10%
0% 20% 40% 60% 80% 100%
Google it
Visit StackOverflow
Do some other work
Read help/manual/tutorial
Call a coworker
Some physical activity
Play a game
Panic
Meditate
StackOverflow
While waiting… on redeploy?
• Coffeeeeeeeee!
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 21
Time to Redeploy?
• How long to redeploy? (by JRebel)
• Remote redeploy in a container?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 23
Part 2 – The new "tools" in Java
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 24
The Most Important Java Features (11-17)
• Languages Features – Records, Switch Expressions, Text Blocks, vars, Pattern
Matching for instanceof, Sealed Classes, Pattern Matching for switch…
• Memory Management – G1 GC enhancements (Full Parallel), ZGC (with
improvements), Shenandoah GC, Elastic Metaspace…
• Library Enhancements – Pseudo-Random Generator, Deserealization Filters,
Vector API, Foreign Fuction & Memory API…
• Future Proofing – Module System (JPMS), Strong Encapsulation for JDK Internals…
• Easier Debugging – Flight Recorder, JFT Event Streaming, NullPointerExceptions…
• Modernizing Infrastructure – MercurialGit, GitHub, AArch64 port…
• Deprecations & Removals – CMS GC, Nashorn, Biased Locking, RMI Activation,
Applet API, Security Manager…
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 25
Switch Expressions
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 26
Switch Expressions
• First Preview as JEP 325 in JDK 12
• Extend switch statement so it can be used as a statement or an expression
• Both can use either a "traditional" or "simplified" scoping and control flow behavior
• "Simplified" switch form with "case L ->" to switch labels
• If a label is matched, then only the expression or statement to the right of an arrow
label is executed – there could be no fall through
• Without fall through! No need for break
• Can also be used as an expression?
• All possible values covered (totality)?
• Without default (completeness)?
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 27
Switch Expressions (Preview) – Example
switch (day) {
case MONDAY:
case FRIDAY:
case SUNDAY:
System.out.println(6);
break;
case TUESDAY:
System.out.println(7);
break;
case THURSDAY:
case SATURDAY:
System.out.println(8);
break;
case WEDNESDAY:
System.out.println(9);
break;
}
enum Weekdays { MONDAY, TUESDAY, WEDNESDAY, THURSDAY,
FRIDAY, SATURDAY, SUNDAY }
switch (day) {
case MONDAY, FRIDAY, SUNDAY -> System.out.println(6);
case TUESDAY -> System.out.println(7);
case THURSDAY, SATURDAY -> System.out.println(8);
case WEDNESDAY -> System.out.println(9);
}
www.hujak.hr 28
HUJAK - B. Mihaljević, A. Radovan, M. Žagar
No fall through (no need for break)
Switch Expressions (Preview) – Example #2
int numLetters;
switch (day) {
case MONDAY:
case FRIDAY:
case SUNDAY:
numLetters = 6;
break;
case TUESDAY:
numLetters = 7;
break;
case THURSDAY:
case SATURDAY:
numLetters = 8;
break;
case WEDNESDAY:
numLetters = 9;
break;
default:
throw new IllegalStateException("Hmm: " + day);
};
enum Weekdays { MONDAY, TUESDAY, WEDNESDAY, THURSDAY,
FRIDAY, SATURDAY, SUNDAY }
int numLetters = switch (day) {
case MONDAY, FRIDAY, SUNDAY -> 6;
case TUESDAY -> 7;
case THURSDAY, SATURDAY -> 8;
case WEDNESDAY -> 9;
// no default!!!
};
www.hujak.hr 29
HUJAK - B. Mihaljević, A. Radovan, M. Žagar
Used as an expression
No fall through
No default needed
Switch Expressions
• Second Preview as JEP 354 in JDK 13
• Extended switch so it can be used as either a statement or an expression
• Both can use either traditional case ... : labels (with fall through) or
new case ... -> labels (with no fall through)
• Expression must be either:
• Char, byte, short, int
• Character, Byte, Short, Integer
• String
• enum
• Introduces new statement for yielding a value from a switch expression
• Based on feedback on design and experience in JDK 12 to simplify everyday coding
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 30
Switch Expressions (2nd Preview) – Example
• When working switch expression, if a full block is needed, a new yield
statement is introduced
• It yields a value that becomes the value of the enclosing switch expression
int j = switch (day) {
case MONDAY -> 0;
case TUESDAY -> 1;
default -> {
int k = day.toString().length();
int result = f(k);
yield result;
}
};
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 31
Switch Expressions (2nd Preview) – Example
• A switch expression can also use a traditional switch block with case L:
switch labels (implying fall through semantics)
• In this case, values are yielded using the new yield statement
int result = switch (s) {
case "Foo":
yield 1;
case "Bar":
yield 2;
default:
System.out.println("Neither Foo nor Bar, hmmm...");
yield 0;
};
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 32
Switch Expressions (2nd Preview) – Example
int numLetters;
switch (day) {
case MONDAY:
case FRIDAY:
case SUNDAY:
numLetters = 6;
break;
case TUESDAY:
numLetters = 7;
break;
case THURSDAY:
case SATURDAY:
numLetters = 8;
break;
case WEDNESDAY:
numLetters = 9;
break;
default:
throw new IllegalStateException("Hmm: " + day);
};
int numLetters =
switch (day) {
case MONDAY:
case FRIDAY:
case SUNDAY:
yield 6;
case TUESDAY
yield 7;
case THURSDAY
case SATURDAY
yield 8;
case WEDNESDAY
yield 9;
default:
throw new IllegalStateException(
"Hmm: " + day);
};
www.hujak.hr 33
HUJAK - B. Mihaljević, A. Radovan, M. Žagar
Switch Expressions (Standard)
• Standard as JEP 361 in JDK 14
• Final version of the extended switch
a) Can be used as either a statement or an expression
b) Can use traditional case ... : labels or new case ... -> labels (no fall
through)
c) Can yield value from a switch expression
• Additionally, to prepare for the use of pattern matching (JEP 305) in switch
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 34
Text Blocks
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 35
Text Blocks
• Idea: Adding text blocks to the Java language (using """)
• Relates to JEP 326: Raw String Literals, Preview as JEP 355 (JDK 13), Second
Preview as JEP 368 (JDK 14), Standard as JEP 378: Text Blocks (JDK 15)
https://openjdk.java.net/jeps/378
• A text block is a multi-line string literal that
• Avoids the need for most escape sequences
• Automatically formats the string in a predictable way
• Gives the developer control over format when desired
• Goals
• Easy to express strings that span several lines of source code (avoiding escape seqs)
• Enhance readability of non-Java code embedded in Java programs as strings
• Support migration from string literals
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 36
Text Blocks – examples
• SQL example using a "two-dimensional" block of text
String query = """
SELECT "EMP_ID", "LAST_NAME" FROM "EMPLOYEE_TB"
WHERE "CITY" = 'INDIANAPOLIS'
ORDER BY "EMP_ID", "LAST_NAME";
""";
• Polyglot language example using a "two-dimensional" block of text
ScriptEngine engine = new ScriptEngineManager().getEngineByName("js");
Object obj = engine.eval("""
function hello() {
print('"Hello, world"');
}
hello();
""");
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 37
Text Blocks – examples
• HTML example using "one-dimensional" string literals
String html = "<html>n" +
" <body>n" +
" <p>Hello, world</p>n" +
" </body>n" +
"</html>n";
• HTML example using a "two-dimensional" block of text
String html = """
<html>
<body>
<p>Hello, world</p>
</body>
</html>
""";
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 38
Records
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 39
Records
• Idea: Data Classes for Java – from project Amber
• JEP 395: Records (JDK 16) https://openjdk.java.net/jeps/395
• Preview in JEP 359 (JDK 14), Second Preview in JEP 385 (JDK 15)
• Provide a compact syntax for declaring classes which are transparent holder for
shallowly immutable data
• Similar to nominal tuples
• Eliminate boilerplate code
• Any of the members that are automatically derived from the state description can
also be declared explicitly
• Deeper improvement – when deserializing a record, a record constructor is called
and checks are made (not just forcing values into fields)
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 40
Records – Example
• Example: We need a point
class Point {
final double x;
final double y;
public Point (double x, double y) {
this.x = x;
this.y = y;
}
public double x() { return x; }
public double y() { return y; }
www.hujak.hr 41
@Override
public double equals (Object o) {
if (…)
…
return …
}
@Override
Public double hashCode () {
return …
}
@Override
Public double toString() {
return …
}
HUJAK - B. Mihaljević, A. Radovan, M. Žagar
Records – Example
• Example: We need a point
record Point { }
final double x;
final double y;
public Point (double x, double y) {
this.x = x;
this.y = y;
}
public double x() { return x; }
public double y() { return y; }
www.hujak.hr 42
@Override
public double equals (Object o) {
if (…)
…
return …
}
@Override
Public double hashCode () {
return …
}
@Override
Public double toString() {
return …
}
HUJAK - B. Mihaljević, A. Radovan, M. Žagar
Sometimes data is just … data.
Mark Reinhold
Records – Goals
• An object-oriented construct that expresses a simple aggregation of values
• Help programmers to focus on modeling immutable data rather than
extensible behavior
• Automatically implement data-driven methods (such as equals and
accessors)
• Preserve principles such as nominal typing and migration compatibility
• Not declaring a "war on boilerplate" or adding features such as properties
or annotation-driven code generation (not streamlining POJOs)
• Hint: Pattern matching for records comes later
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 43
Records – Some Rules
• Some records rules:
• Records do not have an extends clause – superclass is always java.lang.Record
• Implicitly final and cannot be abstract – defined solely by its state description
• Cannot explicitly declare instance fields and cannot contain instance initializers
• Implicitly declared fields corresponding to the components of a record class are final
and are not modifiable via reflection (immutability)
• Any explicit declarations of a member (that would otherwise be automatically
derived) must match the type of the automatically derived member exactly
(disregarding type annotations)
• A record cannot declare native methods
• More at https://openjdk.java.net/jeps/395
• Records work well with sealed types
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 44
Sealed Classes
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 45
Sealed Classes
• Idea: Sealed Classes and Interfaces for Java – from project Amber
• JEP 409: Sealed Classes (JDK 17) https://openjdk.java.net/jeps/409
• Preview in JEP 360 (JDK 15), Second Preview in JEP 397 (JDK 16)
• Restrict which classes or interfaces may extend or implement this class or
interface
• Java already supports enum classes to model the situation where a given
class has only a fixed number of instances
• Sometimes we want to model a fixed set of kinds of values – using a class
hierarchy not as a mechanism for code inheritance and reuse but, rather, as
a way to list kinds of values
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 46
Sealed Classes – Goals
• Allow the author of a class or interface to control which code is responsible
for implementing it
• Provide a more declarative way than access modifiers to restrict the use of
a superclass
• Support future directions in pattern matching by providing a foundation for
the exhaustive analysis of patterns
• Not providing new forms of access control (such as "friends") or changing
final (in any way)
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 47
Sealed Classes – Example
• Example: Shape can only have subclasses Circle, Rectangle, and Square
package com.example.geometry;
public abstract sealed class Shape
permits Circle, Rectangle, Square {
... }
public final class Circle extends Shape { ... }
• The classes specified by permit must be located near the superclass
• In the same module (if the superclass is in a named module) or
• In the same package (if the superclass is in the unnamed module)
• Hint: When the permitted subclasses are small in size and number, it may
be convenient to declare them in the same source file as the sealed class
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 48
Sealed Classes – Example #2
• Example: Sealed class may omit permit if subclasses are defined in same file
abstract sealed class Shape { ...
final class Circle extends Shape { ... }
final class Rectangle extends Shape { ... }
final class Square extends Shape { ... }
}
• Anonymous classes and local classes cannot be permitted subtypes of a
sealed class
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 49
Sealed Classes – Constraints
• Every permitted subclass must directly extend the sealed class
• Every permitted subclass must use a modifier to describe how it propagates
the sealing initiated by its superclass:
• final – to prevent from being extended further
• Note: Record classes are implicitly declared final
• sealed – to allow to be extended further than envisaged by its sealed superclass, but
in a restricted fashion
• non-sealed – being open for extension by unknown subclasses
• Note: The modifier "non-sealed" is the first hyphenated keyword proposed for Java 
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 50
Sealed Classes – Example #3
• Example: Sealed class ma omit permit if subclasses are defined in same file
public abstract sealed class Shape
permits Circle, Rectangle, Square, WeirdShape { ... }
public final class Circle extends Shape { ... }
public sealed class Rectangle extends Shape
permits TransparentRectangle, FilledRectangle { ... }
public final class TransparentRectangle extends Rectangle { ... }
public final class FilledRectangle extends Rectangle { ... }
public final class Square extends Shape { ... }
public non-sealed class WeirdShape extends Shape { ... }
• Note: Even though the WeirdShape is open to extension, all instances of those subclasses are
also instances of WeirdShape
• Therefore code written to test whether an instance of Shape is either a Circle, a Rectangle, a Square, or a
WeirdShape remains exhaustive.
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 51
Sealed Interfaces
• An interface can also be sealed by applying the sealed modifier
• After any extends clause to specify superinterfaces, the implementing classes and
subinterfaces are specified with a permits clause
• Example: Modeling mathematical expressions as a known set of subclasses
package com.example.expression;
public sealed interface Expr
permits ConstantExpr, PlusExpr, TimesExpr, NegExpr { ... }
public final class ConstantExpr implements Expr { ... }
public final class PlusExpr implements Expr { ... }
public final class TimesExpr implements Expr { ... }
public final class NegExpr implements Expr { ... }
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 52
Sealing and Records
• Sealed classes work well with record classes and record classes are implicitly final
• Example:
package com.example.expression;
public sealed interface Expr
permits ConstantExpr, PlusExpr, TimesExpr, NegExpr { ... }
public record ConstantExpr(int i) implements Expr { ... }
public record PlusExpr(Expr a, Expr b) implements Expr { ... }
public record TimesExpr(Expr a, Expr b) implements Expr { ... }
public record NegExpr(Expr e) implements Expr { ... }
• Note: This combination of sealed and record classes is known as algebraic data
types
• Record classes allow to express product types, and sealed classes allow to express sum types
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 53
Sealed Classes and Pattern Matching
• A significant benefit of sealed classes in JEP 406: Pattern Matching for switch
(Preview), which proposes to extend switch with pattern matching
• Instead of inspecting an instance of a sealed class with if-else chains, we can use
a switch enhanced with patterns, and sealed classes will allow the compiler to
check that the patterns are exhaustive
• Example:
Shape rotate(Shape shape, double angle) {
return switch (shape) { // pattern matching switch
case Circle c -> c;
case Rectangle r -> shape.rotate(angle);
case Square s -> shape.rotate(angle);
} // no default needed!
}
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 54
Sealed Classes
• Making Use of Sealed Classes in Java, Dr. Venkat Subramaniam, at
https://www.youtube.com/watch?v=Xkh5sa3vjTE (30:22)
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 55
Pattern Matching
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 56
Patterns
• A pattern is a combination of
1. a predicate that can be applied to a target, and
2. a set of binding variables that are extracted from the target only if the predicate
successfully applies to it
• A type test pattern consists of a predicate that specifies a type, along with
a single binding variable
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 57
Type Patterns
• Type Pattern is a test with initialization
• Example:
if (o instanceof String s) {
System.out.println("String length: ", s.length());
}
• What? – test if the value is a String; if so, initialize s with the String
• Where? – in an instanceof expression
• There could be else block
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 58
Operator instanceof
• Need to enhance the Java programming language with the new version of
instanceof type comparison operator
• Pattern matching allows common logic in a program, namely the
conditional extraction of components from objects, to be expressed more
concisely and safely
• Motivation:
if (obj instanceof String) {
String s = (String) obj;
// use s
}
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 59
Involves:
a) test – is obj a String?
b) conversion – casting obj to
String
c) declaration – of a new local
variable s
Extending instanceof
• The instanceof operator was extended to take a type test pattern instead of just
a type
• Example: the phrase String s is the type test pattern:
if (obj instanceof String s) {
// can use s here
} else {
// can't use s here
}
• The instanceof operator "matches" obj to the type test pattern:
• If obj is an instance of String, then it is cast to String and assigned to the binding
variable s
• The binding variable is in scope in the true block of the if statement, and not in
the false block of the if statement
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 60
Pattern Matching for instanceof
• First preview as JEP 305 in JDK 14, Standard as JEP 375 in JDK 16
• Example:
if (obj instanceof String s && s.length() > 5) {..
s.contains(..) ..}
• Another example:
@Override public boolean equals(Object o) {
return (o instanceof CaseInsensitiveString cis) &&
cis.s.equalsIgnoreCase(s);
}
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 61
Pattern Matching for switch (Preview)
• Idea: Extend pattern matching to switch – from project Amber
• Preview as JEP 406: Pattern Matching for switch (JDK 17)
https://openjdk.java.net/jeps/406
• Relates to JEP 405: Record Patterns & Array Patterns (Preview) (JDK 18)
• Enhance Java with pattern matching for switch expressions and statements
• Pattern matching on switch allows an expression to be tested against a
number of patterns, each with a specific action, so that complex data-
oriented queries can be expressed concisely and safely
• Allows patterns to appear in case labels
• Introduces case null statement
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 62
Pattern Matching for switch – Example
• Example: Testing with else-ifs
static String formatter(Object o) {
String s = "unknown";
if (o instanceof Integer i) {
s = String.format("int %d", i);
} else if (o instanceof Long l) {
s = String.format("long %d", l);
} else if (o instanceof Double d) {
s = String.format("double %f", d);
} else if (o instanceof String s) {
s = String.format("String %s", s);
}
return s;
}
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 63
Pattern Matching for switch – Example
• Example: Testing with switch
static String formatterPatternSwitch(Object o) {
return switch (o) {
case Integer i -> String.format("int %d", i);
case Long l -> String.format("long %d", l);
case Double d -> String.format("double %f", d);
case String s -> String.format("String %s", s);
default -> o.toString();
};
}
• Note: Switch can be of any type – no type restriction anymore
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 64
Pattern Matching for switch – Example #2
• Example: Testing for null to avoid NullPointerException
static String formatterPatternSwitch(Object o) {
if (o == null) {
return "oops";
}
return switch (o) {
case Integer i -> String.format("int %d", i);
case Long l -> String.format("long %d", l);
case Double d -> String.format("double %f", d);
case String s -> String.format("String %s", s);
default -> o.toString();
};
}
• This could be resolved in a better way
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 65
Pattern Matching for switch – Example #2
• Example: Testing for null in the switch
static String formatterPatternSwitch(Object o) {
return switch (o) {
case null -> "null";
case Integer i -> String.format("int %d", i);
case Long l -> String.format("long %d", l);
case Double d -> String.format("double %f", d);
case String s -> String.format("String %s", s);
default -> o.toString();
};
}
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 66
Pattern Matching for switch – Example #2
• Various ways to use null
• Example: Testing for null or String in the switch
switch (o) {
case null -> ...
case String s -> ...
...
}
• is the same as
switch (o) {
case null, String s -> ... // null or String
...
}
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 67
Guarded Patterns
• Rather than add another special case label, we enhance the pattern language by
adding guarded patterns
• Example: Test that o is a String of length 1 (or not)
static void test(Object o) {
switch (o) {
case String s:
if (s.length() == 1) { ... }
else { ... }
break;
...
}
}
• The test that o is a String of length 1 is split between case label and if statement
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 68
Guarded Patterns – Solution
• After a successful pattern match we often further test the result of the
match
• Example:
static void test(Object o) {
switch (o) {
case String s && (s.length() == 1) -> ...
case String s -> ...
...
}
}
• The first case matches if o is both a String and of length 1
• The second case matches if o is a String of some other length
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 69
Guarded Patterns – Issue
• Possible issue – Dominance of pattern labels where order matters
• Example:
static void test(Object o) {
switch (o) {
case String s -> ...
case String s && (s.length() == 1) -> ...
...
}
}
• The second label is never reached – second pattern is dominated by the
first pattern
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 70
Pattern Matching for switch – Issues
• Possible issue – Dominance of pattern labels where order matters
• Example:
static void test(Object o) {
switch (o) {
case CharSequence cs -> ...
case String s -> ...
...
}
}
• The string s is never reached – pattern is dominated by cs pattern
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 71
Mixing patterns and constants
• We can mix constants and patterns
• Example:
static void test(Object o) {
switch (o) {
case "Hello" -> ...
case String s -> ...
...
}
}
• However, if the order is s first, "Hello" second, the string "Hello" is never
reached – pattern is dominated by s pattern
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 72
Be Careful with Totality
• Example:
static int test(Object o) {
return switch (o) {
case String s -> s.length();
case Integer i -> i;
default -> 0; // we need totality!
}
}
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 74
Be Careful with Totality
• Example:
Object o = ...
switch (o) {
case String s: System.out.println(s); break;
case Integer i: System.out.println("Integer"); break;
default: break; // we need totality!
}
}
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 75
Record Patterns
• Take a look at JEP 405 : Record Patterns & Array Patterns (Preview) in JDK
18 https://openjdk.java.net/jeps/405
• Record pattern tests if the target is of certain record type, and if so, pull
apart the structure
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 76
Pattern Matching in Java 17
• Pattern Matching in Java 17 and Beyond, Nicola Parlog,
https://www.youtube.com/watch?v=UlFFKkq6fyU (27:01)
• Java Language Futures: Late 2021 Edition, Gavin Bierman,
https://www.youtube.com/watch?v=hDV6G1MbUH8 (31:11)
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 77
Hidden Classes
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 78
Hidden Classes
• Idea: Classes that cannot be used directly by the bytecode of other classes
• Standard as JEP 371: Hidden Classes (JDK 15)
• Intended for use by frameworks that generate classes at run time and use
them indirectly, only via reflection
• May be defined as a member of an access control nest
• May be unloaded independently of other classes
• Whereas a normal class is created by invoking ClassLoader::defineClass, a
hidden class is created by invoking Lookup::defineHiddenClass
• Causes the JVM to derive a hidden class from the supplied bytes, link the hidden
class, and return a lookup object that provides reflective access to the hidden class
www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 79
Thank you & greetings from HUJAK!
• Web page hujak.hr
• www.hujak.hr
• LinkedIn group HUJAK
• www.linkedin.com/groups?gid=4320174
• Facebook group page HUJAK.hr
• www.facebook.com/HUJAK.hr
• Twitter profile @HUJAK_hr
• twitter.com/HUJAK_hr
www.hujak.hr 80
HUJAK - B. Mihaljević, A. Radovan, M. Žagar

More Related Content

What's hot

Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0David Delabassee
 
What's Coming in Java EE 8
What's Coming in Java EE 8What's Coming in Java EE 8
What's Coming in Java EE 8PT.JUG
 
Migration tales from java ee 5 to 7
Migration tales from java ee 5 to 7Migration tales from java ee 5 to 7
Migration tales from java ee 5 to 7Roberto Cortez
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack ImplementationMert Çalışkan
 
Modern web application development with java ee 7
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7Shekhar Gulati
 
Java 2018 certifications
Java 2018 certificationsJava 2018 certifications
Java 2018 certificationsRory Preddy
 
Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Ryan Cuprak
 
Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot David Delabassee
 
DevoxxUK 2014 "Moving to a DevOps Mode: Easy, Hard, or Just Plain Terrifying?"
DevoxxUK 2014 "Moving to a DevOps Mode: Easy, Hard, or Just Plain Terrifying?"DevoxxUK 2014 "Moving to a DevOps Mode: Easy, Hard, or Just Plain Terrifying?"
DevoxxUK 2014 "Moving to a DevOps Mode: Easy, Hard, or Just Plain Terrifying?"Daniel Bryant
 
EJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyEJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyDavid Delabassee
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"Daniel Bryant
 
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015Edward Burns
 
Testing Java EE Applications Using Arquillian
Testing Java EE Applications Using ArquillianTesting Java EE Applications Using Arquillian
Testing Java EE Applications Using ArquillianReza Rahman
 
2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI Alignment2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI AlignmentDavid Blevins
 
EE4J: Java EE & Jakarta EE JFR & JMC
EE4J: Java EE & Jakarta EE  JFR & JMCEE4J: Java EE & Jakarta EE  JFR & JMC
EE4J: Java EE & Jakarta EE JFR & JMCM. Fevzi Korkutata
 
Expect the unexpected: Anticipate and prepare for failures in microservices b...
Expect the unexpected: Anticipate and prepare for failures in microservices b...Expect the unexpected: Anticipate and prepare for failures in microservices b...
Expect the unexpected: Anticipate and prepare for failures in microservices b...Bhakti Mehta
 
WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015Pavel Bucek
 

What's hot (20)

Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
 
JavaCro'15 - HTTP2 Comes to Java! - David Delabassee
JavaCro'15 - HTTP2 Comes to Java! - David DelabasseeJavaCro'15 - HTTP2 Comes to Java! - David Delabassee
JavaCro'15 - HTTP2 Comes to Java! - David Delabassee
 
What's Coming in Java EE 8
What's Coming in Java EE 8What's Coming in Java EE 8
What's Coming in Java EE 8
 
Migration tales from java ee 5 to 7
Migration tales from java ee 5 to 7Migration tales from java ee 5 to 7
Migration tales from java ee 5 to 7
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack Implementation
 
Modern web application development with java ee 7
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7
 
Java 2018 certifications
Java 2018 certificationsJava 2018 certifications
Java 2018 certifications
 
MVC 1.0 / JSR 371
MVC 1.0 / JSR 371MVC 1.0 / JSR 371
MVC 1.0 / JSR 371
 
Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]
 
Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot Java EE 8 - An instant snapshot
Java EE 8 - An instant snapshot
 
DevoxxUK 2014 "Moving to a DevOps Mode: Easy, Hard, or Just Plain Terrifying?"
DevoxxUK 2014 "Moving to a DevOps Mode: Easy, Hard, or Just Plain Terrifying?"DevoxxUK 2014 "Moving to a DevOps Mode: Easy, Hard, or Just Plain Terrifying?"
DevoxxUK 2014 "Moving to a DevOps Mode: Easy, Hard, or Just Plain Terrifying?"
 
EJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyEJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and Strategy
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
 
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015
 
Testing Java EE Applications Using Arquillian
Testing Java EE Applications Using ArquillianTesting Java EE Applications Using Arquillian
Testing Java EE Applications Using Arquillian
 
Java on Azure
Java on AzureJava on Azure
Java on Azure
 
2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI Alignment2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI Alignment
 
EE4J: Java EE & Jakarta EE JFR & JMC
EE4J: Java EE & Jakarta EE  JFR & JMCEE4J: Java EE & Jakarta EE  JFR & JMC
EE4J: Java EE & Jakarta EE JFR & JMC
 
Expect the unexpected: Anticipate and prepare for failures in microservices b...
Expect the unexpected: Anticipate and prepare for failures in microservices b...Expect the unexpected: Anticipate and prepare for failures in microservices b...
Expect the unexpected: Anticipate and prepare for failures in microservices b...
 
WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015
 

Similar to Java cro'21 the best tools for java developers in 2021 - hujak

New Java features: Simplified Design Patterns[LIT3826]
New Java features: Simplified Design Patterns[LIT3826]New Java features: Simplified Design Patterns[LIT3826]
New Java features: Simplified Design Patterns[LIT3826]Miro Wengner
 
Connect js nodejs_api_shubhra
Connect js nodejs_api_shubhraConnect js nodejs_api_shubhra
Connect js nodejs_api_shubhraShubhra Kar
 
Java overview the piramide of success
Java overview the piramide of successJava overview the piramide of success
Java overview the piramide of successArtem Bilan
 
Deep Learning for Java Developer - Getting Started
Deep Learning for Java Developer - Getting StartedDeep Learning for Java Developer - Getting Started
Deep Learning for Java Developer - Getting StartedSuyash Joshi
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewJosh Padnick
 
Building and Scaling a Test Driven Culture
Building and Scaling a Test Driven CultureBuilding and Scaling a Test Driven Culture
Building and Scaling a Test Driven CultureDaniel Doubrovkine
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project Elad Hirsch
 
Building Modern Web Apps with MEAN Stack
Building Modern Web Apps with MEAN StackBuilding Modern Web Apps with MEAN Stack
Building Modern Web Apps with MEAN StackSuresh Patidar
 
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachJDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachPROIDEA
 
Application Architecture Trends
Application Architecture TrendsApplication Architecture Trends
Application Architecture TrendsSrini Penchikala
 
Nitesh_Sr._Java_developer_Lead
Nitesh_Sr._Java_developer_Lead Nitesh_Sr._Java_developer_Lead
Nitesh_Sr._Java_developer_Lead Nitesh Dasari
 

Similar to Java cro'21 the best tools for java developers in 2021 - hujak (20)

JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
 
Javantura v2 - The Road to Java - HUJAK & Oracle Croatia - Branko Mihaljević,...
Javantura v2 - The Road to Java - HUJAK & Oracle Croatia - Branko Mihaljević,...Javantura v2 - The Road to Java - HUJAK & Oracle Croatia - Branko Mihaljević,...
Javantura v2 - The Road to Java - HUJAK & Oracle Croatia - Branko Mihaljević,...
 
My life as a cyborg
My life as a cyborg My life as a cyborg
My life as a cyborg
 
The Java alternative to Javascript
The Java alternative to JavascriptThe Java alternative to Javascript
The Java alternative to Javascript
 
JavaCro'21 - Java is Here To Stay - HUJAK Keynote
JavaCro'21 - Java is Here To Stay - HUJAK KeynoteJavaCro'21 - Java is Here To Stay - HUJAK Keynote
JavaCro'21 - Java is Here To Stay - HUJAK Keynote
 
New Java features: Simplified Design Patterns[LIT3826]
New Java features: Simplified Design Patterns[LIT3826]New Java features: Simplified Design Patterns[LIT3826]
New Java features: Simplified Design Patterns[LIT3826]
 
mitra_resume-2
mitra_resume-2mitra_resume-2
mitra_resume-2
 
Javantura v3 - The story of Java & HUJAK
Javantura v3 - The story of Java & HUJAKJavantura v3 - The story of Java & HUJAK
Javantura v3 - The story of Java & HUJAK
 
Connect js nodejs_api_shubhra
Connect js nodejs_api_shubhraConnect js nodejs_api_shubhra
Connect js nodejs_api_shubhra
 
01 java intro
01 java intro01 java intro
01 java intro
 
Java overview the piramide of success
Java overview the piramide of successJava overview the piramide of success
Java overview the piramide of success
 
Deep Learning for Java Developer - Getting Started
Deep Learning for Java Developer - Getting StartedDeep Learning for Java Developer - Getting Started
Deep Learning for Java Developer - Getting Started
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level Overview
 
Building and Scaling a Test Driven Culture
Building and Scaling a Test Driven CultureBuilding and Scaling a Test Driven Culture
Building and Scaling a Test Driven Culture
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
 
Building Modern Web Apps with MEAN Stack
Building Modern Web Apps with MEAN StackBuilding Modern Web Apps with MEAN Stack
Building Modern Web Apps with MEAN Stack
 
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachJDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
 
Application Architecture Trends
Application Architecture TrendsApplication Architecture Trends
Application Architecture Trends
 
Node.JS briefly introduced
Node.JS briefly introducedNode.JS briefly introduced
Node.JS briefly introduced
 
Nitesh_Sr._Java_developer_Lead
Nitesh_Sr._Java_developer_Lead Nitesh_Sr._Java_developer_Lead
Nitesh_Sr._Java_developer_Lead
 

More from HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association

More from HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association (20)

Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan LozićJavantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
 
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
 
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander RadovanJavantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
 
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
 
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
 
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
 
Javantura v6 - When remote work really works - the secrets behind successful ...
Javantura v6 - When remote work really works - the secrets behind successful ...Javantura v6 - When remote work really works - the secrets behind successful ...
Javantura v6 - When remote work really works - the secrets behind successful ...
 
Javantura v6 - Kotlin-Java Interop - Matej Vidaković
Javantura v6 - Kotlin-Java Interop - Matej VidakovićJavantura v6 - Kotlin-Java Interop - Matej Vidaković
Javantura v6 - Kotlin-Java Interop - Matej Vidaković
 
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
 
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
 
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
 
Javantura v6 - How can you improve the quality of your application - Ioannis ...
Javantura v6 - How can you improve the quality of your application - Ioannis ...Javantura v6 - How can you improve the quality of your application - Ioannis ...
Javantura v6 - How can you improve the quality of your application - Ioannis ...
 
Javantura v6 - Just say it v2 - Pavao Varela Petrac
Javantura v6 - Just say it v2 - Pavao Varela PetracJavantura v6 - Just say it v2 - Pavao Varela Petrac
Javantura v6 - Just say it v2 - Pavao Varela Petrac
 
Javantura v6 - Automation of web apps testing - Hrvoje Ruhek
Javantura v6 - Automation of web apps testing - Hrvoje RuhekJavantura v6 - Automation of web apps testing - Hrvoje Ruhek
Javantura v6 - Automation of web apps testing - Hrvoje Ruhek
 
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
 
Javantura v6 - Building IoT Middleware with Microservices - Mario Kusek
Javantura v6 - Building IoT Middleware with Microservices - Mario KusekJavantura v6 - Building IoT Middleware with Microservices - Mario Kusek
Javantura v6 - Building IoT Middleware with Microservices - Mario Kusek
 
Javantura v6 - JDK 11 & JDK 12 - Dalibor Topic
Javantura v6 - JDK 11 & JDK 12 - Dalibor TopicJavantura v6 - JDK 11 & JDK 12 - Dalibor Topic
Javantura v6 - JDK 11 & JDK 12 - Dalibor Topic
 
Javantura v6 - Java SE, Today and Tomorrow - Dalibor Topic
Javantura v6 - Java SE, Today and Tomorrow - Dalibor TopicJavantura v6 - Java SE, Today and Tomorrow - Dalibor Topic
Javantura v6 - Java SE, Today and Tomorrow - Dalibor Topic
 
Javantura v6 - Future of the Humankind and the Universe - Ivica Puljak
Javantura v6 - Future of the Humankind and the Universe - Ivica PuljakJavantura v6 - Future of the Humankind and the Universe - Ivica Puljak
Javantura v6 - Future of the Humankind and the Universe - Ivica Puljak
 
Above and Beyond JDK 9, 10, 11, 12... - Branko Mihaljević and Martin Žagar on...
Above and Beyond JDK 9, 10, 11, 12... - Branko Mihaljević and Martin Žagar on...Above and Beyond JDK 9, 10, 11, 12... - Branko Mihaljević and Martin Žagar on...
Above and Beyond JDK 9, 10, 11, 12... - Branko Mihaljević and Martin Žagar on...
 

Recently uploaded

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 

Recently uploaded (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 

Java cro'21 the best tools for java developers in 2021 - hujak

  • 1. dr. sc. Branko Mihaljević dr. sc. Aleksander Radovan doc. dr. sc. Martin Žagar HUJAK www.hujak.hr 1 HUJAK - B. Mihaljević, A. Radovan, M. Žagar The Best Java Tools for Developers (in 2021)
  • 2. The most used tools in Java? • Are we talking about the "developers tools" or best practices as "tools"? • Well, both! • Part 1 – Developers Tools for Java (incl. Platforms and Frameworks) • Part 2 – The new "tools" in Java www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 2
  • 3. What do we most commonly/actually use? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 3
  • 4. Some Surveys Several relevant surveys taken into consideration: • JVM Ecosystem Report 2021 by snyk • 2000 responses in February-March 2021 • 2021 Java Developer Productivity Report by JRebel • 876 responses August-November 2020 • The State of Developer Ecosystem 2021 by JetBrains • 31743 responses • 2021 Developer Survey by StackOverflow • 83052 responses (out of which 58031 professional developers) in May 2021 • CodingGame Developer Survey 2021 • 15000 responses (?) • Java Survey 2020 by HUJAK  • 45+ responses in Feb 2020 • THANK YOU  www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 4
  • 5. Versions of Java • Java platform versions used in projects? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 5 32% 82% 7% 7% 46% 9% 7% 5% 60% 1% 7% 62% 1% 3% 5% 12% 3% 50% 1% 1% 64% 2% 3% 8% 26% 4% 3% 15% 69% 36% 8% 72% 4% 2% 42% 4% 4% 8% 14% 0% 20% 40% 60% 80% 100% 7 or older 8 9 10 11 12 13 14 15 16 17 HUJAK snyk prod. snyk dev. JRebel JetBrains
  • 6. Which JDK? • Which Java vendor's JDK do you currently use in production? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 6 44% 28% 23% 16% 9% 7% 22% 59% 6% 10% 4% 0% 20% 40% 60% 80% AdoptOpenJDK Oracle OpenJDK Oracle JDK Azul Zulu Amazon Corretto GraalVM snyk JRebel
  • 7. Other JVM languages • Other JVM languages in production? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 7 18% 13% 10% 8% 2% 1% 0% 20% Kotlin Groovy Scala Clojure JRuby Other snyk 2021
  • 8. Application Server • What application server do you use on your main application? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 8 66% 19% 18% 15% 14% 6% 6% 61% 9% 5% 17% 5% 4% 4% 28% 0% 20% 40% 60% 80% 100% Tomcat JBoss / Wildfly WebLogic Jetty WebSphere GlassFish Other None JRebel JetBrains
  • 9. Web Application Frameworks? • Which Web application frameworks do you use? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 9 65% 42% 5% 3% 2% 2% 2% 62% 9% 6% 4% 58% 29% 24% 11% 3% 5% 4% 4% 77% 54% 28% 5% 2% 2% 5% 9% 0% 20% 40% 60% 80% JetBrains JRebel snyk HUJAK
  • 10. Cloud Platforms • Cloud platforms and PaaS used? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 10 54% 31% 31% 24% 18% 3% 1,9% 39% 18% 24% 9% 9% 7% 0% 20% 40% 60% Amazon (AWS) Google (GCP) Microsoft (Azure) Heroku Digital Ocean IBM (Cloud or Watson) Oracle (OCI) SAP Cloud Platform Pivotal Cloud Foundry StackOverflow JRebel
  • 11. Top IDEs? • The TOP 10 IDE Index pypl.github.io/IDE.html www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 11 Rank Language Ratings 1 Visual Studio 31.2% 2 Eclipse 21.9% 3 Visual Studio Code 10.2% 4 IntelliJ 9.0% … … 7 NetBeans 3.0%
  • 12. IDEs and Editors • Which IDEs or editors do you use? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 12 72% 25% 23% 14% 13% 1% 65% 48% 27% 13% 4% 2% 29% 16% 71% 24% 7% 30% 20% 75% 11% 4% 2% 0% 20% 40% 60% 80% IntelliJ IDEA Eclipse VS Code Vi/Vim/Emacs… NetBeans Some Browser-based Notepad++ Sublime Some Other snyk JRebel StackOverflow JetBrains
  • 13. IDEs for JDK 17 • IntelliJ IDEA 2021.2.1 • Supports Java 17 Sealed Types, Always-strict Floating-point Semantics, and Pattern Matching for Switch expressions (Preview) • Also supports Java 16 Records, patterns, local enums and interface, and Text Blocks • blog.jetbrains.com/idea/2021/09/java-17-and-intellij-idea/ • Eclipse IDE 2021-09 (4.21) • Supports Java 17, including Pattern Matching for Switch (Preview), Sealed Classes, and more via Eclipse Marketplace • Wait for 2021-12 (4.22) for integrated support • NetBeans 12.5 • With experimental support for JDK 17 • netbeans.apache.org/download/nb125/index.html • Visual Studio Code www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 13
  • 14. IDEs for JDK 17 – IntelliJ IDE Example • Test IntelliJ IDEA 2021.2.1 • More at blog.jetbrains.com/ idea/2021/09/java-17-and- intellij-idea/ • Watch Learn Java 17 with IntelliJ IDE by Mala Gupta • youtu.be/FP0V98S4l9w (31:30) • Pattern matching for instanceof • Pattern matching for switch • Sealed classes and interfaces www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 14
  • 15. App Building Tools? • Tools for building applications? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 15 76% 38% 12% 6% 3% 67% 20% 11% 2% 72% 49% 8% 1% 8% 0% 20% 40% 60% 80% Maven Gradle Ant Other None snyk JRebel JetBrains
  • 16. CI/CD Time and Frequency? • CI/CD time and commit frequency? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 16
  • 17. Unit Testing? • Which unit-testing frameworks do you use? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 17 85% 45% 9% 8% 5% 4% 4% 4% 0% 20% 40% 60% 80% JUnit Mockito PowerMock TestNG Spock EasyMock JMockit My own tests JetBrains
  • 18. JVM Profilers? • Which JVM profilers do you regularly use? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 18 26% 20% 11% 10% 4% 3% 1% 3% 44% 0% 20% 40% Integrated IntelliJ VisualVM JProfiler Java Mission Control NetBeans profiler YourKit async-profiler My own None JetBrains
  • 19. VM platforms? • Which VM platform do you use? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 19 57% 42% 27% 12% 4% 12% 0% 20% 40% 60% 80% Docker Kubernetes VMware Vagrant Other N/A JRebel
  • 20. What if Stuck? • What do you do when you get stuck? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 20 90% 80% 49% 40% 46% 40% 12% 10% 10% 0% 20% 40% 60% 80% 100% Google it Visit StackOverflow Do some other work Read help/manual/tutorial Call a coworker Some physical activity Play a game Panic Meditate StackOverflow
  • 21. While waiting… on redeploy? • Coffeeeeeeeee! www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 21
  • 22. Time to Redeploy? • How long to redeploy? (by JRebel) • Remote redeploy in a container? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 23
  • 23. Part 2 – The new "tools" in Java www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 24
  • 24. The Most Important Java Features (11-17) • Languages Features – Records, Switch Expressions, Text Blocks, vars, Pattern Matching for instanceof, Sealed Classes, Pattern Matching for switch… • Memory Management – G1 GC enhancements (Full Parallel), ZGC (with improvements), Shenandoah GC, Elastic Metaspace… • Library Enhancements – Pseudo-Random Generator, Deserealization Filters, Vector API, Foreign Fuction & Memory API… • Future Proofing – Module System (JPMS), Strong Encapsulation for JDK Internals… • Easier Debugging – Flight Recorder, JFT Event Streaming, NullPointerExceptions… • Modernizing Infrastructure – MercurialGit, GitHub, AArch64 port… • Deprecations & Removals – CMS GC, Nashorn, Biased Locking, RMI Activation, Applet API, Security Manager… www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 25
  • 25. Switch Expressions www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 26
  • 26. Switch Expressions • First Preview as JEP 325 in JDK 12 • Extend switch statement so it can be used as a statement or an expression • Both can use either a "traditional" or "simplified" scoping and control flow behavior • "Simplified" switch form with "case L ->" to switch labels • If a label is matched, then only the expression or statement to the right of an arrow label is executed – there could be no fall through • Without fall through! No need for break • Can also be used as an expression? • All possible values covered (totality)? • Without default (completeness)? www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 27
  • 27. Switch Expressions (Preview) – Example switch (day) { case MONDAY: case FRIDAY: case SUNDAY: System.out.println(6); break; case TUESDAY: System.out.println(7); break; case THURSDAY: case SATURDAY: System.out.println(8); break; case WEDNESDAY: System.out.println(9); break; } enum Weekdays { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY } switch (day) { case MONDAY, FRIDAY, SUNDAY -> System.out.println(6); case TUESDAY -> System.out.println(7); case THURSDAY, SATURDAY -> System.out.println(8); case WEDNESDAY -> System.out.println(9); } www.hujak.hr 28 HUJAK - B. Mihaljević, A. Radovan, M. Žagar No fall through (no need for break)
  • 28. Switch Expressions (Preview) – Example #2 int numLetters; switch (day) { case MONDAY: case FRIDAY: case SUNDAY: numLetters = 6; break; case TUESDAY: numLetters = 7; break; case THURSDAY: case SATURDAY: numLetters = 8; break; case WEDNESDAY: numLetters = 9; break; default: throw new IllegalStateException("Hmm: " + day); }; enum Weekdays { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY } int numLetters = switch (day) { case MONDAY, FRIDAY, SUNDAY -> 6; case TUESDAY -> 7; case THURSDAY, SATURDAY -> 8; case WEDNESDAY -> 9; // no default!!! }; www.hujak.hr 29 HUJAK - B. Mihaljević, A. Radovan, M. Žagar Used as an expression No fall through No default needed
  • 29. Switch Expressions • Second Preview as JEP 354 in JDK 13 • Extended switch so it can be used as either a statement or an expression • Both can use either traditional case ... : labels (with fall through) or new case ... -> labels (with no fall through) • Expression must be either: • Char, byte, short, int • Character, Byte, Short, Integer • String • enum • Introduces new statement for yielding a value from a switch expression • Based on feedback on design and experience in JDK 12 to simplify everyday coding www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 30
  • 30. Switch Expressions (2nd Preview) – Example • When working switch expression, if a full block is needed, a new yield statement is introduced • It yields a value that becomes the value of the enclosing switch expression int j = switch (day) { case MONDAY -> 0; case TUESDAY -> 1; default -> { int k = day.toString().length(); int result = f(k); yield result; } }; www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 31
  • 31. Switch Expressions (2nd Preview) – Example • A switch expression can also use a traditional switch block with case L: switch labels (implying fall through semantics) • In this case, values are yielded using the new yield statement int result = switch (s) { case "Foo": yield 1; case "Bar": yield 2; default: System.out.println("Neither Foo nor Bar, hmmm..."); yield 0; }; www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 32
  • 32. Switch Expressions (2nd Preview) – Example int numLetters; switch (day) { case MONDAY: case FRIDAY: case SUNDAY: numLetters = 6; break; case TUESDAY: numLetters = 7; break; case THURSDAY: case SATURDAY: numLetters = 8; break; case WEDNESDAY: numLetters = 9; break; default: throw new IllegalStateException("Hmm: " + day); }; int numLetters = switch (day) { case MONDAY: case FRIDAY: case SUNDAY: yield 6; case TUESDAY yield 7; case THURSDAY case SATURDAY yield 8; case WEDNESDAY yield 9; default: throw new IllegalStateException( "Hmm: " + day); }; www.hujak.hr 33 HUJAK - B. Mihaljević, A. Radovan, M. Žagar
  • 33. Switch Expressions (Standard) • Standard as JEP 361 in JDK 14 • Final version of the extended switch a) Can be used as either a statement or an expression b) Can use traditional case ... : labels or new case ... -> labels (no fall through) c) Can yield value from a switch expression • Additionally, to prepare for the use of pattern matching (JEP 305) in switch www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 34
  • 34. Text Blocks www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 35
  • 35. Text Blocks • Idea: Adding text blocks to the Java language (using """) • Relates to JEP 326: Raw String Literals, Preview as JEP 355 (JDK 13), Second Preview as JEP 368 (JDK 14), Standard as JEP 378: Text Blocks (JDK 15) https://openjdk.java.net/jeps/378 • A text block is a multi-line string literal that • Avoids the need for most escape sequences • Automatically formats the string in a predictable way • Gives the developer control over format when desired • Goals • Easy to express strings that span several lines of source code (avoiding escape seqs) • Enhance readability of non-Java code embedded in Java programs as strings • Support migration from string literals www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 36
  • 36. Text Blocks – examples • SQL example using a "two-dimensional" block of text String query = """ SELECT "EMP_ID", "LAST_NAME" FROM "EMPLOYEE_TB" WHERE "CITY" = 'INDIANAPOLIS' ORDER BY "EMP_ID", "LAST_NAME"; """; • Polyglot language example using a "two-dimensional" block of text ScriptEngine engine = new ScriptEngineManager().getEngineByName("js"); Object obj = engine.eval(""" function hello() { print('"Hello, world"'); } hello(); """); www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 37
  • 37. Text Blocks – examples • HTML example using "one-dimensional" string literals String html = "<html>n" + " <body>n" + " <p>Hello, world</p>n" + " </body>n" + "</html>n"; • HTML example using a "two-dimensional" block of text String html = """ <html> <body> <p>Hello, world</p> </body> </html> """; www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 38
  • 38. Records www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 39
  • 39. Records • Idea: Data Classes for Java – from project Amber • JEP 395: Records (JDK 16) https://openjdk.java.net/jeps/395 • Preview in JEP 359 (JDK 14), Second Preview in JEP 385 (JDK 15) • Provide a compact syntax for declaring classes which are transparent holder for shallowly immutable data • Similar to nominal tuples • Eliminate boilerplate code • Any of the members that are automatically derived from the state description can also be declared explicitly • Deeper improvement – when deserializing a record, a record constructor is called and checks are made (not just forcing values into fields) www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 40
  • 40. Records – Example • Example: We need a point class Point { final double x; final double y; public Point (double x, double y) { this.x = x; this.y = y; } public double x() { return x; } public double y() { return y; } www.hujak.hr 41 @Override public double equals (Object o) { if (…) … return … } @Override Public double hashCode () { return … } @Override Public double toString() { return … } HUJAK - B. Mihaljević, A. Radovan, M. Žagar
  • 41. Records – Example • Example: We need a point record Point { } final double x; final double y; public Point (double x, double y) { this.x = x; this.y = y; } public double x() { return x; } public double y() { return y; } www.hujak.hr 42 @Override public double equals (Object o) { if (…) … return … } @Override Public double hashCode () { return … } @Override Public double toString() { return … } HUJAK - B. Mihaljević, A. Radovan, M. Žagar Sometimes data is just … data. Mark Reinhold
  • 42. Records – Goals • An object-oriented construct that expresses a simple aggregation of values • Help programmers to focus on modeling immutable data rather than extensible behavior • Automatically implement data-driven methods (such as equals and accessors) • Preserve principles such as nominal typing and migration compatibility • Not declaring a "war on boilerplate" or adding features such as properties or annotation-driven code generation (not streamlining POJOs) • Hint: Pattern matching for records comes later www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 43
  • 43. Records – Some Rules • Some records rules: • Records do not have an extends clause – superclass is always java.lang.Record • Implicitly final and cannot be abstract – defined solely by its state description • Cannot explicitly declare instance fields and cannot contain instance initializers • Implicitly declared fields corresponding to the components of a record class are final and are not modifiable via reflection (immutability) • Any explicit declarations of a member (that would otherwise be automatically derived) must match the type of the automatically derived member exactly (disregarding type annotations) • A record cannot declare native methods • More at https://openjdk.java.net/jeps/395 • Records work well with sealed types www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 44
  • 44. Sealed Classes www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 45
  • 45. Sealed Classes • Idea: Sealed Classes and Interfaces for Java – from project Amber • JEP 409: Sealed Classes (JDK 17) https://openjdk.java.net/jeps/409 • Preview in JEP 360 (JDK 15), Second Preview in JEP 397 (JDK 16) • Restrict which classes or interfaces may extend or implement this class or interface • Java already supports enum classes to model the situation where a given class has only a fixed number of instances • Sometimes we want to model a fixed set of kinds of values – using a class hierarchy not as a mechanism for code inheritance and reuse but, rather, as a way to list kinds of values www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 46
  • 46. Sealed Classes – Goals • Allow the author of a class or interface to control which code is responsible for implementing it • Provide a more declarative way than access modifiers to restrict the use of a superclass • Support future directions in pattern matching by providing a foundation for the exhaustive analysis of patterns • Not providing new forms of access control (such as "friends") or changing final (in any way) www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 47
  • 47. Sealed Classes – Example • Example: Shape can only have subclasses Circle, Rectangle, and Square package com.example.geometry; public abstract sealed class Shape permits Circle, Rectangle, Square { ... } public final class Circle extends Shape { ... } • The classes specified by permit must be located near the superclass • In the same module (if the superclass is in a named module) or • In the same package (if the superclass is in the unnamed module) • Hint: When the permitted subclasses are small in size and number, it may be convenient to declare them in the same source file as the sealed class www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 48
  • 48. Sealed Classes – Example #2 • Example: Sealed class may omit permit if subclasses are defined in same file abstract sealed class Shape { ... final class Circle extends Shape { ... } final class Rectangle extends Shape { ... } final class Square extends Shape { ... } } • Anonymous classes and local classes cannot be permitted subtypes of a sealed class www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 49
  • 49. Sealed Classes – Constraints • Every permitted subclass must directly extend the sealed class • Every permitted subclass must use a modifier to describe how it propagates the sealing initiated by its superclass: • final – to prevent from being extended further • Note: Record classes are implicitly declared final • sealed – to allow to be extended further than envisaged by its sealed superclass, but in a restricted fashion • non-sealed – being open for extension by unknown subclasses • Note: The modifier "non-sealed" is the first hyphenated keyword proposed for Java  www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 50
  • 50. Sealed Classes – Example #3 • Example: Sealed class ma omit permit if subclasses are defined in same file public abstract sealed class Shape permits Circle, Rectangle, Square, WeirdShape { ... } public final class Circle extends Shape { ... } public sealed class Rectangle extends Shape permits TransparentRectangle, FilledRectangle { ... } public final class TransparentRectangle extends Rectangle { ... } public final class FilledRectangle extends Rectangle { ... } public final class Square extends Shape { ... } public non-sealed class WeirdShape extends Shape { ... } • Note: Even though the WeirdShape is open to extension, all instances of those subclasses are also instances of WeirdShape • Therefore code written to test whether an instance of Shape is either a Circle, a Rectangle, a Square, or a WeirdShape remains exhaustive. www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 51
  • 51. Sealed Interfaces • An interface can also be sealed by applying the sealed modifier • After any extends clause to specify superinterfaces, the implementing classes and subinterfaces are specified with a permits clause • Example: Modeling mathematical expressions as a known set of subclasses package com.example.expression; public sealed interface Expr permits ConstantExpr, PlusExpr, TimesExpr, NegExpr { ... } public final class ConstantExpr implements Expr { ... } public final class PlusExpr implements Expr { ... } public final class TimesExpr implements Expr { ... } public final class NegExpr implements Expr { ... } www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 52
  • 52. Sealing and Records • Sealed classes work well with record classes and record classes are implicitly final • Example: package com.example.expression; public sealed interface Expr permits ConstantExpr, PlusExpr, TimesExpr, NegExpr { ... } public record ConstantExpr(int i) implements Expr { ... } public record PlusExpr(Expr a, Expr b) implements Expr { ... } public record TimesExpr(Expr a, Expr b) implements Expr { ... } public record NegExpr(Expr e) implements Expr { ... } • Note: This combination of sealed and record classes is known as algebraic data types • Record classes allow to express product types, and sealed classes allow to express sum types www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 53
  • 53. Sealed Classes and Pattern Matching • A significant benefit of sealed classes in JEP 406: Pattern Matching for switch (Preview), which proposes to extend switch with pattern matching • Instead of inspecting an instance of a sealed class with if-else chains, we can use a switch enhanced with patterns, and sealed classes will allow the compiler to check that the patterns are exhaustive • Example: Shape rotate(Shape shape, double angle) { return switch (shape) { // pattern matching switch case Circle c -> c; case Rectangle r -> shape.rotate(angle); case Square s -> shape.rotate(angle); } // no default needed! } www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 54
  • 54. Sealed Classes • Making Use of Sealed Classes in Java, Dr. Venkat Subramaniam, at https://www.youtube.com/watch?v=Xkh5sa3vjTE (30:22) www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 55
  • 55. Pattern Matching www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 56
  • 56. Patterns • A pattern is a combination of 1. a predicate that can be applied to a target, and 2. a set of binding variables that are extracted from the target only if the predicate successfully applies to it • A type test pattern consists of a predicate that specifies a type, along with a single binding variable www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 57
  • 57. Type Patterns • Type Pattern is a test with initialization • Example: if (o instanceof String s) { System.out.println("String length: ", s.length()); } • What? – test if the value is a String; if so, initialize s with the String • Where? – in an instanceof expression • There could be else block www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 58
  • 58. Operator instanceof • Need to enhance the Java programming language with the new version of instanceof type comparison operator • Pattern matching allows common logic in a program, namely the conditional extraction of components from objects, to be expressed more concisely and safely • Motivation: if (obj instanceof String) { String s = (String) obj; // use s } www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 59 Involves: a) test – is obj a String? b) conversion – casting obj to String c) declaration – of a new local variable s
  • 59. Extending instanceof • The instanceof operator was extended to take a type test pattern instead of just a type • Example: the phrase String s is the type test pattern: if (obj instanceof String s) { // can use s here } else { // can't use s here } • The instanceof operator "matches" obj to the type test pattern: • If obj is an instance of String, then it is cast to String and assigned to the binding variable s • The binding variable is in scope in the true block of the if statement, and not in the false block of the if statement www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 60
  • 60. Pattern Matching for instanceof • First preview as JEP 305 in JDK 14, Standard as JEP 375 in JDK 16 • Example: if (obj instanceof String s && s.length() > 5) {.. s.contains(..) ..} • Another example: @Override public boolean equals(Object o) { return (o instanceof CaseInsensitiveString cis) && cis.s.equalsIgnoreCase(s); } www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 61
  • 61. Pattern Matching for switch (Preview) • Idea: Extend pattern matching to switch – from project Amber • Preview as JEP 406: Pattern Matching for switch (JDK 17) https://openjdk.java.net/jeps/406 • Relates to JEP 405: Record Patterns & Array Patterns (Preview) (JDK 18) • Enhance Java with pattern matching for switch expressions and statements • Pattern matching on switch allows an expression to be tested against a number of patterns, each with a specific action, so that complex data- oriented queries can be expressed concisely and safely • Allows patterns to appear in case labels • Introduces case null statement www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 62
  • 62. Pattern Matching for switch – Example • Example: Testing with else-ifs static String formatter(Object o) { String s = "unknown"; if (o instanceof Integer i) { s = String.format("int %d", i); } else if (o instanceof Long l) { s = String.format("long %d", l); } else if (o instanceof Double d) { s = String.format("double %f", d); } else if (o instanceof String s) { s = String.format("String %s", s); } return s; } www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 63
  • 63. Pattern Matching for switch – Example • Example: Testing with switch static String formatterPatternSwitch(Object o) { return switch (o) { case Integer i -> String.format("int %d", i); case Long l -> String.format("long %d", l); case Double d -> String.format("double %f", d); case String s -> String.format("String %s", s); default -> o.toString(); }; } • Note: Switch can be of any type – no type restriction anymore www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 64
  • 64. Pattern Matching for switch – Example #2 • Example: Testing for null to avoid NullPointerException static String formatterPatternSwitch(Object o) { if (o == null) { return "oops"; } return switch (o) { case Integer i -> String.format("int %d", i); case Long l -> String.format("long %d", l); case Double d -> String.format("double %f", d); case String s -> String.format("String %s", s); default -> o.toString(); }; } • This could be resolved in a better way www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 65
  • 65. Pattern Matching for switch – Example #2 • Example: Testing for null in the switch static String formatterPatternSwitch(Object o) { return switch (o) { case null -> "null"; case Integer i -> String.format("int %d", i); case Long l -> String.format("long %d", l); case Double d -> String.format("double %f", d); case String s -> String.format("String %s", s); default -> o.toString(); }; } www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 66
  • 66. Pattern Matching for switch – Example #2 • Various ways to use null • Example: Testing for null or String in the switch switch (o) { case null -> ... case String s -> ... ... } • is the same as switch (o) { case null, String s -> ... // null or String ... } www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 67
  • 67. Guarded Patterns • Rather than add another special case label, we enhance the pattern language by adding guarded patterns • Example: Test that o is a String of length 1 (or not) static void test(Object o) { switch (o) { case String s: if (s.length() == 1) { ... } else { ... } break; ... } } • The test that o is a String of length 1 is split between case label and if statement www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 68
  • 68. Guarded Patterns – Solution • After a successful pattern match we often further test the result of the match • Example: static void test(Object o) { switch (o) { case String s && (s.length() == 1) -> ... case String s -> ... ... } } • The first case matches if o is both a String and of length 1 • The second case matches if o is a String of some other length www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 69
  • 69. Guarded Patterns – Issue • Possible issue – Dominance of pattern labels where order matters • Example: static void test(Object o) { switch (o) { case String s -> ... case String s && (s.length() == 1) -> ... ... } } • The second label is never reached – second pattern is dominated by the first pattern www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 70
  • 70. Pattern Matching for switch – Issues • Possible issue – Dominance of pattern labels where order matters • Example: static void test(Object o) { switch (o) { case CharSequence cs -> ... case String s -> ... ... } } • The string s is never reached – pattern is dominated by cs pattern www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 71
  • 71. Mixing patterns and constants • We can mix constants and patterns • Example: static void test(Object o) { switch (o) { case "Hello" -> ... case String s -> ... ... } } • However, if the order is s first, "Hello" second, the string "Hello" is never reached – pattern is dominated by s pattern www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 72
  • 72. Be Careful with Totality • Example: static int test(Object o) { return switch (o) { case String s -> s.length(); case Integer i -> i; default -> 0; // we need totality! } } www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 74
  • 73. Be Careful with Totality • Example: Object o = ... switch (o) { case String s: System.out.println(s); break; case Integer i: System.out.println("Integer"); break; default: break; // we need totality! } } www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 75
  • 74. Record Patterns • Take a look at JEP 405 : Record Patterns & Array Patterns (Preview) in JDK 18 https://openjdk.java.net/jeps/405 • Record pattern tests if the target is of certain record type, and if so, pull apart the structure www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 76
  • 75. Pattern Matching in Java 17 • Pattern Matching in Java 17 and Beyond, Nicola Parlog, https://www.youtube.com/watch?v=UlFFKkq6fyU (27:01) • Java Language Futures: Late 2021 Edition, Gavin Bierman, https://www.youtube.com/watch?v=hDV6G1MbUH8 (31:11) www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 77
  • 76. Hidden Classes www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 78
  • 77. Hidden Classes • Idea: Classes that cannot be used directly by the bytecode of other classes • Standard as JEP 371: Hidden Classes (JDK 15) • Intended for use by frameworks that generate classes at run time and use them indirectly, only via reflection • May be defined as a member of an access control nest • May be unloaded independently of other classes • Whereas a normal class is created by invoking ClassLoader::defineClass, a hidden class is created by invoking Lookup::defineHiddenClass • Causes the JVM to derive a hidden class from the supplied bytes, link the hidden class, and return a lookup object that provides reflective access to the hidden class www.hujak.hr HUJAK - B. Mihaljević, A. Radovan, M. Žagar 79
  • 78. Thank you & greetings from HUJAK! • Web page hujak.hr • www.hujak.hr • LinkedIn group HUJAK • www.linkedin.com/groups?gid=4320174 • Facebook group page HUJAK.hr • www.facebook.com/HUJAK.hr • Twitter profile @HUJAK_hr • twitter.com/HUJAK_hr www.hujak.hr 80 HUJAK - B. Mihaljević, A. Radovan, M. Žagar