All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.massfords.javac.effectivelyfinal.EffectivelyFinalPlugin Maven / Gradle / Ivy

Go to download

Javac plugin that requires method parameters to either be explicitly final or effectively final. This enforces the best practice of treating the parameters as final without the burden of having to type final everywhere.

The newest version!
package com.massfords.javac.effectivelyfinal;


import com.sun.source.util.JavacTask;

/**
 * Plugin that produces a compiler error if a method param is assigned to. This prevents the bad practice of assigning
 * to a param which should be treated as final (at least in Java) without having to add the final modifier to every
 * param.
 */
public class EffectivelyFinalPlugin implements com.sun.source.util.Plugin {

    @Override
    public String getName() {
        return "EffectivelyFinal";
    }

    @Override
    public void init(JavacTask task, String... args) {
        task.addTaskListener(new EffectivelyFinalTaskListener(task));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy