Java Code Examples for org.benf.cfr.reader.state.DCCommonState

The following examples show how to use org.benf.cfr.reader.state.DCCommonState. These examples are extracted from open source projects. 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 Project: cfr   Source File: ClassFile.java    License: MIT License 6 votes vote down vote up
private void checkInnerClassAssumption(AttributeInnerClasses attributeInnerClasses, JavaRefTypeInstance typeInstance, DCCommonState state) {
    if (attributeInnerClasses != null) {
        for (InnerClassAttributeInfo innerClassAttributeInfo : attributeInnerClasses.getInnerClassAttributeInfoList()) {
            if (innerClassAttributeInfo.getInnerClassInfo().equals(typeInstance)) {
                return;
            }
        }
    }
    // If we're handling obfuscation where we've been given inner class info, then that might be more trustworthy.
    if (state.getObfuscationMapping().providesInnerClassInfo()) {
        return;
    }
    /*
     * No - we are NOT an inner class, regardless of what the guessed information says.
     */
    typeInstance.markNotInner();
}
 
Example 2
Source Project: cfr   Source File: EnumClassRewriter.java    License: MIT License 6 votes vote down vote up
public static void rewriteEnumClass(ClassFile classFile, DCCommonState state) {
    Options options = state.getOptions();
    ClassFileVersion classFileVersion = classFile.getClassFileVersion();

    if (!options.getOption(OptionsImpl.ENUM_SUGAR, classFileVersion)) return;

    JavaTypeInstance classType = classFile.getClassType();
    if (!classFile.getBindingSupers().containsBase(TypeConstants.ENUM)) {
        return;
    }

    EnumClassRewriter c = new EnumClassRewriter(classFile, classType, state);
    if (!c.rewrite()) {
        c.removeAllRemainingSupers();
    }
}
 
Example 3
Source Project: cfr   Source File: JavaRefTypeInstance.java    License: MIT License 6 votes vote down vote up
private JavaRefTypeInstance(final String className, DCCommonState dcCommonState) {
    this.innerClassInfo = InnerClassInfo.NOT;
    this.dcCommonState = dcCommonState;
    /*
     * This /MAY/ be a red herring.  It's possible for a class name to contain a dollar
     * without it being an inner class.
     */
    if (className.contains(MiscConstants.INNER_CLASS_SEP_STR)) {
        int idx = className.lastIndexOf(MiscConstants.INNER_CLASS_SEP_CHAR);

        if (idx == className.length()-1) {
            /*
             * if this is the case, it's likely to be a non-inner scala class.....
             * Would be nice to have a better way to verify though.
             */
            MiscUtils.handyBreakPoint();
        } else {
            String outer = className.substring(0, idx);
            JavaRefTypeInstance outerClassTmp = dcCommonState.getClassCache().getRefClassFor(outer);
            innerClassInfo = new RefTypeInnerClassInfo(outerClassTmp);
        }
    }
    this.className = className;
    this.shortName = getShortName(className, innerClassInfo);
}
 
Example 4
Source Project: cfr   Source File: ConstructorInvokationAnonymousInner.java    License: MIT License 6 votes vote down vote up
public ConstructorInvokationAnonymousInner(MemberFunctionInvokation constructorInvokation,
                                           InferredJavaType inferredJavaType, List<Expression> args,
                                           DCCommonState dcCommonState, JavaTypeInstance anonymousTypeInstance) {
    super((inferredJavaType), constructorInvokation.getFunction(), args);
    this.constructorInvokation = constructorInvokation;
    this.anonymousTypeInstance = anonymousTypeInstance;
    /*
     * As much as I'd rather not tie this to its use, we have to make sure that the target variables etc
     * are available at the time of usage, so we can hide anonymous inner member clones.
     */
    ClassFile classFile = null;
    try {
        classFile = dcCommonState.getClassFile(
                constructorInvokation.getMethodPrototype().getReturnType().getDeGenerifiedType()
        );
    } catch (CannotLoadClassException e) {
        // Can't find class - live with it.
    }
    this.classFile = classFile;
}
 
Example 5
@Override
public String decompileClassNode(FileContainer container, ClassNode cn) {
    try {
        byte[] bytes = JDA.getClassBytes(container, cn);
        GetOptParser getOptParser = new GetOptParser();
        Pair processedArgs = getOptParser.parse(generateMainMethod(), OptionsImpl.getFactory());
        List files = (List)processedArgs.getFirst();
        Options options = (Options)processedArgs.getSecond();
        ClassFileSourceImpl classFileSource = new ClassFileSourceImpl(options);
        DCCommonState dcCommonState = new DCCommonState(options, classFileSource);
        return doClass(dcCommonState, bytes);
    } catch (Exception e) {
        return parseException(e);
    }
}
 
