1 package org.netbeans.modules.tasklist.javadoc; 2 3 import java.lang.reflect.Modifier ; 4 import org.openide.src.ClassElement; 5 import org.openide.src.MemberElement; 6 7 10 public class JavaDocUtils { 11 14 private JavaDocUtils() { 15 } 16 17 public static int getEffectiveAccess(MemberElement el) { 18 int access = el.getModifiers() & (Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE); 19 if (access == Modifier.PRIVATE) 20 return access; 21 ClassElement decl = el.getDeclaringClass(); 22 if (decl == null) 23 return access; 25 if (!decl.isClassOrInterface()) 26 access = Modifier.PUBLIC; 28 29 int parentAccess = getEffectiveAccess(decl); 30 switch (parentAccess) { 31 case Modifier.PRIVATE: 32 case 0: 33 return parentAccess; 36 case Modifier.PROTECTED: 37 return access == 0 ? 0 : parentAccess; 39 case Modifier.PUBLIC: 40 default: 41 return access; 42 } 43 } 44 } 45 | Popular Tags |