public void visitProgramClass(ProgramClass programClass) {
    String name = programClass.getName();
    String newName = ClassObfuscator.newClassName(programClass);

    ps.println(
        ClassUtil.externalClassName(name) + " -> " + ClassUtil.externalClassName(newName) + ":");

    // Print out the class members.
    programClass.fieldsAccept(this);
    programClass.methodsAccept(this);
  }
 public void visitLibraryClass(LibraryClass libraryClass) {
   notePrinter.print(
       libraryClass.getName(),
       "Note: duplicate definition of library class ["
           + ClassUtil.externalClassName(libraryClass.getName())
           + "]");
 }
 public void visitProgramClass(ProgramClass programClass) {
   notePrinter.print(
       programClass.getName(),
       "Note: duplicate definition of program class ["
           + ClassUtil.externalClassName(programClass.getName())
           + "]");
 }
Exemple #4
0
  public void read(DataEntry dataEntry) throws IOException {
    try {
      // Get the input stream.
      InputStream inputStream = dataEntry.getInputStream();

      // Wrap it into a data input stream.
      DataInputStream dataInputStream = new DataInputStream(inputStream);

      // Create a Clazz representation.
      Clazz clazz;
      if (isLibrary) {
        clazz = new LibraryClass();
        clazz.accept(
            new LibraryClassReader(
                dataInputStream, skipNonPublicLibraryClasses, skipNonPublicLibraryClassMembers));
      } else {
        clazz = new ProgramClass();
        clazz.accept(new ProgramClassReader(dataInputStream));
      }

      // Apply the visitor, if we have a real class.
      String className = clazz.getName();
      if (className != null) {
        if (!dataEntry
                .getName()
                .replace(File.pathSeparatorChar, ClassConstants.PACKAGE_SEPARATOR)
                .equals(className + ClassConstants.CLASS_FILE_EXTENSION)
            && warningPrinter != null) {
          warningPrinter.print(
              className,
              "Warning: class ["
                  + dataEntry.getName()
                  + "] unexpectedly contains class ["
                  + ClassUtil.externalClassName(className)
                  + "]");
        }

        clazz.accept(classVisitor);
      }

      dataEntry.closeInputStream();
    } catch (Exception ex) {
      throw (IOException)
          new IOException(
                  "Can't process class [" + dataEntry.getName() + "] (" + ex.getMessage() + ")")
              .initCause(ex);
    }
  }