njit-jerse / specimin

SPECIfication MINimizer. A different kind of slicer for Java.
MIT License
3 stars 5 forks source link

Remove unused imports #354

Closed theron-wang closed 1 month ago

theron-wang commented 1 month ago

Removes unused imports in all output files.

Take, for example, ManyImports in the included test case. Previously:

package com.example;

import java.util.List;
import java.io.*;
import static java.util.Map.*;
import static java.lang.Math.sqrt;
import static java.lang.Math.PI;

public class ManyImports {
}

Now:

package com.example;

public class ManyImports {
}

Even if the import type is a used type element, it should still be removed if the current, minimized file does not contain any instances.

theron-wang commented 1 month ago

@kelloggm No rush on the review, just whenever you're back and have time!

theron-wang commented 1 month ago

Changes made; thanks.