Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use embedded standalone compiler from Java 11 #770

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions transpiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.kohlschutter.jdk.compiler</groupId>
<artifactId>standalone-jdk11</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
import org.jsweet.transpiler.util.AbstractTreeScanner;
import org.jsweet.transpiler.util.Util;

import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.Tree;
import com.sun.source.util.Trees;
import standalone.com.sun.source.tree.CompilationUnitTree;
import standalone.com.sun.source.tree.MethodInvocationTree;
import standalone.com.sun.source.tree.MethodTree;
import standalone.com.sun.source.tree.Tree;
import standalone.com.sun.source.util.Trees;

/**
* This AST scanner performs propagates async methods automatically.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@

import org.jsweet.transpiler.util.Util;

import com.sun.source.tree.ArrayAccessTree;
import com.sun.source.tree.AssignmentTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.CompoundAssignmentTree;
import com.sun.source.tree.Tree;
import com.sun.source.tree.UnaryTree;
import com.sun.source.util.TreeScanner;
import com.sun.source.util.Trees;
import standalone.com.sun.source.tree.ArrayAccessTree;
import standalone.com.sun.source.tree.AssignmentTree;
import standalone.com.sun.source.tree.CompilationUnitTree;
import standalone.com.sun.source.tree.CompoundAssignmentTree;
import standalone.com.sun.source.tree.Tree;
import standalone.com.sun.source.tree.UnaryTree;
import standalone.com.sun.source.util.TreeScanner;
import standalone.com.sun.source.util.Trees;

/**
* This AST scanner analyzes local variables to determine if they are locally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
import org.jsweet.transpiler.util.AbstractTreeScanner;
import org.jsweet.transpiler.util.Util;

import com.sun.source.tree.BlockTree;
import com.sun.source.tree.ClassTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.LiteralTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.Tree;
import com.sun.source.tree.VariableTree;
import com.sun.source.tree.WildcardTree;
import com.sun.source.util.Trees;
import standalone.com.sun.source.tree.BlockTree;
import standalone.com.sun.source.tree.ClassTree;
import standalone.com.sun.source.tree.CompilationUnitTree;
import standalone.com.sun.source.tree.LiteralTree;
import standalone.com.sun.source.tree.MethodTree;
import standalone.com.sun.source.tree.Tree;
import standalone.com.sun.source.tree.VariableTree;
import standalone.com.sun.source.tree.WildcardTree;
import standalone.com.sun.source.util.Trees;

/**
* This AST scanner performs global analysis and fills up the context with
Expand Down
28 changes: 14 additions & 14 deletions transpiler/src/main/java/org/jsweet/transpiler/JSweetContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,20 @@
import org.jsweet.transpiler.util.DirectedGraph;
import org.jsweet.transpiler.util.Util;

import com.sun.source.tree.AssignmentTree;
import com.sun.source.tree.BlockTree;
import com.sun.source.tree.ClassTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.ExpressionStatementTree;
import com.sun.source.tree.MemberSelectTree;
import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.NewClassTree;
import com.sun.source.tree.StatementTree;
import com.sun.source.tree.Tree;
import com.sun.source.tree.VariableTree;
import com.sun.source.tree.WildcardTree;
import com.sun.source.util.Trees;
import standalone.com.sun.source.tree.AssignmentTree;
import standalone.com.sun.source.tree.BlockTree;
import standalone.com.sun.source.tree.ClassTree;
import standalone.com.sun.source.tree.CompilationUnitTree;
import standalone.com.sun.source.tree.ExpressionStatementTree;
import standalone.com.sun.source.tree.MemberSelectTree;
import standalone.com.sun.source.tree.MethodInvocationTree;
import standalone.com.sun.source.tree.MethodTree;
import standalone.com.sun.source.tree.NewClassTree;
import standalone.com.sun.source.tree.StatementTree;
import standalone.com.sun.source.tree.Tree;
import standalone.com.sun.source.tree.VariableTree;
import standalone.com.sun.source.tree.WildcardTree;
import standalone.com.sun.source.util.Trees;

/**
* The transpiler context, which is an extension of the Java compiler context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.jsweet.transpiler.extension.PrinterAdapter;
import org.jsweet.transpiler.extension.RemoveJavaDependenciesAdapter;

import com.sun.source.tree.CompilationUnitTree;
import standalone.com.sun.source.tree.CompilationUnitTree;

/**
* The factory object is the one creating instances for key JSweet transpilation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
import com.google.debugging.sourcemap.SourceMapGeneratorV3;
import com.google.debugging.sourcemap.SourceMapping;
import com.google.gson.Gson;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.Tree;
import standalone.com.sun.source.tree.CompilationUnitTree;
import standalone.com.sun.source.tree.Tree;

/**
* The actual JSweet transpiler.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,60 +88,60 @@
import org.jsweet.transpiler.util.JSDoc;
import org.jsweet.transpiler.util.Util;

import com.sun.source.tree.AnnotationTree;
import com.sun.source.tree.ArrayAccessTree;
import com.sun.source.tree.ArrayTypeTree;
import com.sun.source.tree.AssertTree;
import com.sun.source.tree.AssignmentTree;
import com.sun.source.tree.BinaryTree;
import com.sun.source.tree.BlockTree;
import com.sun.source.tree.BreakTree;
import com.sun.source.tree.CaseTree;
import com.sun.source.tree.CatchTree;
import com.sun.source.tree.ClassTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.CompoundAssignmentTree;
import com.sun.source.tree.ConditionalExpressionTree;
import com.sun.source.tree.ContinueTree;
import com.sun.source.tree.DoWhileLoopTree;
import com.sun.source.tree.EnhancedForLoopTree;
import com.sun.source.tree.ExpressionStatementTree;
import com.sun.source.tree.ExpressionTree;
import com.sun.source.tree.ForLoopTree;
import com.sun.source.tree.IdentifierTree;
import com.sun.source.tree.IfTree;
import com.sun.source.tree.ImportTree;
import com.sun.source.tree.InstanceOfTree;
import com.sun.source.tree.IntersectionTypeTree;
import com.sun.source.tree.LabeledStatementTree;
import com.sun.source.tree.LambdaExpressionTree;
import com.sun.source.tree.LiteralTree;
import com.sun.source.tree.MemberReferenceTree;
import com.sun.source.tree.MemberSelectTree;
import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.NewArrayTree;
import com.sun.source.tree.NewClassTree;
import com.sun.source.tree.ParameterizedTypeTree;
import com.sun.source.tree.ParenthesizedTree;
import com.sun.source.tree.PrimitiveTypeTree;
import com.sun.source.tree.ReturnTree;
import com.sun.source.tree.StatementTree;
import com.sun.source.tree.SwitchTree;
import com.sun.source.tree.SynchronizedTree;
import com.sun.source.tree.ThrowTree;
import com.sun.source.tree.Tree;
import com.sun.source.tree.Tree.Kind;
import com.sun.source.tree.TryTree;
import com.sun.source.tree.TypeCastTree;
import com.sun.source.tree.TypeParameterTree;
import com.sun.source.tree.UnaryTree;
import com.sun.source.tree.VariableTree;
import com.sun.source.tree.WhileLoopTree;
import com.sun.source.tree.WildcardTree;
import com.sun.source.util.TreePath;
import com.sun.source.util.TreeScanner;
import com.sun.source.util.Trees;
import standalone.com.sun.source.tree.AnnotationTree;
import standalone.com.sun.source.tree.ArrayAccessTree;
import standalone.com.sun.source.tree.ArrayTypeTree;
import standalone.com.sun.source.tree.AssertTree;
import standalone.com.sun.source.tree.AssignmentTree;
import standalone.com.sun.source.tree.BinaryTree;
import standalone.com.sun.source.tree.BlockTree;
import standalone.com.sun.source.tree.BreakTree;
import standalone.com.sun.source.tree.CaseTree;
import standalone.com.sun.source.tree.CatchTree;
import standalone.com.sun.source.tree.ClassTree;
import standalone.com.sun.source.tree.CompilationUnitTree;
import standalone.com.sun.source.tree.CompoundAssignmentTree;
import standalone.com.sun.source.tree.ConditionalExpressionTree;
import standalone.com.sun.source.tree.ContinueTree;
import standalone.com.sun.source.tree.DoWhileLoopTree;
import standalone.com.sun.source.tree.EnhancedForLoopTree;
import standalone.com.sun.source.tree.ExpressionStatementTree;
import standalone.com.sun.source.tree.ExpressionTree;
import standalone.com.sun.source.tree.ForLoopTree;
import standalone.com.sun.source.tree.IdentifierTree;
import standalone.com.sun.source.tree.IfTree;
import standalone.com.sun.source.tree.ImportTree;
import standalone.com.sun.source.tree.InstanceOfTree;
import standalone.com.sun.source.tree.IntersectionTypeTree;
import standalone.com.sun.source.tree.LabeledStatementTree;
import standalone.com.sun.source.tree.LambdaExpressionTree;
import standalone.com.sun.source.tree.LiteralTree;
import standalone.com.sun.source.tree.MemberReferenceTree;
import standalone.com.sun.source.tree.MemberSelectTree;
import standalone.com.sun.source.tree.MethodInvocationTree;
import standalone.com.sun.source.tree.MethodTree;
import standalone.com.sun.source.tree.NewArrayTree;
import standalone.com.sun.source.tree.NewClassTree;
import standalone.com.sun.source.tree.ParameterizedTypeTree;
import standalone.com.sun.source.tree.ParenthesizedTree;
import standalone.com.sun.source.tree.PrimitiveTypeTree;
import standalone.com.sun.source.tree.ReturnTree;
import standalone.com.sun.source.tree.StatementTree;
import standalone.com.sun.source.tree.SwitchTree;
import standalone.com.sun.source.tree.SynchronizedTree;
import standalone.com.sun.source.tree.ThrowTree;
import standalone.com.sun.source.tree.Tree;
import standalone.com.sun.source.tree.Tree.Kind;
import standalone.com.sun.source.tree.TryTree;
import standalone.com.sun.source.tree.TypeCastTree;
import standalone.com.sun.source.tree.TypeParameterTree;
import standalone.com.sun.source.tree.UnaryTree;
import standalone.com.sun.source.tree.VariableTree;
import standalone.com.sun.source.tree.WhileLoopTree;
import standalone.com.sun.source.tree.WildcardTree;
import standalone.com.sun.source.util.TreePath;
import standalone.com.sun.source.util.TreeScanner;
import standalone.com.sun.source.util.Trees;

/**
* This is a TypeScript printer for translating the Java AST to a TypeScript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;

import org.apache.log4j.Logger;
import org.jsweet.JSweetConfig;
import org.jsweet.transpiler.util.ConsoleTranspilationHandler;
import org.jsweet.transpiler.util.Util;

import com.sun.source.util.JavacTask;
import com.sun.source.util.Trees;
import com.kohlschutter.jdk.standaloneutil.ToolProvider;

import standalone.com.sun.source.util.JavacTask;
import standalone.com.sun.source.util.Trees;

public class JavaCompilationComponents implements AutoCloseable {

Expand Down
22 changes: 11 additions & 11 deletions transpiler/src/main/java/org/jsweet/transpiler/OverloadScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@
import org.jsweet.transpiler.util.AbstractTreeScanner;
import org.jsweet.transpiler.util.Util;

import com.sun.source.tree.ClassTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.ExpressionStatementTree;
import com.sun.source.tree.ExpressionTree;
import com.sun.source.tree.IdentifierTree;
import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.ReturnTree;
import com.sun.source.tree.StatementTree;
import com.sun.source.tree.Tree;
import com.sun.source.util.Trees;
import standalone.com.sun.source.tree.ClassTree;
import standalone.com.sun.source.tree.CompilationUnitTree;
import standalone.com.sun.source.tree.ExpressionStatementTree;
import standalone.com.sun.source.tree.ExpressionTree;
import standalone.com.sun.source.tree.IdentifierTree;
import standalone.com.sun.source.tree.MethodInvocationTree;
import standalone.com.sun.source.tree.MethodTree;
import standalone.com.sun.source.tree.ReturnTree;
import standalone.com.sun.source.tree.StatementTree;
import standalone.com.sun.source.tree.Tree;
import standalone.com.sun.source.util.Trees;

/**
* This AST scanner detects method overloads and gather them into
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import org.jsweet.transpiler.util.Position;

import com.sun.source.tree.Tree;
import standalone.com.sun.source.tree.Tree;

/**
* A non-mutable position in a source file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
import org.jsweet.transpiler.util.ReferenceGrabber;
import org.jsweet.transpiler.util.Util;

import com.sun.source.tree.BlockTree;
import com.sun.source.tree.ClassTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.ImportTree;
import com.sun.source.tree.PackageTree;
import com.sun.source.tree.Tree;
import com.sun.source.tree.VariableTree;
import com.sun.source.util.TreePathScanner;
import com.sun.source.util.Trees;
import standalone.com.sun.source.tree.BlockTree;
import standalone.com.sun.source.tree.ClassTree;
import standalone.com.sun.source.tree.CompilationUnitTree;
import standalone.com.sun.source.tree.ImportTree;
import standalone.com.sun.source.tree.PackageTree;
import standalone.com.sun.source.tree.Tree;
import standalone.com.sun.source.tree.VariableTree;
import standalone.com.sun.source.util.TreePathScanner;
import standalone.com.sun.source.util.Trees;

/**
* This AST scanner creates a class dependency graph for each package, based on
Expand Down
14 changes: 7 additions & 7 deletions transpiler/src/main/java/org/jsweet/transpiler/TypeChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
import org.jsweet.transpiler.util.AbstractTreePrinter;
import org.jsweet.transpiler.util.Util;

import com.sun.source.tree.ArrayTypeTree;
import com.sun.source.tree.AssignmentTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.MemberSelectTree;
import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.tree.Tree;
import com.sun.source.tree.VariableTree;
import standalone.com.sun.source.tree.ArrayTypeTree;
import standalone.com.sun.source.tree.AssignmentTree;
import standalone.com.sun.source.tree.CompilationUnitTree;
import standalone.com.sun.source.tree.MemberSelectTree;
import standalone.com.sun.source.tree.MethodInvocationTree;
import standalone.com.sun.source.tree.Tree;
import standalone.com.sun.source.tree.VariableTree;

/**
* This helper class performs extra type checking for the JSweet transpiler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.jsweet.transpiler.util.MainMethodFinder;
import org.jsweet.transpiler.util.MainMethodFinder.MainMethodFoundSignal;

import com.sun.source.tree.CompilationUnitTree;
import standalone.com.sun.source.tree.CompilationUnitTree;

public class JavaEval extends RuntimeEval {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@
import org.jsweet.transpiler.model.support.MethodInvocationElementSupport;
import org.jsweet.transpiler.util.Util;

import com.sun.source.tree.ClassTree;
import com.sun.source.tree.EnhancedForLoopTree;
import com.sun.source.tree.ExpressionTree;
import com.sun.source.tree.IdentifierTree;
import com.sun.source.tree.ImportTree;
import com.sun.source.tree.MemberSelectTree;
import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.tree.NewClassTree;
import com.sun.source.tree.ParameterizedTypeTree;
import com.sun.source.tree.Tree;
import com.sun.source.tree.TypeCastTree;
import standalone.com.sun.source.tree.ClassTree;
import standalone.com.sun.source.tree.EnhancedForLoopTree;
import standalone.com.sun.source.tree.ExpressionTree;
import standalone.com.sun.source.tree.IdentifierTree;
import standalone.com.sun.source.tree.ImportTree;
import standalone.com.sun.source.tree.MemberSelectTree;
import standalone.com.sun.source.tree.MethodInvocationTree;
import standalone.com.sun.source.tree.NewClassTree;
import standalone.com.sun.source.tree.ParameterizedTypeTree;
import standalone.com.sun.source.tree.Tree;
import standalone.com.sun.source.tree.TypeCastTree;

/**
* This is an adapter for the TypeScript code generator. It overrides the
Expand Down
Loading
Loading