proguard.classfile.ClassConstants Java Examples

The following examples show how to use proguard.classfile.ClassConstants. 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: ConstantParameterFilter.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    // All parameters of non-static methods are shifted by one in the local
    // variable frame.
    int firstParameterIndex =
        (programMethod.getAccessFlags() & ClassConstants.INTERNAL_ACC_STATIC) != 0 ?
            0 : 1;

    int parameterCount =
        ClassUtil.internalMethodParameterCount(programMethod.getDescriptor(programClass));

    for (int index = firstParameterIndex; index < parameterCount; index++)
    {
        Value value = StoringInvocationUnit.getMethodParameterValue(programMethod, index);
        if (value != null &&
            value.isParticular())
        {
            constantParameterVisitor.visitProgramMethod(programClass, programMethod);
        }
    }
}
 
Example #2
Source File: SubroutineInliner.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Performs subroutine inlining of the given program class pool.
 */
public void execute(ClassPool programClassPool)
{
    // Clean up any old visitor info.
    programClassPool.classesAccept(new ClassCleaner());

    // Inline all subroutines.
    ClassVisitor inliner =
        new AllMethodVisitor(
        new AllAttributeVisitor(
        new CodeSubroutineInliner()));

    // In Java Standard Edition, only class files from Java 6 or higher
    // should be preverified.
    if (!configuration.microEdition)
    {
        inliner =
            new ClassVersionFilter(ClassConstants.INTERNAL_CLASS_VERSION_1_6,
                                   Integer.MAX_VALUE,
                                   inliner);
    }

    programClassPool.classesAccept(inliner);
}
 
Example #3
Source File: Preverifier.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Performs preverification of the given program class pool.
 */
public void execute(ClassPool programClassPool)
{
    // Clean up any old visitor info.
    programClassPool.classesAccept(new ClassCleaner());

    // Preverify all methods.
    ClassVisitor preverifier =
        new AllMethodVisitor(
        new AllAttributeVisitor(
        new CodePreverifier(configuration.microEdition)));

    // In Java Standard Edition, only class files from Java 6 or higher
    // should be preverified.
    if (!configuration.microEdition)
    {
        preverifier =
            new ClassVersionFilter(ClassConstants.INTERNAL_CLASS_VERSION_1_6,
                                   Integer.MAX_VALUE,
                                   preverifier);
    }

    programClassPool.classesAccept(preverifier);
}
 
Example #4
Source File: MethodStaticizer.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    // Is the 'this' parameter being used?
    if (!ParameterUsageMarker.isParameterUsed(programMethod, 0))
    {
        // Make the method static.
        programMethod.u2accessFlags =
            (programMethod.getAccessFlags() & ~ClassConstants.INTERNAL_ACC_FINAL) |
            ClassConstants.INTERNAL_ACC_STATIC;

        // Visit the method, if required.
        if (extraStaticMemberVisitor != null)
        {
            extraStaticMemberVisitor.visitProgramMethod(programClass, programMethod);
        }
    }
}
 
Example #5
Source File: ClassMerger.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Returns whether the two given classes have initializers with the same
 * descriptors.
 */
private boolean haveAnyIdenticalInitializers(Clazz clazz, Clazz targetClass)
{
    MemberCounter counter = new MemberCounter();

    // TODO: Currently checking shared methods, not just initializers.
    // TODO: Allow identical methods.
    // Visit all methods, counting the ones that are also present in the
    // target class.
    clazz.methodsAccept(//new MemberNameFilter(new FixedStringMatcher(ClassConstants.INTERNAL_METHOD_NAME_INIT),
                        new SimilarMemberVisitor(targetClass, true, false, false, false,
                        new MemberAccessFilter(0, ClassConstants.INTERNAL_ACC_ABSTRACT,
                        counter)));

    return counter.getCount() > 0;
}
 
Example #6
Source File: ClassObfuscator.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new package prefix in the given new superpackage, with the
 * given package name factory.
 */
private String generateUniquePackagePrefix(String      newSuperPackagePrefix,
                                           NameFactory packageNameFactory)
{
    // Come up with package names until we get an original one.
    String newPackagePrefix;
    do
    {
        // Let the factory produce a package name.
        newPackagePrefix = newSuperPackagePrefix +
                           packageNameFactory.nextName() +
                           ClassConstants.INTERNAL_PACKAGE_SEPARATOR;
    }
    while (packagePrefixMap.containsValue(newPackagePrefix));

    return newPackagePrefix;
}
 
Example #7
Source File: ConstantPoolEditor.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Finds or creates a IntegerConstant constant pool entry with the given
 * value.
 * @return the constant pool index of the Utf8Constant.
 */
public int addIntegerConstant(int value)
{
    int        constantPoolCount = targetClass.u2constantPoolCount;
    Constant[] constantPool      = targetClass.constantPool;

    // Check if the entry already exists.
    for (int index = 1; index < constantPoolCount; index++)
    {
        Constant constant = constantPool[index];

        if (constant != null &&
            constant.getTag() == ClassConstants.CONSTANT_Integer)
        {
            IntegerConstant integerConstant = (IntegerConstant)constant;
            if (integerConstant.getValue() == value)
            {
                return index;
            }
        }
    }

    return addConstant(new IntegerConstant(value));
}
 
Example #8
Source File: MappingPrinter.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    // Special cases: <clinit> and <init> are always kept unchanged.
    // We can ignore them here.
    String name = programMethod.getName(programClass);
    if (name.equals(ClassConstants.INTERNAL_METHOD_NAME_CLINIT) ||
        name.equals(ClassConstants.INTERNAL_METHOD_NAME_INIT))
    {
        return;
    }

    String newName = MemberObfuscator.newMemberName(programMethod);
    if (newName != null)
    {
        ps.println("    " +
                   lineNumberRange(programClass, programMethod) +
                   ClassUtil.externalFullMethodDescription(
                       programClass.getName(),
                       0,
                       programMethod.getName(programClass),
                       programMethod.getDescriptor(programClass)) +
                   " -> " +
                   newName);
    }
}
 
Example #9
Source File: ProgramClassReader.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
private Constant createConstant()
{
    int u1tag = dataInput.readUnsignedByte();

    switch (u1tag)
    {
        case ClassConstants.CONSTANT_Utf8:               return new Utf8Constant();
        case ClassConstants.CONSTANT_Integer:            return new IntegerConstant();
        case ClassConstants.CONSTANT_Float:              return new FloatConstant();
        case ClassConstants.CONSTANT_Long:               return new LongConstant();
        case ClassConstants.CONSTANT_Double:             return new DoubleConstant();
        case ClassConstants.CONSTANT_String:             return new StringConstant();
        case ClassConstants.CONSTANT_Fieldref:           return new FieldrefConstant();
        case ClassConstants.CONSTANT_Methodref:          return new MethodrefConstant();
        case ClassConstants.CONSTANT_InterfaceMethodref: return new InterfaceMethodrefConstant();
        case ClassConstants.CONSTANT_Class:              return new ClassConstant();
        case ClassConstants.CONSTANT_NameAndType:        return new NameAndTypeConstant();

        default: throw new RuntimeException("Unknown constant type ["+u1tag+"] in constant pool");
    }
}
 
Example #10
Source File: ExternalTypeEnumeration.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public String nextType()
{
    int startIndex = index;

    // Find the next separating comma.
    index = descriptor.indexOf(ClassConstants.EXTERNAL_METHOD_ARGUMENTS_SEPARATOR,
                               startIndex);

    // Otherwise find the closing parenthesis.
    if (index < 0)
    {
        index = descriptor.indexOf(ClassConstants.EXTERNAL_METHOD_ARGUMENTS_CLOSE,
                                   startIndex);
        if (index < 0)
        {
            throw new IllegalArgumentException("Missing closing parenthesis in descriptor ["+descriptor+"]");
        }
    }

    return descriptor.substring(startIndex, index++).trim();
}
 
