Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
e15ea96
SONARJAVA-7236 Drop the ECJ parser so the frontend can be replaced
rombirli Oct 26, 2026
cf0f027
SONARJAVA-7236 Produce the Java CST with SemSitter semantics
rombirli Oct 27, 2026
0c67729
SONARJAVA-7236 Bridge the CST over stdin/stdout JSONL with a CLI to q…
rombirli Oct 27, 2026
15a5d3e
SONARJAVA-7236 Translate the SemSitter CST into the SonarJava AST and…
rombirli Oct 27, 2026
9f9b64b
SONARJAVA-7236 Lower the plugin JAR size floor after dropping ECJ
rombirli Oct 27, 2026
cd9f64a
SONARJAVA-7236 Package the SemSitter bridge in the plugin
rombirli Oct 27, 2026
b0aba6f
SONARJAVA-7236 Ship prebuilt bridge archives so CI does not need cargo
rombirli Oct 28, 2026
2f43f8e
SONARJAVA-7236 Keep new-class constructor symbols as method symbols
rombirli Oct 28, 2026
41303be
SONARJAVA-7236 Place primitive and brace tokens on their real source …
rombirli Oct 28, 2026
d3312ba
SONARJAVA-7236 Translate qualified type names such as Map.Entry
rombirli Oct 28, 2026
1940dbf
SONARJAVA-7236 Wrap compact source files in an implicit class
rombirli Oct 28, 2026
d245514
SONARJAVA-7236 Give file-level issues a text range
rombirli Oct 28, 2026
231167d
SONARJAVA-7236 Translate catch types and stop declaring type parameters
rombirli Oct 28, 2026
5cc3015
SONARJAVA-7236 Resolve varargs library and user methods correctly
rombirli Oct 28, 2026
afeb7ee
SONARJAVA-7236 Guard TypeSymbol.declaration() against non-class trees
rombirli Oct 28, 2026
0619e78
SONARJAVA-7236 Skip comment nodes when walking CST children
rombirli Oct 28, 2026
6bc51e7
SONARJAVA-7236 Translate case labels, patterns and guards
rombirli Oct 28, 2026
b45ffba
SONARJAVA-7236 Translate class literals, annotation values and annota…
rombirli Oct 28, 2026
a731c86
SONARJAVA-7236 Fix tokens of update, for header, spread parameter and…
rombirli Oct 28, 2026
8490218
SONARJAVA-7236 Fix method reference qualifier, package name and top-l…
rombirli Oct 28, 2026
e68806e
SONARJAVA-7236 Strip carriage return from line comments
rombirli Oct 28, 2026
a9c2fe6
SONARJAVA-7236 Translate text blocks as TEXT_BLOCK literals
rombirli Oct 28, 2026
a4c0ea6
SONARJAVA-7236 Bind compact source methods to their implicit class
rombirli Oct 28, 2026
27d3bc6
SONARJAVA-7236 Resolve overloads by parameter types and type new expr…
rombirli Oct 28, 2026
36ef140
SONARJAVA-7236 Return no type argument metadata for symbols
rombirli Oct 28, 2026
68e5181
SONARJAVA-7236 Convert annotation values like ECJ and report unknown …
rombirli Oct 28, 2026
06a66c5
SONARJAVA-7236 Lift the JSON nesting limit for deep CSTs
rombirli Oct 28, 2026
bf1d418
SONARJAVA-7236 Take superclasses from the extends clause and break in…
rombirli Oct 28, 2026
9077819
SONARJAVA-7236 Serve the CST over shared memory as protobuf
rombirli Oct 29, 2026
771b3da
SONARJAVA-7236 Repin SemSitter to the java-cst branch head
rombirli Oct 30, 2026
6d8f0d7
SONARJAVA-7236 Put the end-of-file token at the end of the source
rombirli Oct 30, 2026
d64bae7
SONARJAVA-7236 Keep the body of an anonymous class
rombirli Oct 30, 2026
e394c13
SONARJAVA-7236 Translate enum members declared after the constants
rombirli Oct 30, 2026
684046f
SONARJAVA-7236 Read implemented and extended interfaces from the type…
rombirli Oct 30, 2026
a00eba1
SONARJAVA-7236 Translate this() and super() calls in constructors
rombirli Oct 30, 2026
da38caf
SONARJAVA-7236 Merge case labels without statements into the next cas…
rombirli Oct 30, 2026
1ba7c9e
SONARJAVA-7236 Yield the expression of a switch expression rule
rombirli Oct 30, 2026
4868047
SONARJAVA-7236 Yield arrow case expressions in switch statements too
rombirli Oct 30, 2026
b6b13f0
SONARJAVA-7236 Keep the body of a labeled statement
rombirli Oct 30, 2026
ed09385
SONARJAVA-7236 Split a switch followed by a semicolon into a switch a…
rombirli Oct 30, 2026
7fdb607
SONARJAVA-7236 Keep array dimensions declared after method parameters
rombirli Oct 30, 2026
2081767
SONARJAVA-7236 Translate every array creation dimension and its annot…
rombirli Oct 30, 2026
80a4e0a
SONARJAVA-7236 Keep the default value of annotation elements
rombirli Oct 30, 2026
be61b11
SONARJAVA-7236 Read package annotations that are direct children of t…
rombirli Oct 30, 2026
0388d70
SONARJAVA-7236 Keep the super qualifier of X.super member selects
rombirli Oct 30, 2026
bddbbf3
SONARJAVA-7236 Keep array dimensions declared after a for-each variable
rombirli Oct 30, 2026
4ec9c03
SONARJAVA-7236 Attach annotations of a qualified type to its last ide…
rombirli Oct 30, 2026
a5db44e
SONARJAVA-7236 Translate module declarations
rombirli Oct 30, 2026
c648a5f
SONARJAVA-7236 Keep commas of for-loop init and update lists as separ…
rombirli Oct 30, 2026
9908eb6
SONARJAVA-7236 Drop semicolons between the last enum constant and the…
rombirli Oct 30, 2026
37d96eb
SONARJAVA-7236 End a do-while statement at its last semicolon
rombirli Oct 30, 2026
00074ee
SONARJAVA-7236 Keep the enclosing expression of a qualified class cre…
rombirli Oct 30, 2026
1576fd0
SONARJAVA-7236 End an inferred lambda parameter at its comma
rombirli Oct 30, 2026
6f1d06d
SONARJAVA-7236 Translate try resources that reference an existing var…
rombirli Oct 30, 2026
d98fccf
SONARJAVA-7236 Keep type annotations of method references and creations
rombirli Oct 30, 2026
32c4686
SONARJAVA-7236 Type method names with their return type
rombirli Oct 30, 2026
6b9a8d4
SONARJAVA-7236 Load the declaration of a type the first time it is re…
rombirli Oct 30, 2026
837989b
SONARJAVA-7236 Resolve library type names through imports and qualifi…
rombirli Oct 30, 2026
909caa2
SONARJAVA-7236 Bind package symbols to the qualifiers of resolved typ…
rombirli Oct 30, 2026
20062b7
SONARJAVA-7236 Type annotations with their annotation type
rombirli Oct 30, 2026
770ede6
SONARJAVA-7236 Type variables declared with a library type
rombirli Oct 30, 2026
3bab89d
SONARJAVA-7236 Resolve library methods and constructors by name and a…
rombirli Oct 30, 2026
e864ec8
SONARJAVA-7236 Bind package symbols to the package declaration name
rombirli Oct 30, 2026
78f5ed1
SONARJAVA-7236 Pick the library overload Java would choose from the a…
rombirli Oct 30, 2026
95df649
SONARJAVA-7236 Resolve unqualified library calls through enclosing ty…
rombirli Oct 30, 2026
7a1c4ec
SONARJAVA-7236 Resolve annotation element names to their annotation m…
rombirli Oct 30, 2026
f10be57
SONARJAVA-7236 Bind anonymous class creations to the super constructor
rombirli Oct 30, 2026
097c3e4
SONARJAVA-7236 Return the receiver type from methods returning their …
rombirli Oct 30, 2026
d7d0901
SONARJAVA-7236 Bind enum constants to the enum constructor and type t…
rombirli Oct 30, 2026
ae986e3
SONARJAVA-7236 Recover anonymous class symbols from their members
rombirli Oct 30, 2026
ce24baa
SONARJAVA-7236 Bind type parameter declarations
rombirli Oct 30, 2026
5e1bf81
SONARJAVA-7236 Type methods with their declared return type when SemS…
rombirli Oct 30, 2026
e24dee6
SONARJAVA-7236 Bind record components to their fields
rombirli Oct 30, 2026
86841df
SONARJAVA-7236 Resolve library fields of member selects
rombirli Oct 30, 2026
7fb9114
SONARJAVA-7236 Type lambdas, method references and array initializers…
rombirli Oct 30, 2026
22c23ab
SONARJAVA-7236 Type patterns with their variable type
rombirli Oct 30, 2026
a4cf2ae
SONARJAVA-7236 Pick the overload of arity-only SemSitter references f…
rombirli Oct 30, 2026
c36700b
SONARJAVA-7236 Substitute type variables in the parameter types of li…
rombirli Oct 30, 2026
0f95327
SONARJAVA-7236 Substitute the method type variables of JDK invocation…
rombirli Oct 30, 2026
112c3d9
SONARJAVA-7236 Own lambda parameters and locals by the functional int…
rombirli Oct 30, 2026
00a3470
SONARJAVA-7236 Give local classes their binary names
rombirli Oct 30, 2026
24d28bc
SONARJAVA-7236 Type untyped lambda parameters from their functional i…
rombirli Oct 30, 2026
bcd3bd4
SONARJAVA-7236 Bind qualified this and super to their receiver
rombirli Oct 30, 2026
f57cd12
SONARJAVA-7236 Type switch expressions from their results
rombirli Oct 30, 2026
80f80f7
SONARJAVA-7236 Copy only the bridge executable when archiving
rombirli Oct 30, 2026
6154f22
SONARJAVA-7236 Rebuild the prebuilt bridges
rombirli Oct 30, 2026
465b052
SONARJAVA-7236 Give array typed annotation members an array value
rombirli Oct 30, 2026
a35fc49
SONARJAVA-7236 Give records and enums their implicit superclass
rombirli Oct 30, 2026
2f495e6
SONARJAVA-7236 Read the constant value of a field from its declaration
rombirli Oct 30, 2026
69c5020
SONARJAVA-7236 Repin on the Java grammar fork that accepts the reject…
rombirli Oct 30, 2026
3d3bb45
SONARJAVA-7236 Rebuild the prebuilt bridges on the grammar fork
rombirli Oct 30, 2026
4c48ffe
SONARJAVA-7236 Replace the extracted bridge when a newer prebuilt exists
rombirli Oct 30, 2026
75b0a58
SONARJAVA-7236 Keep type arguments on parameterized type symbols
rombirli Nov 2, 2026
01f2311
SONARJAVA-7236 Fill library declaration facts, implicit modifiers, ge…
antonioaversa Nov 1, 2026
b65d69a
SONARJAVA-7236 Walk supertypes erased when checking subtyping
antonioaversa Nov 1, 2026
91d4619
SONARJAVA-7236 Use constants for repeated literals and a private temp…
antonioaversa Nov 1, 2026
27d3c7a
SONARJAVA-7236 Keep file-level issues file-level instead of moving th…
antonioaversa Nov 1, 2026
c3fedca
SONARJAVA-7236 Make every package symbol a child of the root package
antonioaversa Nov 1, 2026
6c1fa06
SONARJAVA-7236 Keep the deprecation of a library method on its per-ca…
antonioaversa Nov 1, 2026
ff5f7bf
SONARJAVA-7236 Keep the written name of an unresolved type, as a reco…
antonioaversa Nov 1, 2026
06170cd
SONARJAVA-7236 Report unused imports and assignments without effect a…
antonioaversa Nov 1, 2026
696cd25
SONARJAVA-7236 Evaluate the constant value of static final fields fro…
antonioaversa Nov 1, 2026
75a9031
SONARJAVA-7236 List the implicit default constructor among the member…
antonioaversa Nov 1, 2026
d1aae8e
SONARJAVA-7236 Keep the written qualified name of unresolved annotati…
antonioaversa Nov 1, 2026
20a081f
SONARJAVA-7236 Mark local variables and parameters that are never rea…
antonioaversa Nov 1, 2026
89b0f1b
SONARJAVA-7236 Split the import usage check and the annotation type l…
antonioaversa Nov 1, 2026
4d5897f
SONARJAVA-7236 Emit generic classpath supertypes from the pinned clas…
rombirli Nov 2, 2026
1a328dd
SONARJAVA-7236 Rebuild the prebuilt bridges
rombirli Nov 2, 2026
4a60242
SONARJAVA-7236 Resolve local and anonymous classes as type symbols
rombirli Nov 2, 2026
cfa27f2
SONARJAVA-7236 Substitute type variables nested in parameter types
rombirli Nov 2, 2026
62d413a
SONARJAVA-7236 Ascribe call arguments against the receiver-substitute…
rombirli Nov 2, 2026
7624b4c
SONARJAVA-7236 Rebuild the prebuilt bridges
rombirli Nov 2, 2026
1798e67
SONARJAVA-7236 Analyze a file from the tree recovered after a syntax …
rombirli Nov 2, 2026
40f655e
SONARJAVA-7236 Emit the access flags of a classpath type
rombirli Nov 2, 2026
9bbebd4
SONARJAVA-7236 Read JDK declarations from the runtime image
rombirli Nov 3, 2026
b031613
SONARJAVA-7236 Keep the value of a Retention annotation
rombirli Nov 3, 2026
a426b83
SONARJAVA-7236 Give a call the exceptions its method declares
rombirli Nov 3, 2026
5b0612f
SONARJAVA-7236 Tell a raw type from the generic type it uses
rombirli Nov 3, 2026
385d514
SONARJAVA-7236 Report a cast the expression type already satisfies
rombirli Nov 3, 2026
316114d
SONARJAVA-7236 Mark a class that extends Enum as an enum
rombirli Nov 3, 2026
edd2cc0
SONARJAVA-7236 Give a new array the rank its dimensions declare
rombirli Nov 3, 2026
f2ecb10
SONARJAVA-7236 Keep the type arguments of a declared variable
rombirli Nov 3, 2026
48afd27
SONARJAVA-7236 Record a use on the symbol it resolves to
rombirli Nov 3, 2026
1fd63f4
SONARJAVA-7236 Rebuild the bridge with declared exceptions
rombirli Nov 3, 2026
c490100
SONARJAVA-7236 Substitute generic arguments on a call
rombirli Nov 4, 2026
336e8dc
SONARJAVA-7236 Type a static field from its class file
rombirli Nov 4, 2026
0f190c4
SONARJAVA-7236 Pick the overload the arguments select
rombirli Nov 4, 2026
188bae4
SONARJAVA-7236 Capture a wildcard in a method return
rombirli Nov 4, 2026
60c226d
SONARJAVA-7236 Resolve a member the graph left unknown
rombirli Nov 4, 2026
abc2eef
SONARJAVA-7236 Keep the first import when the same name is imported t…
rombirli Nov 4, 2026
bfaaae5
SONARJAVA-7236 Report a redundant cast only when the erasure matches
rombirli Nov 4, 2026
dab3bba
SONARJAVA-7236 Mark a project type that extends Enum as an enum
rombirli Nov 4, 2026
66d4add
SONARJAVA-7236 Give each array dimension its own rank
rombirli Nov 4, 2026
f31ec0f
SONARJAVA-7236 Keep the static modifier of a nested class
rombirli Nov 4, 2026
8a388db
SONARJAVA-7236 Inherit deprecation from the method a declaration over…
rombirli Nov 4, 2026
0760066
SONARJAVA-7236 Use one symbol for a parameter in its scope
rombirli Nov 4, 2026
54ab104
SONARJAVA-7236 Recover a compact constructor that was split at throws
rombirli Nov 4, 2026
bbec8ea
SONARJAVA-7236 Recover a new array left in a broken initializer
rombirli Nov 4, 2026
ccb9db7
SONARJAVA-7236 Rebuild the bridge with generic return types
rombirli Nov 4, 2026
90b0eb8
SONARJAVA-7236 Stop loading types once the bridge is closed
rombirli Nov 4, 2026
af9036e
SONARJAVA-7236 Send classpath field types as JVM descriptors so stati…
rombirli Nov 4, 2026
0e51925
SONARJAVA-7236 Keep type arguments on declared method parameter types
rombirli Nov 4, 2026
cd28a41
SONARJAVA-7236 Capture self types only for wildcard receivers and kee…
rombirli Nov 4, 2026
22d7bb8
SONARJAVA-7236 Treat arrays of unresolved types as unresolved
rombirli Nov 4, 2026
fe4f60b
SONARJAVA-7236 Leave the class keyword of class literals unbound and …
rombirli Nov 4, 2026
379a967
SONARJAVA-7236 Type wildcard arguments by their bound and capture the…
rombirli Nov 4, 2026
33e7226
SONARJAVA-7236 Keep wildcard bounds in classpath generic signatures
rombirli Nov 4, 2026
ddba353
SONARJAVA-7236 Type library wildcards by their bounds and give lambda…
rombirli Nov 4, 2026
f96422a
SONARJAVA-7236 Read declared generic return types from the syntax bef…
rombirli Nov 4, 2026
60d5148
SONARJAVA-7236 Infer diamond type arguments from declarations, assign…
rombirli Nov 4, 2026
256c051
SONARJAVA-7236 Never rebind a qualified constructor type to a single …
rombirli Nov 4, 2026
9710553
SONARJAVA-7236 Rebuild the bridge with JVM field descriptors and wild…
rombirli Nov 4, 2026
99e5032
SONARJAVA-7236 Leave a call unresolved when no method takes that many…
rombirli Nov 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private static class EraseSymbols extends BaseTreeVisitor {
@Override
public void visitVariable(VariableTree tree) {
if (tree instanceof VariableTreeImpl varImpl) {
varImpl.variableBinding = null;
varImpl.variableSymbol = null;
}
super.visitVariable(tree);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,16 @@ void test() {
assertThat(issue.getMessage()).isEqualTo("Parse error");
}

/**
* Related to SONARJAVA-3486: discrepancies between JLS, javac (more tolerant than JLS) and ECJ (strict to JLS).
* According to JLS (§7.3 Compilation Units), empty statements are not allowed in import section.
*/
/** An empty statement among the imports is kept and the file is still analyzed. */
@Test
void javacEmptyStatementsInImportsBug() {
void empty_statement_in_imports_is_analyzed() {
SonarComponents sonarComponents = mock(SonarComponents.class);
when(sonarComponents.inputFileContents(any())).thenCallRealMethod();

VisitorsBridgeForTests visitorsBridge = new VisitorsBridgeForTests.Builder(new ParsingErrorCheck())
.withSonarComponents(sonarComponents)
.build();
JavaAstScanner.scanSingleFileForTests(TestUtils.inputFile("src/test/files/checks/parsing/EmptyStatementsInImportsBug.java"), visitorsBridge);
Set<AnalyzerMessage> issues = visitorsBridge.testContexts().get(0).getIssues();
assertThat(issues).hasSize(1);
AnalyzerMessage issue = issues.iterator().next();
assertThat(issue.getLine()).isEqualTo(3);
assertThat(issue.getMessage()).isEqualTo("Parse error");
assertThat(visitorsBridge.testContexts().get(0).getIssues()).isEmpty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.google.common.io.Files;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.sonar.java.model.JParser;
Expand Down Expand Up @@ -83,9 +82,9 @@ public static CompilationUnitTree parse(File file) {
}

public static CompilationUnitTree parse(String source) {
List<File> classpath = Arrays.asList(new File("target/test-classes"), new File("target/classes"));
List<File> classpath = List.of(new File("target/test-classes"), new File("target/classes"));
JavaVersion version = JParserConfig.MAXIMUM_SUPPORTED_JAVA_VERSION;
return JParser.parse(JParserConfig.Mode.FILE_BY_FILE.create(version, classpath).astParser(), version.toString(), "test", source);
return JParser.parse(version.toString(), "test", source, classpath);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,6 @@ private static CompilationUnitTree parse(File file, List<File> classpath) {
throw new IllegalStateException("Unable to read file '" + file.getAbsolutePath() + "'", e);
}
JavaVersion version = JParserConfig.MAXIMUM_SUPPORTED_JAVA_VERSION;
return JParser.parse(JParserConfig.Mode.FILE_BY_FILE.create(version, classpath).astParser(), version.toString(), file.getName(), source);
return JParser.parse(version.toString(), file.getName(), source);
}
}
28 changes: 22 additions & 6 deletions java-frontend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jdt-package</artifactId>
<version>1.9.0.1840</version>
</dependency>

<dependency>
<groupId>org.sonarsource.api.plugin</groupId>
<artifactId>sonar-plugin-api</artifactId>
Expand Down Expand Up @@ -92,6 +86,16 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.27.1</version>
</dependency>
<dependency>
<groupId>org.tukaani</groupId>
<artifactId>xz</artifactId>
<version>1.10</version>
</dependency>

<dependency>
<groupId>org.sonarsource.java</groupId>
Expand Down Expand Up @@ -144,6 +148,18 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>${maven.multiModuleProjectDirectory}/semsitter-bridge/prebuilt</directory>
<includes>
<include>bridge-*.xz</include>
</includes>
<targetPath>bridge</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
132 changes: 0 additions & 132 deletions java-frontend/src/main/java/org/eclipse/jdt/core/dom/ASTUtils.java

This file was deleted.

This file was deleted.

11 changes: 1 addition & 10 deletions java-frontend/src/main/java/org/sonar/java/ProgressMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BooleanSupplier;
import org.eclipse.core.runtime.IProgressMonitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.java.annotations.VisibleForTesting;

public class ProgressMonitor implements IProgressMonitor, Runnable {
public class ProgressMonitor implements Runnable {

private final Logger logger;
private final long period;
Expand Down Expand Up @@ -84,7 +83,6 @@ public void run() {
}
}

@Override
public void beginTask(String name, int totalWork) {
if (totalWork <= 0) {
unknownTotalWork = true;
Expand All @@ -96,7 +94,6 @@ public void beginTask(String name, int totalWork) {
thread.start();
}

@Override
public void done() {
if (success && analysisProgress.isLastBatch()) {
log("100% analyzed");
Expand All @@ -107,7 +104,6 @@ public void done() {
join();
}

@Override
public boolean isCanceled() {
if (isCanceled.getAsBoolean()) {
log("Batch processing: Cancelled!");
Expand All @@ -116,7 +112,6 @@ public boolean isCanceled() {
return false;
}

@Override
public void setCanceled(boolean value) {
// do nothing
}
Expand All @@ -129,25 +124,21 @@ private void join() {
}
}

@Override
public void worked(int work) {
processedWork += work;
if (processedWork == totalWork) {
success = true;
}
}

@Override
public void internalWorked(double work) {
// do nothing
}

@Override
public void setTaskName(String name) {
// do nothing
}

@Override
public void subTask(String name) {
// do nothing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,19 @@
*/
package org.sonar.java.model;

import org.eclipse.jdt.core.dom.ITypeBinding;
import org.sonar.plugins.java.api.semantic.Type;

import javax.annotation.Nullable;
import org.sonar.plugins.java.api.semantic.Type;

/**
* This class is intended for internal use during semantic analysis and should not be used in checks.
*/
public abstract class AbstractTypedTree extends JavaTree {

@Nullable
public ITypeBinding typeBinding;
public Type type;

public Type symbolType() {
return typeBinding != null
? root.sema.type(typeBinding)
: Type.UNKNOWN;
return type != null ? type : Type.UNKNOWN;
}

}
Loading
Loading