parameters: (jar_path, dest_dir, java_files)
docstring: Extracts all .class files not corresponding to |java_files|.
docstring_summary: Extracts all .class files not corresponding to |java_files|.
docstring_tokens: Extracts all . class files not corresponding to |java_files| .
function: def _ExtractClassFiles(jar_path, dest_dir, java_files):
    """Extracts all .class files not corresponding to |java_files|."""
    # Two challenges exist here:
    # 1. |java_files| have prefixes that are not represented in the the jar paths.
    # 2. A single .java file results in multiple .class files when it contains
    #    nested classes.
    # Here's an example:
    #   source path: ../../base/android/java/src/org/chromium/Foo.java
    #   jar paths: org/chromium/Foo.class, org/chromium/Foo$Inner.class
    # To extract only .class files not related to the given .java files, we strip
    # off ".class" and "$*.class" and use a substring match against java_files.
    def extract_predicate(path):
      if not path.endswith('.class'):
        return False
      path_without_suffix = re.sub(r'(?:\$|\.)[^/]*class$', '', path)
      partial_java_path = path_without_suffix + '.java'
      return not any(p.endswith(partial_java_path) for p in java_files)
  
    build_utils.ExtractAll(jar_path, path=dest_dir, predicate=extract_predicate)
    for path in build_utils.FindInDirectory(dest_dir, '*.class'):
      shutil.copystat(jar_path, path)
function_tokens: def _ExtractClassFiles ( jar_path , dest_dir , java_files ) : # Two challenges exist here: # 1. |java_files| have prefixes that are not represented in the the jar paths. # 2. A single .java file results in multiple .class files when it contains #    nested classes. # Here's an example: #   source path: ../../base/android/java/src/org/chromium/Foo.java #   jar paths: org/chromium/Foo.class, org/chromium/Foo$Inner.class # To extract only .class files not related to the given .java files, we strip # off ".class" and "$*.class" and use a substring match against java_files. def extract_predicate ( path ) : if not path . endswith ( '.class' ) : return False path_without_suffix = re . sub ( r'(?:\$|\.)[^/]*class$' , '' , path ) partial_java_path = path_without_suffix + '.java' return not any ( p . endswith ( partial_java_path ) for p in java_files ) build_utils . ExtractAll ( jar_path , path = dest_dir , predicate = extract_predicate ) for path in build_utils . FindInDirectory ( dest_dir , '*.class' ) : shutil . copystat ( jar_path , path )