@Test public void testClassesInSamePackage() { Truth.assertThat(ClassDumper.classesInSamePackage("foo.Abc", "bar.Abc")).isFalse(); Truth.assertThat(ClassDumper.classesInSamePackage("foo.bar.Abc", "foo.bar.Cde")).isTrue(); Truth.assertThat(ClassDumper.classesInSamePackage("foo.bar.Abc$XYZ", "foo.bar.Cde")).isTrue(); Truth.assertThat(ClassDumper.classesInSamePackage("Abc", "Cde")).isTrue(); Truth.assertThat(ClassDumper.classesInSamePackage("Abc", "xyz.Cde")).isFalse(); }
static boolean classesInSamePackage(String classNameA, String classNameB) { int lastDotIndexA = Math.max(classNameA.lastIndexOf('.'), 0); int lastDotIndexB = Math.max(classNameB.lastIndexOf('.'), 0); String packageNameA = classNameA.substring(0, lastDotIndexA); String packageNameB = classNameB.substring(0, lastDotIndexB); return packageNameA.equals(packageNameB); }
ClassDumper { static boolean classesInSamePackage(String classNameA, String classNameB) { int lastDotIndexA = Math.max(classNameA.lastIndexOf('.'), 0); int lastDotIndexB = Math.max(classNameB.lastIndexOf('.'), 0); String packageNameA = classNameA.substring(0, lastDotIndexA); String packageNameB = classNameB.substring(0, lastDotIndexB); return packageNameA.equals(packageNameB); } }
ClassDumper { static boolean classesInSamePackage(String classNameA, String classNameB) { int lastDotIndexA = Math.max(classNameA.lastIndexOf('.'), 0); int lastDotIndexB = Math.max(classNameB.lastIndexOf('.'), 0); String packageNameA = classNameA.substring(0, lastDotIndexA); String packageNameB = classNameB.substring(0, lastDotIndexB); return packageNameA.equals(packageNameB); } private  ClassDumper(
      List<ClassPathEntry> inputClassPath,
      ClassLoader extensionClassLoader,
      Map<String, ClassPathEntry> fileNameToClassPathEntry); }
ClassDumper { static boolean classesInSamePackage(String classNameA, String classNameB) { int lastDotIndexA = Math.max(classNameA.lastIndexOf('.'), 0); int lastDotIndexB = Math.max(classNameB.lastIndexOf('.'), 0); String packageNameA = classNameA.substring(0, lastDotIndexA); String packageNameB = classNameB.substring(0, lastDotIndexB); return packageNameA.equals(packageNameB); } private  ClassDumper(
      List<ClassPathEntry> inputClassPath,
      ClassLoader extensionClassLoader,
      Map<String, ClassPathEntry> fileNameToClassPathEntry);  }
ClassDumper { static boolean classesInSamePackage(String classNameA, String classNameB) { int lastDotIndexA = Math.max(classNameA.lastIndexOf('.'), 0); int lastDotIndexB = Math.max(classNameB.lastIndexOf('.'), 0); String packageNameA = classNameA.substring(0, lastDotIndexA); String packageNameB = classNameB.substring(0, lastDotIndexB); return packageNameA.equals(packageNameB); } private  ClassDumper(
      List<ClassPathEntry> inputClassPath,
      ClassLoader extensionClassLoader,
      Map<String, ClassPathEntry> fileNameToClassPathEntry);   }