Example #11
Source File: InternalTypeEnumeration.java    From proguard with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the next type from the method descriptor.
 */
public String nextType()
{
    int startIndex = index;

    skipArray();

    char c = descriptor.charAt(index++);
    switch (c)
    {
        case ClassConstants.TYPE_CLASS_START:
        case ClassConstants.TYPE_GENERIC_VARIABLE_START:
        {
            skipClass();
            break;
        }
        case ClassConstants.TYPE_GENERIC_START:
        {
            skipGeneric();
            break;
        }
    }

    return descriptor.substring(startIndex, index);
}
 
Example #12
Source File: MemberPrivatizer.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void visitProgramField(ProgramClass programClass, ProgramField programField)
{
    // Is the field unmarked?
    if (NonPrivateMemberMarker.canBeMadePrivate(programField))
    {
        // Make the field private.
        programField.u2accessFlags =
            AccessUtil.replaceAccessFlags(programField.u2accessFlags,
                                          ClassConstants.INTERNAL_ACC_PRIVATE);

        // Visit the field, if required.
        if (extraMemberVisitor != null)
        {
            extraMemberVisitor.visitProgramField(programClass, programField);
        }
    }
}
 
Example #13
Source File: ConstantPoolEditor.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Finds or creates a FloatConstant constant pool entry with the given
 * value.
 * @return the constant pool index of the FloatConstant.
 */
public int addFloatConstant(float value)
{
    int        constantPoolCount = targetClass.u2constantPoolCount;
    Constant[] constantPool      = targetClass.constantPool;

    // Check if the entry already exists.
    for (int index = 1; index < constantPoolCount; index++)
    {
        Constant constant = constantPool[index];

        if (constant != null &&
            constant.getTag() == ClassConstants.CONSTANT_Float)
        {
            FloatConstant floatConstant = (FloatConstant)constant;
            if (floatConstant.getValue() == value)
            {
                return index;
            }
        }
    }

    return addConstant(new FloatConstant(value));
}
 
Example #14
Source File: MemberReferenceFixer.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
{
    // Check if this class entry is an array type.
    if (ClassUtil.isInternalArrayType(classConstant.getName(clazz)))
    {
        isInterfaceMethod = false;
    }
    else
    {
        // Check if this class entry refers to an interface class.
        Clazz referencedClass = classConstant.referencedClass;
        if (referencedClass != null)
        {
            isInterfaceMethod = (referencedClass.getAccessFlags() & ClassConstants.INTERNAL_ACC_INTERFACE) != 0;
        }
    }
}
 
Example #15
Source File: InternalTypeEnumeration.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the next type from the method descriptor.
 */
public String nextType()
{
    int startIndex = index;

    skipArray();

    char c = descriptor.charAt(index++);
    switch (c)
    {
        case ClassConstants.INTERNAL_TYPE_CLASS_START:
        case ClassConstants.INTERNAL_TYPE_GENERIC_VARIABLE_START:
        {
            skipClass();
            break;
        }
        case ClassConstants.INTERNAL_TYPE_GENERIC_START:
        {
            skipGeneric();
            break;
        }
    }

    return descriptor.substring(startIndex, index);
}
 
Example #16
Source File: ConstantPoolEditor.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Finds or creates a LongConstant constant pool entry with the given value.
 * @return the constant pool index of the LongConstant.
 */
public int addLongConstant(long value)
{
    int        constantPoolCount = targetClass.u2constantPoolCount;
    Constant[] constantPool      = targetClass.constantPool;

    // Check if the entry already exists.
    for (int index = 1; index < constantPoolCount; index++)
    {
        Constant constant = constantPool[index];

        if (constant != null &&
            constant.getTag() == ClassConstants.CONSTANT_Long)
        {
            LongConstant longConstant = (LongConstant)constant;
            if (longConstant.getValue() == value)
            {
                return index;
            }
        }
    }

    return addConstant(new LongConstant(value));
}
 
