java-topology/test/langtools/tools/javac/T8016099/UncheckedWarningRegressionTest.java
russell@unturf.com 0a580b313d undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com

Patches, unit tests, benchmarks, whitepaper, and outreach briefs.
Public domain — no copyright claimed. Use freely.
2026-03-26 17:11:57 -04:00

32 lines
913 B
Java

/*
* @test /nodynamiccopyright/
* @bug 8016099
* @summary Some SuppressWarnings annotations ignored ( unchecked, rawtypes )
* @compile UncheckedWarningRegressionTest.java
* @compile/fail/ref=UncheckedWarningRegressionTest.out -XDrawDiagnostics -Werror -Xlint:unchecked UncheckedWarningRegressionTest.java
*/
public class UncheckedWarningRegressionTest {
<T> void suppressedWarningsFinalInitializer() {
@SuppressWarnings("unchecked")
T[] tt = (T[]) FINAL_EMPTY_ARRAY;
}
final Object[] FINAL_EMPTY_ARRAY = {};
<T> void finalInitializer() {
T[] tt = (T[]) FINAL_EMPTY_ARRAY;
}
<T> void suppressedWarningsNonFinalInitializer() {
@SuppressWarnings("unchecked")
T[] tt = (T[]) NON_FINAL_EMPTY_ARRAY;
}
Object[] NON_FINAL_EMPTY_ARRAY = {};
<T> void nonFinalInitializer() {
T[] tt = (T[]) NON_FINAL_EMPTY_ARRAY;
}
}