fix Issue 10144 - Using enum inside final class occurs weird errors

An enum and static variable declaration should not be affected by `synchronized`, `override`, `abstract`, and `final` attributes.
Also allow __gshared and synchronized/override/abstract/final combinations