We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Java, Code Coverage & Their Best Friend: Bytecode • Evgeny Mandrikov • YOW! 2023
Explore the complexities of Java's try-finally blocks, synthetic methods, and bytecode inspection, and discover how this trio impacts code analysis and test coverage with Jacoco.
-
try
andfinally
blocks can lead to synthetic methods being generated, which can make code analysis challenging. - Bytecode inspection can reveal the true code paths and show the synthetic methods introduced by the compiler.
-
The
try
andfinally
blocks can also lead to duplicated code and exceptions being generated. - The enum type can have synthetic methods generated for its constants.
-
The
switch
statement can be used with enum types and can lead to synthetic methods being generated. - Code coverage tools like Jacoco need to be updated to correctly handle synthetic methods.
- Synthetic methods can be ignored if they don’t affect the behavior of the program.
-
The
nested
keyword can be used to create nested enum types. - Pattern matching can be used to simplify code and reduce the need for synthetic methods.
-
The
when
keyword can be used to specify the conditions for a pattern match. - Synthetic methods can be generated by the compiler even if the code is never executed.
- Code analysis tools need to be updated to correctly handle the new features and synthetic methods introduced by Java.
-
The
match
keyword can be used to simplify code and reduce the need for synthetic methods. - Synthetic methods can be generated by the compiler even if the code is never executed.
- Code coverage tools like Jacoco need to be updated to correctly handle synthetic methods.