Skip to content

Commit

Permalink
Merge pull request #49 from sviperll/fix-nested-enums-in-meta
Browse files Browse the repository at this point in the history
Fix nested enums in meta
  • Loading branch information
phax authored Jul 7, 2016
2 parents faae724 + 037fbec commit 9e13eff
Showing 1 changed file with 16 additions and 1 deletion.
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

0 comments on commit 9e13eff

Please sign in to comment.