I'm trying to write a generic class that takes an Enum as generic
parameter but
I'm not able to compile it:
------------------------------------
public class Foo<T extends Enum> {
public Foo() {
for ( T t : T.values() ) {
System.out.println( "t = " + t );
}
}
enum Stuff {RED, BLUE, GREEN};
public static void main( String args[] ) throws Exception {
Foo<Stuff> foo = new Foo<Stuff>();
}
}
--------------------------------------------
I get a compile error:
Foo.java:3: cannot find symbol
symbol : method values()
location: class java.lang.Enum
for ( T t : T.values() ) {
^
Re: VB6 compile error "constant expression required" with enum - solution ... On the enum line, put the cursor after 'enum', spacebar, arrow down. ...compile over, but you will be under way in 10 seconds or less. ...Posting for future reference and to keep this thread around. ...Private Const item1 = 0 ... (microsoft.public.vb.bugs)
Re: passing enum value as an argument ... >> safety at all (at compile time) when you've got option strict turned ... the whole point of enums - because that dismisses type safety as being ... For you to get the benefits of an Enum,... > Dim SomeVariable as Juan... (microsoft.public.dotnet.general)
3 .class files generated for 1 .java file ... I wrote the following code to get more type-safe C++-equivalent enum in Java.... Whenever I compile this code, 3 class files are generated. ... (comp.lang.java.programmer)
3 .class files generated for 1 .java file ... I wrote the following code to get more type-safe C++-equivalent enum in Java.... Whenever I compile this code, 3 class files are generated. ... (comp.unix.solaris)
"Error reflecting type" message in custom class. ...enum vary from class to class, but the enum is used for the same ... When I compile this class along with the rest of my solution in debug ... 'MMIT.Applications.GUS.Common.Address.ReferenceIDType' both use the XML... specify a unique XML name and/or namespace for the type. ... (microsoft.public.dotnet.framework)