Example #17
Source File: BridgeMethodFixer.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    switch (constantInstruction.opcode)
    {
        case InstructionConstants.OP_INVOKEVIRTUAL:
        case InstructionConstants.OP_INVOKESPECIAL:
        case InstructionConstants.OP_INVOKESTATIC:
        case InstructionConstants.OP_INVOKEINTERFACE:
            // Get the name of the bridged method.
            clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);

            // Check if the name is different.
            if (!method.getName(clazz).equals(bridgedMethodName))
            {
                if (DEBUG)
                {
                    System.out.println("BridgeMethodFixer: ["+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)+"] does not bridge to ["+bridgedMethodName+"]");
                }

                // Clear the bridge flag.
                ((ProgramMethod)method).u2accessFlags &= ~ClassConstants.INTERNAL_ACC_BRIDGE;
            }
            break;
    }
}
 
Example #18
Source File: ConstantPoolEditor.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Finds or creates a DoubleConstant constant pool entry with the given
 * value.
 * @return the constant pool index of the DoubleConstant.
 */
public int addDoubleConstant(double value)
{
    int        constantPoolCount = targetClass.u2constantPoolCount;
    Constant[] constantPool      = targetClass.constantPool;

    // Check if the entry already exists.
    for (int index = 1; index < constantPoolCount; index++)
    {
        Constant constant = constantPool[index];

        if (constant != null &&
            constant.getTag() == ClassConstants.CONSTANT_Double)
        {
            DoubleConstant doubleConstant = (DoubleConstant)constant;
            if (doubleConstant.getValue() == value)
            {
                return index;
            }
        }
    }

    return addConstant(new DoubleConstant(value));
}
 
Example #19
Source File: MemberPrivatizer.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    // Is the method unmarked?
    if (NonPrivateMemberMarker.canBeMadePrivate(programMethod))
    {
        // Make the method private.
        programMethod.u2accessFlags =
            AccessUtil.replaceAccessFlags(programMethod.u2accessFlags,
                                          ClassConstants.INTERNAL_ACC_PRIVATE);

        // Visit the method, if required.
        if (extraMemberVisitor != null)
        {
            extraMemberVisitor.visitProgramMethod(programClass, programMethod);
        }
    }
}
 
Example #20
Source File: MethodDescriptorShrinker.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a shrunk descriptor or signature of the given method.
 */
private String shrinkDescriptor(Method method, String descriptor)
{
    // All parameters of non-static methods are shifted by one in the local
    // variable frame.
    int parameterIndex =
        (method.getAccessFlags() & ClassConstants.INTERNAL_ACC_STATIC) != 0 ?
            0 : 1;

    // Go over the parameters.
    InternalTypeEnumeration internalTypeEnumeration =
        new InternalTypeEnumeration(descriptor);

    StringBuffer newDescriptorBuffer = new StringBuffer();

    newDescriptorBuffer.append(internalTypeEnumeration.formalTypeParameters());
    newDescriptorBuffer.append(ClassConstants.INTERNAL_METHOD_ARGUMENTS_OPEN);

    while (internalTypeEnumeration.hasMoreTypes())
    {
        String type = internalTypeEnumeration.nextType();
        if (ParameterUsageMarker.isParameterUsed(method, parameterIndex))
        {
            newDescriptorBuffer.append(type);
        }
        else if (DEBUG)
        {
            System.out.println("  Deleting parameter #"+parameterIndex+" ["+type+"]");
        }

        parameterIndex += ClassUtil.isInternalCategory2Type(type) ? 2 : 1;
    }

    newDescriptorBuffer.append(ClassConstants.INTERNAL_METHOD_ARGUMENTS_CLOSE);
    newDescriptorBuffer.append(internalTypeEnumeration.returnType());

    return newDescriptorBuffer.toString();
}
 