Example 6
Source Project: cfr   Source File: MappingFactory.java    License: MIT License 5 votes vote down vote up
public static ObfuscationMapping get(Options options, DCCommonState state) {
    String path = options.getOption(OptionsImpl.OBFUSCATION_PATH);
    if (path == null) {
        return NullMapping.INSTANCE;
    }
    return new MappingFactory(options, state.getClassCache()).createFromPath(path);
}
 
Example 7
Source Project: cfr   Source File: PluginRunner.java    License: MIT License 5 votes vote down vote up
private static DCCommonState initDCState(Map<String, String> optionsMap, ClassFileSource classFileSource) {
    OptionsImpl options = new OptionsImpl(optionsMap);
    ClassFileSource2 source = classFileSource == null ?
            new ClassFileSourceImpl(options) :
            new ClassFileSourceWrapper(classFileSource);
    return new DCCommonState(options, source);
}
 
Example 8
Source Project: cfr   Source File: CfrDriverImpl.java    License: MIT License 5 votes vote down vote up
@Override
public void analyse(List<String> toAnalyse) {
    /*
     * There's an interesting question here - do we want to skip inner classes, if we've been given a wildcard?
     * (or a wildcard expanded by the operating system).
     *
     * Assume yes.
     */
    boolean skipInnerClass = toAnalyse.size() > 1 && options.getOption(OptionsImpl.SKIP_BATCH_INNER_CLASSES);

    Collections.sort(toAnalyse);
    for (String path : toAnalyse) {
        // TODO : We shouldn't have to discard state here.  But we do, because
        // it causes test fails.  (used class name table retains useful symbols).
        classFileSource.informAnalysisRelativePathDetail(null, null);
        // Note - both of these need to be reset, as they have caches.
        DCCommonState dcCommonState = new DCCommonState(options, classFileSource);
        DumperFactory dumperFactory = outputSinkFactory != null ?
                new SinkDumperFactory(outputSinkFactory, options) :
                new InternalDumperFactoryImpl(options);

        AnalysisType type = options.getOption(OptionsImpl.ANALYSE_AS);
        if (type == null || type == AnalysisType.DETECT) {
            type = dcCommonState.detectClsJar(path);
        }

        if (type == AnalysisType.JAR || type == AnalysisType.WAR) {
            Driver.doJar(dcCommonState, path, type, dumperFactory);
        } else if (type == AnalysisType.CLASS) {
            Driver.doClass(dcCommonState, path, skipInnerClass, dumperFactory);
        }
    }
}
 
Example 9
Source Project: cfr   Source File: ClassFile.java    License: MIT License 5 votes vote down vote up
private boolean testIsInnerClass(DCCommonState dcCommonState) {
    List<InnerClassAttributeInfo> innerClassAttributeInfoList = getInnerClassAttributeInfos(dcCommonState);
    if (innerClassAttributeInfoList == null) return false;
    final JavaTypeInstance thisType = thisClass.getTypeInstance();

    for (InnerClassAttributeInfo innerClassAttributeInfo : innerClassAttributeInfoList) {
        JavaTypeInstance innerType = innerClassAttributeInfo.getInnerClassInfo();
        if (innerType == thisType) return true;
    }
    return false;
}
 
Example 10
Source Project: cfr   Source File: ClassFile.java    License: MIT License 5 votes vote down vote up
private List<InnerClassAttributeInfo> getInnerClassAttributeInfos(DCCommonState state) {
    AttributeInnerClasses attributeInnerClasses = attributes.getByName(AttributeInnerClasses.ATTRIBUTE_NAME);
    List<InnerClassAttributeInfo> innerClassAttributeInfoList = attributeInnerClasses == null ? null : attributeInnerClasses.getInnerClassAttributeInfoList();
    if (innerClassAttributeInfoList != null) {
        return innerClassAttributeInfoList;
    }
    // If we don't have any inner class attributes, we might be dealing with obfuscated code that has stripped them.
    return state.getObfuscationMapping().getInnerClassInfo(getClassType());
}
 
