Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nested enums in meta #49

Merged
merged 2 commits into from
Jul 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,30 @@ private void declareInnerClasses (final JDefinedClass klass,
{
if (enclosedElement.getKind ().equals (ElementKind.INTERFACE) ||
enclosedElement.getKind ().equals (ElementKind.CLASS) ||
enclosedElement.getKind ().equals (ElementKind.ENUM) ||
enclosedElement.getKind ().equals (ElementKind.ANNOTATION_TYPE))
{
final EClassType classType = toClassType (enclosedElement.getKind ());
int modifiers = toJMod (enclosedElement.getModifiers ());
if (classType.equals (EClassType.INTERFACE))
if (classType.equals (EClassType.INTERFACE) ||
classType.equals (EClassType.ANNOTATION_TYPE_DECL))
{
// Interfaces are always implicitly abstract, but explicit abstract modifier is not allowed in the code.
modifiers &= ~JMod.ABSTRACT;
}
if (classType.equals (EClassType.INTERFACE) ||
classType.equals (EClassType.ENUM) ||
classType.equals (EClassType.ANNOTATION_TYPE_DECL))
{
// Interfaces and enums are implicitly static. No need for static modifier.
modifiers &= ~JMod.STATIC;
}
if (classType.equals (EClassType.ENUM))
{
// Enums are effectively final. You can't extend enums.
// But explicit final modifier is not allowed in the code.
modifiers &= ~JMod.FINAL;
}
JDefinedClass enclosedClass;
try
{
Expand Down