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<Class<?>, EnumeratedCalc> cache = new ConcurrentHashMap<Class<?>, EnumeratedCalc>();
@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<?> 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 <JM> 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 <JM, C> 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 <JM> String javaMateToString(JM from)
{
return toString((Enum) from);
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public <JM, C> C javaMateTo(JM from, Class<C> 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<Enum>)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<?> class1 = eValue1.getClass();
Class<?> class2 = eValue2.getClass();
int rc = 0;
if (class1 == class2)
rc = eValue1.compareTo(eValue2);
else
rc = class1.getName().compareTo(class2.getName());
return rc;
}
public <E extends Enum<E>> String toString(E from)
{
if (from == null)
return null;
return from.name();
} // toString
public <E extends Enum<E>> 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<?> enumClass)
{
EnumeratedCalc calculus = create(enumClass);
return calculus;
}
public static EnumeratedCalc create(Class<?> 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