Example 11
Source Project: cfr   Source File: ClassFile.java    License: MIT License 5 votes vote down vote up
private void analyseInnerClassesPass1(DCCommonState state) {
    if (innerClassesByTypeInfo == null) return;
    for (Pair<InnerClassAttributeInfo, ClassFile> innerClassInfoClassFilePair : innerClassesByTypeInfo.values()) {
        ClassFile classFile = innerClassInfoClassFilePair.getSecond();
        classFile.analyseMid(state);
    }
}
 
Example 12
Source Project: cfr   Source File: ExceptionCheckImpl.java    License: MIT License 5 votes vote down vote up
public ExceptionCheckImpl(DCCommonState dcCommonState, Set<JavaRefTypeInstance> caught) {
    this.dcCommonState = dcCommonState;
    JavaRefTypeInstance runtimeExceptionType = dcCommonState.getClassTypeOrNull(TypeConstants.runtimeExceptionPath);
    if (runtimeExceptionType == null) {
        mightUseUnchecked = true;
        missingInfo = true;
        return;
    }

    boolean lmightUseUnchecked = false;
    boolean lmissinginfo = false;
    for (JavaRefTypeInstance ref : caught) {
        BindingSuperContainer superContainer = ref.getBindingSupers();
        if (superContainer == null) {
            lmightUseUnchecked = true;
            lmissinginfo = true;
            continue;
        }
        Map<JavaRefTypeInstance, ?> supers = superContainer.getBoundSuperClasses();
        if (supers == null) {
            lmightUseUnchecked = true;
            lmissinginfo = true;
            continue;
        }
        if (supers.containsKey(runtimeExceptionType)) {
            lmightUseUnchecked = true;
            caughtUnchecked.add(ref);
        } else {
            caughtChecked.add(ref);
        }
    }
    mightUseUnchecked = lmightUseUnchecked;
    missingInfo = lmissinginfo;
}
 
Example 13
Source Project: cfr   Source File: ConstantPool.java    License: MIT License 5 votes vote down vote up
public ConstantPool(ClassFile classFile, DCCommonState dcCommonState, ByteData raw, int count) {
    this.classFile = classFile;
    this.options = dcCommonState.getOptions();
    count--;

    RawTmp tmp = processRaw(raw, count);
    this.entries = tmp.entries;
    this.length = tmp.rawLength;
    this.dynamicConstants = tmp.dynamicConstants;
    this.dcCommonState = dcCommonState;
    this.classCache = dcCommonState.getClassCache();
    this.isLoaded = true;
}
 
Example 14
Source Project: cfr   Source File: CodeAnalyser.java    License: MIT License 5 votes vote down vote up
private AnalysisResult getAnalysisOrWrapFail(int passIdx, List<Op01WithProcessedDataAndByteJumps> instrs, DCCommonState commonState, Options options, List<DecompilerComment> extraComments, BytecodeMeta bytecodeMeta) {
    try {
        AnalysisResult res = getAnalysisInner(instrs, commonState, options, bytecodeMeta, passIdx);
        if (extraComments != null) res.getComments().addComments(extraComments);
        return res;
    } catch (RuntimeException e) {
        return new AnalysisResultFromException(e);
    }
}
 
Example 15
Source Project: cfr   Source File: CodeAnalyserWholeClass.java    License: MIT License 5 votes vote down vote up
private static void inlineAccessors(DCCommonState state, ClassFile classFile) {
    for (Method method : classFile.getMethods()) {
        if (method.hasCodeAttribute()) {
            Op04StructuredStatement code = method.getAnalysis();
            Op04StructuredStatement.inlineSyntheticAccessors(state, method, code);
        }
    }
}
 
Example 16
Source Project: cfr   Source File: CodeAnalyserWholeClass.java    License: MIT License 5 votes vote down vote up
public static void wholeClassAnalysisPass3(ClassFile classFile, DCCommonState state, TypeUsageCollectingDumper typeUsage) {
    Options options = state.getOptions();
    if (options.getOption(OptionsImpl.REMOVE_BOILERPLATE)) {
        removeRedundantSupers(classFile);
    }

    if (options.getOption(OptionsImpl.REMOVE_DEAD_METHODS)) {
        removeDeadMethods(classFile);
    }

    rewriteUnreachableStatics(classFile, typeUsage);

    detectFakeMethods(classFile, typeUsage);
}
 
