Menu

#697 Unrelated classes are being kept.

v6.0
open-works-for-me
Shrinking (4)
Medium
2020-02-04
2018-03-24
randomname
No

I've a project that has a lot of libraries to it, for a total of 25135 visible in the classpath, now I'm having proguard only keep 1 class, which has no dependencies at all on anything (it's a trivial java class with a main that only does System.out.println("hello world")). The resulting jar nevertheless, is keeping 1076 classes, none of them make sense, and when using -whyareyoukeeping on any of them, the processing time multiplies by 100 (it ends up taking like 30 minutes, instead of ~40.

The justification for keeping the class is

monix.execution.Scheduler
  is kept by a directive in the configuration.

but my directives, as shown by the printseeds is

randomstuff.SimpleMain

I can check via decompilation of my trivial java class that it really has no dependencies on anything else, and the injars and libraries parameters are correctly generated.

The classes that are being kept, all belong to some scala libraries I have in the classpath, though only some classes of some libraires are being kept (it's not even consistent). Here's the code of SmpleMain

package randomstuff;

public class SimpleMain {
  public static void main(String[] args) {
    System.out.println("hello world");
  }
}

Attached are configuration file as well as output from proguard

1 Attachments

Discussion

  • randomname

    randomname - 2018-03-24

    Errata (because I can't seem to be able to edit the original post):

    (it ends up taking like 30 minutes, instead of ~40.
    I meant 40 seconds.
    The classes that are being kept, all belong to some scala libraries I have in the classpath, though only some classes of some libraires are being kept (it's not even consistent)
    I meant it doens't keep the library in full, but only some classes, not that the resulting classes change between runs.

     
  • Eric Lafortune

    Eric Lafortune - 2018-04-22

    This can only happen if you have more ProGuard configuration outside of your own configuration file. Are you running ProGuard by itself or as part of a build system? Can the build system be adding options? You can check with

    -printconfiguration configuration.txt
    
     
    • randomname

      randomname - 2018-04-22

      The configuration file is generated by a build tool, nevertheless I've inspected it myself and played with it, and I can run proguard directly with that configuration file and I still observe this behaviour.

       
  • Eric Lafortune

    Eric Lafortune - 2018-04-22
    • status: open --> open-works-for-me
    • assigned_to: Eric Lafortune
    • Priority: 5 --> Medium
     
  • T. Neidhart

    T. Neidhart - 2019-12-06

    Would you be able to share the configuration with us for inspection?

     
  • randomname

    randomname - 2020-02-04

    The attachment I included in the original report: "proguardoutput", is a text file that has the configuration at the beginning, and after that (separated with some blank lines and a line of equal signs) comes the log.

     

Log in to post a comment.

MongoDB Logo MongoDB