strip-comments icon indicating copy to clipboard operation
strip-comments copied to clipboard

Comments not stripped correctly

Open HectorRicardo opened this issue 4 years ago • 0 comments

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

HectorRicardo avatar Jul 29 '20 16:07 HectorRicardo