Return to site

☕1️⃣8️⃣ JDK18 NEWS: Code Snippets in Java API Documentation #JEP413

· java

A new JavaDoc tag '@𝐬𝐧𝐢𝐩𝐩𝐞𝐭' is available in JDK18.

It can be used to define a code fragment.

It is more flexible than the '@𝐜𝐨𝐝𝐞' existing tag, in the way that it does not require to escape special characters.

'@𝐬𝐧𝐢𝐩𝐩𝐞𝐭'  also allows to include code fragments from external files.

𝐄𝐱𝐚𝐦𝐩𝐥𝐞:

 

𝐄𝐱𝐚𝐦𝐩𝐥𝐞 𝐰𝐢𝐭𝐡 𝐞𝐱𝐭𝐞𝐫𝐧𝐚𝐥 𝐟𝐢𝐥𝐞𝐬 𝐢𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧:

 

Those external files can be defined in the Unit tests