Java Code Examples for javassist.bytecode.AccessFlag#isProtected()
The following examples show how to use
javassist.bytecode.AccessFlag#isProtected() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassFileJavassist.java From jbse with GNU General Public License v3.0 | 6 votes |
@Override public int getModifiers() { //this code reimplements CtClassType.getModifiers() to circumvent a bug int acc = this.cf.getAccessFlags(); acc = clear(acc, SUPER); int inner = this.cf.getInnerAccessFlags(); if (inner != -1) { if ((inner & STATIC) != 0) { acc |= STATIC; } if (AccessFlag.isPublic(inner)) { //seems that public nested classes already have the PUBLIC modifier set //but we are paranoid and we set it again acc = setPublic(acc); } else if (AccessFlag.isProtected(inner)) { acc = setProtected(acc); } else if (AccessFlag.isPrivate(inner)) { acc = setPrivate(acc); } else { //package visibility acc = setPackage(acc); //clear the PUBLIC modifier in case it is set } } return AccessFlag.toModifier(acc); }
Example 2
Source File: LogLifeCycleProcessor.java From loglifecycle with Apache License 2.0 | 5 votes |
private void debugLifeCycleMethods(CtClass classToTransform, CtMethod[] methods) throws CannotCompileException, AfterBurnerImpossibleException, NotFoundException { for (CtMethod lifeCycleHook : methods) { String methodName = lifeCycleHook.getName(); String className = classToTransform.getName(); int accessFlags = lifeCycleHook.getMethodInfo().getAccessFlags(); boolean isFinal = (accessFlags & AccessFlag.FINAL) == AccessFlag.FINAL; boolean canOverride = !isFinal && (AccessFlag.isPublic(accessFlags) || AccessFlag.isProtected(accessFlags) || AccessFlag.isPackage(accessFlags)); if (canOverride && methodName.startsWith("on")) { log.info("Overriding " + methodName); try { String body = "android.util.Log.d(\"LogLifeCycle\", \"" + className + " [\" + System.identityHashCode(this) + \"] \u27F3 " + methodName + "\");"; afterBurner.afterOverrideMethod(classToTransform, methodName, body); log.info("Override successful " + methodName); } catch (Exception e) { logMoreIfDebug("Override didn't work ", e); } } else { log.info( "Skipping " + methodName + ". Either it is final, private or doesn't start by 'on...'"); } } }
Example 3
Source File: JavassistAdapter.java From panda with Apache License 2.0 | 4 votes |
@Override public String getMethodModifier(MethodInfo method) { int accessFlags = method.getAccessFlags(); return AccessFlag.isPrivate(accessFlags) ? "private" : AccessFlag.isProtected(accessFlags) ? "protected" : isPublic(accessFlags) ? "public" : ""; }
Example 4
Source File: JType.java From jadira with Apache License 2.0 | 4 votes |
public boolean isProtected() { return AccessFlag.isProtected(classFile.getAccessFlags()); }
Example 5
Source File: JMethod.java From jadira with Apache License 2.0 | 4 votes |
public boolean isProtected() { return AccessFlag.isProtected(getMethodInfo().getAccessFlags()); }
Example 6
Source File: JConstructor.java From jadira with Apache License 2.0 | 4 votes |
public boolean isProtected() { return AccessFlag.isProtected(getMethodInfo().getAccessFlags()); }