Skip to content

Commit 8867a5a

Browse files
committed
Fix javac8 compilation failure.
java 8 adds new methods to the javax.lang.model API to deal with jsr308 annotations. [] build --java_langtools=//third_party/java/jdk/javac8 \ --javabuilder_top=//tools:java/JavaBuilder8_deploy.jar \ //third_party/java_src/compile_testing/javatests:test_lib ... third_party/java_src/compile_testing/javatests/com/google/testing/compile/EqualityScannerTest.java:58: error: SimpleNewArrayTree is not abstract and does not override abstract method getDimAnnotations() in NewArrayTree private static class SimpleNewArrayTree implements NewArrayTree { ^ ... https://sponge.[]/6fc84e37-f6b6-4af2-b38e-73edd0addf1e ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=62375603
1 parent 2f34849 commit 8867a5a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/test/java/com/google/testing/compile/EqualityScannerTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919

2020
import com.sun.source.tree.*;
2121
import com.sun.source.tree.Tree.Kind;
22+
2223
import org.junit.Test;
2324
import org.junit.runner.RunWith;
2425
import org.junit.runners.JUnit4;
2526

2627
import java.util.Arrays;
28+
import java.util.Collections;
2729
import java.util.List;
2830

2931
@RunWith(JUnit4.class)
@@ -55,6 +57,7 @@ public void uninitialisedArraysCanBeScanned() {
5557
ASSERT.that(scanner.visitNewArray(newArrayTree, newArrayTree)).isTrue();
5658
}
5759

60+
// TODO(gak): replace this with a CompilationRule and actual trees from javac
5861
private static class SimpleNewArrayTree implements NewArrayTree {
5962

6063
private final List<? extends ExpressionTree> mDimensions;
@@ -89,6 +92,16 @@ public Kind getKind() {
8992
public <R, D> R accept(TreeVisitor<R, D> rdTreeVisitor, D d) {
9093
return rdTreeVisitor.visitNewArray(this, d);
9194
}
95+
96+
// JDK8 Compatibility:
97+
98+
public List<? extends AnnotationTree> getAnnotations() {
99+
return Collections.emptyList();
100+
}
101+
102+
public List<? extends List<? extends AnnotationTree>> getDimAnnotations() {
103+
return Collections.emptyList();
104+
}
92105
}
93106

94107
private static class SimpleLiteralTree implements LiteralTree {

0 commit comments

Comments
 (0)