Usages of

com.ibm.wala.types.TypeName.findOrCreateClass(?, ?)
/** * Construct JUnit entrypoints for the specified test method in a scope. * * @throws IllegalArgumentException if cha is null */ public static Iterable<Entrypoint> makeOne(IClassHierarchy cha, String targetPackageName, String targetSimpleClassName, String targetMethodName) { if (cha == null) { throw new IllegalArgumentException("cha is null"); } // assume test methods don't have parameters final Atom targetPackageAtom = Atom.findOrCreateAsciiAtom(targetPackageName); final Atom targetSimpleClassAtom = Atom.findOrCreateAsciiAtom(targetSimpleClassName); final TypeName targetType = TypeName.findOrCreateClass(targetPackageAtom, targetSimpleClassAtom); final Atom targetMethodAtom = Atom.findOrCreateAsciiAtom(targetMethodName); if (DEBUG) { System.err.println(("finding entrypoint " + targetMethodAtom + " in " + targetType)); } final Set<Entrypoint> entryPts = HashSetFactory.make(); // TODO: improve this so that we don't need to check all the // classes and method to find a match try { for (IClass klass : cha) { TypeName klassType = klass.getName(); if (klassType.equals(targetType) && isJUnitTestCase(klass)) { if (DEBUG) { System.err.println("found test class"); } // add entry point corresponding to the target method for (Iterator methodsIt = klass.getDeclaredMethods().iterator(); methodsIt.hasNext();) { IMethod method = (IMethod) methodsIt.next(); Atom methodAtom = method.getName(); if (methodAtom.equals(targetMethodAtom)) { entryPts.add(new DefaultEntrypoint(method, cha)); System.out.println("- adding entry point of the call graph: " + methodAtom.toString()); } } // add entry points of setUp/tearDown methods Set<IMethod> setUpTearDowns = getSetUpTearDownMethods(klass); for (IMethod m : setUpTearDowns) { entryPts.add(new DefaultEntrypoint(m, cha)); } } } } catch (ClassHierarchyException e) { // TODO Auto-generated catch block e.printStackTrace(); } return new Iterable<Entrypoint>() { public Iterator<Entrypoint> iterator() { return entryPts.iterator(); } }; }
/** * Construct JUnit entrypoints for the specified test method in a scope. * * @throws IllegalArgumentException if cha is null */ public static Iterable<Entrypoint> makeOne(IClassHierarchy cha, String targetPackageName, String targetSimpleClassName, String targetMethodName) { if (cha == null) { throw new IllegalArgumentException("cha is null"); } // assume test methods don't have parameters final Atom targetPackageAtom = Atom.findOrCreateAsciiAtom(targetPackageName); final Atom targetSimpleClassAtom = Atom.findOrCreateAsciiAtom(targetSimpleClassName); final TypeName targetType = TypeName.findOrCreateClass(targetPackageAtom, targetSimpleClassAtom); final Atom targetMethodAtom = Atom.findOrCreateAsciiAtom(targetMethodName); if (DEBUG) { System.err.println(("finding entrypoint " + targetMethodAtom + " in " + targetType)); } final Set<Entrypoint> entryPts = HashSetFactory.make(); // TODO: improve this so that we don't need to check all the // classes and method to find a match try { for (IClass klass : cha) { TypeName klassType = klass.getName(); if (klassType.equals(targetType) && isJUnitTestCase(klass)) { if (DEBUG) { System.err.println("found test class"); } // add entry point corresponding to the target method for (Iterator methodsIt = klass.getDeclaredMethods().iterator(); methodsIt.hasNext();) { IMethod method = (IMethod) methodsIt.next(); Atom methodAtom = method.getName(); if (methodAtom.equals(targetMethodAtom)) { entryPts.add(new DefaultEntrypoint(method, cha)); System.out.println("- adding entry point of the call graph: " + methodAtom.toString()); } } // add entry points of setUp/tearDown methods Set<IMethod> setUpTearDowns = getSetUpTearDownMethods(klass); for (IMethod m : setUpTearDowns) { entryPts.add(new DefaultEntrypoint(m, cha)); } } } } catch (ClassHierarchyException e) { // TODO Auto-generated catch block e.printStackTrace(); } return new Iterable<Entrypoint>() { @Override public Iterator<Entrypoint> iterator() { return entryPts.iterator(); } }; }
/** * Construct JUnit entrypoints for the specified test method in a scope. * * @throws IllegalArgumentException if cha is null */ public static Iterable<Entrypoint> makeOne(IClassHierarchy cha, String targetPackageName, String targetSimpleClassName, String targetMethodName) { if (cha == null) { throw new IllegalArgumentException("cha is null"); } // assume test methods don't have parameters final Atom targetPackageAtom = Atom.findOrCreateAsciiAtom(targetPackageName); final Atom targetSimpleClassAtom = Atom.findOrCreateAsciiAtom(targetSimpleClassName); final TypeName targetType = TypeName.findOrCreateClass(targetPackageAtom, targetSimpleClassAtom); final Atom targetMethodAtom = Atom.findOrCreateAsciiAtom(targetMethodName); if (DEBUG) { System.err.println(("finding entrypoint " + targetMethodAtom + " in " + targetType)); } final Set<Entrypoint> entryPts = HashSetFactory.make(); for (IClass klass : cha) { TypeName klassType = klass.getName(); if (klassType.equals(targetType) && isJUnitTestCase(klass)) { if (DEBUG) { System.err.println("found test class"); } // add entry point corresponding to the target method for (Iterator methodsIt = klass.getDeclaredMethods().iterator(); methodsIt.hasNext();) { IMethod method = (IMethod) methodsIt.next(); Atom methodAtom = method.getName(); if (methodAtom.equals(targetMethodAtom)) { entryPts.add(new DefaultEntrypoint(method, cha)); System.out.println("- adding entry point of the call graph: " + methodAtom.toString()); } } // add entry points of setUp/tearDown methods Set<IMethod> setUpTearDowns = getSetUpTearDownMethods(klass); for (IMethod m : setUpTearDowns) { entryPts.add(new DefaultEntrypoint(m, cha)); } } } return new Iterable<Entrypoint>() { @Override public Iterator<Entrypoint> iterator() { return entryPts.iterator(); } }; }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes