Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments not stripped correctly #59

Open
HectorRicardo opened this issue Jul 29, 2020 · 0 comments
Open

Comments not stripped correctly #59

HectorRicardo opened this issue Jul 29, 2020 · 0 comments

Comments

@HectorRicardo
Copy link

I found an example of a java file whose comments are not being stripped correctly. You can download the file at: https://hg.openjdk.java.net/jdk8u/jdk8u/jdk/raw-file/c60436725ce4/src/share/classes/javax/sound/sampled/FloatControl.java

Sample code

const fs = require('fs').promises;
const strip = require('strip-comments');

(async () => {
  const contents = await fs.readFile('FloatControl.java', 'utf-8');
  await fs.writeFile('Output.java', strip(contents));
})();

This is an example chunk of the resulting Output.java file that contains unstripped comments (lines 73 to 97):

/**
     * Constructs a new float control object with the given parameters.
     * The labels for the minimum, maximum, and mid-point values are set
     * to zero-length strings.
     *
     * @param type the kind of control represented by this float control object
     * @param minimum the smallest value permitted for the control
     * @param maximum the largest value permitted for the control
     * @param precision the resolution or granularity of the control.
     * This is the size of the increment between discrete valid values.
     * @param updatePeriod the smallest time interval, in microseconds, over which the control
     * can change from one discrete value to the next during a {@link #shift(float,float,int) shift}
     * @param initialValue the value that the control starts with when constructed
     * @param units the label for the units in which the control's values are expressed,
     * such as "dB" or "frames per second"
     *
     * @throws IllegalArgumentException if {@code minimum} is greater
     *     than {@code maximum} or {@code initialValue} does not fall
     *     within the allowable range
     */
    protected FloatControl(Type type, float minimum, float maximum,
            float precision, int updatePeriod, float initialValue, String units) {
        this(type, minimum, maximum, precision, updatePeriod,
                initialValue, units, "", "", "");
    }

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant