<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/compiled-and-tested-code-in-javadoc-tuhjjo3oj" -->

---
title: Compiled And Tested Code In Javadoc | daily.dev
description: JDK 18 introduces JEP 413, which adds a new `@snippet` tag to Javadoc that lets developers reference code from external source files. These external files can...
canonical: https://daily.dev/posts/compiled-and-tested-code-in-javadoc-tuhjjo3oj
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Compiled And Tested Code In Javadoc | daily.dev
og:description: JDK 18 introduces JEP 413, which adds a new `@snippet` tag to Javadoc that lets developers reference code from external source files. These external files can...
og:url: https://daily.dev/posts/compiled-and-tested-code-in-javadoc-tuhjjo3oj
og:image: https://api.daily.dev/og/posts/TUHJjO3Oj.png
og:image:alt: Compiled And Tested Code In Javadoc
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Compiled And Tested Code In Javadoc

**[nipafx \(Nicolai Parlog\)](https://daily.dev/sources/nipafx)** · 8 min read · 0 upvotes · 0 comments

## Summary

JDK 18 introduces JEP 413, which adds a new `@snippet` tag to Javadoc that lets developers reference code from external source files. These external files can be compiled and tested, ensuring documentation examples stay accurate and up to date. The tag supports regions to show only relevant code sections, text highlighting, linking, and inline-plus-external validation. Projects targeting older Java versions can still use this feature by building with JDK 18 while setting the compiler's `--release` flag to their target version.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://nipafx.dev/inside-java-newscast-20>

## Similar posts on daily.dev

- [JDK 28: Rich JavaDoc Notes](https://daily.dev/posts/jdk-28-rich-javadoc-notes-reqcgp9wo) · Inside Java · 11 upvotes · 0 comments
- [foojay – a place for friends of OpenJDK](https://daily.dev/posts/foojay-a-place-for-friends-of-openjdk-uxwbbkqtb) · Foojay.io · 2 upvotes · 0 comments
- [adam bien's blog](https://daily.dev/posts/adam-bien-s-blog-zhafb9kzg) · Adam Bien · 0 upvotes · 0 comments

---

Tags: [#testing](https://daily.dev/tags/testing), [#java](https://daily.dev/tags/java)

[View this post on daily.dev](https://daily.dev/posts/compiled-and-tested-code-in-javadoc-tuhjjo3oj)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Compiled And Tested Code In Javadoc","url":"https://daily.dev/posts/compiled-and-tested-code-in-javadoc-tuhjjo3oj","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/compiled-and-tested-code-in-javadoc-tuhjjo3oj"},"datePublished":"2026-03-16T08:13:27.332Z","dateModified":"2026-03-16T08:28:03.062Z","description":"JDK 18 introduces JEP 413, which adds a new `@snippet` tag to Javadoc that lets developers reference code from external source files. These external files can...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/367e39fa60f0923e94a3f4d8d507b6bb?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/367e39fa60f0923e94a3f4d8d507b6bb?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"nipafx (Nicolai Parlog)","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"nipafx (Nicolai Parlog)","logo":"https://media.daily.dev/image/upload/s--H_Echo_u--/f_auto,q_auto/v1773648772/logos/nipafx?_a=BAMAMiiu0","url":"https://daily.dev/sources/nipafx"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/compiled-and-tested-code-in-javadoc-tuhjjo3oj","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"testing,java","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"nipafx (Nicolai Parlog)","item":"https://daily.dev/sources/nipafx"},{"@type":"ListItem","position":3,"name":"Compiled And Tested Code In Javadoc"}]}
```

