Community
Participate
Working Groups
With the following example: public enum X { A() {} } we tag the enum as abstract and I don't think this is needed. There is no abstract method that needs to be implemented.
Philippe : candidate for RC3.
+1 for RC3 Dani: pls also approve this one. After final bit, there is an issue with abstract bit where we are inconsistent.
+1 for 3.1 RC3.
Philippe, for this case: public enum EnumTest { B { int value() { return 1; } }; int value(){ return 0; } } the test fieldDecl.initialization instanceof QualifiedAllocationExpression from ClassScope.checkAndSetModifiers() is not sufficient: TypeDeclaration typeDeclaration = this.referenceContext; FieldDeclaration[] fields = typeDeclaration.fields; int length = typeDeclaration.fields == null ? 0 : typeDeclaration.fields.length; checkAbstractEnum: { if (length == 0) break checkAbstractEnum; // must implement the method itself for (int i = 0; i < length; i++) { FieldDeclaration fieldDecl = fields[i]; if (fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) if (!(fieldDecl.initialization instanceof QualifiedAllocationExpression)) break checkAbstractEnum; } modifiers |= AccAbstract; } Any ideas?
Added EnumTest test114. We are better than before but still not 100%. We still tag enums that implement all the methods defined by an interface as abstract, such as: enum EnumX implements I { BLUE {}; public void foo(){} } interface I { void foo(); }
As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you.