Skip to content

Commit

Permalink
GEODE-3: remove dependency on sun.tools.java.CompilerError (apache#2468)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinmeiliao authored Sep 14, 2018
1 parent 5e35490 commit 35d9bba
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You 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 org.apache.geode.javac;

public class CompilerException extends RuntimeException {
public CompilerException(String message){
super(message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.apache.geode.javac;

import org.junit.Test;
import sun.tools.java.CompilerError;

public class TestAnnotationProcessor {
private static final String VALID_CLASS_TEMPLATE = "package org.apache.geode;\n"
Expand All @@ -43,7 +42,7 @@ public void checkValidAnnotations() {
compiler.compile(qualifiedClassName, VALID_CLASS_TEMPLATE);
}

@Test (expected = CompilerError.class)
@Test (expected = CompilerException.class)
public void checkInvalidAnnotations() {
String qualifiedClassName = "org.apache.geode.Test";
compiler.compile(qualifiedClassName, INVALID_CLASS_TEMPLATE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;

import sun.tools.java.CompilerError;

public class TestCompiler {
public byte[] compile(String qualifiedClassName, String testSource) {

Expand All @@ -43,7 +41,7 @@ public byte[] compile(String qualifiedClassName, String testSource) {
compiler.getTask(null, fileManager, null, arguments, null, compilationUnits);

if (!task.call()) {
throw new CompilerError("Compilation errors");
throw new CompilerException("Compilation errors");
}

return fileManager.getCompiled().iterator().next().getCompiledBinaries();
Expand Down

0 comments on commit 35d9bba

Please sign in to comment.