6679509: AssertionError in com.sun.tools.javac.jvm.Gen$1ComplexityScanner

Maurizio Cimadamore Maurizio.Cimadamore at Sun.COM
Fri Apr 4 02:01:59 PDT 2008


I'll have a look at it soon, it seems quite promising

Maurizio

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