Scala 2.13
Last reviewed Sep 5, 2026
Prompt Details
Prompt Composition
2prompts
- Java 25113 lines · 2.8K tokens
- Scala 2.1367 lines · 2.2K tokens
Total180 lines · 5.1K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 113
- 117
- 190
- 201
- 208
- 209
- 214
- 295
- 297
- 306
- 323
- 327
- 338
- 347
- 362
- 367
- 378
- 427
- 470
- 471
- 476
- 494
- 502
- 532
- 611
- 653
- 674
- 681
- 732
- 749
- 770
- 772
- 776
- 789
- 807
- 829
- 863
- 915
- 916
- 918
- 922
- 942
- 1333
Prompt Preview
Apply the Java 25 prompt first. These rules cover the maintained Scala 2.13 language, compiler, standard library, reflection, and JVM interoperability, and were checked against 2.13.18.
Domain types and trust boundaries
- Give validated identities, authorization decisions, money, paths, and other security values distinct types rather than aliases of
Stringor numeric primitives. - Enforce invariants through private constructors and checked companion factories; restrict case-class
applyandcopypaths that can recreate privileged values without validation. - Define closed security states with sealed hierarchies and use exhaustive matches; never let a default case turn an unknown role, operation, or state into an allowed result.
- Treat erased type tests,
asInstanceOf,@unchecked, structural calls, reflective access, and unchecked variance as deliberate escapes from the type system. - Use
Optionto express absence in Scala-owned APIs, validatenullat every Java boundary, and avoid partial accessors such asOption.geton external state.
Parsing, interpolation, and operating-system actions
- Decode input with an explicit schema and limits for bytes, nesting, fields, collection elements, numeric magnitude, and accepted variants.
- Bound
LazyList,View, iterator, range, regex, recursion, collection-building, and numeric-conversion work controlled by external values. - Do not treat
s,f,raw, or an unvetted custom interpolator as contextual escaping; use parameter binding or a vetted encoder for SQL, markup, headers, logs, and other