Example #21
Source File: ClassUtil.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Checks whether the given class version number is supported.
 * @param classVersion the combined class version number.
 * @throws UnsupportedOperationException when the version is not supported.
 */
public static void checkVersionNumbers(int classVersion) throws UnsupportedOperationException
{
    if (classVersion < ClassConstants.INTERNAL_CLASS_VERSION_1_0 ||
        classVersion > ClassConstants.INTERNAL_CLASS_VERSION_1_6)
    {
        throw new UnsupportedOperationException("Unsupported version number ["+
                                                internalMajorClassVersion(classVersion)+"."+
                                                internalMinorClassVersion(classVersion)+"] for class format");
    }
}
 
Example #22
Source File: InternalTypeEnumeration.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new InternalTypeEnumeration for the given method descriptor.
 */
public InternalTypeEnumeration(String descriptor)
{
    this.descriptor = descriptor;
    this.firstIndex = descriptor.indexOf(ClassConstants.INTERNAL_METHOD_ARGUMENTS_OPEN);
    this.lastIndex  = descriptor.indexOf(ClassConstants.INTERNAL_METHOD_ARGUMENTS_CLOSE);
    this.index      = firstIndex + 1;

    if (lastIndex < 0)
    {
        lastIndex = descriptor.length();
    }
}
 
Example #23
Source File: AccessUtil.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Replaces the access part of the given access flags.
 * @param accessFlags the internal access flags.
 * @param accessFlags the new internal access flags.
 */
public static int replaceAccessFlags(int accessFlags, int newAccessFlags)
{
    // A private class member should not be explicitly final.
    if (newAccessFlags == ClassConstants.INTERNAL_ACC_PRIVATE)
    {
        accessFlags &= ~ClassConstants.INTERNAL_ACC_FINAL;
    }

    return (accessFlags    & ~ACCESS_MASK) |
           (newAccessFlags &  ACCESS_MASK);
}
 
Example #24
Source File: ClassSpecificationDialog.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the ClassSpecification currently represented in this dialog.
 */
public ClassSpecification getClassSpecification()
{
    String comments              = commentsTextArea.getText();
    String annotationType        = annotationTypeTextField.getText();
    String className             = classNameTextField.getText();
    String extendsAnnotationType = extendsAnnotationTypeTextField.getText();
    String extendsClassName      = extendsClassNameTextField.getText();

    ClassSpecification classSpecification =
        new ClassSpecification(comments.equals("")              ? null : comments,
                               0,
                               0,
                               annotationType.equals("")        ? null : ClassUtil.internalType(annotationType),
                               className.equals("") ||
                               className.equals("*")            ? null : ClassUtil.internalClassName(className),
                               extendsAnnotationType.equals("") ? null : ClassUtil.internalType(extendsAnnotationType),
                               extendsClassName.equals("")      ? null : ClassUtil.internalClassName(extendsClassName));

    // Also get the access radio button settings.
    getClassSpecificationRadioButtons(classSpecification, ClassConstants.ACC_PUBLIC,      publicRadioButtons);
    getClassSpecificationRadioButtons(classSpecification, ClassConstants.ACC_FINAL,       finalRadioButtons);
    getClassSpecificationRadioButtons(classSpecification, ClassConstants.ACC_ABSTRACT,    abstractRadioButtons);
    getClassSpecificationRadioButtons(classSpecification, ClassConstants.ACC_INTERFACE,   interfaceRadioButtons);
    getClassSpecificationRadioButtons(classSpecification, ClassConstants.ACC_ANNOTATTION, annotationRadioButtons);
    getClassSpecificationRadioButtons(classSpecification, ClassConstants.ACC_ENUM,        enumRadioButtons);
    getClassSpecificationRadioButtons(classSpecification, ClassConstants.ACC_SYNTHETIC,   syntheticRadioButtons);

    // Get the keep class member option lists.
    classSpecification.fieldSpecifications  = memberSpecificationsPanel.getMemberSpecifications(true);
    classSpecification.methodSpecifications = memberSpecificationsPanel.getMemberSpecifications(false);

    return classSpecification;
}
 
