Package com.sun.tools.javac.main.Main

Examples of com.sun.tools.javac.main.Main.Result


  @Test
  public void testNegativeCase() throws Exception {
    List<JavaFileObject> sources = compiler.fileManager()
        .sources(getClass(), "CustomSuppressionNegativeCases.java");
    Result exitCode = compiler.compile(sources);
    assertThat(exitCode, is(Result.OK));
  }
View Full Code Here


        .report(new ErrorProneScanner(new DisableableChecker()))
        .build();

    List<JavaFileObject> sources =
        compiler.fileManager().sources(getClass(), "CommandLineFlagTestFile.java");
    Result exitCode = compiler.compile(sources);
    assertThat(exitCode, is(Result.ERROR));
    exitCode = compiler.compile(new String[]{"-Xepdisable:DisableableChecker"}, sources);
    assertThat(exitCode, is(Result.OK));
  }
View Full Code Here

        .report(new ErrorProneScanner(new NondisableableChecker()))
        .build();

    List<JavaFileObject> sources =
        compiler.fileManager().sources(getClass(), "CommandLineFlagTestFile.java");
    Result exitCode = compiler.compile(
        new String[]{"-Xepdisable:NondisableableChecker"}, sources);
    assertThat(exitCode, is(Result.CMDERR));
    assertThat(testStderr.toString(),
        containsString("error-prone check NondisableableChecker may not be disabled"));
  }
View Full Code Here

        .report(new ErrorProneScanner(new DisableableChecker()))
        .build();

    List<JavaFileObject> sources =
        compiler.fileManager().sources(getClass(), "CommandLineFlagTestFile.java");
    Result exitCode = compiler.compile(new String[]{"-Xepdisable:BogusChecker"}, sources);
    assertThat(exitCode, is(Result.ERROR));
    assertThat(testStderr.toString(), is(""));
  }
View Full Code Here

        .report(new ErrorProneScanner(new DisableableChecker()))
        .build();

    List<JavaFileObject> sources =
        compiler.fileManager().sources(getClass(), "CommandLineFlagTestFile.java");
    Result exitCode = compiler.compile(new String[]{"-Xepdisable:foo"}, sources);
    assertThat(exitCode, is(Result.ERROR));
  }
View Full Code Here

        .build();
  }

  @Test
  public void fileWithError() throws Exception {
    Result exitCode = compiler.compile(compiler.fileManager().sources(getClass(),
        "bugpatterns/SelfAssignmentPositiveCases1.java"));
    outputStream.flush();
    assertThat("Compiler should have exited with ERROR status", exitCode, is(Result.ERROR));
    assertThat("Compiler error message should include suggested fix", outputStream.toString(),
        containsString("Did you mean 'this.a = b;'?"));
View Full Code Here

    compiler = compilerBuilder.build();
  }

  @Test
  public void fileWithError() throws Exception {
    Result exitCode = compiler.compile(compiler.fileManager().sources(getClass(),
        "bugpatterns/BadShiftAmountPositiveCases.java"));
    outputStream.flush();
    assertThat(outputStream.toString(), exitCode, is(Result.ERROR));

    Matcher<Iterable<Diagnostic<JavaFileObject>>> matcher = hasItem(
View Full Code Here

  @Test
  public void fileWithWarning() throws Exception {
    compilerBuilder.report(new ErrorProneScanner(new NonAtomicVolatileUpdate()));
    compiler = compilerBuilder.build();
    Result exitCode = compiler.compile(compiler.fileManager().sources(getClass(),
        "bugpatterns/NonAtomicVolatileUpdatePositiveCases.java"));
    outputStream.flush();
    assertThat(outputStream.toString(), exitCode, is(Result.OK));

    Matcher<Iterable<Diagnostic<JavaFileObject>>> matcher = hasItem(
View Full Code Here

        matcher.matches(diagnosticHelper.getDiagnostics()));
  }

  @Test
  public void fileWithMultipleTopLevelClasses() throws Exception {
    Result exitCode = compiler.compile(
        compiler.fileManager().sources(getClass(), "MultipleTopLevelClassesWithNoErrors.java"));
    outputStream.flush();
    assertThat(outputStream.toString(), exitCode, is(Result.OK));
  }
View Full Code Here

    assertThat(outputStream.toString(), exitCode, is(Result.OK));
  }

  @Test
  public void fileWithMultipleTopLevelClassesExtends() throws Exception {
    Result exitCode = compiler.compile(
        compiler.fileManager().sources(getClass(), "MultipleTopLevelClassesWithNoErrors.java",
            "ExtendedMultipleTopLevelClassesWithNoErrors.java"));
    outputStream.flush();
    assertThat(outputStream.toString(), exitCode, is(Result.OK));
  }
View Full Code Here

TOP

Related Classes of com.sun.tools.javac.main.Main.Result

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.