Skip to content

Commit 55a492a

Browse files
committed
Support Java 15
1 parent 5bd4059 commit 55a492a

73 files changed

Lines changed: 1514 additions & 90 deletions

File tree

Some content is hidden

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

‎impl-jdk12/src/main/saker/java/compiler/jdk/impl/JavaCompilationUtils.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
package saker.java.compiler.jdk.impl;
1717

1818
import java.util.Collection;
19+
import java.util.Collections;
20+
import java.util.List;
1921
import java.util.Map;
2022

2123
import javax.lang.model.element.Element;
2224
import javax.lang.model.element.ElementKind;
25+
import javax.lang.model.element.TypeElement;
26+
import javax.lang.model.type.TypeMirror;
2327
import javax.lang.model.util.Elements;
2428
import javax.tools.JavaFileManager;
2529
import javax.tools.StandardJavaFileManager;
@@ -80,6 +84,7 @@ public static String getModuleNameOf(Element elem) {
8084
return Java9LanguageUtils.getModuleNameOf(elem);
8185
}
8286

83-
public static void addTreeKindToElementKindMapping(Map<Tree.Kind, ElementKind> map) {
87+
public static List<? extends TypeMirror> getPermittedSubclasses(TypeElement elem) {
88+
return Collections.emptyList();
8489
}
8590
}

‎impl-jdk13/src/main/saker/java/compiler/jdk/impl/JavaCompilationUtils.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
package saker.java.compiler.jdk.impl;
1717

1818
import java.util.Collection;
19+
import java.util.Collections;
20+
import java.util.List;
1921
import java.util.Map;
2022

2123
import javax.lang.model.element.Element;
2224
import javax.lang.model.element.ElementKind;
25+
import javax.lang.model.element.TypeElement;
26+
import javax.lang.model.type.TypeMirror;
2327
import javax.lang.model.util.Elements;
2428
import javax.tools.JavaFileManager;
2529
import javax.tools.StandardJavaFileManager;
@@ -79,6 +83,7 @@ public static String getModuleNameOf(Element elem) {
7983
return Java9LanguageUtils.getModuleNameOf(elem);
8084
}
8185

82-
public static void addTreeKindToElementKindMapping(Map<Tree.Kind, ElementKind> map) {
86+
public static List<? extends TypeMirror> getPermittedSubclasses(TypeElement elem) {
87+
return Collections.emptyList();
8388
}
8489
}

‎impl-jdk14/src/main/saker/java/compiler/jdk/impl/JavaCompilationUtils.java‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@
1515
*/
1616
package saker.java.compiler.jdk.impl;
1717

18+
import java.util.Collections;
19+
import java.util.List;
1820
import java.util.Map;
1921

2022
import javax.lang.model.element.Element;
2123
import javax.lang.model.element.ElementKind;
24+
import javax.lang.model.element.TypeElement;
25+
import javax.lang.model.type.TypeMirror;
2226
import javax.lang.model.util.Elements;
2327
import javax.tools.JavaFileManager;
2428
import javax.tools.StandardJavaFileManager;
@@ -82,7 +86,7 @@ public static String getModuleNameOf(Element elem) {
8286
return Java9LanguageUtils.getModuleNameOf(elem);
8387
}
8488

85-
public static void addTreeKindToElementKindMapping(Map<Tree.Kind, ElementKind> map) {
86-
Java14LanguageUtils.addTreeKindToElementKindMapping(map);
89+
public static List<? extends TypeMirror> getPermittedSubclasses(TypeElement elem) {
90+
return Collections.emptyList();
8791
}
8892
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
import com.sun.source.util.Trees;
1919

2020
import saker.java.compiler.impl.compile.signature.parser.ParserCache;
21-
import saker.java.compiler.util13.impl.parser.usage.AbiUsageParser13;
21+
import saker.java.compiler.util14.impl.parser.usage.AbiUsageParser14;
2222

23-
public class AbiUsageParser extends AbiUsageParser13 {
23+
public class AbiUsageParser extends AbiUsageParser14 {
2424

2525
public AbiUsageParser(Trees trees, String sourceversion, ParserCache cache) {
2626
super(trees, sourceversion, cache);
Lines changed: 91 additions & 0 deletions
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+
}
Lines changed: 21 additions & 0 deletions
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+
}
Lines changed: 21 additions & 0 deletions
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+
}
Lines changed: 29 additions & 0 deletions
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.compat.tree;
17+
18+
import com.sun.source.tree.BreakTree;
19+
import com.sun.source.tree.ExpressionTree;
20+
21+
public class TreeCompatUtil {
22+
private TreeCompatUtil() {
23+
throw new UnsupportedOperationException();
24+
}
25+
26+
public static ExpressionTree getBreakTreeValue(BreakTree tree) {
27+
return null;
28+
}
29+
}
Lines changed: 28 additions & 0 deletions
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+
}
Lines changed: 29 additions & 0 deletions
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)