Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
import static java.util.Objects.requireNonNull;

import io.github.ascopes.jct.annotations.Nullable;
import io.github.ascopes.jct.ex.CompilerAlreadyUsedException;
import io.github.ascopes.jct.pathwrappers.PathWrapper;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.processing.Processor;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileManager.Location;
Expand All @@ -41,10 +39,6 @@
* <p>Implementations should extend this class and override anything they require.
* In most cases, you should not need to override anything other than the constructor.
*
* <p>Each instance of this class should be considered to be single-use. Mutation does
* <strong>not</strong> produce a new instance, meaning that this class is not immutable by
* design.
*
* <p>This class is <strong>not</strong> thread-safe.
*
* <p>If you wish to create a common set of configuration settings for instances of
Expand All @@ -60,12 +54,6 @@
public abstract class AbstractCompiler<A extends AbstractCompiler<A>>
implements Compilable<A, CompilationImpl> {

// Use atomics for this to ensure no race conditions
// if the user makes a mistake during parallel test runs.
// We do not enforce thread safety but this one will prevent
// flaky tests at zero cost, so we make an exception for this.
private final AtomicBoolean alreadyCompiled;

private final String name;
private final JavaCompiler jsr199Compiler;
private final FlagBuilder flagBuilder;
Expand Down Expand Up @@ -100,8 +88,6 @@ protected AbstractCompiler(
JavaCompiler jsr199Compiler,
FlagBuilder flagBuilder
) {
alreadyCompiled = new AtomicBoolean(false);

this.name = requireNonNull(name, "name");
this.fileManagerBuilder = requireNonNull(fileManagerBuilder, "fileManagerTemplate");
this.jsr199Compiler = requireNonNull(jsr199Compiler, "jsr199Compiler");
Expand Down Expand Up @@ -156,10 +142,6 @@ public String getName() {

@Override
public CompilationImpl compile() {
if (alreadyCompiled.getAndSet(true)) {
throw new CompilerAlreadyUsedException();
}

var factory = new CompilationFactory<A>();

return factory.compile(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package io.github.ascopes.jct.compilers;

import io.github.ascopes.jct.ex.CompilerAlreadyUsedException;
import io.github.ascopes.jct.ex.CompilerException;
import io.github.ascopes.jct.pathwrappers.BasicPathWrapperImpl;
import io.github.ascopes.jct.pathwrappers.PathWrapper;
Expand Down Expand Up @@ -1176,8 +1175,6 @@ default C target(SourceVersion target) {
* Invoke the compilation and return the compilation result.
*
* @return the compilation result.
* @throws CompilerAlreadyUsedException if the compiler was already used previously. Compilers are
* single-use only.
* @throws CompilerException if the compiler threw an unhandled exception. This should
* not occur for compilation failures generally.
* @throws IllegalStateException if no compilation units were found.
Expand Down

This file was deleted.