6679509: AssertionError in com.sun.tools.javac.jvm.Gen$1ComplexityScanner
Rémi Forax
forax at univ-mlv.fr
Fri Apr 4 06:41:31 PDT 2008
Maurizio Cimadamore a écrit :
> I'll have a look at it soon, it seems quite promising
>
> Maurizio
by the way bug 6500701
http://bugs.sun.com/view_bug.do?bug_id=6500701
can be fixed in the same time by removing the line:
if (iteratorTarget != syms.objectType)
vardefinit = make.TypeCast(iteratorTarget, vardefinit);
the one just before the patch.
Rémi
>
> Jan Lahoda wrote:
>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6679509
>>
>> Summary: An AssertionError is thrown while analyzing valid program.
>> The exception occurs when a foreach loop like:
>> for (java.util.List<?> t : l) {
>> }
>> is used in a finally block, and target is 1.5.
>>
>> The problem's root cause is, IMO, that Gen is processing a tree with
>> generics (the generics should be stripped from the trees in
>> TransTypes, if I understand everything correctly).
>>
>> In this case, the code above gets correctly TransType-d to:
>> for (java.util.List t : l) {
>> }
>>
>> Then, during Lower, the foreach loop is expanded into an ordinary
>> Iterator-based loop:
>> for (java.util.Iterator i$ = l.iterator(); i$.hasNext(); ) {
>> List<?> t = (List)i$.next();
>> {
>> }
>> }
>>
>> which contains the tree with generics.
>>
>> This is side-effect of using TreeMaker.VarDef(VarSymbol v,
>> JCExpression init), which uses v.type (which contains generics) to
>> construct the tree for the variable's type.
>>
>> I have prepared a patch that constructs the tree for the variable
>> using erasure(v.type). The patch is attached.
>>
>> Any opinions on the patch?
>>
>> Thanks,
>> Jan
>>
More information about the compiler-dev
mailing list