Fix build under JDK9+

This commit is contained in:
Alexey Andreev konsoletyper@gmail.com 2018-03-28 22:54:55 +03:00
parent 0d1cb85067
commit fe47fe19ce
9 changed files with 55 additions and 111 deletions

View File

@ -115,58 +115,6 @@
</instructions> </instructions>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>generate-classlib-doc</id>
<goals>
<goal>java</goal>
</goals>
<phase>process-test-classes</phase>
<configuration>
<mainClass>org.teavm.classlib.impl.report.JCLComparisonBuilder</mainClass>
<arguments>
<argument>java.lang</argument>
<argument>java.lang.annotation</argument>
<argument>java.lang.reflect</argument>
<argument>java.io</argument>
<argument>java.math</argument>
<argument>java.net</argument>
<argument>java.nio</argument>
<argument>java.nio.charset</argument>
<argument>java.text</argument>
<argument>java.security</argument>
<argument>java.util</argument>
<argument>java.util.concurrent</argument>
<argument>java.util.function</argument>
<argument>java.util.logging</argument>
<argument>java.util.regex</argument>
<argument>java.util.zip</argument>
<argument>java.util.jar</argument>
<argument>java.util.stream</argument>
<argument>-output</argument>
<argument>${project.build.directory}/jcl-report</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>generate-tz-cache</id>
<goals>
<goal>java</goal>
</goals>
<phase>process-classes</phase>
<configuration>
<mainClass>org.teavm.classlib.impl.tz.TimeZoneCache</mainClass>
<arguments>
<argument>${project.build.directory}/classes/org/teavm/classlib/impl/tz/cache</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>

View File

@ -45,27 +45,34 @@ public class WasmStringPool {
} }
public int getStringPointer(String value) { public int getStringPointer(String value) {
return stringMap.computeIfAbsent(value, str -> { Integer pointer = stringMap.get(value);
DataArray charactersType = new DataArray(DataPrimitives.SHORT, str.length()); if (pointer == null) {
DataStructure wrapperType = new DataStructure((byte) 0, arrayHeaderType, charactersType); pointer = generateStringPointer(value);
DataValue wrapper = wrapperType.createValue(); stringMap.put(value, pointer);
DataValue header = wrapper.getValue(0); }
DataValue characters = wrapper.getValue(1); return pointer;
}
int classPointer = classGenerator.getClassPointer(ValueType.arrayOf(ValueType.CHARACTER)); private int generateStringPointer(String value) {
header.setInt(0, (classPointer >>> 3) | RuntimeObject.GC_MARKED); DataArray charactersType = new DataArray(DataPrimitives.SHORT, value.length());
header.setInt(2, str.length()); DataStructure wrapperType = new DataStructure((byte) 0, arrayHeaderType, charactersType);
for (int i = 0; i < str.length(); ++i) { DataValue wrapper = wrapperType.createValue();
characters.setShort(i, (short) str.charAt(i)); DataValue header = wrapper.getValue(0);
} DataValue characters = wrapper.getValue(1);
DataValue stringObject = stringType.createValue(); int classPointer = classGenerator.getClassPointer(ValueType.arrayOf(ValueType.CHARACTER));
int stringPointer = binaryWriter.append(stringObject); header.setInt(0, (classPointer >>> 3) | RuntimeObject.GC_MARKED);
classPointer = classGenerator.getClassPointer(ValueType.object(String.class.getName())); header.setInt(2, value.length());
stringObject.setInt(0, (classPointer >>> 3) | RuntimeObject.GC_MARKED); for (int i = 0; i < value.length(); ++i) {
stringObject.setAddress(2, binaryWriter.append(wrapper)); characters.setShort(i, (short) value.charAt(i));
}
return stringPointer; DataValue stringObject = stringType.createValue();
}); int stringPointer = binaryWriter.append(stringObject);
classPointer = classGenerator.getClassPointer(ValueType.object(String.class.getName()));
stringObject.setInt(0, (classPointer >>> 3) | RuntimeObject.GC_MARKED);
stringObject.setAddress(2, binaryWriter.append(wrapper));
return stringPointer;
} }
} }

View File

@ -16,7 +16,6 @@
package org.teavm.jso.dom.html; package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty; import org.teavm.jso.JSProperty;
import org.w3c.dom.html.HTMLFormElement;
public interface HTMLButtonElement extends HTMLElement { public interface HTMLButtonElement extends HTMLElement {
String TYPE_BUTTON = "button"; String TYPE_BUTTON = "button";
@ -38,7 +37,7 @@ public interface HTMLButtonElement extends HTMLElement {
void setDisabled(boolean disabled); void setDisabled(boolean disabled);
@JSProperty @JSProperty
HTMLFormElement getForm(); HTMLElement getForm();
@JSProperty @JSProperty
String getName(); String getName();

View File

@ -170,7 +170,12 @@ class JSObjectClassTransformer implements ClassHolderTransformer {
} }
private ExposedClass getExposedClass(String name) { private ExposedClass getExposedClass(String name) {
return exposedClasses.computeIfAbsent(name, this::createExposedClass); ExposedClass cls = exposedClasses.get(name);
if (cls == null) {
cls = createExposedClass(name);
exposedClasses.put(name, cls);
}
return cls;
} }
private ExposedClass createExposedClass(String name) { private ExposedClass createExposedClass(String name) {

View File

@ -34,7 +34,12 @@ class JSTypeHelper {
} }
public boolean isJavaScriptClass(String className) { public boolean isJavaScriptClass(String className) {
return knownJavaScriptClasses.computeIfAbsent(className, k -> examineIfJavaScriptClass(className)); Boolean isJsClass = knownJavaScriptClasses.get(className);
if (isJsClass == null) {
isJsClass = examineIfJavaScriptClass(className);
knownJavaScriptClasses.put(className, isJsClass);
}
return isJsClass;
} }
public boolean isJavaScriptImplementation(String className) { public boolean isJavaScriptImplementation(String className) {

View File

@ -52,7 +52,12 @@ public class MetaprogrammingClassLoader extends ClassLoader {
} }
public boolean isCompileTimeClass(String name) { public boolean isCompileTimeClass(String name) {
return compileTimeClasses.computeIfAbsent(name, n -> checkIfCompileTime(n)); Boolean result = compileTimeClasses.get(name);
if (result == null) {
result = checkIfCompileTime(name);
compileTimeClasses.put(name, result);
}
return result;
} }
private boolean checkIfCompileTime(String name) { private boolean checkIfCompileTime(String name) {

10
pom.xml
View File

@ -203,7 +203,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version> <version>3.7.0</version>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
@ -212,7 +212,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version> <version>3.0.0</version>
<executions> <executions>
<execution> <execution>
<id>build-javadoc</id> <id>build-javadoc</id>
@ -230,7 +230,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version> <version>3.0.1</version>
<executions> <executions>
<execution> <execution>
<id>attach-sources</id> <id>attach-sources</id>
@ -244,7 +244,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version> <version>2.21.0</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -278,7 +278,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>2.6</version> <version>3.0.2</version>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>

View File

@ -29,7 +29,8 @@
<description>Compares performance of the JavaScript code produced by TeaVM and GWT</description> <description>Compares performance of the JavaScript code produced by TeaVM and GWT</description>
<properties> <properties>
<bck2brwsr.version>0.17</bck2brwsr.version> <bck2brwsr.version>0.22</bck2brwsr.version>
<gwt.version>2.8.2</gwt.version>
</properties> </properties>
<dependencies> <dependencies>
@ -72,7 +73,7 @@
<dependency> <dependency>
<groupId>com.google.gwt</groupId> <groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId> <artifactId>gwt-user</artifactId>
<version>2.8.0</version> <version>${gwt.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -172,7 +173,7 @@
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId> <artifactId>gwt-maven-plugin</artifactId>
<version>2.8.0</version> <version>${gwt.version}</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@ -187,32 +188,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apidesign.bck2brwsr</groupId>
<artifactId>bck2brwsr-maven-plugin</artifactId>
<version>${bck2brwsr.version}</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>aot</goal>
</goals>
</execution>
</executions>
<configuration>
<obfuscation>NONE</obfuscation>
<classPathPrefix>lib</classPathPrefix>
<mainJavaScript>${project.build.directory}/generated/js/b2b-benchmark.js</mainJavaScript>
<vm>${project.build.directory}/generated/js/bck2brwsr.js</vm>
<exports>
<export>org.teavm.samples.benchmark.htmljava.BenchmarkStarter</export>
<export>org/jbox2d/collision/shapes/</export>
<export>org/jbox2d/common/</export>
<export>org/jbox2d/dynamics/</export>
<export>org/jbox2d/dynamics/joints/</export>
</exports>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>

View File

@ -30,7 +30,7 @@
<description>A sample application written in Kotlin and compiled by TeaVM</description> <description>A sample application written in Kotlin and compiled by TeaVM</description>
<properties> <properties>
<kotlin.version>1.1.2-5</kotlin.version> <kotlin.version>1.2.31</kotlin.version>
</properties> </properties>
<dependencies> <dependencies>