/** * Get all non-constructor, non-class-initializer methods declared by a class */ private static Collection<IMethod> getDeclaredNormalMethods(IClass cls) { Collection<IMethod> result = HashSetFactory.make(); for (IMethod m : cls.getDeclaredMethods()) { if (!m.isInit() && !m.isClinit()) { result.add(m); } } return result; }
/** * Get all non-constructor, non-class-initializer methods declared by a class */ private static Collection<IMethod> getDeclaredNormalMethods(IClass cls) { Collection<IMethod> result = HashSetFactory.make(); for (IMethod m : cls.getDeclaredMethods()) { if (!m.isInit() && !m.isClinit()) { result.add(m); } } return result; }
/** * Get all non-constructor, non-class-initializer methods declared by a class and all its superclasses */ private static Collection<IMethod> getAllNormalPublicMethods(IClass cls) { Collection<IMethod> result = HashSetFactory.make(); Collection<? extends IMethod> allMethods = null; allMethods = cls.getAllMethods(); for (IMethod m : allMethods) { if (!m.isInit() && !m.isClinit() && m.isPublic()) { result.add(m); } } return result; }
/** * Get all non-constructor, non-class-initializer methods declared by a class and all its superclasses */ private static Collection<IMethod> getAllNormalPublicMethods(IClass cls) { Collection<IMethod> result = HashSetFactory.make(); Collection<? extends IMethod> allMethods = null; allMethods = cls.getAllMethods(); for (IMethod m : allMethods) { if (!m.isInit() && !m.isClinit() && m.isPublic()) { result.add(m); } } return result; }
public static boolean isAppClass(IClass clazz) { // Normalization: // filter empty dummy classes // possibly related too: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4295934 boolean isEmptyInnerClass = WalaUtils.isInnerClass(clazz) && isAnonymousInnerClass(clazz) && (clazz.getDeclaredMethods().isEmpty() || (clazz.getDeclaredMethods().size() == 1 && clazz.getDeclaredMethods().iterator().next().isClinit()) && clazz.getDeclaredInstanceFields().isEmpty() && clazz.getDeclaredStaticFields().isEmpty() && clazz.getDirectInterfaces().isEmpty()); return clazz.getClassHierarchy().getScope().isApplicationLoader(clazz.getClassLoader()) && !isAndroidResourceClass(clazz) && !isEmptyInnerClass && !clazz.isSynthetic(); }
/** * Get all non-constructor, non-class-initializer methods declared by a class * if their name is equal to the specified name. * @param cls the class * @param name the name */ private static Collection<IMethod> getDeclaredNormalMethods(IClass cls,Atom name) { Collection<IMethod> result = HashSetFactory.make(); for (IMethod m : cls.getDeclaredMethods()) { if (!m.isInit() && !m.isClinit() && m.getSelector().getName().equals(name)) { result.add(m); } } return result; }
/** * Get all non-constructor, non-class-initializer methods declared by a class * if their name is equal to the specified name. * @param cls the class * @param name the name */ private static Collection<IMethod> getDeclaredNormalMethods(IClass cls,Atom name) { Collection<IMethod> result = HashSetFactory.make(); for (IMethod m : cls.getDeclaredMethods()) { if (!m.isInit() && !m.isClinit() && m.getSelector().getName().equals(name)) { result.add(m); } } return result; }
if ((method.isInit() || method.isClinit()) && (! this.flags.contains(LocatorFlags.WITH_CTOR))) { logger.debug("Skipping constructor of {}", method); continue;
String qname = ""; com.sap.psr.vulas.shared.json.model.ConstructId cid = null; if (_method.isClinit()) { qname = _method.getSignature().substring(0, _method.getSignature().indexOf("<") - 1); cid = JavaId.toSharedType(JavaId.parseClassQName(qname).getClassInit());
if ((method.isInit() || method.isClinit()) && (! this.flags.contains(LocatorFlags.WITH_CTOR))) { logger.debug("Skipping constructor of {}", method); continue;
for (Iterator<IMethod> m_iter = klass.getDeclaredMethods().iterator(); m_iter.hasNext(); ) { method = (IMethod) m_iter.next(); if (!method.isClinit()) { method_qname = getCid(method).getQname(); if (!method.isAbstract() && (_constructs_qname.contains(method_qname))) {
/** * Get all non-constructor, non-class-initializer methods declared by a class * and all its superclasses if their name is equal to the specified name. * @param cls the class * @param name the name */ private static Collection<IMethod> getAllNormalPublicMethods(IClass cls,Atom name) { Collection<IMethod> result = HashSetFactory.make(); Collection<? extends IMethod> allMethods = null; allMethods = cls.getAllMethods(); for (IMethod m : allMethods) { if (!m.isInit() && !m.isClinit() && m.isPublic() && m.getSelector().getName().equals(name)) { result.add(m); } } return result; }
/** * Get all non-constructor, non-class-initializer methods declared by a class * and all its superclasses if their name is equal to the specified name. * @param cls the class * @param name the name */ private static Collection<IMethod> getAllNormalPublicMethods(IClass cls,Atom name) { Collection<IMethod> result = HashSetFactory.make(); Collection<? extends IMethod> allMethods = null; allMethods = cls.getAllMethods(); for (IMethod m : allMethods) { if (!m.isInit() && !m.isClinit() && m.isPublic() && m.getSelector().getName().equals(name)) { result.add(m); } } return result; }
final Collection<? extends IMethod> methods = appClass.getDeclaredMethods(); for (final IMethod method : methods) { if ((method.isInit() || method.isClinit()) && (! this.flags.contains(LocatorFlags.WITH_CTOR))) { logger.debug("Skipping constructor of {}", method); continue;
final Collection<? extends IMethod> methods = appClass.getDeclaredMethods(); for (final IMethod method : methods) { if ((method.isInit() || method.isClinit()) && (! this.flags.contains(LocatorFlags.WITH_CTOR))) { logger.debug("Skipping constructor of {}", method); continue;
/** * Get the "setUp" and "tearDown" methods in the given class */ public static Set<IMethod> getSetUpTearDownMethods(IClass testClass) { final Atom junitPackage = Atom.findOrCreateAsciiAtom("junit/framework"); final Atom junitClass = Atom.findOrCreateAsciiAtom("TestCase"); final Atom junitSuite = Atom.findOrCreateAsciiAtom("TestSuite"); final TypeName junitTestCaseType = TypeName.findOrCreateClass(junitPackage, junitClass); final TypeName junitTestSuiteType = TypeName.findOrCreateClass(junitPackage, junitSuite); final Atom setUpMethodAtom = Atom.findOrCreateAsciiAtom("setUp"); final Atom tearDownMethodAtom = Atom.findOrCreateAsciiAtom("tearDown"); Set<IMethod> result = HashSetFactory.make(); IClass currClass = testClass; while (currClass != null && !currClass.getName().equals(junitTestCaseType) && !currClass.getName().equals(junitTestSuiteType)) { for (IMethod method : currClass.getDeclaredMethods()) { final Atom methodAtom = method.getName(); if (methodAtom.equals(setUpMethodAtom) || methodAtom.equals(tearDownMethodAtom) || method.isClinit() || method.isInit()) { result.add(method); } } currClass = currClass.getSuperclass(); } return result; } }
/** * Get the "setUp" and "tearDown" methods in the given class */ public static Set<IMethod> getSetUpTearDownMethods(IClass testClass) { final Atom junitPackage = Atom.findOrCreateAsciiAtom("junit/framework"); final Atom junitClass = Atom.findOrCreateAsciiAtom("TestCase"); final Atom junitSuite = Atom.findOrCreateAsciiAtom("TestSuite"); final TypeName junitTestCaseType = TypeName.findOrCreateClass(junitPackage, junitClass); final TypeName junitTestSuiteType = TypeName.findOrCreateClass(junitPackage, junitSuite); final Atom setUpMethodAtom = Atom.findOrCreateAsciiAtom("setUp"); final Atom tearDownMethodAtom = Atom.findOrCreateAsciiAtom("tearDown"); Set<IMethod> result = HashSetFactory.make(); IClass currClass = testClass; while (currClass != null && !currClass.getName().equals(junitTestCaseType) && !currClass.getName().equals(junitTestSuiteType)) { for (IMethod method : currClass.getDeclaredMethods()) { final Atom methodAtom = method.getName(); if (methodAtom.equals(setUpMethodAtom) || methodAtom.equals(tearDownMethodAtom) || method.isClinit() || method.isInit()) { result.add(method); } } currClass = currClass.getSuperclass(); } return result; } }