DulcetAirman icon

Eclipse type problem

DulcetAirman | PRO | 04/03/14 12:36:26 PM UTC | 0 ⭐ | 901 👁️ | Never ⏰ | []
Java |

1.57 KB

|

None

|

0 👍

/

0 👎

// WARNING: THIS CAN CRASH YOUR IDE (Eclipse)!!!!
 
package com.example.foo;
 
import java.math.RoundingMode;
 
public class SomeClass {
 
  static <T extends Enum<T>> void doEnumStuff(final Class<T> type) {
    for (final T constant : type.getEnumConstants())
      System.out.println(constant);
  }
 
  static <T> void doStuff(final Class<T> 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 "<workspace>/.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)

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