Example #25
Source File: NameMarker.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Ensures the name of the given method name will be kept.
 */
private void keepMethodName(Clazz clazz, Method method)
{
    String name = method.getName(clazz);

    if (!name.equals(ClassConstants.INTERNAL_METHOD_NAME_CLINIT) &&
        !name.equals(ClassConstants.INTERNAL_METHOD_NAME_INIT))
    {
        MemberObfuscator.setFixedNewMemberName(method,
                                               method.getName(clazz));
    }
}
 
Example #26
Source File: FieldOptimizationInfo.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
private Value initialValue(String type)
{
    switch (type.charAt(0))
    {
        case ClassConstants.INTERNAL_TYPE_BOOLEAN:
        case ClassConstants.INTERNAL_TYPE_BYTE:
        case ClassConstants.INTERNAL_TYPE_CHAR:
        case ClassConstants.INTERNAL_TYPE_SHORT:
        case ClassConstants.INTERNAL_TYPE_INT:
            return VALUE_FACTORY.createIntegerValue(0);

        case ClassConstants.INTERNAL_TYPE_LONG:
            return VALUE_FACTORY.createLongValue(0L);

        case ClassConstants.INTERNAL_TYPE_FLOAT:
            return VALUE_FACTORY.createFloatValue(0.0f);

        case ClassConstants.INTERNAL_TYPE_DOUBLE:
            return VALUE_FACTORY.createDoubleValue(0.0);

        case ClassConstants.INTERNAL_TYPE_CLASS_START:
        case ClassConstants.INTERNAL_TYPE_ARRAY:
            return VALUE_FACTORY.createReferenceValueNull();

        default:
            throw new IllegalArgumentException("Invalid type ["+type+"]");
    }
}
 
Example #27
Source File: AccessUtil.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the corresponding access level of the given access flags.
 * @param accessFlags the internal access flags.
 * @return the corresponding access level: <code>PRIVATE</code>,
 *         <code>PACKAGE_VISIBLE</code>, <code>PROTECTED</code>, or
 *         <code>PUBLIC</code>.
 */
public static int accessLevel(int accessFlags)
{
    switch (accessFlags & ACCESS_MASK)
    {
        case ClassConstants.ACC_PRIVATE:   return PRIVATE;
        default:                           return PACKAGE_VISIBLE;
        case ClassConstants.ACC_PROTECTED: return PROTECTED;
        case ClassConstants.ACC_PUBLIC:    return PUBLIC;
    }
}
 
Example #28
Source File: MethodImplementationTraveler.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
private boolean isSpecial(Clazz clazz, Method method)
{
    return (method.getAccessFlags() &
            (ClassConstants.INTERNAL_ACC_PRIVATE |
             ClassConstants.INTERNAL_ACC_STATIC)) != 0 ||
           method.getName(clazz).equals(ClassConstants.INTERNAL_METHOD_NAME_INIT);
}
 
Example #29
Source File: ClassFilter.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ClassFilter that delegates to either of the two given
 * readers.
 */
public ClassFilter(DataEntryReader classReader,
                   DataEntryReader dataEntryReader)
{
    super(new DataEntryNameFilter(
          new ExtensionMatcher(ClassConstants.CLASS_FILE_EXTENSION)),
          classReader,
          dataEntryReader);
}
 
Example #30
Source File: AccessMethodMarker.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void visitAnyClass(Clazz clazz)
{
    int accessFlags = clazz.getAccessFlags();

    if ((accessFlags & ClassConstants.INTERNAL_ACC_PUBLIC) == 0)
    {
        setAccessesPackageCode(invokingMethod);
    }
}