managed-commons / stab-language

Automatically exported from code.google.com/p/stab-language
Apache License 2.0
5 stars 3 forks source link

Generics leads to compiler error #41

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

The following code:

using java.lang;

package test {

    public class TemplateMapper<E> where E : Enum<E> {

        public static final TemplateMapper<E> getInstance(Class<E> templateClass) where E : Enum<E> {
            return null;
        }
    }
}

results the compiler error:

Exception in thread "main" java.lang.IllegalStateException: name = E
        at stab.reflection.MethodBuilder.addGenericConstraint(MethodBuilder.stab:104)
        at stab.tools.compiler.Compiler.setMethodConstraints(Compiler.stab:1555)
        at stab.tools.compiler.Compiler.defineClassMethod(Compiler.stab:1423)
        at stab.tools.compiler.Compiler.defineClassMembers(Compiler.stab:1183)
        at stab.tools.compiler.Compiler.defineMembers(Compiler.stab:1117)
        at stab.tools.compiler.Compiler.defineMembers(Compiler.stab:1137)
        at stab.tools.compiler.Compiler.defineMembers(Compiler.stab:1114)
        at stab.tools.compiler.Compiler.defineMembers(Compiler.stab:1058)
        at stab.tools.compiler.Compiler.doCompile(Compiler.stab:308)
        at stab.tools.compiler.Compiler.compileFromFiles(Compiler.stab:222)
        at stab.tools.compiler.Application.run(Application.stab:129)
        at stab.tools.compiler.Application.main(Application.stab:31)

Original issue reported on code.google.com by ice.ta...@gmail.com on 27 Feb 2011 at 12:42