Re: Enum in Eclipse Scrapbook
On 2/28/2013 10:24 AM, lipska the kat wrote:
On 28/02/13 13:28, Arne Vajh?j wrote:
On 2/28/2013 4:02 AM, lipska the kat wrote:
>>>On 27/02/13 20:25, Lew wrote:
>>>>Nowhere does it state that its purpose is to define complex
classes. Its purpose is to execute expressions.
>>>>
>>>>So define your classes where you're supposed to, in their own
source files.
>>>>
enum Month {JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC};
Month m = Month.JAN;
>>>is not a 'complex class'
>>>
>>>Month m = Month.JAN;
>>>
>>>is an expression, yet it still fails.
>>
The original example was also an expression.
But both the original example and your example
contains a nested type.
>>
>>And apparently scrapbook does not support nested types.
>>
>>So the solution is to move the nested types out as top
level types.
>>
>>As Lew said. Assuming that we consider enum a class.
It's not my example you buffoon, it's the OPs
No.
OP's example was:
class A {
enum Month {JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC}
}
A a = new A();
So it is:
implicit class - nested enum
and:
implicit class - nested class - nested enum
OP's example gives 1 error.
Your example give 3 errors (where the first is the
one in OP's example).
So Lew's comment is absolutely correct - moving class A out
as a top level class in its own file will solve the problem.
For reasons unknown to me you posted a similar but not identical
example.
Lew's solution still applies though - just by moving the enum
Month out as top level.
So stop whining and express your admiration that Lew analyzed
the problem correctly.
Arne