|
16 | 16 | */ |
17 | 17 | package org.sonar.java.model; |
18 | 18 |
|
| 19 | +import java.lang.reflect.Field; |
| 20 | +import java.lang.reflect.Modifier; |
| 21 | +import java.util.HashSet; |
19 | 22 | import org.junit.jupiter.api.Test; |
20 | 23 | import org.sonar.java.model.declaration.VariableTreeImpl; |
21 | 24 | import org.sonar.java.model.expression.IdentifierTreeImpl; |
22 | 25 | import org.sonar.java.model.expression.LiteralTreeImpl; |
23 | 26 | import org.sonar.java.model.expression.MemberSelectExpressionTreeImpl; |
24 | 27 | import org.sonar.java.model.expression.MethodInvocationTreeImpl; |
25 | 28 |
|
26 | | -import java.lang.reflect.Field; |
27 | | -import java.lang.reflect.Modifier; |
28 | | -import java.nio.file.Files; |
29 | | -import java.nio.file.Path; |
30 | | -import java.util.HashSet; |
31 | | -import java.util.List; |
32 | | -import java.util.Set; |
33 | | -import java.util.stream.Stream; |
34 | | - |
35 | 29 | import static org.assertj.core.api.Assertions.assertThat; |
36 | 30 |
|
37 | 31 | /** |
|
43 | 37 | */ |
44 | 38 | class ClassesLayoutTest { |
45 | 39 |
|
46 | | - @Test |
47 | | - void shared_model_and_contracts_have_no_compiler_imports() throws Exception { |
48 | | - Path model = Path.of("src/main/java/org/sonar/java/model"); |
49 | | - Set<String> sharedFiles = Set.of("AbstractTypedTree.java", "JavaTree.java", "KeywordThis.java", "KeywordSuper.java", |
50 | | - "TypeParameterTreeImpl.java", "JUtils.java", "JSymbolMetadata.java", "JSymbolMetadataNullabilityHelper.java", |
51 | | - "JProblem.java", "JWarning.java", "SemanticValues.java"); |
52 | | - try (Stream<Path> files = Files.walk(model)) { |
53 | | - for (Path file : files.filter(path -> path.toString().endsWith(".java")).toList()) { |
54 | | - if (sharedFiles.contains(file.getFileName().toString()) || List.of("declaration", "expression", "pattern").contains(file.getParent().getFileName().toString())) { |
55 | | - assertThat(Files.readAllLines(file).stream().filter(line -> line.startsWith("import "))).as(file.toString()) |
56 | | - .noneMatch(line -> line.contains("org.eclipse.jdt")); |
57 | | - } |
58 | | - } |
59 | | - } |
60 | | - } |
61 | | - |
62 | 40 | @Test |
63 | 41 | void token() { |
64 | 42 | assertThat(countFields(InternalSyntaxToken.class)).isEqualTo(7); |
|
0 commit comments