Example 17
Source Project: cfr   Source File: RecoveryOptions.java    License: MIT License 5 votes vote down vote up
public Applied apply(DCCommonState commonState, Options originalOptions, BytecodeMeta bytecodeMeta) {
    MutableOptions mutableOptions = new MutableOptions(originalOptions);
    List<DecompilerComment> appliedComments = ListFactory.newList();
    boolean hadEffect = false;
    for (RecoveryOption<?> option : recoveryOptions) {
        if (option.apply(mutableOptions, appliedComments, bytecodeMeta)) hadEffect = true;
    }
    return new Applied(mutableOptions, appliedComments, hadEffect);
}
 
Example 18
Source Project: cfr   Source File: RecordRewriter.java    License: MIT License 5 votes vote down vote up
public static void rewrite(ClassFile classFile, DCCommonState state) {
    if (!TypeConstants.RECORD.equals(classFile.getBaseClassType())) return;

    /* For a record, we can eliminate
     * * the constructor (if it only assigns fields, and assigns ALL fields)
     *    (but we must leave validation code in place).
     * * equals, hashcode and toString, if they exactly match the expected bootstrap pattern.
     * * getters (if they are exactly getters).
     */
    rewriteIfRecord(classFile, state);
}
 
Example 19
Source Project: cfr   Source File: EnumClassRewriter.java    License: MIT License 5 votes vote down vote up
private EnumClassRewriter(ClassFile classFile, JavaTypeInstance classType, DCCommonState state) {
    this.classFile = classFile;
    this.classType = classType;
    this.state = state;
    this.options = state.getOptions();
    this.clazzIJT = new InferredJavaType(classType, InferredJavaType.Source.UNKNOWN, true);
}
 
Example 20
Source Project: cfr   Source File: CondenseConstruction.java    License: MIT License 5 votes vote down vote up
static void condenseConstruction(DCCommonState state, Method method, List<Op03SimpleStatement> statements, AnonymousClassUsage anonymousClassUsage) {
    CreationCollector creationCollector = new CreationCollector(anonymousClassUsage);
    for (Op03SimpleStatement statement : statements) {
        statement.findCreation(creationCollector);
    }
    creationCollector.condenseConstructions(method, state);
}
 
Example 21
Source Project: cfr   Source File: Op02WithProcessedDataAndRefs.java    License: MIT License 5 votes vote down vote up
private Statement buildInvokeDynamic(Method method, DCCommonState dcCommonState) {
    ConstantPoolEntryInvokeDynamic invokeDynamic = (ConstantPoolEntryInvokeDynamic) cpEntries[0];
    ConstantPoolEntryNameAndType nameAndType = invokeDynamic.getNameAndTypeEntry();
    int idx = invokeDynamic.getBootstrapMethodAttrIndex();
    ConstantPoolEntryUTF8 descriptor = nameAndType.getDescriptor();
    ConstantPoolEntryUTF8 name = nameAndType.getName();
    MethodPrototype dynamicPrototype = ConstantPoolUtils.parseJavaMethodPrototype(dcCommonState, null, null, "", false, Method.MethodConstructor.NOT, descriptor, cp, false, false, new VariableNamerDefault());
    return buildInvokeDynamic(method.getClassFile(), dcCommonState, name.getValue(), dynamicPrototype, idx, false);
}
 
Example 22
Source Project: cfr   Source File: Op02WithProcessedDataAndRefs.java    License: MIT License 5 votes vote down vote up
public static List<Op03SimpleStatement> convertToOp03List(List<Op02WithProcessedDataAndRefs> op2list,
                                                          final Method method,
                                                          final VariableFactory variableFactory,
                                                          final BlockIdentifierFactory blockIdentifierFactory,
                                                          final DCCommonState dcCommonState,
                                                          final TypeHintRecovery typeHintRecovery) {


    final List<Op03SimpleStatement> op03SimpleParseNodesTmp = ListFactory.newList();
    // Convert the op2s into a simple set of statements.
    // Do these need to be processed in a sensible order?  Could just iterate?

    final GraphConversionHelper<Op02WithProcessedDataAndRefs, Op03SimpleStatement> conversionHelper = new GraphConversionHelper<Op02WithProcessedDataAndRefs, Op03SimpleStatement>();
    // By only processing reachable bytecode, we ignore deliberate corruption.   However, we could
    // Nop out unreachable code, so as to not have this ugliness.
    // We start at 0 as that's not controversial ;)

    GraphVisitor<Op02WithProcessedDataAndRefs> o2Converter = new GraphVisitorFIFO<Op02WithProcessedDataAndRefs>(op2list.get(0),
            new BinaryProcedure<Op02WithProcessedDataAndRefs, GraphVisitor<Op02WithProcessedDataAndRefs>>() {
                @Override
                public void call(Op02WithProcessedDataAndRefs arg1, GraphVisitor<Op02WithProcessedDataAndRefs> arg2) {
                    Op03SimpleStatement res = new Op03SimpleStatement(arg1, arg1.createStatement(method, variableFactory, blockIdentifierFactory, dcCommonState, typeHintRecovery));
                    conversionHelper.registerOriginalAndNew(arg1, res);
                    op03SimpleParseNodesTmp.add(res);
                    for (Op02WithProcessedDataAndRefs target : arg1.getTargets()) {
                        arg2.enqueue(target);
                    }
                }
            }
    );
    o2Converter.process();
    conversionHelper.patchUpRelations();

    return op03SimpleParseNodesTmp;
}
 
