Skip to content

Generics leads to compiler error #41

@GoogleCodeExporter

Description

@GoogleCodeExporter

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 [email protected] on 27 Feb 2011 at 12:42

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions