Skip to content

Commit bc6ef25

Browse files
committed
Add Java 16 support, fix some bugs
1 parent bddade2 commit bc6ef25

File tree

54 files changed

+714
-85
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+714
-85
lines changed

azure-pipelines.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ strategy:
88
matrix:
99
Java8:
1010
J_JAVA_MAJOR: '8'
11-
J_JDKS: '8 9 12 13 14 15'
11+
J_JDKS: '8 9 12 13 14 15 16'
1212
Java9:
1313
J_JAVA_MAJOR: '9'
14-
J_JDKS: '8 9 12 13 14 15'
14+
J_JDKS: '8 9 12 13 14 15 16'
1515
Java10:
1616
J_JAVA_MAJOR: '10'
17-
J_JDKS: '8 9 10 12 13 14 15'
17+
J_JDKS: '8 9 10 12 13 14 15 16'
1818
Java11:
1919
J_JAVA_MAJOR: '11'
20-
J_JDKS: '8 9 11 12 13 14 15'
20+
J_JDKS: '8 9 11 12 13 14 15 16'
2121
Java12:
2222
J_JAVA_MAJOR: '12'
23-
J_JDKS: '8 9 12 13 14 15'
23+
J_JDKS: '8 9 12 13 14 15 16'
2424
Java13:
2525
J_JAVA_MAJOR: '13'
26-
J_JDKS: '8 9 12 13 14 15'
26+
J_JDKS: '8 9 12 13 14 15 16'
2727
Java14:
2828
J_JAVA_MAJOR: '14'
29-
J_JDKS: '8 9 12 13 14 15'
29+
J_JDKS: '8 9 12 13 14 15 16'
3030
Java15:
3131
J_JAVA_MAJOR: '15'
32-
J_JDKS: '8 9 12 13 14 15'
32+
J_JDKS: '8 9 12 13 14 15 16'
3333
steps:
3434
- script: curl -L https://api.nest.saker.build/bundle/download/saker.build-v$(curl -s https://mirror.nest.saker.build/badges/saker.build/latest.txt) -o saker.build.jar
3535
displayName: 'Download saker.build'

impl-jdk14/src/main/saker/java/compiler/jdk/impl/compat/tree/TreeCompatUtil.java

+17
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@
1515
*/
1616
package saker.java.compiler.jdk.impl.compat.tree;
1717

18+
import javax.lang.model.element.Name;
19+
20+
import com.sun.source.tree.BindingPatternTree;
1821
import com.sun.source.tree.BreakTree;
1922
import com.sun.source.tree.ExpressionTree;
23+
import com.sun.source.tree.Tree;
24+
import com.sun.source.tree.VariableTree;
2025

