Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 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
b7de00f
SONARJAVA-7236 Fill library declaration facts, implicit modifiers, ge…
antonioaversa Nov 1, 2026
7ea5598
SONARJAVA-7236 Walk supertypes erased when checking subtyping
antonioaversa Nov 1, 2026
d4a357e
SONARJAVA-7236 Use constants for repeated literals and a private temp…
antonioaversa Nov 1, 2026
84b7078
SONARJAVA-7236 Keep file-level issues file-level instead of moving th…
antonioaversa Nov 1, 2026
eb2b5c0
SONARJAVA-7236 Make every package symbol a child of the root package
antonioaversa Nov 1, 2026
de798f5
SONARJAVA-7236 Keep the deprecation of a library method on its per-ca…
antonioaversa Nov 1, 2026
bcb065e
SONARJAVA-7236 Keep the written name of an unresolved type, as a reco…
antonioaversa Nov 1, 2026
b570594
SONARJAVA-7236 Report unused imports and assignments without effect a…
antonioaversa Nov 1, 2026
a1b85fa
SONARJAVA-7236 Evaluate the constant value of static final fields fro…
antonioaversa Nov 1, 2026
7d6fed3
SONARJAVA-7236 List the implicit default constructor among the member…
antonioaversa Nov 1, 2026
cd4a3a4
SONARJAVA-7236 Keep the written qualified name of unresolved annotati…
antonioaversa Nov 1, 2026
72fe0f1
SONARJAVA-7236 Mark local variables and parameters that are never rea…
antonioaversa Nov 1, 2026
dedca18
SONARJAVA-7236 Split the import usage check and the annotation type l…
antonioaversa Nov 1, 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 @@ -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