JDK-7123100 : javac fails with java.lang.StackOverflowError
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2011-12-20
  • Updated: 2012-07-18
  • Resolved: 2012-02-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u4Fixed 8 b23Fixed
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) Client VM (build 22.0-b10, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
javac  version 1.7.0+ fails with java.lang.StackOverflowError on quite simple source. javac version 1.6.0_20 works OK on same source.

REGRESSION.  Last worked in version 6u29

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run:
C:\Program Files\Java\jdk1.7.0_02\bin\javac.exe" -version EnumeratedCalc.java

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
error log without stacktrace.
ACTUAL -
javac 1.7.0_02
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:3: error: cannot find symbol
public class EnumeratedCalc extends AbstractCalc implements DataCalculus.Tunable
                                    ^
  symbol: class AbstractCalc
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:3: error: package DataCalculus does not exist
public class EnumeratedCalc extends AbstractCalc implements DataCalculus.Tunable
                                                                        ^
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:8: error: cannot find symbol
	public static final DataBox nullDataBox = DataBox.Lib.dataBox(staticInstance, nullJavaMate);
	                    ^
  symbol:   class DataBox
  location: class EnumeratedCalc
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:11: error: cannot find symbol
	public static final DataBox minDataBox = nullDataBox;
	                    ^
  symbol:   class DataBox
  location: class EnumeratedCalc
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:14: error: cannot find symbol
	public static final DataBox maxDataBox = DataBox.Lib.dataBox(staticInstance, maxJavaMate);
	                    ^
  symbol:   class DataBox
  location: class EnumeratedCalc
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:33: error: cannot find symbol
	public ClassBase getClassBase()
	       ^
  symbol:   class ClassBase
  location: class EnumeratedCalc
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:60: error: cannot find symbol
	public <JM> JM stringToJavaMate(String from) throws RobustInvocationException
	                                                    ^
  symbol:   class RobustInvocationException
  location: class EnumeratedCalc
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:69: error: cannot find symbol
	public Object toJavaMate(Object from) throws RobustInvocationException
	                                             ^
  symbol:   class RobustInvocationException
  location: class EnumeratedCalc
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:117: error: cannot find symbol
	public <JM, C> C javaMateTo(JM from, Class<C> classTo) throws RobustInvocationException
	                                                              ^
  symbol:   class RobustInvocationException
  location: class EnumeratedCalc
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:138: error: cannot find symbol
	public int compareThisClassBase(DataBox b1, DataBox b2)
	                                ^
  symbol:   class DataBox
  location: class EnumeratedCalc
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:138: error: cannot find symbol
	public int compareThisClassBase(DataBox b1, DataBox b2)
	                                            ^
  symbol:   class DataBox
  location: class EnumeratedCalc
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:167: error: cannot find symbol
	public <E extends Enum<E>> E fromString(String from) throws RobustInvocationException
	                                                            ^
  symbol:   class RobustInvocationException
  location: class EnumeratedCalc
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:8: error: package DataBox does not exist
	public static final DataBox nullDataBox = DataBox.Lib.dataBox(staticInstance, nullJavaMate);
	                                                 ^
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:14: error: package DataBox does not exist
	public static final DataBox maxDataBox = DataBox.Lib.dataBox(staticInstance, maxJavaMate);
	                                                ^
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:16: error: type argument EnumeratedCalc is not within bounds of type-variable V
	private static ConcurrentHashMap<Class<?>, EnumeratedCalc> cache = new ConcurrentHashMap<Class<?>, EnumeratedCalc>();
	                                           ^
  where V is a type-variable:
    V extends Object declared in class ConcurrentHashMap
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:16: error: type argument EnumeratedCalc is not within bounds of type-variable V
	private static ConcurrentHashMap<Class<?>, EnumeratedCalc> cache = new ConcurrentHashMap<Class<?>, EnumeratedCalc>();
	                                                                                                   ^
  where V is a type-variable:
    V extends Object declared in class ConcurrentHashMap
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:26: error: method does not override or implement a method from a supertype
	@Override
	^
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:35: error: cannot find symbol
		return ClassBase.Enumerated;
		       ^
  symbol:   variable ClassBase
  location: class EnumeratedCalc
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:32: error: method does not override or implement a method from a supertype
	@Override
	^
E:\All\src\robust\akern\type\calc\EnumeratedCalc.java:38: error: method does not override or implement a method from a supertype
	@Override
	^


The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitWildcardType(Types.java:3609)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3583)
	at com.sun.tools.javac.code.Types$Rewriter.visitCapturedType(Types.java:3548)
	at com.sun.tools.javac.code.Type$CapturedType.accept(Type.java:1077)
	at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3791)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3563)
	at com.sun.tools.javac.code.Types$Rewriter.visitClassType(Types.java:3548)
	at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
	at com.sun.tools.javac.code.Types$Unar


