Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
Java
/
Type erasure
A class implements `Decoder<Integer>` by declaring `Integer decode(String)`. Why may refl…
from Type erasure
Java 25 LTS
intermediate
1 min
A class implements `Decoder<Integer>` by declaring `Integer decode(String)`. Why may reflection also report `Object decode(String)`?
The compiler generated a bridge method to preserve dispatch through the erased interface signature.
Reflection synthesizes an overload every time methods are queried.
`Object` is inferred from the string argument at runtime.
Java permits overloading methods by return type alone.
Check
Ask AI about this kata
Report an error
next kata
What is the erasure of `T` in `T extends CharSequence & Comparable<T>`?
Quiz
A new version is available
Reload