<commit_before>/*
 * Copyright 2012 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.errorprone;

import org.codehaus.plexus.compiler.CompilerConfiguration;
import org.codehaus.plexus.compiler.CompilerException;
import org.codehaus.plexus.compiler.javac.JavacCompiler;

import java.util.List;

/**
 * @author <EMAIL> (<NAME>)
 */
public class PlexusErrorProneCompiler extends JavacCompiler {
  @Override
  public List compile(CompilerConfiguration config) throws CompilerException {
    throw new UnsupportedOperationException("Uh oh!");
  }
}<commit_msg>Implement the compiler hook. Now the maven build runs with error-prone and reports our errors, but it doesn't detect the outcome of the failed build correctly, so it needs us to emit errors.<commit_after>/*
 * Copyright 2012 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.errorprone;

import org.codehaus.plexus.compiler.CompilerConfiguration;
import org.codehaus.plexus.compiler.CompilerException;
import org.codehaus.plexus.compiler.javac.JavacCompiler;

import java.io.File;
import java.util.Collections;
import java.util.List;

/**
 * @author <EMAIL> (<NAME>)
 */
public class PlexusErrorProneCompiler extends JavacCompiler {
  @Override
  public List compile( CompilerConfiguration config )
      throws CompilerException {
    File destinationDir = new File(config.getOutputLocation() );

    if (!destinationDir.exists()) {
      destinationDir.mkdirs();
    }

    String[] sourceFiles = getSourceFiles(config);

    if ((sourceFiles == null) || ( sourceFiles.length == 0 )) {
      return Collections.EMPTY_LIST;
    }

    if ( ( getLogger() != null ) && getLogger().isInfoEnabled() )
    {
      getLogger().info( "Compiling " + sourceFiles.length + " " +
          "source file" + ( sourceFiles.length == 1 ? "" : "s" ) +
          " to " + destinationDir.getAbsolutePath() );
    }

    String[] args = buildCompilerArguments( config, sourceFiles );

    if (config.isFork()) {
      throw new UnsupportedOperationException(
          "error-prone compiler can only be run in-process");
    } else {
      new ErrorProneCompiler.Builder().build().compile(args);

      return Collections.emptyList();
    }
  }
}
{'fraction_non_alphanumeric': 0.09806879903439952, 'fraction_numerical': 0.005431502715751358, 'mean_word_length': 3.79739507959479, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3021857', 'n_tokens_mistral': 902, 'n_tokens_neox': 878, 'n_words': 316}