( This report has more than 16,000 characters and has been truncated. )
Problematic source:

import java.util.concurrent.*;
public class EnumeratedCalc extends AbstractCalc implements DataCalculus.Tunable
{
	public static final EnumeratedCalc staticInstance = new EnumeratedCalc();

	public static final PlaceHolderEnum nullJavaMate = PlaceHolderEnum.Null;
	public static final DataBox nullDataBox = DataBox.Lib.dataBox(staticInstance, nullJavaMate);

	public static final PlaceHolderEnum minJavaMate = nullJavaMate;
	public static final DataBox minDataBox = nullDataBox;

	public static final PlaceHolderEnum maxJavaMate  = PlaceHolderEnum.Max;
	public static final DataBox maxDataBox = DataBox.Lib.dataBox(staticInstance, maxJavaMate);

	private static ConcurrentHashMap&lt;Class&lt;?&gt;, EnumeratedCalc&gt; cache = new ConcurrentHashMap&lt;Class&lt;?&gt;, EnumeratedCalc&gt;();

	@SuppressWarnings("rawtypes")
	private Class enumClass = PlaceHolderEnum.class;

	private EnumeratedCalc()
	{
		super();
	}

	@Override
	public boolean isTunable()
	{
		return true;
	}

	@Override
	public ClassBase getClassBase()
	{
		return ClassBase.Enumerated;
	}

	@Override
	public boolean isCompatible(Class&lt;?&gt; c)
	{
		if (c == String.class)
			return true;
		if (c.isEnum())
			return true;

		return false;
	}

	//!! uncomment this method for workaround
	/*
	@Override
	public Object stringToJavaMate(String from) throws RobustInvocationException
	{
		@SuppressWarnings("unchecked")
		Object jm = fromString(from);
		return jm;
	}
	 */
	//!! comment this method for workaround

	@Override
	public &lt;JM&gt; JM stringToJavaMate(String from) throws RobustInvocationException
	{
		@SuppressWarnings("unchecked")
		JM jm = (JM)fromString(from);
		return jm;
	}

	@SuppressWarnings("unchecked")
	@Override
	public Object toJavaMate(Object from) throws RobustInvocationException
	{
		Object eValue;
		if (from instanceof String)
			eValue = fromString((String)from);
		else
		{
			if (enumClass.isInstance(from))
				eValue = from;
			else if (from.getClass().isEnum())
				eValue = EnumUtilities.valueOfIgnoreCase(enumClass, from.toString());
			else
				throw new RobustInvocationException("Incompatible object for Enumerated ("+from+"). Compatible are Enum values and String");
		}

		return eValue;
	}

	/*
	@SuppressWarnings("unchecked")
	@Override
	public &lt;JM, C&gt; JM toJavaMate(C from) throws RobustInvocationException
	{
		JM eValue;
		if (from instanceof String)
			eValue = (JM)fromString((String)from);
		else
		{
			if (enumClass.isInstance(from))
				eValue = (JM)from;
			else if (from.getClass().isEnum())
				eValue = EnumUtilities.valueOfIgnoreCase(enumClass, from.toString());
			else
				throw new RobustInvocationException("Incompatible object for Enumerated ("+from+"). Compatible are Enum values and String");
		}

		return eValue;
	}
	 */
	@SuppressWarnings({"unchecked", "rawtypes"})
	@Override
	public &lt;JM&gt; String javaMateToString(JM from)
	{
		return toString((Enum) from);
	}