Example 23
Source Project: cfr   Source File: JavaRefTypeInstance.java    License: MIT License 5 votes vote down vote up
private JavaRefTypeInstance(final String className, final JavaRefTypeInstance knownOuter, DCCommonState dcCommonState) {
    this.className = className;
    this.dcCommonState = dcCommonState;
    String innerSub = className.substring(knownOuter.className.length());
    /*
     * Now, we have to make an assumption at this point that if the first character of innerSub is a $ (Sep)
     * that we should replace it.  This isn't mandated by anything, so we could create illegals again here. :P
     *
     */
    if (innerSub.charAt(0) == MiscConstants.INNER_CLASS_SEP_CHAR) {
        innerSub = innerSub.substring(1);
    }
    this.innerClassInfo = new RefTypeInnerClassInfo(knownOuter);
    this.shortName = innerSub;
}
 
Example 24
Source Project: cfr   Source File: JavaRefTypeInstance.java    License: MIT License 5 votes vote down vote up
public static Pair<JavaRefTypeInstance, JavaRefTypeInstance> createKnownInnerOuter(String inner, String outer, JavaRefTypeInstance outerType, DCCommonState dcCommonState) {
    if (outerType == null) outerType = new JavaRefTypeInstance(outer, dcCommonState);
    JavaRefTypeInstance innerType;
    if (!inner.startsWith(outer)) {
        // Handle the illegal inner/outer combo.
        innerType = new JavaRefTypeInstance(inner, dcCommonState);
    } else {
        innerType = new JavaRefTypeInstance(inner, outerType, dcCommonState);
    }
    return Pair.make(innerType, outerType);
}
 
Example 25
public static String doClass(DCCommonState dcCommonState, byte[] content1) {
    Options options = dcCommonState.getOptions();
    IllegalIdentifierDump illegalIdentifierDump = IllegalIdentifierDump.Factory.get(options);
    Dumper d = new ToStringDumper();

    try {
        StackTraceElement[] arr$;
        int len$;
        int i$;
        StackTraceElement x;
        try {
            SummaryDumper summaryDumper = new NopSummaryDumper();
            BaseByteData data = new BaseByteData(content1);
            ClassFile c = new ClassFile(data, "", dcCommonState);

            dcCommonState.configureWith(c);

            try {
                c = dcCommonState.getClassFile(c.getClassType());
            } catch (CannotLoadClassException var20) {
            }

            if (options.getOption(OptionsImpl.DECOMPILE_INNER_CLASSES)) {
                c.loadInnerClasses(dcCommonState);
            }

            if (options.getOption(OptionsImpl.RENAME_DUP_MEMBERS)) {
                MemberNameResolver.resolveNames(dcCommonState, ListFactory.newList(dcCommonState.getClassCache().getLoadedTypes()));
            }

            c.analyseTop(dcCommonState);
            TypeUsageCollector collectingDumper = new TypeUsageCollector(c);
            c.collectTypeUsages(collectingDumper);
            String methname = options.getOption(OptionsImpl.METHODNAME);
            if (methname == null) {
                c.dump(d);
            } else {
                try {
                    Iterator i$$ = c.getMethodByName(methname).iterator();

                    while(i$$.hasNext()) {
                        Method method = (Method)i$$.next();
                        method.dump(d, true);
                    }
                } catch (NoSuchMethodException var21) {
                    throw new IllegalArgumentException("No such method '" + methname + "'.");
                }
            }

            d.print("");
            return d.toString();
        } catch (ConfusedCFRException var22) {
            System.err.println(var22.toString());
            arr$ = var22.getStackTrace();
            len$ = arr$.length;

            for(i$ = 0; i$ < len$; ++i$) {
                x = arr$[i$];
                System.err.println(x);
            }
        } catch (CannotLoadClassException var23) {
            System.out.println("Can't load the class specified:");
            System.out.println(var23.toString());
        } catch (RuntimeException var24) {
            System.err.println(var24.toString());
            arr$ = var24.getStackTrace();
            len$ = arr$.length;

            for(i$ = 0; i$ < len$; ++i$) {
                x = arr$[i$];
                System.err.println(x);
            }
        }
    } finally {
        if (d != null) {
            d.close();
        }
    }
    return "";
}
 
