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>
</configuration>
</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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>

View File

@ -45,27 +45,34 @@ public class WasmStringPool {
}
public int getStringPointer(String value) {
return stringMap.computeIfAbsent(value, str -> {
DataArray charactersType = new DataArray(DataPrimitives.SHORT, str.length());
DataStructure wrapperType = new DataStructure((byte) 0, arrayHeaderType, charactersType);
DataValue wrapper = wrapperType.createValue();
DataValue header = wrapper.getValue(0);
DataValue characters = wrapper.getValue(1);
Integer pointer = stringMap.get(value);
if (pointer == null) {
pointer = generateStringPointer(value);
stringMap.put(value, pointer);
}
return pointer;
}
int classPointer = classGenerator.getClassPointer(ValueType.arrayOf(ValueType.CHARACTER));
header.setInt(0, (classPointer >>> 3) | RuntimeObject.GC_MARKED);
header.setInt(2, str.length());
for (int i = 0; i < str.length(); ++i) {
characters.setShort(i, (short) str.charAt(i));
}
private int generateStringPointer(String value) {
DataArray charactersType = new DataArray(DataPrimitives.SHORT, value.length());
DataStructure wrapperType = new DataStructure((byte) 0, arrayHeaderType, charactersType);
DataValue wrapper = wrapperType.createValue();
DataValue header = wrapper.getValue(0);
DataValue characters = wrapper.getValue(1);
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));
int classPointer = classGenerator.getClassPointer(ValueType.arrayOf(ValueType.CHARACTER));
header.setInt(0, (classPointer >>> 3) | RuntimeObject.GC_MARKED);
header.setInt(2, value.length());
for (int i = 0; i < value.length(); ++i) {
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;
import org.teavm.jso.JSProperty;
import org.w3c.dom.html.HTMLFormElement;
public interface HTMLButtonElement extends HTMLElement {
String TYPE_BUTTON = "button";
@ -38,7 +37,7 @@ public interface HTMLButtonElement extends HTMLElement {
void setDisabled(boolean disabled);
@JSProperty
HTMLFormElement getForm();
HTMLElement getForm();
@JSProperty
String getName();

View File

@ -170,7 +170,12 @@ class JSObjectClassTransformer implements ClassHolderTransformer {
}
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) {

View File

@ -34,7 +34,12 @@ class JSTypeHelper {
}
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) {

View File

@ -52,7 +52,12 @@ public class MetaprogrammingClassLoader extends ClassLoader {
}
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) {

10
pom.xml
View File

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

View File

@ -29,7 +29,8 @@
<description>Compares performance of the JavaScript code produced by TeaVM and GWT</description>
<properties>
<bck2brwsr.version>0.17</bck2brwsr.version>
<bck2brwsr.version>0.22</bck2brwsr.version>
<gwt.version>2.8.2</gwt.version>
</properties>
<dependencies>
@ -72,7 +73,7 @@
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.8.0</version>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -172,7 +173,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.8.0</version>
<version>${gwt.version}</version>
<executions>
<execution>
<goals>
@ -187,32 +188,6 @@
</execution>
</executions>
</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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>

View File

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