	@SuppressWarnings({"unchecked", "rawtypes"})
	@Override
	public &lt;JM, C&gt; C javaMateTo(JM from, Class&lt;C&gt; classTo) throws RobustInvocationException
	{
		C cValue;
		if (classTo == enumClass)
			cValue = (C)from;
		else if (classTo == String.class)
		{
			cValue = (C)toString((Enum)from);
		}
		else if (classTo.isEnum())
		{
			cValue = (C)EnumUtilities.valueOfIgnoreCase((Class&lt;Enum&gt;)classTo, (Enum)from);
		}
		else
			throw new RobustInvocationException("Incompatible object for Boolean ("+from+"). Compatible are Boolean and String");

		return cValue;
	}

	@SuppressWarnings({"rawtypes", "unchecked"})
	@Override
	public int compareThisClassBase(DataBox b1, DataBox b2)
	{
		Comparable eValue1 = b1.getValueAsJavaMate();
		Comparable eValue2 = b2.getValueAsJavaMate();
		if (eValue1 == eValue2)
			return 0;
		if (eValue1 == minDataBox || eValue2 == maxDataBox)
			return -1;
		if (eValue1 == maxDataBox || eValue2 == minDataBox)
			return 1;
		Class&lt;?&gt; class1 = eValue1.getClass();
		Class&lt;?&gt; class2 = eValue2.getClass();
		int rc = 0;
		if (class1 == class2)
			rc = eValue1.compareTo(eValue2);
		else
			rc = class1.getName().compareTo(class2.getName());

		return rc;
	}

	public &lt;E extends Enum&lt;E&gt;&gt; String toString(E from)
	{
		if (from == null)
			return null;
		return from.name();
	} // toString


	public &lt;E extends Enum&lt;E&gt;&gt; E fromString(String from) throws RobustInvocationException
	{
		if (StringUtilities.isEmpty(from))
			return null;
		@SuppressWarnings("unchecked")
		E fromString = (E) EnumUtilities.valueOfIgnoreCase(enumClass, from);
		return fromString;
	} // fromString

	public EnumeratedCalc tunedForClass(Class&lt;?&gt; enumClass)
	{
		EnumeratedCalc calculus = create(enumClass);
		return calculus;
	}

	public static EnumeratedCalc create(Class&lt;?&gt; enumClass)
	{
		EnumeratedCalc calculus = cache.get(enumClass);
		if (calculus == null)
		{
			 calculus = new EnumeratedCalc();
			 calculus.enumClass = enumClass;
			 EnumeratedCalc storedCalculus = cache.putIfAbsent(enumClass, calculus);
			 if (storedCalculus != null)
				 calculus = storedCalculus;
		}
		return calculus;
	}

	/**
	 * PlaceHolderEnum
	 *
	 */
	public enum PlaceHolderEnum
	{
		Null,
		Max
	} // PlaceHolderEnum
} // EnumeratedCalc

Comments
SUGGESTED FIX A webrev of this fix is available at the following URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/133744729455
23-01-2012

SUGGESTED FIX diff --git a/src/share/classes/com/sun/tools/javac/code/Types.java b/src/share/classes/com/sun/tools/javac/code/Types.java --- a/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/src/share/classes/com/sun/tools/javac/code/Types.java @@ -3599,11 +3599,8 @@ } @Override - public Type visitCapturedType(CapturedType t, Void s) { - Type bound = visitWildcardType(t.wildcard, null); - return (bound.contains(t)) ? - erasure(bound) : - bound; + public Type visitCapturedType(CapturedType c, Void s) { + return visitWildcardRecursive(c.wildcard, c); } @Override @@ -3622,11 +3619,15 @@ @Override public Type visitWildcardType(WildcardType t, Void s) { + return visitWildcardRecursive(t, null); + } + + private Type visitWildcardRecursive(WildcardType t, Type rec) { Type bound = high ? t.getExtendsBound() : t.getSuperBound(); if (bound == null) bound = high ? syms.objectType : syms.botType; - return rewriteAsWildcardType(visit(bound), t.bound); + return rewriteAsWildcardType(visit(bound.contains(rec) ? erasure(bound) : bound), t.bound); } private Type rewriteAsWildcardType(Type bound, TypeVar formal) {
20-12-2011

EVALUATION Reduced test case: class Bug { <E extends Enum<E>> E m() { return ""; } <Z> void test() { Z z = (Z)m(); } } Seems like a bad interaction between 6548436 and 6369605.
20-12-2011