Example 26
Source Project: cfr   Source File: MemberNameResolver.java    License: MIT License 4 votes vote down vote up
public static void resolveNames(DCCommonState dcCommonState, Collection<? extends JavaTypeInstance> types) {
    MemberNameResolver self = new MemberNameResolver(dcCommonState);
    self.initialise(types);
    self.resolve();
}
 
Example 27
Source Project: cfr   Source File: MemberNameResolver.java    License: MIT License 4 votes vote down vote up
private MemberNameResolver(DCCommonState dcCommonState) {
    this.dcCommonState = dcCommonState;
}
 
Example 28
Source Project: cfr   Source File: Main.java    License: MIT License 4 votes vote down vote up
@SuppressWarnings({"WeakerAccess", "unused"}) // too many people use it - left for historical reasons.
public static void doClass(DCCommonState dcCommonState, String path, boolean skipInnerClass, DumperFactory dumperFactory) {
    Driver.doClass(dcCommonState, path, skipInnerClass, dumperFactory);
}
 
Example 29
Source Project: cfr   Source File: Main.java    License: MIT License 4 votes vote down vote up
@SuppressWarnings({"WeakerAccess", "unused"}) // too many people use it - left for historical reasons.
public static void doJar(DCCommonState dcCommonState, String path, DumperFactory dumperFactory) {
    Driver.doJar(dcCommonState, path, AnalysisType.JAR, dumperFactory);
}
 
Example 30
Source Project: cfr   Source File: ClassFile.java    License: MIT License 4 votes vote down vote up
private boolean isInferredAnonymousStatic(DCCommonState state, JavaTypeInstance thisType, JavaTypeInstance innerType) {
    if (!innerType.getInnerClassHereInfo().isAnonymousClass()) return false;

    boolean j8orLater = classFileVersion.equalOrLater(ClassFileVersion.JAVA_8);
    if (!j8orLater) return false;
    
    JavaRefTypeInstance containing = thisType.getInnerClassHereInfo().getOuterClass();

    // if the outer class doesn't exist, we just don't know
    ClassFile containingClassFile = containing.getClassFile();
    if (containingClassFile == null) {
        return false;
    }

    // if the containing class is a static class, so is this.
    if (containingClassFile.getAccessFlags().contains(AccessFlag.ACC_STATIC)) {
        return true;
    }

    AttributeEnclosingMethod encloser = attributes.getByName(AttributeEnclosingMethod.ATTRIBUTE_NAME);
    if (encloser == null) return false;
    int classIndex = encloser.getClassIndex();
    if (classIndex == 0) return false;
    ConstantPoolEntryClass encloserClass = constantPool.getClassEntry(classIndex);
    JavaTypeInstance encloserType = encloserClass.getTypeInstance();
    if (encloserType != containing) return false;
    int methodIndex = encloser.getMethodIndex();
    if (methodIndex == 0) return false;
    ConstantPoolEntryNameAndType nameAndType = constantPool.getNameAndTypeEntry(methodIndex);
    ConstantPoolEntryUTF8 descriptor = nameAndType.getDescriptor();
    String name = nameAndType.getName().getValue();
    VariableNamer fakeNamer = new VariableNamerDefault();

    MethodPrototype basePrototype = ConstantPoolUtils.parseJavaMethodPrototype(state,null, containing, name, /* interfaceMethod */ false, Method.MethodConstructor.NOT, descriptor, constantPool, false /* we can't tell */, false, fakeNamer);

    try {
        Method m = containingClassFile.getMethodByPrototype(basePrototype);
        if (m.getAccessFlags().contains(AccessFlagMethod.ACC_STATIC)) {
            return true;
        }
    } catch (NoSuchMethodException ignore) {
    }
    return false;
}