mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Refactoring and bugfixes
This commit is contained in:
parent
1aca1d5a1e
commit
b51d8fe452
|
@ -27,7 +27,9 @@
|
||||||
<module name="SimplifyBooleanExpression"/>
|
<module name="SimplifyBooleanExpression"/>
|
||||||
<module name="SimplifyBooleanReturn"/>
|
<module name="SimplifyBooleanReturn"/>
|
||||||
<module name="StringLiteralEquality"/>
|
<module name="StringLiteralEquality"/>
|
||||||
<module name="IllegalThrows"/>
|
<module name="IllegalThrows">
|
||||||
|
<property name="illegalClassNames" value="java.lang.Error, java.lang.RuntimeException"/>
|
||||||
|
</module>
|
||||||
<module name="ExplicitInitialization"/>
|
<module name="ExplicitInitialization"/>
|
||||||
<module name="DefaultComesLast"/>
|
<module name="DefaultComesLast"/>
|
||||||
<module name="FallThrough"/>
|
<module name="FallThrough"/>
|
22
pom.xml
22
pom.xml
|
@ -208,6 +208,28 @@
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.17</version>
|
<version>2.17</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
<version>2.11</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>validate</id>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<configuration>
|
||||||
|
<propertyExpansion>config_loc=${basedir}/..</propertyExpansion>
|
||||||
|
<configLocation>../checkstyle.xml</configLocation>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
<consoleOutput>true</consoleOutput>
|
||||||
|
<failsOnError>true</failsOnError>
|
||||||
|
<linkXRef>false</linkXRef>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>check</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
|
|
|
@ -42,6 +42,13 @@
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<configLocation>../checkstyle.xml</configLocation>
|
||||||
|
</configuration>
|
||||||
|
</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>
|
||||||
|
|
|
@ -24,7 +24,10 @@ import org.teavm.tooling.TeaVMTool;
|
||||||
*
|
*
|
||||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||||
*/
|
*/
|
||||||
public class TeaVMRunner {
|
public final class TeaVMRunner {
|
||||||
|
private TeaVMRunner() {
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("static-access")
|
@SuppressWarnings("static-access")
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
|
|
|
@ -1,3 +1,18 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.teavm.cli;
|
package org.teavm.cli;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -14,7 +29,10 @@ import org.teavm.tooling.TeaVMToolException;
|
||||||
*
|
*
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
*/
|
*/
|
||||||
public class TeaVMTestRunner {
|
public final class TeaVMTestRunner {
|
||||||
|
private TeaVMTestRunner() {
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("static-access")
|
@SuppressWarnings("static-access")
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
|
|
|
@ -50,24 +50,10 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
<version>2.11</version>
|
<configuration>
|
||||||
<executions>
|
<propertyExpansion>config_loc=${basedir}</propertyExpansion>
|
||||||
<execution>
|
<configLocation>../checkstyle.xml</configLocation>
|
||||||
<id>validate</id>
|
</configuration>
|
||||||
<phase>validate</phase>
|
|
||||||
<configuration>
|
|
||||||
<propertyExpansion>config_loc=${basedir}</propertyExpansion>
|
|
||||||
<configLocation>checkstyle.xml</configLocation>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
<consoleOutput>true</consoleOutput>
|
|
||||||
<failsOnError>true</failsOnError>
|
|
||||||
<linkXRef>false</linkXRef>
|
|
||||||
</configuration>
|
|
||||||
<goals>
|
|
||||||
<goal>check</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
|
|
@ -208,7 +208,20 @@ public class DebugInformation {
|
||||||
if (mapping == null) {
|
if (mapping == null) {
|
||||||
return new String[0];
|
return new String[0];
|
||||||
}
|
}
|
||||||
return componentSetByKey(mapping, variableNames, location);
|
int keyIndex = indexByKey(mapping, location);
|
||||||
|
if (keyIndex < 0) {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
|
GeneratedLocation keyLocation = key(mapping.get(keyIndex));
|
||||||
|
if (!Objects.equals(getMethodAt(keyLocation), getMethodAt(location))) {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
|
int[] valueIndexes = mapping.get(keyIndex).getArray(0);
|
||||||
|
String[] result = new String[valueIndexes.length];
|
||||||
|
for (int i = 0; i < result.length; ++i) {
|
||||||
|
result[i] = variableNames[valueIndexes[i]];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SourceLocation[] getFollowingLines(SourceLocation location) {
|
public SourceLocation[] getFollowingLines(SourceLocation location) {
|
||||||
|
@ -349,19 +362,6 @@ public class DebugInformation {
|
||||||
return valueIndex >= 0 ? values[valueIndex] : null;
|
return valueIndex >= 0 ? values[valueIndex] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] componentSetByKey(RecordArray mapping, String[] values, GeneratedLocation location) {
|
|
||||||
int keyIndex = indexByKey(mapping, location);
|
|
||||||
if (keyIndex < 0) {
|
|
||||||
return new String[0];
|
|
||||||
}
|
|
||||||
int[] valueIndexes = mapping.get(keyIndex).getArray(0);
|
|
||||||
String[] result = new String[valueIndexes.length];
|
|
||||||
for (int i = 0; i < result.length; ++i) {
|
|
||||||
result[i] = values[valueIndexes[i]];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int indexByKey(RecordArray mapping, GeneratedLocation location) {
|
private int indexByKey(RecordArray mapping, GeneratedLocation location) {
|
||||||
int index = Collections.binarySearch(new LocationList(mapping), location);
|
int index = Collections.binarySearch(new LocationList(mapping), location);
|
||||||
return index >= 0 ? index : -index - 2;
|
return index >= 0 ? index : -index - 2;
|
||||||
|
@ -509,7 +509,7 @@ public class DebugInformation {
|
||||||
ClassMetadata superclsData = classesMetadata.get(clsData.parentId);
|
ClassMetadata superclsData = classesMetadata.get(clsData.parentId);
|
||||||
Integer parentId = clsData.parentId;
|
Integer parentId = clsData.parentId;
|
||||||
while (superclsData != null) {
|
while (superclsData != null) {
|
||||||
if (Arrays.binarySearch(superclsData.methods, methodIndex) >= 0) {
|
if (superclsData.methods != null && Arrays.binarySearch(superclsData.methods, methodIndex) >= 0) {
|
||||||
int childMethod = getExactMethodIndex(i, methodIndex);
|
int childMethod = getExactMethodIndex(i, methodIndex);
|
||||||
int parentMethod = getExactMethodIndex(parentId, methodIndex);
|
int parentMethod = getExactMethodIndex(parentId, methodIndex);
|
||||||
int ptr = start[parentMethod];
|
int ptr = start[parentMethod];
|
||||||
|
|
|
@ -226,6 +226,7 @@ public class DebugInformationBuilder implements DebugInformationEmitter {
|
||||||
for (int i = 0; i < builder.size(); ++i) {
|
for (int i = 0; i < builder.size(); ++i) {
|
||||||
RecordArrayBuilder.Record record = builder.get(i);
|
RecordArrayBuilder.Record record = builder.get(i);
|
||||||
if (i == 0 || lastValue != record.get(2)) {
|
if (i == 0 || lastValue != record.get(2)) {
|
||||||
|
lastValue = record.get(2);
|
||||||
RecordArrayBuilder.Record compressedRecord = compressed.add();
|
RecordArrayBuilder.Record compressedRecord = compressed.add();
|
||||||
for (int j = 0; j < builder.getRecordSize(); ++j) {
|
for (int j = 0; j < builder.getRecordSize(); ++j) {
|
||||||
compressedRecord.set(j, record.get(j));
|
compressedRecord.set(j, record.get(j));
|
||||||
|
|
|
@ -115,8 +115,8 @@ class DebugInformationReader {
|
||||||
for (int sz : sizes) {
|
for (int sz : sizes) {
|
||||||
totalSize += sz;
|
totalSize += sz;
|
||||||
}
|
}
|
||||||
int files[] = readRle(totalSize);
|
int[] files = readRle(totalSize);
|
||||||
int lines[] = readRle(totalSize);
|
int[] lines = readRle(totalSize);
|
||||||
int lastFile = 0;
|
int lastFile = 0;
|
||||||
int lastLine = 0;
|
int lastLine = 0;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
@ -150,7 +150,7 @@ class DebugInformationReader {
|
||||||
RecordArrayBuilder.SubArray array = builder.get(i).getArray(0);
|
RecordArrayBuilder.SubArray array = builder.get(i).getArray(0);
|
||||||
int last = 0;
|
int last = 0;
|
||||||
for (int j = 0; j < count; ++j) {
|
for (int j = 0; j < count; ++j) {
|
||||||
last += readUnsignedNumber();
|
last += readNumber();
|
||||||
array.add(last);
|
array.add(last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,11 +119,11 @@ class DebugInformationWriter {
|
||||||
private void writeMultiMapping(RecordArray mapping) throws IOException {
|
private void writeMultiMapping(RecordArray mapping) throws IOException {
|
||||||
writeLinesAndColumns(mapping);
|
writeLinesAndColumns(mapping);
|
||||||
for (int i = 0; i < mapping.size(); ++i) {
|
for (int i = 0; i < mapping.size(); ++i) {
|
||||||
int[] array = mapping.get(0).getArray(0);
|
int[] array = mapping.get(i).getArray(0);
|
||||||
writeUnsignedNumber(array.length);
|
writeUnsignedNumber(array.length);
|
||||||
int lastNumber = 0;
|
int lastNumber = 0;
|
||||||
for (int elem : array) {
|
for (int elem : array) {
|
||||||
writeUnsignedNumber(elem - lastNumber);
|
writeNumber(elem - lastNumber);
|
||||||
lastNumber = elem;
|
lastNumber = elem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,6 +250,9 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
||||||
try {
|
try {
|
||||||
writer.append("function ").appendClass(cls.getName()).append("()").ws().append("{")
|
writer.append("function ").appendClass(cls.getName()).append("()").ws().append("{")
|
||||||
.indent().softNewLine();
|
.indent().softNewLine();
|
||||||
|
if (cls.getParentName() != null) {
|
||||||
|
writer.appendClass(cls.getParentName()).append(".call(this);").softNewLine();
|
||||||
|
}
|
||||||
for (FieldNode field : cls.getFields()) {
|
for (FieldNode field : cls.getFields()) {
|
||||||
if (field.getModifiers().contains(NodeModifier.STATIC)) {
|
if (field.getModifiers().contains(NodeModifier.STATIC)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -43,6 +43,13 @@
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<configLocation>../checkstyle.xml</configLocation>
|
||||||
|
</configuration>
|
||||||
|
</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>
|
||||||
|
|
|
@ -38,6 +38,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<configLocation>../checkstyle.xml</configLocation>
|
||||||
|
</configuration>
|
||||||
|
</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>
|
||||||
|
|
|
@ -212,7 +212,7 @@ public final class JS {
|
||||||
return new Iterable<T>() {
|
return new Iterable<T>() {
|
||||||
@Override public Iterator<T> iterator() {
|
@Override public Iterator<T> iterator() {
|
||||||
return new Iterator<T>() {
|
return new Iterator<T>() {
|
||||||
int index = 0;
|
int index;
|
||||||
@Override public boolean hasNext() {
|
@Override public boolean hasNext() {
|
||||||
return index < array.getLength();
|
return index < array.getLength();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,18 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.teavm.jso;
|
package org.teavm.jso;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
|
|
|
@ -1,3 +1,18 @@
|
||||||
|
<!--
|
||||||
|
Copyright 2014 Alexey Andreev.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -9,6 +24,9 @@
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>teavm-platform</artifactId>
|
<artifactId>teavm-platform</artifactId>
|
||||||
|
|
||||||
|
<name>TeaVM platform</name>
|
||||||
|
<description>A low-level classes that help to implement Java class library</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.teavm</groupId>
|
<groupId>org.teavm</groupId>
|
||||||
|
@ -21,4 +39,24 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<configLocation>../checkstyle.xml</configLocation>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
|
@ -22,6 +22,9 @@ import org.teavm.platform.metadata.Resource;
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
*/
|
*/
|
||||||
final class ResourceAccessor {
|
final class ResourceAccessor {
|
||||||
|
private ResourceAccessor() {
|
||||||
|
}
|
||||||
|
|
||||||
public static native Object getProperty(Object obj, String propertyName);
|
public static native Object getProperty(Object obj, String propertyName);
|
||||||
|
|
||||||
public static native Resource get(Object obj, String propertyName);
|
public static native Resource get(Object obj, String propertyName);
|
||||||
|
|
|
@ -1,3 +1,18 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
package org.teavm.platform.plugin;
|
package org.teavm.platform.plugin;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
|
@ -23,6 +23,9 @@ import org.teavm.codegen.SourceWriter;
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
*/
|
*/
|
||||||
final class ResourceWriterHelper {
|
final class ResourceWriterHelper {
|
||||||
|
private ResourceWriterHelper() {
|
||||||
|
}
|
||||||
|
|
||||||
public static void write(SourceWriter writer, Object resource) throws IOException {
|
public static void write(SourceWriter writer, Object resource) throws IOException {
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
writer.append("null");
|
writer.append("null");
|
||||||
|
|
|
@ -38,6 +38,13 @@
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<configLocation>../checkstyle.xml</configLocation>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.teavm</groupId>
|
<groupId>org.teavm</groupId>
|
||||||
<artifactId>teavm-maven-plugin</artifactId>
|
<artifactId>teavm-maven-plugin</artifactId>
|
||||||
|
|
|
@ -34,7 +34,10 @@ import org.teavm.jso.JS;
|
||||||
*
|
*
|
||||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||||
*/
|
*/
|
||||||
public class DateTime {
|
public final class DateTime {
|
||||||
|
private DateTime() {
|
||||||
|
}
|
||||||
|
|
||||||
private static Window window = (Window)JS.getGlobal();
|
private static Window window = (Window)JS.getGlobal();
|
||||||
private static HTMLDocument document = window.getDocument();
|
private static HTMLDocument document = window.getDocument();
|
||||||
private static HTMLSelectElement localeElem = (HTMLSelectElement)document.getElementById("locale");
|
private static HTMLSelectElement localeElem = (HTMLSelectElement)document.getElementById("locale");
|
||||||
|
|
|
@ -23,12 +23,14 @@ import org.teavm.dom.events.EventListener;
|
||||||
import org.teavm.dom.events.EventTarget;
|
import org.teavm.dom.events.EventTarget;
|
||||||
import org.teavm.jso.JS;
|
import org.teavm.jso.JS;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
*/
|
*/
|
||||||
public class HelloWorld {
|
public final class HelloWorld {
|
||||||
|
private HelloWorld() {
|
||||||
|
}
|
||||||
|
|
||||||
private static Window window;
|
private static Window window;
|
||||||
private static Document document;
|
private static Document document;
|
||||||
private static Element body;
|
private static Element body;
|
||||||
|
|
|
@ -42,7 +42,7 @@ import java.util.Arrays;
|
||||||
*/
|
*/
|
||||||
public class Matrix {
|
public class Matrix {
|
||||||
private final int rank;
|
private final int rank;
|
||||||
private final float data[][];
|
private final float[][] data;
|
||||||
|
|
||||||
public Matrix(int r) {
|
public Matrix(int r) {
|
||||||
this(r, new float[r][r]);
|
this(r, new float[r][r]);
|
||||||
|
@ -75,7 +75,7 @@ public class Matrix {
|
||||||
throw new IllegalArgumentException("Rank doesn't match");
|
throw new IllegalArgumentException("Rank doesn't match");
|
||||||
}
|
}
|
||||||
|
|
||||||
final float res[][] = new float[rank][rank];
|
final float[][] res = new float[rank][rank];
|
||||||
for (int i = 0; i < rank; i++) {
|
for (int i = 0; i < rank; i++) {
|
||||||
for (int j = 0; j < rank; j++) {
|
for (int j = 0; j < rank; j++) {
|
||||||
float ij = 0;
|
float ij = 0;
|
||||||
|
|
|
@ -21,7 +21,10 @@ import java.io.IOException;
|
||||||
*
|
*
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
*/
|
*/
|
||||||
public class MatrixMultiplication {
|
public final class MatrixMultiplication {
|
||||||
|
private MatrixMultiplication() {
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
for (int k = 0; k < 20; ++k) {
|
for (int k = 0; k < 20; ++k) {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user