// WARNING: THIS CAN CRASH YOUR IDE (Eclipse)!!!! package com.example.foo; import java.math.RoundingMode; public class SomeClass { static > void doEnumStuff(final Class type) { for (final T constant : type.getEnumConstants()) System.out.println(constant); } static void doStuff(final Class type) { System.out.println("Type: " + type); if (type.isEnum()) doEnumStuff((Class) type);// <- eclipse crashes when you remove the cast! } public static void main(final String[] args) throws Throwable { doStuff(String.class); doStuff(RoundingMode.class); } } -------------------------------------------------------------------- From "/.metadata/.log": java.lang.StackOverflowError at org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding.nullAnnotatedReadableName(TypeVariableBinding.java:728) at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.nullAnnotatedReadableName(ParameterizedTypeBinding.java:1116) at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.nullAnnotatedReadableName(ParameterizedTypeBinding.java:1085) at org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding.nullAnnotatedReadableName(TypeVariableBinding.java:728) at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.nullAnnotatedReadableName(ParameterizedTypeBinding.java:1116) at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.nullAnnotatedReadableName(ParameterizedTypeBinding.java:1085) (Naturally this repeats endlessly)