SONARJAVA-5978 Support Compact Source Files#5397
SONARJAVA-5978 Support Compact Source Files#5397tomasz-tylenda-sonarsource merged 6 commits intomasterfrom
Conversation
1fcda73 to
d0ee95d
Compare
df8c9db to
127ad59
Compare
| public ITypeBinding typeBinding; | ||
|
|
||
| public ClassTreeImpl(Kind kind, SyntaxToken openBraceToken, List<Tree> members, SyntaxToken closeBraceToken) { | ||
| public ClassTreeImpl(Kind kind, List<Tree> members) { |
There was a problem hiding this comment.
How about introducing a new constructor with nullable arguments? It might help us reducing the amount of call sites to change and keeping the fields brace fields final. WDYT?
There was a problem hiding this comment.
Done.
| ClassTreeImpl clazz = (ClassTreeImpl) cu.types().get(0); | ||
| assertThat(clazz).isNotNull(); | ||
| assertThat(clazz.kind()).isEqualTo(Tree.Kind.IMPLICIT_CLASS); | ||
| assertThat(clazz.members()).hasSize(3); |
There was a problem hiding this comment.
Should we explicitly test that the 3 members are a method, a variable and a type?
There was a problem hiding this comment.
Done.
|
|
||
| @Test | ||
| void compact_source() { | ||
| JavaFilesCache javaFilesCache = new JavaFilesCache(); |
There was a problem hiding this comment.
TIL about JavaFilesCache
There was a problem hiding this comment.
Ack.
java-checks-test-sources/default/src/main/java/checks/IndentationCheck_compactSource.java
Outdated
Show resolved
Hide resolved
| boolean isAnonymous = tree.simpleName() == null; | ||
| if (!isAnonymous) { | ||
| // Exclude anonymous classes other than implicit classed of compact source files. | ||
| boolean isExcluded = tree.simpleName() == null && !tree.is(Kind.IMPLICIT_CLASS); |
There was a problem hiding this comment.
No need to address this but I wonder in how many places we infer a class is anonymous from it simpleName is null rather than using a more explicit Kind
There was a problem hiding this comment.
dorian-burihabwa-sonarsource
left a comment
There was a problem hiding this comment.
Looking good, let's try and see if we can avoid modifying the existing constructor of ClassTreeImpl
Co-authored-by: Dorian Burihabwa <75226315+dorian-burihabwa-sonarsource@users.noreply.github.com>
4ea59bf to
7d074ad
Compare
|




No description provided.