diff --git a/sootup.callgraph/src/main/java/sootup/callgraph/AbstractCallGraphAlgorithm.java b/sootup.callgraph/src/main/java/sootup/callgraph/AbstractCallGraphAlgorithm.java index 15aec6c97e8..2fddb264117 100644 --- a/sootup.callgraph/src/main/java/sootup/callgraph/AbstractCallGraphAlgorithm.java +++ b/sootup.callgraph/src/main/java/sootup/callgraph/AbstractCallGraphAlgorithm.java @@ -282,46 +282,6 @@ protected Stream resolveAllStaticInitializerCallsFromSourceMeth .map(SootClassMember::getSignature); } - /** - * searches the method object in the given hierarchy - * - * @param view it contains all classes - * @param sig the signature of the searched method - * @param the generic type of the searched method object - * @return the found method object, or null if the method was not found. - */ - protected final T findMethodInHierarchy( - @Nonnull View> view, @Nonnull MethodSignature sig) { - Optional> optSc = view.getClass(sig.getDeclClassType()); - - if (optSc.isPresent()) { - SootClass sc = optSc.get(); - - List superClasses = view.getTypeHierarchy().superClassesOf(sc.getType()); - Set interfaces = view.getTypeHierarchy().implementedInterfacesOf(sc.getType()); - superClasses.addAll(interfaces); - - for (ClassType superClassType : superClasses) { - Optional> superClassOpt = view.getClass(superClassType); - if (superClassOpt.isPresent()) { - SootClass superClass = superClassOpt.get(); - Optional methodOpt = superClass.getMethod(sig.getSubSignature()); - if (methodOpt.isPresent()) { - return (T) methodOpt.get(); - } - } - } - logger.warn( - "Could not find \"" - + sig.getSubSignature() - + "\" in " - + sig.getDeclClassType().getClassName() - + " and in its superclasses"); - } else { - logger.trace("Could not find \"" + sig.getDeclClassType() + "\" in view"); - } - return null; - } /** * This method enables optional pre-processing of a method in the call graph algorithm @@ -444,7 +404,7 @@ public MethodSignature findMainMethod() { "There are more than 1 main method present.\n Below main methods are found: \n" + mainMethods + "\n initialize() method can be used if only one main method exists. \n You can specify these main methods as entry points by passing them as parameter to initialize method."); - } else if (mainMethods.size() == 0) { + } else if (mainMethods.isEmpty()) { throw new RuntimeException( "No main method is present in the input programs. initialize() method can be used if only one main method exists in the input program and that should be used as entry point for call graph. \n Please specify entry point as a parameter to initialize method."); }