2126
public class TreeCompatUtil {
2227
private TreeCompatUtil() {
@@ -26,4 +31,16 @@ private TreeCompatUtil() {
2631
public static ExpressionTree getBreakTreeValue(BreakTree tree) {
2732
return null;
2833
}
34+
35+
public static Tree getBindingPatternTreeType(BindingPatternTree tree) {
36+
return tree.getType();
37+
}
38+
39+
public static Name getBindingPatternTreeBinding(BindingPatternTree tree) {
40+
return tree.getBinding();
41+
}
42+
43+
public static VariableTree getBindingPatternTreeVariable(BindingPatternTree tree) {
44+
return null;
45+
}
2946
}

impl-jdk14/src/main/saker/java/compiler/jdk/impl/parser/usage/AbiUsageParser.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616
package saker.java.compiler.jdk.impl.parser.usage;
1717

18+
import com.sun.source.tree.BindingPatternTree;
19+
import com.sun.source.tree.Tree;
20+
import com.sun.source.util.TreePath;
1821
import com.sun.source.util.Trees;
1922

2023
import saker.java.compiler.impl.compile.signature.parser.ParserCache;
@@ -25,5 +28,4 @@ public class AbiUsageParser extends AbiUsageParser14 {
2528
public AbiUsageParser(Trees trees, String sourceversion, ParserCache cache) {
2629
super(trees, sourceversion, cache);
2730
}
28-
2931
}

impl-jdk15/src/main/saker/java/compiler/jdk/impl/compat/tree/TreeCompatUtil.java

+17
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@
1515
*/
1616
package saker.java.compiler.jdk.impl.compat.tree;
1717

18+
import javax.lang.model.element.Name;
19+
20+
import com.sun.source.tree.BindingPatternTree;
1821
import com.sun.source.tree.BreakTree;
1922
import com.sun.source.tree.ExpressionTree;
23+
import com.sun.source.tree.Tree;
24+
import com.sun.source.tree.VariableTree;
2025

2126
public class TreeCompatUtil {
2227
private TreeCompatUtil() {
@@ -26,4 +31,16 @@ private TreeCompatUtil() {
2631
public static ExpressionTree getBreakTreeValue(BreakTree tree) {
2732
return null;
2833
}
34+
35+
public static Tree getBindingPatternTreeType(BindingPatternTree tree) {
36+
return tree.getType();
37+
}
38+
39+
public static Name getBindingPatternTreeBinding(BindingPatternTree tree) {
40+
return tree.getBinding();
41+
}
42+
43+
public static VariableTree getBindingPatternTreeVariable(BindingPatternTree tree) {
44+
return null;
45+
}
2946
}

impl-jdk15/src/main/saker/java/compiler/jdk/impl/parser/usage/AbiUsageParser.java

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616
package saker.java.compiler.jdk.impl.parser.usage;
1717

18+
import com.sun.source.tree.BindingPatternTree;
19+
import com.sun.source.tree.Tree;
20+
import com.sun.source.util.TreePath;
1821
import com.sun.source.util.Trees;
1922

2023
import saker.java.compiler.impl.compile.signature.parser.ParserCache;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright (C) 2020 Bence Sipka
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, version 3.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
package saker.java.compiler.jdk.impl;
17+
18+
import java.util.Collections;
19+
import java.util.List;
20+
21+
import javax.lang.model.element.Element;
22+
import javax.lang.model.element.TypeElement;
23+
import javax.lang.model.type.TypeMirror;
24+
import javax.lang.model.util.Elements;
25+
import javax.tools.JavaFileManager;
26+
import javax.tools.StandardJavaFileManager;
27+
28+
import com.sun.source.tree.CompilationUnitTree;
29+
import com.sun.source.util.Trees;
30+
31+
import saker.build.thirdparty.saker.rmi.connection.RMITransferProperties;
32+
import saker.java.compiler.impl.compile.file.IncrementalDirectoryPaths;
33+
import saker.java.compiler.impl.compile.handler.info.RealizedSignatureData;
34+
import saker.java.compiler.impl.compile.handler.invoker.CompilationContextInformation;
35+
import saker.java.compiler.impl.compile.signature.parser.ParserCache;
36+
import saker.java.compiler.jdk.impl.incremental.model.IncrementalElementsTypes;
37+
import saker.java.compiler.jdk.impl.parser.signature.CompilationUnitSignatureParser;
38+
import saker.java.compiler.jdk.impl.parser.usage.AbiUsageParser;
39+
import saker.java.compiler.util12.impl.Java12LanguageUtils;
40+
import saker.java.compiler.util13.impl.Java13LanguageUtils;
41+
import saker.java.compiler.util14.impl.Java14LanguageUtils;
42+
import saker.java.compiler.util15.impl.Java15LanguageUtils;
43+
import saker.java.compiler.util8.impl.Java8LanguageUtils;
44+
import saker.java.compiler.util9.impl.Java9LanguageUtils;
45+
import saker.java.compiler.util9.impl.file.IncrementalJavaFileManager9;
46+
47+
public class JavaCompilationUtils {
48+
private JavaCompilationUtils() {
49+
throw new UnsupportedOperationException();
50+
}
51+
52+
public static CompilationUnitSignatureParser createSignatureParser(Trees trees, String srcver, ParserCache cache) {
53+
return new CompilationUnitSignatureParser(trees, srcver, cache);
54+
}
55+
56+
public static AbiUsageParser createAbiUsageParser(Trees trees, String srcver, ParserCache cache) {
57+
return new AbiUsageParser(trees, srcver, cache);
58+
}
59+
60+
public static IncrementalElementsTypes createElementsTypes(Elements realelements, Object javacsync,
61+
CompilationContextInformation context, ParserCache cache) {
62+
return new IncrementalElementsTypes(realelements, javacsync, cache, context);
63+
}
64+
65+
public static RealizedSignatureData getRealizedSignatures(CompilationUnitTree unit, Trees trees, String filename,
66+
ParserCache cache) {
67+
return Java9LanguageUtils.getRealizedSignatures(unit, trees, filename, cache);
68+
}
69+
70+
public static JavaFileManager createFileManager(StandardJavaFileManager stdfilemanager,
71+
IncrementalDirectoryPaths directorypaths) {
72+
return new IncrementalJavaFileManager9(stdfilemanager, directorypaths);
73+
}
74+
75+
public static void applyRMIProperties(RMITransferProperties.Builder builder) {
76+
Java8LanguageUtils.applyRMIProperties(builder);
77+
Java9LanguageUtils.applyRMIProperties(builder);
78+
Java12LanguageUtils.applyRMIProperties(builder);
79+
Java13LanguageUtils.applyRMIProperties(builder);
80+
Java14LanguageUtils.applyRMIProperties(builder);
81+
Java15LanguageUtils.applyRMIProperties(builder);
82+
}
83+
84+
public static String getModuleNameOf(Element elem) {
85+
return Java9LanguageUtils.getModuleNameOf(elem);
86+
}
87+
88+
public static List<? extends TypeMirror> getPermittedSubclasses(TypeElement elem) {
89+
return elem.getPermittedSubclasses();
90+
}
91+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (C) 2020 Bence Sipka
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, version 3.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
package saker.java.compiler.jdk.impl.compat.element;
17+
18+
import saker.java.compiler.util14.impl.compat.element.DefaultedElementVisitor14;
19+
20+
public interface DefaultedElementVisitor<R, P> extends DefaultedElementVisitor14<R, P> {
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (C) 2020 Bence Sipka
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, version 3.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
package saker.java.compiler.jdk.impl.compat.tree;
17+
18+
import saker.java.compiler.util14.impl.tree.DefaultedTreeVisitor14;
19+
20+
public interface DefaultedTreeVisitor<R, P> extends DefaultedTreeVisitor14<R, P> {
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (C) 2020 Bence Sipka
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, version 3.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
package saker.java.compiler.jdk.impl.compat.tree;
17+
18+
import javax.lang.model.element.Name;
19+
20+
import com.sun.source.tree.BindingPatternTree;
21+
import com.sun.source.tree.BreakTree;
22+
import com.sun.source.tree.ExpressionTree;
23+
import com.sun.source.tree.Tree;
24+
import com.sun.source.tree.VariableTree;
25+
26+
public class TreeCompatUtil {
27+
private TreeCompatUtil() {
28+
throw new UnsupportedOperationException();
29+
}
30+
31+
public static ExpressionTree getBreakTreeValue(BreakTree tree) {
32+
return null;
33+
}
34+
35+
public static Tree getBindingPatternTreeType(BindingPatternTree tree) {
36+
return null;
37+
}
38+
39+
public static Name getBindingPatternTreeBinding(BindingPatternTree tree) {
40+
return null;
41+
}
42+
43+
public static VariableTree getBindingPatternTreeVariable(BindingPatternTree tree) {
44+
return tree.getVariable();
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (C) 2020 Bence Sipka
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, version 3.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
package saker.java.compiler.jdk.impl.compat.type;
17+
18+
import javax.lang.model.type.TypeMirror;
19+
import javax.lang.model.type.UnknownTypeException;
20+
21+
import saker.java.compiler.impl.compat.type.TypeVisitorCompat;
22+
23+
public interface DefaultedTypeVisitor<R, P> extends TypeVisitorCompat<R, P> {
24+
@Override
25+
public default R visitUnknown(TypeMirror t, P p) {
26+
throw new UnknownTypeException(t, p);
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (C) 2020 Bence Sipka
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, version 3.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
package saker.java.compiler.jdk.impl.incremental.model;
17+
18+
import javax.lang.model.util.Elements;
19+
20+
import saker.java.compiler.impl.compile.handler.invoker.CompilationContextInformation;
21+
import saker.java.compiler.impl.compile.signature.parser.ParserCache;
22+
import saker.java.compiler.util15.impl.model.IncrementalElementsTypes15;
23+
24+
public class IncrementalElementsTypes extends IncrementalElementsTypes15 {
25+
public IncrementalElementsTypes(Elements realelements, Object javacsync, ParserCache cache,
26+
CompilationContextInformation context) {
27+
super(realelements, javacsync, cache, context);
28+
}
29+
}

0 commit comments

Comments
 (0)