diff --git a/checkstyle.xml b/checkstyle.xml
index b4e4725ef..076a1982b 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -63,20 +63,19 @@
     <module name="EmptyForIteratorPad"/>
     <module name="MethodParamPad"/>
     <module name="NoWhitespaceAfter">
-       <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS,TYPECAST"/>
+       <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
     </module>
     <module name="NoWhitespaceBefore">
       <property name="allowLineBreaks" value="true"/>
       <property name="tokens" value="SEMI,POST_DEC,POST_INC"/>
     </module>
-    <module name="OperatorWrap">
-      <property name="option" value="eol"/>
-    </module>
+    <module name="OperatorWrap"/>
     <module name="ParenPad"/>
     <module name="TypecastParenPad"/>
     <module name="WhitespaceAfter">
-      <property name="tokens" value="COMMA,SEMI"/>
+      <property name="tokens" value="COMMA,SEMI,TYPECAST"/>
     </module>
+    <module name="WhitespaceAround"/>
   </module>
   <module name="RegexpHeader">
     <property name="headerFile" value="${config_loc}/license-regexp.txt"/>
diff --git a/pom.xml b/pom.xml
index 318da3dcb..8f1458297 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,6 +69,7 @@
     <html4j.version>1.1</html4j.version>
     <jetty.version>9.2.1.v20140609</jetty.version>
     <slf4j.version>1.7.7</slf4j.version>
+    <checker.version>1.9.3</checker.version>
   </properties>
 
   <modules>
@@ -164,6 +165,11 @@
         <artifactId>slf4j-api</artifactId>
         <version>${slf4j.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.checkerframework</groupId>
+        <artifactId>checker</artifactId>
+        <version>${checker.version}</version>
+      </dependency>
     </dependencies>
   </dependencyManagement>
 
diff --git a/teavm-chrome-rdp/src/main/java/org/teavm/chromerdp/ChromeRDPDebugger.java b/teavm-chrome-rdp/src/main/java/org/teavm/chromerdp/ChromeRDPDebugger.java
index 664e8438e..d6f25a271 100644
--- a/teavm-chrome-rdp/src/main/java/org/teavm/chromerdp/ChromeRDPDebugger.java
+++ b/teavm-chrome-rdp/src/main/java/org/teavm/chromerdp/ChromeRDPDebugger.java
@@ -436,8 +436,8 @@ public class ChromeRDPDebugger implements JavaScriptDebugger, ChromeRDPExchangeC
                 } else {
                     CallFunctionResponse response = mapper.reader(CallFunctionResponse.class).readValue(node);
                     RemoteObjectDTO result = response.getResult();
-                    sync.add(new RepresentationWrapper(result.getValue() != null ?
-                            result.getValue().getTextValue() : null));
+                    sync.add(new RepresentationWrapper(result.getValue() != null
+                            ? result.getValue().getTextValue() : null));
                 }
             }
         });
diff --git a/teavm-chrome-rdp/src/main/java/org/teavm/chromerdp/ChromeRDPDebuggerEndpoint.java b/teavm-chrome-rdp/src/main/java/org/teavm/chromerdp/ChromeRDPDebuggerEndpoint.java
index d7712ebd4..f19c2f931 100644
--- a/teavm-chrome-rdp/src/main/java/org/teavm/chromerdp/ChromeRDPDebuggerEndpoint.java
+++ b/teavm-chrome-rdp/src/main/java/org/teavm/chromerdp/ChromeRDPDebuggerEndpoint.java
@@ -39,7 +39,7 @@ public class ChromeRDPDebuggerEndpoint implements ChromeRDPExchange {
         session.setMaxIdleTimeout(0);
         Object debugger = session.getUserProperties().get("chrome.rdp");
         if (debugger instanceof ChromeRDPExchangeConsumer) {
-            this.debugger = (ChromeRDPExchangeConsumer)debugger;
+            this.debugger = (ChromeRDPExchangeConsumer) debugger;
             this.debugger.setExchange(this);
         }
     }
diff --git a/teavm-chrome-rdp/src/main/java/org/teavm/chromerdp/RDPValue.java b/teavm-chrome-rdp/src/main/java/org/teavm/chromerdp/RDPValue.java
index 95372b0ec..6784fcea0 100644
--- a/teavm-chrome-rdp/src/main/java/org/teavm/chromerdp/RDPValue.java
+++ b/teavm-chrome-rdp/src/main/java/org/teavm/chromerdp/RDPValue.java
@@ -41,8 +41,8 @@ public class RDPValue implements JavaScriptValue {
         this.debugger = debugger;
         this.objectId = objectId;
         this.innerStructure = innerStructure;
-        properties = objectId != null ? new RDPScope(debugger, objectId) :
-                Collections.<String, RDPLocalVariable>emptyMap();
+        properties = objectId != null ? new RDPScope(debugger, objectId)
+                : Collections.<String, RDPLocalVariable>emptyMap();
     }
 
     @Override
@@ -69,7 +69,7 @@ public class RDPValue implements JavaScriptValue {
     @SuppressWarnings("unchecked")
     @Override
     public Map<String, JavaScriptVariable> getProperties() {
-        return (Map<String, JavaScriptVariable>)properties;
+        return (Map<String, JavaScriptVariable>) properties;
     }
 
     @Override
diff --git a/teavm-cli/src/main/java/org/teavm/cli/TeaVMTestRunner.java b/teavm-cli/src/main/java/org/teavm/cli/TeaVMTestRunner.java
index af9941e38..32bf89b19 100644
--- a/teavm-cli/src/main/java/org/teavm/cli/TeaVMTestRunner.java
+++ b/teavm-cli/src/main/java/org/teavm/cli/TeaVMTestRunner.java
@@ -149,7 +149,7 @@ public final class TeaVMTestRunner {
         }
 
         try {
-            return (TestAdapter)cons.newInstance();
+            return (TestAdapter) cons.newInstance();
         } catch (IllegalAccessException | InstantiationException e) {
             System.err.println("Error instantiating adapter: " + adapterName);
             e.printStackTrace(System.err);
@@ -187,7 +187,7 @@ public final class TeaVMTestRunner {
         }
 
         try {
-            return (ClassHolderTransformer)cons.newInstance();
+            return (ClassHolderTransformer) cons.newInstance();
         } catch (IllegalAccessException | InstantiationException e) {
             System.err.println("Error instantiating transformer: " + transformerName);
             e.printStackTrace(System.err);
diff --git a/teavm-core/pom.xml b/teavm-core/pom.xml
index 798a6b5a8..38849b528 100644
--- a/teavm-core/pom.xml
+++ b/teavm-core/pom.xml
@@ -45,6 +45,10 @@
       <artifactId>hppc</artifactId>
       <version>0.6.1</version>
     </dependency>
+    <dependency>
+      <groupId>org.checkerframework</groupId>
+      <artifactId>checker</artifactId>
+    </dependency>
   </dependencies>
 
   <name>TeaVM core</name>
diff --git a/teavm-core/src/main/java/org/teavm/cache/AstIO.java b/teavm-core/src/main/java/org/teavm/cache/AstIO.java
index cf7fd957a..319a624ec 100644
--- a/teavm-core/src/main/java/org/teavm/cache/AstIO.java
+++ b/teavm-core/src/main/java/org/teavm/cache/AstIO.java
@@ -71,7 +71,7 @@ public class AstIO {
         node.getModifiers().addAll(unpackModifiers(input.readInt()));
         int varCount = input.readShort();
         for (int i = 0; i < varCount; ++i) {
-            node.getVariables().add((int)input.readShort());
+            node.getVariables().add((int) input.readShort());
         }
         int paramDebugNameCount = input.readShort();
         for (int i = 0; i < paramDebugNameCount; ++i) {
@@ -116,7 +116,7 @@ public class AstIO {
         node.getModifiers().addAll(unpackModifiers(input.readInt()));
         int varCount = input.readShort();
         for (int i = 0; i < varCount; ++i) {
-            node.getVariables().add((int)input.readShort());
+            node.getVariables().add((int) input.readShort());
         }
         int paramDebugNameCount = input.readShort();
         for (int i = 0; i < paramDebugNameCount; ++i) {
@@ -345,10 +345,10 @@ public class AstIO {
             try {
                 output.writeByte(16);
                 writeSequence(statement.getProtectedBody());
-                output.writeInt(statement.getExceptionType() != null ?
-                        symbolTable.lookup(statement.getExceptionType()) : -1);
-                output.writeShort(statement.getExceptionVariable() != null ?
-                        statement.getExceptionVariable() : -1);
+                output.writeInt(statement.getExceptionType() != null
+                        ? symbolTable.lookup(statement.getExceptionType()) : -1);
+                output.writeShort(statement.getExceptionVariable() != null
+                        ? statement.getExceptionVariable() : -1);
                 writeSequence(statement.getHandler());
             } catch (IOException e) {
                 throw new IOExceptionWrapper(e);
@@ -430,19 +430,19 @@ public class AstIO {
                     output.writeByte(3);
                 } else if (value instanceof Integer) {
                     output.writeByte(4);
-                    output.writeInt((Integer)value);
+                    output.writeInt((Integer) value);
                 } else if (value instanceof Long) {
                     output.writeByte(5);
-                    output.writeLong((Long)value);
+                    output.writeLong((Long) value);
                 } else if (value instanceof Float) {
                     output.writeByte(6);
-                    output.writeFloat((Float)value);
+                    output.writeFloat((Float) value);
                 } else if (value instanceof Double) {
                     output.writeByte(7);
-                    output.writeDouble((Double)value);
+                    output.writeDouble((Double) value);
                 } else if (value instanceof String) {
                     output.writeByte(8);
-                    output.writeUTF((String)value);
+                    output.writeUTF((String) value);
                 } else if (value instanceof ValueType) {
                     output.writeByte(9);
                     output.writeInt(symbolTable.lookup(value.toString()));
diff --git a/teavm-core/src/main/java/org/teavm/cache/DiskCachedClassHolderSource.java b/teavm-core/src/main/java/org/teavm/cache/DiskCachedClassHolderSource.java
index b513194e0..86952801e 100644
--- a/teavm-core/src/main/java/org/teavm/cache/DiskCachedClassHolderSource.java
+++ b/teavm-core/src/main/java/org/teavm/cache/DiskCachedClassHolderSource.java
@@ -157,19 +157,19 @@ public class DiskCachedClassHolderSource implements ClassHolderSource {
             output.writeByte(0);
         } else if (value instanceof Integer) {
             output.writeByte(1);
-            output.writeInt((Integer)value);
+            output.writeInt((Integer) value);
         } else if (value instanceof Long) {
             output.writeByte(2);
-            output.writeLong((Long)value);
+            output.writeLong((Long) value);
         } else if (value instanceof Float) {
             output.writeByte(3);
-            output.writeFloat((Float)value);
+            output.writeFloat((Float) value);
         } else if (value instanceof Double) {
             output.writeByte(4);
-            output.writeDouble((Double)value);
+            output.writeDouble((Double) value);
         } else if (value instanceof String) {
             output.writeByte(5);
-            output.writeUTF((String)value);
+            output.writeUTF((String) value);
         }
     }
 
diff --git a/teavm-core/src/main/java/org/teavm/cache/DiskRegularMethodNodeCache.java b/teavm-core/src/main/java/org/teavm/cache/DiskRegularMethodNodeCache.java
index 80fe31f10..4e0caba6e 100644
--- a/teavm-core/src/main/java/org/teavm/cache/DiskRegularMethodNodeCache.java
+++ b/teavm-core/src/main/java/org/teavm/cache/DiskRegularMethodNodeCache.java
@@ -155,8 +155,8 @@ public class DiskRegularMethodNodeCache implements MethodNodeCache {
 
     private File getMethodFile(MethodReference method, boolean async) {
         File dir = new File(directory, method.getClassName().replace('.', '/'));
-        return new File(dir, FileNameEncoder.encodeFileName(method.getDescriptor().toString()) + ".teavm-ast" +
-                (async ? "-async" : ""));
+        return new File(dir, FileNameEncoder.encodeFileName(method.getDescriptor().toString()) + ".teavm-ast"
+                + (async ? "-async" : ""));
     }
 
     static class AstDependencyAnalyzer implements StatementVisitor, ExprVisitor {
diff --git a/teavm-core/src/main/java/org/teavm/cache/ProgramIO.java b/teavm-core/src/main/java/org/teavm/cache/ProgramIO.java
index 7321f496b..ec0192edb 100644
--- a/teavm-core/src/main/java/org/teavm/cache/ProgramIO.java
+++ b/teavm-core/src/main/java/org/teavm/cache/ProgramIO.java
@@ -67,8 +67,8 @@ public class ProgramIO {
             for (TryCatchBlock tryCatch : basicBlock.getTryCatchBlocks()) {
                 data.writeInt(tryCatch.getExceptionType() != null ? symbolTable.lookup(
                         tryCatch.getExceptionType()) : -1);
-                data.writeShort(tryCatch.getExceptionVariable() != null ?
-                        tryCatch.getExceptionVariable().getIndex() : -1);
+                data.writeShort(tryCatch.getExceptionVariable() != null
+                        ? tryCatch.getExceptionVariable().getIndex() : -1);
                 data.writeShort(tryCatch.getHandler().getIndex());
             }
             InstructionLocation location = null;
@@ -87,7 +87,7 @@ public class ProgramIO {
                     }
                     insn.acceptVisitor(insnWriter);
                 } catch (IOExceptionWrapper e) {
-                    throw (IOException)e.getCause();
+                    throw (IOException) e.getCause();
                 }
             }
             data.writeByte(-1);
diff --git a/teavm-core/src/main/java/org/teavm/callgraph/DefaultCallGraph.java b/teavm-core/src/main/java/org/teavm/callgraph/DefaultCallGraph.java
index 1b44f00b2..1819c6192 100644
--- a/teavm-core/src/main/java/org/teavm/callgraph/DefaultCallGraph.java
+++ b/teavm-core/src/main/java/org/teavm/callgraph/DefaultCallGraph.java
@@ -41,8 +41,8 @@ public class DefaultCallGraph implements CallGraph {
     @Override
     public Collection<DefaultFieldAccessSite> getFieldAccess(FieldReference reference) {
         Set<DefaultFieldAccessSite> resultSet = fieldAccessSites.get(reference);
-        return resultSet != null ? Collections.unmodifiableSet(resultSet) :
-                Collections.<DefaultFieldAccessSite>emptySet();
+        return resultSet != null ? Collections.unmodifiableSet(resultSet)
+                : Collections.<DefaultFieldAccessSite>emptySet();
     }
 
     void addFieldAccess(DefaultFieldAccessSite accessSite) {
@@ -57,8 +57,8 @@ public class DefaultCallGraph implements CallGraph {
     @Override
     public Collection<DefaultClassAccessSite> getClassAccess(String className) {
         Set<DefaultClassAccessSite> resultSet = classAccessSites.get(className);
-        return resultSet != null ? Collections.unmodifiableSet(resultSet) :
-            Collections.<DefaultClassAccessSite>emptySet();
+        return resultSet != null ? Collections.unmodifiableSet(resultSet)
+                : Collections.<DefaultClassAccessSite>emptySet();
     }
 
     void addClassAccess(DefaultClassAccessSite accessSite) {
diff --git a/teavm-core/src/main/java/org/teavm/callgraph/DefaultCallSite.java b/teavm-core/src/main/java/org/teavm/callgraph/DefaultCallSite.java
index badb1d35f..404bdde58 100644
--- a/teavm-core/src/main/java/org/teavm/callgraph/DefaultCallSite.java
+++ b/teavm-core/src/main/java/org/teavm/callgraph/DefaultCallSite.java
@@ -56,9 +56,9 @@ public class DefaultCallSite implements CallSite {
         if (!(obj instanceof DefaultCallSite)) {
             return false;
         }
-        DefaultCallSite other = (DefaultCallSite)obj;
-        return Objects.equals(callee.getMethod(), other.callee.getMethod()) &&
-                Objects.equals(location, other.location);
+        DefaultCallSite other = (DefaultCallSite) obj;
+        return Objects.equals(callee.getMethod(), other.callee.getMethod())
+                && Objects.equals(location, other.location);
     }
 
     @Override
diff --git a/teavm-core/src/main/java/org/teavm/callgraph/DefaultClassAccessSite.java b/teavm-core/src/main/java/org/teavm/callgraph/DefaultClassAccessSite.java
index 766e36801..98da28dd8 100644
--- a/teavm-core/src/main/java/org/teavm/callgraph/DefaultClassAccessSite.java
+++ b/teavm-core/src/main/java/org/teavm/callgraph/DefaultClassAccessSite.java
@@ -61,9 +61,9 @@ public class DefaultClassAccessSite implements ClassAccessSite {
         if (!(obj instanceof DefaultClassAccessSite)) {
             return false;
         }
-        DefaultClassAccessSite other = (DefaultClassAccessSite)obj;
-        return Objects.equals(location, other.location) &&
-                Objects.equals(callee, other.callee) &&
-                Objects.equals(className, other.className);
+        DefaultClassAccessSite other = (DefaultClassAccessSite) obj;
+        return Objects.equals(location, other.location)
+                && Objects.equals(callee, other.callee)
+                && Objects.equals(className, other.className);
     }
 }
diff --git a/teavm-core/src/main/java/org/teavm/callgraph/DefaultFieldAccessSite.java b/teavm-core/src/main/java/org/teavm/callgraph/DefaultFieldAccessSite.java
index 52594377d..4d4c91c7b 100644
--- a/teavm-core/src/main/java/org/teavm/callgraph/DefaultFieldAccessSite.java
+++ b/teavm-core/src/main/java/org/teavm/callgraph/DefaultFieldAccessSite.java
@@ -62,8 +62,8 @@ public class DefaultFieldAccessSite implements FieldAccessSite {
         if (!(obj instanceof DefaultFieldAccessSite)) {
             return false;
         }
-        DefaultFieldAccessSite other = (DefaultFieldAccessSite)obj;
-        return Objects.equals(location, other.location) && Objects.equals(callee, other.callee) &&
-                Objects.equals(field, other.field);
+        DefaultFieldAccessSite other = (DefaultFieldAccessSite) obj;
+        return Objects.equals(location, other.location) && Objects.equals(callee, other.callee)
+                && Objects.equals(field, other.field);
     }
 }
diff --git a/teavm-core/src/main/java/org/teavm/codegen/DefaultNamingStrategy.java b/teavm-core/src/main/java/org/teavm/codegen/DefaultNamingStrategy.java
index 7fdd95a22..fb55caa69 100644
--- a/teavm-core/src/main/java/org/teavm/codegen/DefaultNamingStrategy.java
+++ b/teavm-core/src/main/java/org/teavm/codegen/DefaultNamingStrategy.java
@@ -155,8 +155,8 @@ public class DefaultNamingStrategy implements NamingStrategy {
             ClassReader clsHolder = classSource.get(cls);
             cls = clsHolder.getParent();
             if (cls == null) {
-                throw new NamingException("Can't provide name for field as the field not found: " +
-                        initialCls + "." + field);
+                throw new NamingException("Can't provide name for field as the field not found: "
+                        + initialCls + "." + field);
             }
         }
         return cls;
diff --git a/teavm-core/src/main/java/org/teavm/codegen/SourceWriter.java b/teavm-core/src/main/java/org/teavm/codegen/SourceWriter.java
index d10815dfb..2157e0c02 100644
--- a/teavm-core/src/main/java/org/teavm/codegen/SourceWriter.java
+++ b/teavm-core/src/main/java/org/teavm/codegen/SourceWriter.java
@@ -46,7 +46,7 @@ public class SourceWriter implements Appendable, LocationProvider {
     }
 
     public SourceWriter append(String value) throws IOException {
-        append((CharSequence)value);
+        append((CharSequence) value);
         return this;
     }
 
@@ -154,7 +154,7 @@ public class SourceWriter implements Appendable, LocationProvider {
         }
     }
 
-    public SourceWriter newLine() throws IOException{
+    public SourceWriter newLine() throws IOException {
         innerWriter.append('\n');
         column = 0;
         ++line;
@@ -181,7 +181,7 @@ public class SourceWriter implements Appendable, LocationProvider {
         return this;
     }
 
-    public SourceWriter softNewLine() throws IOException{
+    public SourceWriter softNewLine() throws IOException {
         if (!minified) {
             innerWriter.append('\n');
             column = 0;
diff --git a/teavm-core/src/main/java/org/teavm/common/DJGraph.java b/teavm-core/src/main/java/org/teavm/common/DJGraph.java
index adc9754cb..aa137a471 100644
--- a/teavm-core/src/main/java/org/teavm/common/DJGraph.java
+++ b/teavm-core/src/main/java/org/teavm/common/DJGraph.java
@@ -40,8 +40,8 @@ public class DJGraph {
 
     public DJGraph(Graph src, int[] weight) {
         if (src.size() != weight.length) {
-            throw new IllegalArgumentException("Node count " + src.size() + " is not equal to weight array " +
-                    weight.length);
+            throw new IllegalArgumentException("Node count " + src.size() + " is not equal to weight array "
+                    + weight.length);
         }
         this.cfg = new MutableDirectedGraph(src);
         domTree = GraphUtils.buildDominatorTree(src);
diff --git a/teavm-core/src/main/java/org/teavm/debugging/Debugger.java b/teavm-core/src/main/java/org/teavm/debugging/Debugger.java
index f49d21eae..3747f5f7c 100644
--- a/teavm-core/src/main/java/org/teavm/debugging/Debugger.java
+++ b/teavm-core/src/main/java/org/teavm/debugging/Debugger.java
@@ -95,8 +95,8 @@ public class Debugger {
             return;
         }
         CallFrame recentFrame = callStack[0];
-        if (recentFrame.getLocation() == null || recentFrame.getLocation().getFileName() == null ||
-                recentFrame.getLocation().getLine() < 0) {
+        if (recentFrame.getLocation() == null || recentFrame.getLocation().getFileName() == null
+                || recentFrame.getLocation().getLine() < 0) {
             jsStep(enterMethod);
             return;
         }
@@ -105,8 +105,8 @@ public class Debugger {
             boolean exits;
             String script = frame.getOriginalLocation().getScript();
             DebugInformation debugInfo = debugInformationMap.get(script);
-            if (frame.getLocation() != null && frame.getLocation().getFileName() != null &&
-                    frame.getLocation().getLine() >= 0 && debugInfo != null) {
+            if (frame.getLocation() != null && frame.getLocation().getFileName() != null
+                    && frame.getLocation().getLine() >= 0 && debugInfo != null) {
                 exits = addFollowing(debugInfo, frame.getLocation(), script, new HashSet<>(), successors);
                 if (enterMethod) {
                     CallSiteSuccessorFinder successorFinder = new CallSiteSuccessorFinder(debugInfo, script,
diff --git a/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformation.java b/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformation.java
index 12fd1e235..2022e9cfc 100644
--- a/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformation.java
+++ b/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformation.java
@@ -116,13 +116,13 @@ public class DebugInformation {
 
     public MethodReference getExactMethod(int index) {
         long item = exactMethods[index];
-        int classIndex = (int)(item >>> 32);
-        int methodIndex = (int)item;
+        int classIndex = (int) (item >>> 32);
+        int methodIndex = (int) item;
         return new MethodReference(classNames[classIndex], MethodDescriptor.parse(methods[methodIndex]));
     }
 
     public int getExactMethodId(int classNameId, int methodId) {
-        long full = ((long)classNameId << 32) | methodId;
+        long full = ((long) classNameId << 32) | methodId;
         Integer id = exactMethodMap.get(full);
         return id != null ? id : -1;
     }
@@ -501,7 +501,7 @@ public class DebugInformation {
         int lastClass = -1;
         for (int i = 0; i < exactMethods.length; ++i) {
             long exactMethod = exactMethods[i];
-            int classIndex = (int)(exactMethod >>> 32);
+            int classIndex = (int) (exactMethod >>> 32);
             if (classIndex != lastClass) {
                 if (lastClass >= 0) {
                     ClassMetadata clsData = classesMetadata.get(lastClass);
@@ -510,7 +510,7 @@ public class DebugInformation {
                 }
                 lastClass = classIndex;
             }
-            int methodIndex = (int)exactMethod;
+            int methodIndex = (int) exactMethod;
             methods.add(methodIndex);
         }
         if (lastClass >= 0) {
@@ -563,7 +563,7 @@ public class DebugInformation {
     }
 
     private Integer getExactMethodIndex(int classIndex, int methodIndex) {
-        long entry = ((long)classIndex << 32) | methodIndex;
+        long entry = ((long) classIndex << 32) | methodIndex;
         return exactMethodMap.get(entry);
     }
 
@@ -663,8 +663,8 @@ public class DebugInformation {
             MethodReference[] references = new MethodReference[end - start];
             for (int i = 0; i < references.length; ++i) {
                 long item = exactMethods[data[start + i]];
-                int classIndex = (int)(item >>> 32);
-                int methodIndex = (int)item;
+                int classIndex = (int) (item >>> 32);
+                int methodIndex = (int) item;
                 references[i] = new MethodReference(classNames[classIndex],
                         MethodDescriptor.parse(methods[methodIndex]));
             }
diff --git a/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformationBuilder.java b/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformationBuilder.java
index 64c77931d..23c5ceda4 100644
--- a/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformationBuilder.java
+++ b/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformationBuilder.java
@@ -113,7 +113,7 @@ public class DebugInformationBuilder implements DebugInformationEmitter {
         }
         if (currentClass != null) {
             int classIndex = classes.index(currentClass);
-            long fullIndex = ((long)classIndex << 32) | methodIndex;
+            long fullIndex = ((long) classIndex << 32) | methodIndex;
             if (!exactMethodMap.containsKey(fullIndex)) {
                 exactMethodMap.put(fullIndex, exactMethods.size());
                 exactMethods.add(fullIndex);
@@ -171,7 +171,7 @@ public class DebugInformationBuilder implements DebugInformationEmitter {
             private int getExactMethodIndex(MethodReference method) {
                 int methodIndex = methods.index(method.getDescriptor().toString());
                 int classIndex = classes.index(method.getClassName());
-                long fullIndex = ((long)classIndex << 32) | methodIndex;
+                long fullIndex = ((long) classIndex << 32) | methodIndex;
                 Integer exactMethodIndex = exactMethodMap.get(fullIndex);
                 if (exactMethodIndex == null) {
                     exactMethodIndex = exactMethods.size();
diff --git a/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformationReader.java b/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformationReader.java
index 238f2f2df..06b0cbaa2 100644
--- a/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformationReader.java
+++ b/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformationReader.java
@@ -269,7 +269,7 @@ class DebugInformationReader {
         for (int i = 0; i < result.length; ++i) {
             lastClass += readNumber();
             lastMethod += readNumber();
-            result[i] = ((long)lastClass << 32) | lastMethod;
+            result[i] = ((long) lastClass << 32) | lastMethod;
         }
         return result;
     }
@@ -306,7 +306,7 @@ class DebugInformationReader {
             if (r < 0) {
                 throw new EOFException();
             }
-            byte b = (byte)r;
+            byte b = (byte) r;
             number |= (b & 0x7F) << shift;
             shift += 7;
             if ((b & 0x80) == 0) {
diff --git a/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformationWriter.java b/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformationWriter.java
index 3063e8b6b..83373ffcc 100644
--- a/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformationWriter.java
+++ b/teavm-core/src/main/java/org/teavm/debugging/information/DebugInformationWriter.java
@@ -108,8 +108,8 @@ class DebugInformationWriter {
         writeUnsignedNumber(array.length);
         for (int i = 0; i < array.length; ++i) {
             long item = array[i];
-            int classIndex = (int)(item >> 32);
-            int methodIndex = (int)item;
+            int classIndex = (int) (item >> 32);
+            int methodIndex = (int) item;
             writeNumber(classIndex - lastClass);
             lastClass = classIndex;
             writeNumber(methodIndex - lastMethod);
@@ -249,7 +249,7 @@ class DebugInformationWriter {
 
     private void writeUnsignedNumber(int number) throws IOException {
         do {
-            byte b = (byte)(number & 0x7F);
+            byte b = (byte) (number & 0x7F);
             if ((number & 0xFFFFFF80) != 0) {
                 b |= 0x80;
             }
diff --git a/teavm-core/src/main/java/org/teavm/debugging/information/ExactMethodIterator.java b/teavm-core/src/main/java/org/teavm/debugging/information/ExactMethodIterator.java
index 4bffca6b6..87505defc 100644
--- a/teavm-core/src/main/java/org/teavm/debugging/information/ExactMethodIterator.java
+++ b/teavm-core/src/main/java/org/teavm/debugging/information/ExactMethodIterator.java
@@ -39,13 +39,13 @@ public class ExactMethodIterator {
     }
 
     public boolean isEndReached() {
-        return methodIndex >= debugInformation.methodMapping.size() &&
-                classIndex >= debugInformation.classMapping.size();
+        return methodIndex >= debugInformation.methodMapping.size()
+                && classIndex >= debugInformation.classMapping.size();
     }
 
     private void read() {
-        if (classIndex < debugInformation.classMapping.size() &&
-                methodIndex < debugInformation.methodMapping.size()) {
+        if (classIndex < debugInformation.classMapping.size()
+                && methodIndex < debugInformation.methodMapping.size()) {
             RecordArray.Record classRecord = debugInformation.classMapping.get(classIndex);
             RecordArray.Record methodRecord = debugInformation.methodMapping.get(methodIndex);
             GeneratedLocation classLoc = DebugInformation.key(classRecord);
diff --git a/teavm-core/src/main/java/org/teavm/debugging/information/GeneratedLocation.java b/teavm-core/src/main/java/org/teavm/debugging/information/GeneratedLocation.java
index 606ff4503..ddc4f937d 100644
--- a/teavm-core/src/main/java/org/teavm/debugging/information/GeneratedLocation.java
+++ b/teavm-core/src/main/java/org/teavm/debugging/information/GeneratedLocation.java
@@ -62,7 +62,7 @@ public class GeneratedLocation implements Comparable<GeneratedLocation> {
         if (obj == null) {
             return false;
         }
-        GeneratedLocation other = (GeneratedLocation)obj;
+        GeneratedLocation other = (GeneratedLocation) obj;
         return line == other.line && column == other.column;
     }
 
diff --git a/teavm-core/src/main/java/org/teavm/debugging/information/SourceLocationIterator.java b/teavm-core/src/main/java/org/teavm/debugging/information/SourceLocationIterator.java
index d7a6ff1f4..bc2b3ba4e 100644
--- a/teavm-core/src/main/java/org/teavm/debugging/information/SourceLocationIterator.java
+++ b/teavm-core/src/main/java/org/teavm/debugging/information/SourceLocationIterator.java
@@ -37,13 +37,11 @@ public class SourceLocationIterator {
     }
 
     public boolean isEndReached() {
-        return fileIndex >= debugInformation.fileMapping.size() &&
-                lineIndex >= debugInformation.lineMapping.size();
+        return fileIndex >= debugInformation.fileMapping.size() && lineIndex >= debugInformation.lineMapping.size();
     }
 
     private void read() {
-        if (fileIndex < debugInformation.fileMapping.size() &&
-                lineIndex < debugInformation.lineMapping.size()) {
+        if (fileIndex < debugInformation.fileMapping.size() && lineIndex < debugInformation.lineMapping.size()) {
             RecordArray.Record fileRecord = debugInformation.fileMapping.get(fileIndex);
             RecordArray.Record lineRecord = debugInformation.lineMapping.get(lineIndex);
             GeneratedLocation fileLoc = DebugInformation.key(fileRecord);
diff --git a/teavm-core/src/main/java/org/teavm/debugging/javascript/JavaScriptLocation.java b/teavm-core/src/main/java/org/teavm/debugging/javascript/JavaScriptLocation.java
index 7928a2039..e9938ce2b 100644
--- a/teavm-core/src/main/java/org/teavm/debugging/javascript/JavaScriptLocation.java
+++ b/teavm-core/src/main/java/org/teavm/debugging/javascript/JavaScriptLocation.java
@@ -52,7 +52,7 @@ public class JavaScriptLocation {
         if (!(obj instanceof JavaScriptLocation)) {
             return false;
         }
-        JavaScriptLocation other = (JavaScriptLocation)obj;
+        JavaScriptLocation other = (JavaScriptLocation) obj;
         return Objects.equals(other.script, script) && other.line == line && other.column == column;
     }
 
diff --git a/teavm-core/src/main/java/org/teavm/dependency/DependencyChecker.java b/teavm-core/src/main/java/org/teavm/dependency/DependencyChecker.java
index 49d477a58..ae451caa2 100644
--- a/teavm-core/src/main/java/org/teavm/dependency/DependencyChecker.java
+++ b/teavm-core/src/main/java/org/teavm/dependency/DependencyChecker.java
@@ -430,7 +430,7 @@ public class DependencyChecker implements DependencyInfo {
             return;
         }
         ValueType depType = depAnnot.getValue("value").getJavaClass();
-        String depClassName = ((ValueType.Object)depType).getClassName();
+        String depClassName = ((ValueType.Object) depType).getClassName();
         Class<?> depClass;
         try {
             depClass = Class.forName(depClassName, true, classLoader);
@@ -438,7 +438,7 @@ public class DependencyChecker implements DependencyInfo {
             throw new RuntimeException("Dependency plugin not found: " + depClassName, e);
         }
         try {
-            methodDep.dependencyPlugin = (DependencyPlugin)depClass.newInstance();
+            methodDep.dependencyPlugin = (DependencyPlugin) depClass.newInstance();
         } catch (IllegalAccessException | InstantiationException e) {
             throw new RuntimeException("Can't instantiate dependency plugin " + depClassName, e);
         }
diff --git a/teavm-core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java b/teavm-core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java
index 164d75331..79f4191db 100644
--- a/teavm-core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java
+++ b/teavm-core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java
@@ -220,8 +220,8 @@ class DependencyGraphBuilder {
         public void consume(DependencyType type) {
             String className = type.getName();
             if (DependencyChecker.shouldLog) {
-                System.out.println("Virtual call of " + methodDesc + " detected on " + node.getTag() + ". " +
-                        "Target class is " + className);
+                System.out.println("Virtual call of " + methodDesc + " detected on " + node.getTag() + ". "
+                        + "Target class is " + className);
             }
             if (className.startsWith("[")) {
                 className = "java.lang.Object";
@@ -286,10 +286,10 @@ class DependencyGraphBuilder {
                 node.propagate(dependencyChecker.getType("java.lang.Class"));
             }
             while (cst instanceof ValueType.Array) {
-                cst = ((ValueType.Array)cst).getItemType();
+                cst = ((ValueType.Array) cst).getItemType();
             }
             if (cst instanceof ValueType.Object) {
-                final String className = ((ValueType.Object)cst).getClassName();
+                final String className = ((ValueType.Object) cst).getClassName();
                 dependencyChecker.linkClass(className, new CallLocation(caller.getMethod(), currentLocation));
             }
         }
@@ -348,7 +348,7 @@ class DependencyGraphBuilder {
             DependencyNode valueNode = nodes[value.getIndex()];
             DependencyNode receiverNode = nodes[receiver.getIndex()];
             if (targetType instanceof ValueType.Object) {
-                String targetClsName = ((ValueType.Object)targetType).getClassName();
+                String targetClsName = ((ValueType.Object) targetType).getClassName();
                 final ClassReader targetClass = dependencyChecker.getClassSource().get(targetClsName);
                 if (targetClass != null) {
                     if (valueNode != null && receiverNode != null) {
@@ -426,9 +426,9 @@ class DependencyGraphBuilder {
 
         private String extractClassName(ValueType itemType) {
             while (itemType instanceof ValueType.Array) {
-                itemType = ((ValueType.Array)itemType).getItemType();
+                itemType = ((ValueType.Array) itemType).getItemType();
             }
-            return itemType instanceof ValueType.Object ? ((ValueType.Object)itemType).getClassName() : null;
+            return itemType instanceof ValueType.Object ? ((ValueType.Object) itemType).getClassName() : null;
         }
 
         @Override
@@ -437,11 +437,11 @@ class DependencyGraphBuilder {
             StringBuilder sb = new StringBuilder();
             for (int i = 0; i < dimensions.size(); ++i) {
                 sb.append('[');
-                itemType = ((ValueType.Array)itemType).getItemType();
+                itemType = ((ValueType.Array) itemType).getItemType();
             }
             String itemTypeStr;
             if (itemType instanceof ValueType.Object) {
-                itemTypeStr = ((ValueType.Object)itemType).getClassName();
+                itemTypeStr = ((ValueType.Object) itemType).getClassName();
             } else {
                 itemTypeStr = itemType.toString();
             }
diff --git a/teavm-core/src/main/java/org/teavm/dependency/Linker.java b/teavm-core/src/main/java/org/teavm/dependency/Linker.java
index b844f956f..cc4f1b377 100644
--- a/teavm-core/src/main/java/org/teavm/dependency/Linker.java
+++ b/teavm-core/src/main/java/org/teavm/dependency/Linker.java
@@ -52,19 +52,19 @@ public class Linker {
             BasicBlock block = program.basicBlockAt(i);
             for (Instruction insn : block.getInstructions()) {
                 if (insn instanceof InvokeInstruction) {
-                    InvokeInstruction invoke = (InvokeInstruction)insn;
+                    InvokeInstruction invoke = (InvokeInstruction) insn;
                     MethodDependencyInfo linkedMethod = dependency.getMethodImplementation(invoke.getMethod());
                     if (linkedMethod != null) {
                         invoke.setMethod(linkedMethod.getReference());
                     }
                 } else if (insn instanceof GetFieldInstruction) {
-                    GetFieldInstruction getField = (GetFieldInstruction)insn;
+                    GetFieldInstruction getField = (GetFieldInstruction) insn;
                     FieldDependencyInfo linkedField = dependency.getField(getField.getField());
                     if (linkedField != null) {
                         getField.setField(linkedField.getReference());
                     }
                 } else if (insn instanceof PutFieldInstruction) {
-                    PutFieldInstruction getField = (PutFieldInstruction)insn;
+                    PutFieldInstruction getField = (PutFieldInstruction) insn;
                     FieldDependencyInfo linkedField = dependency.getField(getField.getField());
                     if (linkedField != null) {
                         getField.setField(linkedField.getReference());
diff --git a/teavm-core/src/main/java/org/teavm/diagnostics/Problem.java b/teavm-core/src/main/java/org/teavm/diagnostics/Problem.java
index 37aee8b68..87ef15bd2 100644
--- a/teavm-core/src/main/java/org/teavm/diagnostics/Problem.java
+++ b/teavm-core/src/main/java/org/teavm/diagnostics/Problem.java
@@ -111,31 +111,31 @@ public class Problem {
                 if (!(param instanceof String)) {
                     return index;
                 }
-                consumer.appendClass((String)param);
+                consumer.appendClass((String) param);
                 break;
             case TYPE:
                 if (!(param instanceof ValueType)) {
                     return index;
                 }
-                consumer.appendType((ValueType)param);
+                consumer.appendType((ValueType) param);
                 break;
             case METHOD:
                 if (!(param instanceof MethodReference)) {
                     return index;
                 }
-                consumer.appendMethod((MethodReference)param);
+                consumer.appendMethod((MethodReference) param);
                 break;
             case FIELD:
                 if (!(param instanceof FieldReference)) {
                     return index;
                 }
-                consumer.appendField((FieldReference)param);
+                consumer.appendField((FieldReference) param);
                 break;
             case LOCATION:
                 if (!(param instanceof InstructionLocation)) {
                     return index;
                 }
-                consumer.appendLocation((InstructionLocation)param);
+                consumer.appendLocation((InstructionLocation) param);
                 break;
         }
         next += 2;
diff --git a/teavm-core/src/main/java/org/teavm/javascript/AsyncCallsFinder.java b/teavm-core/src/main/java/org/teavm/javascript/AsyncCallsFinder.java
index 51d322484..b8f5da0ea 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/AsyncCallsFinder.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/AsyncCallsFinder.java
@@ -49,7 +49,7 @@ class AsyncCallsFinder implements StatementVisitor, ExprVisitor {
             statement.getRightValue().acceptVisitor(this);
             return;
         }
-        InvocationExpr invocation = (InvocationExpr)statement.getRightValue();
+        InvocationExpr invocation = (InvocationExpr) statement.getRightValue();
         asyncCalls.add(invocation.getMethod());
     }
 
diff --git a/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java b/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java
index 80969bd09..3db516699 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java
@@ -202,8 +202,8 @@ public class Decompiler {
             if (method.getModifiers().contains(ElementModifier.ABSTRACT)) {
                 continue;
             }
-            if (method.getAnnotations().get(InjectedBy.class.getName()) != null ||
-                    methodsToPass.contains(method.getReference())) {
+            if (method.getAnnotations().get(InjectedBy.class.getName()) != null
+                    || methodsToPass.contains(method.getReference())) {
                 continue;
             }
             MethodNode methodNode = decompile(method);
@@ -215,8 +215,8 @@ public class Decompiler {
     }
 
     public MethodNode decompile(MethodHolder method) {
-        return method.getModifiers().contains(ElementModifier.NATIVE) ? decompileNative(method) :
-                !asyncMethods.contains(method.getReference()) ? decompileRegular(method) : decompileAsync(method);
+        return method.getModifiers().contains(ElementModifier.NATIVE) ? decompileNative(method)
+                : !asyncMethods.contains(method.getReference()) ? decompileRegular(method) : decompileAsync(method);
     }
 
     public NativeMethodNode decompileNative(MethodHolder method) {
@@ -224,17 +224,17 @@ public class Decompiler {
         if (generator == null) {
             AnnotationHolder annotHolder = method.getAnnotations().get(GeneratedBy.class.getName());
             if (annotHolder == null) {
-                throw new DecompilationException("Method " + method.getOwnerName() + "." + method.getDescriptor() +
-                        " is native, but no " + GeneratedBy.class.getName() + " annotation found");
+                throw new DecompilationException("Method " + method.getOwnerName() + "." + method.getDescriptor()
+                        + " is native, but no " + GeneratedBy.class.getName() + " annotation found");
             }
             ValueType annotValue = annotHolder.getValues().get("value").getJavaClass();
-            String generatorClassName = ((ValueType.Object)annotValue).getClassName();
+            String generatorClassName = ((ValueType.Object) annotValue).getClassName();
             try {
                 Class<?> generatorClass = Class.forName(generatorClassName, true, classLoader);
-                generator = (Generator)generatorClass.newInstance();
+                generator = (Generator) generatorClass.newInstance();
             } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
-                throw new DecompilationException("Error instantiating generator " + generatorClassName +
-                        " for native method " + method.getOwnerName() + "." + method.getDescriptor());
+                throw new DecompilationException("Error instantiating generator " + generatorClassName
+                        + " for native method " + method.getOwnerName() + "." + method.getDescriptor());
             }
         }
         NativeMethodNode methodNode = new NativeMethodNode(new MethodReference(method.getOwnerName(),
@@ -323,8 +323,8 @@ public class Decompiler {
             try {
                 part = getRegularMethodStatement(splitter.getProgram(i), splitter.getBlockSuccessors(i), i > 0);
             } catch (RuntimeException e) {
-                StringBuilder sb = new StringBuilder("Error decompiling method " + method.getReference() +
-                        " part " + i + ":\n");
+                StringBuilder sb = new StringBuilder("Error decompiling method " + method.getReference()
+                        + " part " + i + ":\n");
                 sb.append(new ListingBuilder().buildListing(splitter.getProgram(i), "  "));
                 throw new DecompilationException(sb.toString(), e);
             }
@@ -539,8 +539,8 @@ public class Decompiler {
             bookmark.offset = bookmark.block.body.size();
             bookmark.exceptionHandler = tryCatch.getHandler().getIndex();
             bookmark.exceptionType = tryCatch.getExceptionType();
-            bookmark.exceptionVariable = tryCatch.getExceptionVariable() != null ?
-                    tryCatch.getExceptionVariable().getIndex() : null;
+            bookmark.exceptionVariable = tryCatch.getExceptionVariable() != null
+                    ? tryCatch.getExceptionVariable().getIndex() : null;
             bookmark.block.tryCatches.add(bookmark);
             tryCatchBookmarks.add(bookmark);
         }
@@ -581,8 +581,8 @@ public class Decompiler {
             }
             result.add(block);
             int mappedIndex = indexer.nodeAt(currentNode.getEnd());
-            if (mappedIndex >= 0 && (blockMap[mappedIndex] == null ||
-                    !(blockMap[mappedIndex].statement instanceof WhileStatement))) {
+            if (mappedIndex >= 0 && (blockMap[mappedIndex] == null
+                    || !(blockMap[mappedIndex].statement instanceof WhileStatement))) {
                 blockMap[mappedIndex] = block;
             }
             if (loop) {
diff --git a/teavm-core/src/main/java/org/teavm/javascript/EscapingStatementFinder.java b/teavm-core/src/main/java/org/teavm/javascript/EscapingStatementFinder.java
index 6ee00fe5e..8525d3c29 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/EscapingStatementFinder.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/EscapingStatementFinder.java
@@ -34,7 +34,7 @@ class EscapingStatementFinder implements StatementVisitor {
         if (!(statement instanceof SequentialStatement)) {
             return false;
         }
-        SequentialStatement seq = (SequentialStatement)statement;
+        SequentialStatement seq = (SequentialStatement) statement;
         for (int i = seq.getSequence().size() - 1; i >= 0; --i) {
             if (!isEmpty(seq.getSequence().get(i))) {
                 return false;
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ExprOptimizer.java b/teavm-core/src/main/java/org/teavm/javascript/ExprOptimizer.java
index 01780ad23..d98646976 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ExprOptimizer.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/ExprOptimizer.java
@@ -27,12 +27,12 @@ final class ExprOptimizer {
 
     public static Expr invert(Expr expr) {
         if (expr instanceof UnaryExpr) {
-            UnaryExpr unary = (UnaryExpr)expr;
+            UnaryExpr unary = (UnaryExpr) expr;
             if (unary.getOperation() == UnaryOperation.NOT) {
                 return unary.getOperand();
             }
         } else if (expr instanceof BinaryExpr) {
-            BinaryExpr binary = (BinaryExpr)expr;
+            BinaryExpr binary = (BinaryExpr) expr;
             Expr a = binary.getFirstOperand();
             Expr b = binary.getSecondOperand();
             switch (binary.getOperation()) {
diff --git a/teavm-core/src/main/java/org/teavm/javascript/NameFrequencyEstimator.java b/teavm-core/src/main/java/org/teavm/javascript/NameFrequencyEstimator.java
index f6f5f724d..b61e9faa5 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/NameFrequencyEstimator.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/NameFrequencyEstimator.java
@@ -67,8 +67,8 @@ public class NameFrequencyEstimator implements StatementVisitor, ExprVisitor, Me
             if (asyncFamilyMethods.contains(method.getReference())) {
                 consumer.consume(method.getReference());
             }
-            if (clinit != null && (method.getModifiers().contains(NodeModifier.STATIC) ||
-                    method.getReference().getName().equals("<init>"))) {
+            if (clinit != null && (method.getModifiers().contains(NodeModifier.STATIC)
+                    || method.getReference().getName().equals("<init>"))) {
                 consumer.consume(method.getReference());
             }
             if (!method.getModifiers().contains(NodeModifier.STATIC)) {
@@ -258,16 +258,16 @@ public class NameFrequencyEstimator implements StatementVisitor, ExprVisitor, Me
     @Override
     public void visit(ConstantExpr expr) {
         if (expr.getValue() instanceof ValueType) {
-            visitType((ValueType)expr.getValue());
+            visitType((ValueType) expr.getValue());
         }
     }
 
     private void visitType(ValueType type) {
         while (type instanceof ValueType.Array) {
-            type = ((ValueType.Array)type).getItemType();
+            type = ((ValueType.Array) type).getItemType();
         }
         if (type instanceof ValueType.Object) {
-            String clsName = ((ValueType.Object)type).getClassName();
+            String clsName = ((ValueType.Object) type).getClassName();
             consumer.consume(clsName);
             consumer.consumeFunction("$rt_cls");
         }
@@ -340,7 +340,7 @@ public class NameFrequencyEstimator implements StatementVisitor, ExprVisitor, Me
         expr.getExpr().acceptVisitor(this);
         visitType(expr.getType());
         if (expr.getType() instanceof ValueType.Object) {
-            String clsName = ((ValueType.Object)expr.getType()).getClassName();
+            String clsName = ((ValueType.Object) expr.getType()).getClassName();
             ClassReader cls = classSource.get(clsName);
             if (cls == null || cls.hasModifier(ElementModifier.INTERFACE)) {
                 consumer.consumeFunction("$rt_isInstance");
diff --git a/teavm-core/src/main/java/org/teavm/javascript/NullPointerExceptionTransformer.java b/teavm-core/src/main/java/org/teavm/javascript/NullPointerExceptionTransformer.java
index 3d9f3126e..0fb56a8c5 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/NullPointerExceptionTransformer.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/NullPointerExceptionTransformer.java
@@ -44,7 +44,7 @@ public class NullPointerExceptionTransformer implements ClassHolderTransformer {
         for (int i = 0; i < block.getInstructions().size(); ++i) {
             Instruction insn = block.getInstructions().get(i);
             if (insn instanceof InvokeInstruction) {
-                InvokeInstruction invoke = (InvokeInstruction)insn;
+                InvokeInstruction invoke = (InvokeInstruction) insn;
                 if (invoke.getType() != InvocationType.VIRTUAL) {
                     continue;
                 }
diff --git a/teavm-core/src/main/java/org/teavm/javascript/OptimizingVisitor.java b/teavm-core/src/main/java/org/teavm/javascript/OptimizingVisitor.java
index c5e0127e3..1b3a62571 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/OptimizingVisitor.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/OptimizingVisitor.java
@@ -35,11 +35,11 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
     }
 
     private static boolean isZero(Expr expr) {
-        return expr instanceof ConstantExpr && Integer.valueOf(0).equals(((ConstantExpr)expr).getValue());
+        return expr instanceof ConstantExpr && Integer.valueOf(0).equals(((ConstantExpr) expr).getValue());
     }
 
     private static boolean isComparison(Expr expr) {
-        return expr instanceof BinaryExpr && ((BinaryExpr)expr).getOperation() == BinaryOperation.COMPARE;
+        return expr instanceof BinaryExpr && ((BinaryExpr) expr).getOperation() == BinaryOperation.COMPARE;
     }
 
     @Override
@@ -55,7 +55,7 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
         expr.getSecondOperand().acceptVisitor(this);
         Expr b = resultExpr;
         if (b instanceof ConstantExpr && expr.getOperation() == BinaryOperation.SUBTRACT) {
-            if (tryMakePositive((ConstantExpr)b)) {
+            if (tryMakePositive((ConstantExpr) b)) {
                 expr.setOperation(BinaryOperation.ADD);
             }
         }
@@ -78,7 +78,7 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
                 case LESS_OR_EQUALS:
                 case GREATER:
                 case GREATER_OR_EQUALS: {
-                    BinaryExpr comparison = (BinaryExpr)p;
+                    BinaryExpr comparison = (BinaryExpr) p;
                     Expr result = BinaryExpr.binary(expr.getOperation(),
                             comparison.getFirstOperand(), comparison.getSecondOperand());
                     result.setLocation(comparison.getLocation());
@@ -102,7 +102,7 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
         expr.getOperand().acceptVisitor(this);
         Expr operand = resultExpr;
         if (expr.getOperation() == UnaryOperation.NEGATE && operand instanceof ConstantExpr) {
-            ConstantExpr constantExpr = (ConstantExpr)operand;
+            ConstantExpr constantExpr = (ConstantExpr) operand;
             if (tryMakePositive(constantExpr)) {
                 resultExpr = expr;
                 return;
@@ -114,23 +114,23 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
 
     private boolean tryMakePositive(ConstantExpr constantExpr) {
         Object value = constantExpr.getValue();
-        if (value instanceof Integer && (Integer)value < 0) {
-            constantExpr.setValue(-(Integer)value);
+        if (value instanceof Integer && (Integer) value < 0) {
+            constantExpr.setValue(-(Integer) value);
             return true;
-        } else if (value instanceof Float && (Float)value < 0) {
-            constantExpr.setValue(-(Float)value);
+        } else if (value instanceof Float && (Float) value < 0) {
+            constantExpr.setValue(-(Float) value);
             return true;
-        } else if (value instanceof Byte && (Byte)value < 0) {
-            constantExpr.setValue(-(Byte)value);
+        } else if (value instanceof Byte && (Byte) value < 0) {
+            constantExpr.setValue(-(Byte) value);
             return true;
-        } else if (value instanceof Short && (Short)value < 0) {
-            constantExpr.setValue(-(Short)value);
+        } else if (value instanceof Short && (Short) value < 0) {
+            constantExpr.setValue(-(Short) value);
             return true;
-        } else if (value instanceof Long && (Long)value < 0) {
-            constantExpr.setValue(-(Long)value);
+        } else if (value instanceof Long && (Long) value < 0) {
+            constantExpr.setValue(-(Long) value);
             return true;
-        } else if (value instanceof Double && (Double)value < 0) {
-            constantExpr.setValue(-(Double)value);
+        } else if (value instanceof Double && (Double) value < 0) {
+            constantExpr.setValue(-(Double) value);
             return true;
         }
         return false;
@@ -169,16 +169,16 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
         if (!(last instanceof AssignmentStatement)) {
             return;
         }
-        AssignmentStatement assignment = (AssignmentStatement)last;
+        AssignmentStatement assignment = (AssignmentStatement) last;
         if (assignment.isAsync()) {
             return;
         }
         if (!(assignment.getLeftValue() instanceof VariableExpr)) {
             return;
         }
-        VariableExpr var = (VariableExpr)assignment.getLeftValue();
-        if (var.getLocation() != null && assignment.getLocation() != null &&
-                !assignment.getLocation().equals(var.getLocation())) {
+        VariableExpr var = (VariableExpr) assignment.getLeftValue();
+        if (var.getLocation() != null && assignment.getLocation() != null
+                && !assignment.getLocation().equals(var.getLocation())) {
             return;
         }
         if (var.getIndex() == index) {
@@ -231,22 +231,22 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
         if (!(last instanceof AssignmentStatement)) {
             return false;
         }
-        AssignmentStatement assignment = (AssignmentStatement)last;
+        AssignmentStatement assignment = (AssignmentStatement) last;
         if (!(assignment.getLeftValue() instanceof VariableExpr)) {
             return false;
         }
-        VariableExpr var = (VariableExpr)assignment.getLeftValue();
+        VariableExpr var = (VariableExpr) assignment.getLeftValue();
         if (!(expr.getArguments().get(0) instanceof VariableExpr)) {
             return false;
         }
-        VariableExpr target = (VariableExpr)expr.getArguments().get(0);
+        VariableExpr target = (VariableExpr) expr.getArguments().get(0);
         if (target.getIndex() != var.getIndex()) {
             return false;
         }
         if (!(assignment.getRightValue() instanceof NewExpr)) {
             return false;
         }
-        NewExpr constructed = (NewExpr)assignment.getRightValue();
+        NewExpr constructed = (NewExpr) assignment.getRightValue();
         if (!constructed.getConstructedClass().equals(expr.getMethod().getClassName())) {
             return false;
         }
@@ -306,7 +306,7 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
     public void visit(AssignmentStatement statement) {
         if (statement.getLeftValue() == null) {
             statement.getRightValue().acceptVisitor(this);
-            if (resultExpr instanceof InvocationExpr && tryApplyConstructor((InvocationExpr)resultExpr)) {
+            if (resultExpr instanceof InvocationExpr && tryApplyConstructor((InvocationExpr) resultExpr)) {
                 resultStmt = new SequentialStatement();
             } else {
                 statement.setRightValue(resultExpr);
@@ -345,7 +345,7 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
         for (int i = 0; i < statements.size(); ++i) {
             Statement part = statements.get(i);
             if (part instanceof SequentialStatement) {
-                if (!processSequenceImpl(((SequentialStatement)part).getSequence())) {
+                if (!processSequenceImpl(((SequentialStatement) part).getSequence())) {
                     return false;
                 }
                 continue;
@@ -353,7 +353,7 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
             part.acceptVisitor(this);
             part = resultStmt;
             if (part instanceof SequentialStatement) {
-                if (!processSequenceImpl(((SequentialStatement)part).getSequence())) {
+                if (!processSequenceImpl(((SequentialStatement) part).getSequence())) {
                     return false;
                 }
                 continue;
@@ -369,11 +369,11 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
     private void wieldTryCatch(List<Statement> statements) {
         for (int i = 0; i < statements.size() - 1; ++i) {
             if (statements.get(i) instanceof TryCatchStatement && statements.get(i + 1) instanceof TryCatchStatement) {
-                TryCatchStatement first = (TryCatchStatement)statements.get(i);
-                TryCatchStatement second = (TryCatchStatement)statements.get(i + 1);
-                if (Objects.equals(first.getExceptionType(), second.getExceptionType()) &&
-                        Objects.equals(first.getExceptionVariable(), second.getExceptionVariable()) &&
-                        briefStatementComparison(first.getHandler(), second.getHandler())) {
+                TryCatchStatement first = (TryCatchStatement) statements.get(i);
+                TryCatchStatement second = (TryCatchStatement) statements.get(i + 1);
+                if (Objects.equals(first.getExceptionType(), second.getExceptionType())
+                        && Objects.equals(first.getExceptionVariable(), second.getExceptionVariable())
+                        && briefStatementComparison(first.getHandler(), second.getHandler())) {
                     first.getProtectedBody().addAll(second.getProtectedBody());
                     statements.remove(i + 1);
                     wieldTryCatch(first.getProtectedBody());
@@ -393,8 +393,8 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
         Statement first = firstSeq.get(0);
         Statement second = secondSeq.get(0);
         if (first instanceof BreakStatement && second instanceof BreakStatement) {
-            BreakStatement firstBreak = (BreakStatement)first;
-            BreakStatement secondBreak = (BreakStatement)second;
+            BreakStatement firstBreak = (BreakStatement) first;
+            BreakStatement secondBreak = (BreakStatement) second;
             return firstBreak.getTarget() == secondBreak.getTarget();
         }
         return false;
@@ -406,7 +406,7 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
         }
         Statement last = statements.get(statements.size() - 1);
         if (last instanceof BreakStatement && exit != null) {
-            IdentifiedStatement target = ((BreakStatement)last).getTarget();
+            IdentifiedStatement target = ((BreakStatement) last).getTarget();
             if (exit == target) {
                 statements.remove(statements.size() - 1);
             }
@@ -417,12 +417,12 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
         for (int i = 0; i < statements.size(); ++i) {
             Statement stmt = statements.get(i);
             if (stmt instanceof ConditionalStatement) {
-                ConditionalStatement cond = (ConditionalStatement)stmt;
+                ConditionalStatement cond = (ConditionalStatement) stmt;
                 check_conditional: {
-                    last = cond.getConsequent().isEmpty() ? null :
-                            cond.getConsequent().get(cond.getConsequent().size() - 1);
+                    last = cond.getConsequent().isEmpty() ? null
+                            : cond.getConsequent().get(cond.getConsequent().size() - 1);
                     if (last instanceof BreakStatement) {
-                        BreakStatement breakStmt = (BreakStatement)last;
+                        BreakStatement breakStmt = (BreakStatement) last;
                         if (exit != null && exit == breakStmt.getTarget()) {
                             cond.getConsequent().remove(cond.getConsequent().size() - 1);
                             List<Statement> remaining = statements.subList(i + 1, statements.size());
@@ -431,10 +431,10 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
                             break check_conditional;
                         }
                     }
-                    last = cond.getAlternative().isEmpty() ? null :
-                            cond.getAlternative().get(cond.getAlternative().size() - 1);
+                    last = cond.getAlternative().isEmpty() ? null
+                            : cond.getAlternative().get(cond.getAlternative().size() - 1);
                     if (last instanceof BreakStatement) {
-                        BreakStatement breakStmt = (BreakStatement)last;
+                        BreakStatement breakStmt = (BreakStatement) last;
                         if (exit != null && exit == breakStmt.getTarget()) {
                             cond.getAlternative().remove(cond.getAlternative().size() - 1);
                             List<Statement> remaining = statements.subList(i + 1, statements.size());
@@ -450,7 +450,7 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
                 }
                 normalizeConditional(cond);
                 if (cond.getConsequent().size() == 1 && cond.getConsequent().get(0) instanceof ConditionalStatement) {
-                    ConditionalStatement innerCond = (ConditionalStatement)cond.getConsequent().get(0);
+                    ConditionalStatement innerCond = (ConditionalStatement) cond.getConsequent().get(0);
                     if (innerCond.getAlternative().isEmpty()) {
                         if (cond.getAlternative().isEmpty()) {
                             cond.getConsequent().clear();
@@ -458,8 +458,8 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
                             cond.setCondition(Expr.binary(BinaryOperation.AND, cond.getCondition(),
                                     innerCond.getCondition(), cond.getCondition().getLocation()));
                             --i;
-                        } else if (cond.getAlternative().size() != 1 ||
-                                !(cond.getAlternative().get(0) instanceof ConditionalStatement)) {
+                        } else if (cond.getAlternative().size() != 1
+                                || !(cond.getAlternative().get(0) instanceof ConditionalStatement)) {
                             cond.setCondition(ExprOptimizer.invert(cond.getCondition()));
                             cond.getConsequent().clear();
                             cond.getConsequent().addAll(cond.getAlternative());
@@ -470,13 +470,13 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
                     }
                 }
             } else if (stmt instanceof BlockStatement) {
-                BlockStatement nestedBlock = (BlockStatement)stmt;
+                BlockStatement nestedBlock = (BlockStatement) stmt;
                 eliminateRedundantBreaks(nestedBlock.getBody(), nestedBlock);
             } else if (stmt instanceof WhileStatement) {
-                WhileStatement whileStmt = (WhileStatement)stmt;
+                WhileStatement whileStmt = (WhileStatement) stmt;
                 eliminateRedundantBreaks(whileStmt.getBody(), null);
             } else if (stmt instanceof SwitchStatement) {
-                SwitchStatement switchStmt = (SwitchStatement)stmt;
+                SwitchStatement switchStmt = (SwitchStatement) stmt;
                 for (SwitchClause clause : switchStmt.getClauses()) {
                     eliminateRedundantBreaks(clause.getBody(), null);
                 }
@@ -546,7 +546,7 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
     @Override
     public void visit(WhileStatement statement) {
         if (statement.getBody().size() == 1 && statement.getBody().get(0) instanceof WhileStatement) {
-            WhileStatement innerLoop = (WhileStatement)statement.getBody().get(0);
+            WhileStatement innerLoop = (WhileStatement) statement.getBody().get(0);
             BreakToContinueReplacer replacer = new BreakToContinueReplacer(innerLoop, statement);
             replacer.visitSequence(innerLoop.getBody());
             statement.getBody().clear();
@@ -555,7 +555,7 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
         List<Statement> statements = processSequence(statement.getBody());
         for (int i = 0; i < statements.size(); ++i) {
             if (statements.get(i) instanceof ContinueStatement) {
-                ContinueStatement continueStmt = (ContinueStatement)statements.get(i);
+                ContinueStatement continueStmt = (ContinueStatement) statements.get(i);
                 if (continueStmt.getTarget() == statement) {
                     statements.subList(i, statements.size()).clear();
                     break;
@@ -573,9 +573,9 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
         }
         while (true) {
             if (!statement.getBody().isEmpty() && statement.getBody().get(0) instanceof ConditionalStatement) {
-                ConditionalStatement cond = (ConditionalStatement)statement.getBody().get(0);
+                ConditionalStatement cond = (ConditionalStatement) statement.getBody().get(0);
                 if (cond.getConsequent().size() == 1 && cond.getConsequent().get(0) instanceof BreakStatement) {
-                    BreakStatement breakStmt = (BreakStatement)cond.getConsequent().get(0);
+                    BreakStatement breakStmt = (BreakStatement) cond.getConsequent().get(0);
                     if (breakStmt.getTarget() == statement) {
                         statement.getBody().remove(0);
                         if (statement.getCondition() != null) {
diff --git a/teavm-core/src/main/java/org/teavm/javascript/Renderer.java b/teavm-core/src/main/java/org/teavm/javascript/Renderer.java
index d83ca70f5..214faeb7d 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/Renderer.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/Renderer.java
@@ -363,8 +363,8 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
                     new MethodDescriptor("<clinit>", ValueType.VOID));
             List<MethodNode> clinitMethods = new ArrayList<>();
             for (MethodNode method : cls.getMethods()) {
-                if (clinit == null || (!method.getModifiers().contains(NodeModifier.STATIC) &&
-                        !method.getReference().getName().equals("<init>"))) {
+                if (clinit == null || (!method.getModifiers().contains(NodeModifier.STATIC)
+                        && !method.getReference().getName().equals("<init>"))) {
                     nonInitMethods.add(method);
                 } else {
                     clinitMethods.add(method);
@@ -451,8 +451,8 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
                 List<String> stubNames = new ArrayList<>();
                 List<MethodNode> virtualMethods = new ArrayList<>();
                 for (MethodNode method : cls.getMethods()) {
-                    if (clinit != null && (method.getModifiers().contains(NodeModifier.STATIC) ||
-                            method.getReference().getName().equals("<init>"))) {
+                    if (clinit != null && (method.getModifiers().contains(NodeModifier.STATIC)
+                            || method.getReference().getName().equals("<init>"))) {
                         stubNames.add(naming.getFullNameFor(method.getReference()));
                     }
                     if (!method.getModifiers().contains(NodeModifier.STATIC)) {
@@ -485,14 +485,14 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
 
     private static Object getDefaultValue(ValueType type) {
         if (type instanceof ValueType.Primitive) {
-            ValueType.Primitive primitive = (ValueType.Primitive)type;
+            ValueType.Primitive primitive = (ValueType.Primitive) type;
             switch (primitive.getKind()) {
                 case BOOLEAN:
                     return false;
                 case BYTE:
-                    return (byte)0;
+                    return (byte) 0;
                 case SHORT:
-                    return (short)0;
+                    return (short) 0;
                 case INTEGER:
                     return 0;
                 case CHARACTER:
@@ -893,7 +893,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
                 popLocation();
             }
             if (statement.getLeftValue() instanceof VariableExpr) {
-                VariableExpr receiver = (VariableExpr)statement.getLeftValue();
+                VariableExpr receiver = (VariableExpr) statement.getLeftValue();
                 debugEmitter.emitVariable(statement.getDebugNames().toArray(new String[0]),
                         variableName(receiver.getIndex()));
             }
@@ -928,9 +928,9 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
                 visitStatements(statement.getConsequent());
                 if (!statement.getAlternative().isEmpty()) {
                     writer.outdent().append("}").ws();
-                    if (statement.getAlternative().size() == 1 &&
-                            statement.getAlternative().get(0) instanceof ConditionalStatement) {
-                        statement = (ConditionalStatement)statement.getAlternative().get(0);
+                    if (statement.getAlternative().size() == 1
+                            && statement.getAlternative().get(0) instanceof ConditionalStatement) {
+                        statement = (ConditionalStatement) statement.getAlternative().get(0);
                         writer.append("else ");
                         continue;
                     }
@@ -1194,8 +1194,8 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
         if (index < variableNames.length()) {
             sb.append(Character.toString(variableNames.charAt(index)));
         } else {
-            sb.append(Character.toString(variableNames.charAt(index % variableNames.length())) +
-                    index / variableNames.length());
+            sb.append(Character.toString(variableNames.charAt(index % variableNames.length()))
+                    + index / variableNames.length());
         }
         if (!minifying && names != null && !names.isEmpty()) {
             List<String> nameList = new ArrayList<>(names);
@@ -1249,9 +1249,9 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
         precedence.associativity = this.associativity;
         precedenceStack.push(precedence);
         wasGrouped = false;
-        if (autoGroup && (priority.ordinal() < this.priority.ordinal() ||
-                priority.ordinal() == this.priority.ordinal() &&
-                (associativity != this.associativity || associativity == Associativity.NONE))) {
+        if (autoGroup && (priority.ordinal() < this.priority.ordinal()
+                || priority.ordinal() == this.priority.ordinal()
+                && (associativity != this.associativity || associativity == Associativity.NONE))) {
             wasGrouped = true;
             writer.append('(');
         }
@@ -1548,10 +1548,10 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
             return "null";
         }
         if (cst instanceof ValueType) {
-            ValueType type = (ValueType)cst;
+            ValueType type = (ValueType) cst;
             return naming.getNameForFunction("$rt_cls") + "(" + typeToClsString(naming, type) + ")";
         } else if (cst instanceof String) {
-            String string = (String)cst;
+            String string = (String) cst;
             Integer index = stringPoolMap.get(string);
             if (index == null) {
                 index = stringPool.size();
@@ -1560,16 +1560,16 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
             }
             return "$rt_s(" + index + ")";
         } else if (cst instanceof Long) {
-            long value = (Long)cst;
+            long value = (Long) cst;
             if (value == 0) {
                 return "Long_ZERO";
-            } else if ((int)value == value) {
+            } else if ((int) value == value) {
                 return "Long_fromInt(" + value + ")";
             } else {
                 return "new Long(" + (value & 0xFFFFFFFFL) + ", " + (value >>> 32) + ")";
             }
         } else if (cst instanceof Character) {
-            return Integer.toString((Character)cst);
+            return Integer.toString((Character) cst);
         } else {
             return cst.toString();
         }
@@ -1579,16 +1579,16 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
         int arrayCount = 0;
         while (type instanceof ValueType.Array) {
             arrayCount++;
-            type = ((ValueType.Array)type).getItemType();
+            type = ((ValueType.Array) type).getItemType();
         }
         String value;
         if (type instanceof ValueType.Object) {
-            ValueType.Object objType = (ValueType.Object)type;
+            ValueType.Object objType = (ValueType.Object) type;
             value = naming.getNameFor(objType.getClassName());
         } else if (type instanceof ValueType.Void) {
             value = "$rt_voidcls()";
         } else if (type instanceof ValueType.Primitive) {
-            ValueType.Primitive primitiveType = (ValueType.Primitive)type;
+            ValueType.Primitive primitiveType = (ValueType.Primitive) type;
             switch (primitiveType.getKind()) {
                 case BOOLEAN:
                     value = "$rt_booleancls()";
@@ -1854,7 +1854,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
             ValueType type = expr.getType();
             enterPriority(Priority.COMMA, Associativity.NONE, false);
             if (type instanceof ValueType.Primitive) {
-                switch (((ValueType.Primitive)type).getKind()) {
+                switch (((ValueType.Primitive) type).getKind()) {
                     case BOOLEAN:
                         writer.append("$rt_createBooleanArray(");
                         expr.getLength().acceptVisitor(this);
@@ -1919,11 +1919,11 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
             }
             ValueType type = expr.getType();
             for (int i = 0; i < expr.getDimensions().size(); ++i) {
-                type = ((ValueType.Array)type).getItemType();
+                type = ((ValueType.Array) type).getItemType();
             }
             enterPriority(Priority.COMMA, Associativity.NONE, false);
             if (type instanceof ValueType.Primitive) {
-                switch (((ValueType.Primitive)type).getKind()) {
+                switch (((ValueType.Primitive) type).getKind()) {
                     case BOOLEAN:
                         writer.append("$rt_createBooleanMultiArray(");
                         break;
@@ -1981,7 +1981,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
                 pushLocation(expr.getLocation());
             }
             if (expr.getType() instanceof ValueType.Object) {
-                String clsName = ((ValueType.Object)expr.getType()).getClassName();
+                String clsName = ((ValueType.Object) expr.getType()).getClassName();
                 ClassHolder cls = classSource.get(clsName);
                 if (cls != null && !cls.getModifiers().contains(ElementModifier.INTERFACE)) {
                     enterPriority(Priority.COMPARISON, Associativity.LEFT, true);
@@ -2041,7 +2041,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
             sequence.add(statement);
             List<Statement> protectedBody = statement.getProtectedBody();
             while (protectedBody.size() == 1 && protectedBody.get(0) instanceof TryCatchStatement) {
-                TryCatchStatement nextStatement = (TryCatchStatement)protectedBody.get(0);
+                TryCatchStatement nextStatement = (TryCatchStatement) protectedBody.get(0);
                 sequence.add(nextStatement);
                 protectedBody = nextStatement.getProtectedBody();
             }
@@ -2082,7 +2082,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
             if (!end || statement.getPart() != currentPart + 1) {
                 writer.append("continue ").append(mainLoopName()).append(";").softNewLine();
             }
-        } catch (IOException ex){
+        } catch (IOException ex) {
             throw new RenderingException("IO error occured", ex);
         }
     }
@@ -2104,7 +2104,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
                 statement.getObjectRef().acceptVisitor(this);
                 writer.append(");").softNewLine();
             }
-        } catch (IOException ex){
+        } catch (IOException ex) {
             throw new RenderingException("IO error occured", ex);
         }
     }
@@ -2132,7 +2132,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
                 statement.getObjectRef().acceptVisitor(this);
                 writer.append(");").softNewLine();
             }
-        } catch (IOException ex){
+        } catch (IOException ex) {
             throw new RenderingException("IO error occured", ex);
         }
     }
@@ -2149,7 +2149,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
                     AnnotationHolder injectedByAnnot = method.getAnnotations().get(InjectedBy.class.getName());
                     if (injectedByAnnot != null) {
                         ValueType type = injectedByAnnot.getValues().get("value").getJavaClass();
-                        holder = new InjectorHolder(instantiateInjector(((ValueType.Object)type).getClassName()));
+                        holder = new InjectorHolder(instantiateInjector(((ValueType.Object) type).getClassName()));
                     }
                 }
             }
diff --git a/teavm-core/src/main/java/org/teavm/javascript/StatementGenerator.java b/teavm-core/src/main/java/org/teavm/javascript/StatementGenerator.java
index 1e098a853..1b4d59571 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/StatementGenerator.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/StatementGenerator.java
@@ -437,8 +437,8 @@ class StatementGenerator implements InstructionVisitor {
 
     @Override
     public void visit(ExitInstruction insn) {
-        ReturnStatement stmt = Statement.exitFunction(insn.getValueToReturn() != null ?
-                Expr.var(insn.getValueToReturn().getIndex()) : null);
+        ReturnStatement stmt = Statement.exitFunction(insn.getValueToReturn() != null
+                ? Expr.var(insn.getValueToReturn().getIndex()) : null);
         stmt.setLocation(currentLocation);
         statements.add(stmt);
     }
diff --git a/teavm-core/src/main/java/org/teavm/javascript/ast/UnwrapArrayExpr.java b/teavm-core/src/main/java/org/teavm/javascript/ast/UnwrapArrayExpr.java
index 500fc0924..80a755427 100644
--- a/teavm-core/src/main/java/org/teavm/javascript/ast/UnwrapArrayExpr.java
+++ b/teavm-core/src/main/java/org/teavm/javascript/ast/UnwrapArrayExpr.java
@@ -49,7 +49,7 @@ public class UnwrapArrayExpr extends Expr {
 
     @Override
     protected UnwrapArrayExpr clone(Map<Expr, Expr> cache) {
-        UnwrapArrayExpr copy = (UnwrapArrayExpr)cache.get(this);
+        UnwrapArrayExpr copy = (UnwrapArrayExpr) cache.get(this);
         if (copy == null) {
             copy = new UnwrapArrayExpr(elementType);
             copy.array = array != null ? array.clone(cache) : null;
diff --git a/teavm-core/src/main/java/org/teavm/model/AnnotationValue.java b/teavm-core/src/main/java/org/teavm/model/AnnotationValue.java
index e112a94a3..0a226ee5d 100644
--- a/teavm-core/src/main/java/org/teavm/model/AnnotationValue.java
+++ b/teavm-core/src/main/java/org/teavm/model/AnnotationValue.java
@@ -102,63 +102,63 @@ public class AnnotationValue {
         if (type != BOOLEAN) {
             throw new IllegalStateException("There is no boolean value");
         }
-        return (Boolean)value;
+        return (Boolean) value;
     }
 
     public byte getByte() {
         if (type != BYTE) {
             throw new IllegalStateException("There is no byte value");
         }
-        return (Byte)value;
+        return (Byte) value;
     }
 
     public short getShort() {
         if (type != SHORT) {
             throw new IllegalStateException("There is no short value");
         }
-        return (Short)value;
+        return (Short) value;
     }
 
     public int getInt() {
         if (type != INT) {
             throw new IllegalStateException("There is no int value");
         }
-        return (Integer)value;
+        return (Integer) value;
     }
 
     public long getLong() {
         if (type != LONG) {
             throw new IllegalStateException("There is no long value");
         }
-        return (Long)value;
+        return (Long) value;
     }
 
     public float getFloat() {
         if (type != FLOAT) {
             throw new IllegalStateException("There is no float value");
         }
-        return (Float)value;
+        return (Float) value;
     }
 
     public double getDouble() {
         if (type != DOUBLE) {
             throw new IllegalStateException("There is no double value");
         }
-        return (Double)value;
+        return (Double) value;
     }
 
     public String getString() {
         if (type != STRING) {
             throw new IllegalStateException("There is no String value");
         }
-        return (String)value;
+        return (String) value;
     }
 
     public ValueType getJavaClass() {
         if (type != CLASS) {
             throw new IllegalStateException("There is no ValueType value");
         }
-        return (ValueType)value;
+        return (ValueType) value;
     }
 
     @SuppressWarnings("unchecked")
@@ -166,21 +166,21 @@ public class AnnotationValue {
         if (type != LIST) {
             throw new IllegalStateException("There is no List value");
         }
-        return Collections.unmodifiableList((List<AnnotationValue>)value);
+        return Collections.unmodifiableList((List<AnnotationValue>) value);
     }
 
     public FieldReference getEnumValue() {
         if (type != ENUM) {
             throw new IllegalStateException("There is no enum value");
         }
-        return (FieldReference)value;
+        return (FieldReference) value;
     }
 
     public AnnotationReader getAnnotation() {
         if (type != ANNOTATION) {
             throw new IllegalStateException("There is no annotation value");
         }
-        return (AnnotationReader)value;
+        return (AnnotationReader) value;
     }
 
     public byte getType() {
diff --git a/teavm-core/src/main/java/org/teavm/model/CallLocation.java b/teavm-core/src/main/java/org/teavm/model/CallLocation.java
index 8f9a93ee8..f7b33784a 100644
--- a/teavm-core/src/main/java/org/teavm/model/CallLocation.java
+++ b/teavm-core/src/main/java/org/teavm/model/CallLocation.java
@@ -58,7 +58,7 @@ public class CallLocation {
         if (!(obj instanceof CallLocation)) {
             return false;
         }
-        CallLocation other = (CallLocation)obj;
+        CallLocation other = (CallLocation) obj;
         return Objects.equals(method, other.method) && Objects.equals(sourceLocation, other.sourceLocation);
     }
 }
diff --git a/teavm-core/src/main/java/org/teavm/model/ClassHolder.java b/teavm-core/src/main/java/org/teavm/model/ClassHolder.java
index 3440de6bb..9a964aae0 100644
--- a/teavm-core/src/main/java/org/teavm/model/ClassHolder.java
+++ b/teavm-core/src/main/java/org/teavm/model/ClassHolder.java
@@ -58,8 +58,8 @@ public class ClassHolder extends ElementHolder implements ClassReader {
 
     public void addMethod(MethodHolder method) {
         if (method.getOwner() != null) {
-            throw new IllegalArgumentException("Method " + method.getDescriptor() +
-                    " is already in another class (" + method.getOwner().getName() + ")");
+            throw new IllegalArgumentException("Method " + method.getDescriptor()
+                    + " is already in another class (" + method.getOwner().getName() + ")");
         }
         method.setOwner(this);
         MethodHolder oldMethod = methods.put(method.getDescriptor(), method);
@@ -70,8 +70,8 @@ public class ClassHolder extends ElementHolder implements ClassReader {
 
     public void removeMethod(MethodHolder method) {
         if (method.getOwner() != this) {
-            throw new IllegalArgumentException("Method " + method.getOwner().getName() +
-                    "." + method.getDescriptor() + " is not a member of " + getName());
+            throw new IllegalArgumentException("Method " + method.getOwner().getName()
+                    + "." + method.getDescriptor() + " is not a member of " + getName());
         }
         methods.remove(method.getDescriptor());
         method.setOwner(null);
@@ -89,8 +89,8 @@ public class ClassHolder extends ElementHolder implements ClassReader {
 
     public void addField(FieldHolder field) {
         if (field.getOwner() != null) {
-            throw new IllegalArgumentException("Field " + field.getName() + " is already " +
-                    "in another class (" + field.getOwner().getName() + ")");
+            throw new IllegalArgumentException("Field " + field.getName() + " is already "
+                    + "in another class (" + field.getOwner().getName() + ")");
         }
         field.setOwner(this);
         FieldHolder oldField = fields.put(field.getName(), field);
@@ -101,8 +101,8 @@ public class ClassHolder extends ElementHolder implements ClassReader {
 
     public void removeField(FieldHolder field) {
         if (field.getOwner() != this) {
-            throw new IllegalArgumentException("Field " + field.getOwner().getName() + "." +
-                    field.getName() + " is not a member of " + getName());
+            throw new IllegalArgumentException("Field " + field.getOwner().getName() + "."
+                    + field.getName() + " is not a member of " + getName());
         }
         fields.remove(field.getName());
         field.setOwner(null);
diff --git a/teavm-core/src/main/java/org/teavm/model/FieldReference.java b/teavm-core/src/main/java/org/teavm/model/FieldReference.java
index b20876f54..5dc6ae891 100644
--- a/teavm-core/src/main/java/org/teavm/model/FieldReference.java
+++ b/teavm-core/src/main/java/org/teavm/model/FieldReference.java
@@ -49,7 +49,7 @@ public class FieldReference {
         if (!(obj instanceof FieldReference)) {
             return false;
         }
-        FieldReference other = (FieldReference)obj;
+        FieldReference other = (FieldReference) obj;
         return className.equals(other.className) && fieldName.equals(other.fieldName);
     }
 
diff --git a/teavm-core/src/main/java/org/teavm/model/InstructionLocation.java b/teavm-core/src/main/java/org/teavm/model/InstructionLocation.java
index eb6a92898..d8ade12b0 100644
--- a/teavm-core/src/main/java/org/teavm/model/InstructionLocation.java
+++ b/teavm-core/src/main/java/org/teavm/model/InstructionLocation.java
@@ -55,7 +55,7 @@ public class InstructionLocation {
         if (!(obj instanceof InstructionLocation)) {
             return false;
         }
-        InstructionLocation other = (InstructionLocation)obj;
+        InstructionLocation other = (InstructionLocation) obj;
         return Objects.equals(fileName, other.fileName) && line == other.line;
     }
 
diff --git a/teavm-core/src/main/java/org/teavm/model/MethodDescriptor.java b/teavm-core/src/main/java/org/teavm/model/MethodDescriptor.java
index aeba3a45e..2b646d060 100644
--- a/teavm-core/src/main/java/org/teavm/model/MethodDescriptor.java
+++ b/teavm-core/src/main/java/org/teavm/model/MethodDescriptor.java
@@ -67,8 +67,7 @@ public class MethodDescriptor {
 
     public ValueType parameterType(int index) {
         if (index >= signature.length - 1) {
-            throw new IndexOutOfBoundsException(String.valueOf(index) + "/" +
-                    (signature.length - 1));
+            throw new IndexOutOfBoundsException(String.valueOf(index) + "/" + (signature.length - 1));
         }
         return signature[index];
     }
diff --git a/teavm-core/src/main/java/org/teavm/model/MethodReference.java b/teavm-core/src/main/java/org/teavm/model/MethodReference.java
index 4e196af0e..42123a8c5 100644
--- a/teavm-core/src/main/java/org/teavm/model/MethodReference.java
+++ b/teavm-core/src/main/java/org/teavm/model/MethodReference.java
@@ -127,7 +127,7 @@ public class MethodReference {
         if (!(obj instanceof MethodReference)) {
             return false;
         }
-        MethodReference other = (MethodReference)obj;
+        MethodReference other = (MethodReference) obj;
         return toString().equals(other.toString());
     }
 
diff --git a/teavm-core/src/main/java/org/teavm/model/ValueType.java b/teavm-core/src/main/java/org/teavm/model/ValueType.java
index 53547517b..08f29f4b3 100644
--- a/teavm-core/src/main/java/org/teavm/model/ValueType.java
+++ b/teavm-core/src/main/java/org/teavm/model/ValueType.java
@@ -296,7 +296,7 @@ public abstract class ValueType {
         if (supertype instanceof ValueType.Object) {
             return !(this instanceof Primitive);
         } else if (supertype instanceof Array && this instanceof Array) {
-            return ((Array)this).getItemType().isSubtypeOf(((Array)supertype).getItemType());
+            return ((Array) this).getItemType().isSubtypeOf(((Array) supertype).getItemType());
         } else {
             return false;
         }
diff --git a/teavm-core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java b/teavm-core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java
index da24ecbb8..1ed4b2c87 100644
--- a/teavm-core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java
+++ b/teavm-core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java
@@ -138,10 +138,10 @@ public class AsyncMethodFinder {
         if (method == null) {
             return;
         }
-        if (method.getAnnotations().get(Sync.class.getName()) != null ||
-                method.getAnnotations().get(InjectedBy.class.getName()) != null) {
-            diagnostics.error(new CallLocation(methodRef), "Method {{m0}} is claimed to be synchronous, " +
-                    "but it is has invocations of asynchronous methods", methodRef);
+        if (method.getAnnotations().get(Sync.class.getName()) != null
+                || method.getAnnotations().get(InjectedBy.class.getName()) != null) {
+            diagnostics.error(new CallLocation(methodRef), "Method {{m0}} is claimed to be synchronous, "
+                    + "but it is has invocations of asynchronous methods", methodRef);
             return;
         }
         for (CallSite callSite : node.getCallerCallSites()) {
diff --git a/teavm-core/src/main/java/org/teavm/model/util/AsyncProgramSplitter.java b/teavm-core/src/main/java/org/teavm/model/util/AsyncProgramSplitter.java
index dc0cd0a5d..e49c9c2fc 100644
--- a/teavm-core/src/main/java/org/teavm/model/util/AsyncProgramSplitter.java
+++ b/teavm-core/src/main/java/org/teavm/model/util/AsyncProgramSplitter.java
@@ -64,7 +64,7 @@ public class AsyncProgramSplitter {
             for (int i = 0; i < sourceBlock.getInstructions().size(); ++i) {
                 Instruction insn = sourceBlock.getInstructions().get(i);
                 if (insn instanceof InvokeInstruction) {
-                    InvokeInstruction invoke = (InvokeInstruction)insn;
+                    InvokeInstruction invoke = (InvokeInstruction) insn;
                     if (!asyncMethods.contains(findRealMethod(invoke.getMethod()))) {
                         continue;
                     }
@@ -92,7 +92,7 @@ public class AsyncProgramSplitter {
 
                 // If this instruction already separates program, end with current block and refer to the
                 // existing part
-                long key = ((long)step.source << 32) | i;
+                long key = ((long) step.source << 32) | i;
                 if (partMap.containsKey(key)) {
                     step.targetPart.blockSuccessors[targetBlock.getIndex()] = partMap.get(key);
                     continue taskLoop;
diff --git a/teavm-core/src/main/java/org/teavm/model/util/InterferenceGraphBuilder.java b/teavm-core/src/main/java/org/teavm/model/util/InterferenceGraphBuilder.java
index 54c42aec7..40a04631f 100644
--- a/teavm-core/src/main/java/org/teavm/model/util/InterferenceGraphBuilder.java
+++ b/teavm-core/src/main/java/org/teavm/model/util/InterferenceGraphBuilder.java
@@ -107,7 +107,7 @@ class InterferenceGraphBuilder {
         for (int i = 0; i < program.basicBlockCount(); ++i) {
             BasicBlock block = program.basicBlockAt(i);
             for (Phi phi : block.getPhis()) {
-                for(Incoming incoming : phi.getIncomings()) {
+                for (Incoming incoming : phi.getIncomings()) {
                     outgoings.get(incoming.getSource().getIndex()).add(incoming);
                 }
             }
diff --git a/teavm-core/src/main/java/org/teavm/model/util/ListingBuilder.java b/teavm-core/src/main/java/org/teavm/model/util/ListingBuilder.java
index c7d0852f3..26424155c 100644
--- a/teavm-core/src/main/java/org/teavm/model/util/ListingBuilder.java
+++ b/teavm-core/src/main/java/org/teavm/model/util/ListingBuilder.java
@@ -67,8 +67,8 @@ public class ListingBuilder {
                 block.readInstruction(j, stringifier);
                 if (!Objects.equals(location, stringifier.getLocation())) {
                     location = stringifier.getLocation();
-                    sb.append(prefix).append("  at ").append(location != null ? location.toString() :
-                            "unknown location").append('\n');
+                    sb.append(prefix).append("  at ").append(location != null ? location.toString()
+                            : "unknown location").append('\n');
                 }
                 sb.append(prefix).append("    ").append(insnSb).append("\n");
             }
diff --git a/teavm-core/src/main/java/org/teavm/model/util/LivenessAnalyzer.java b/teavm-core/src/main/java/org/teavm/model/util/LivenessAnalyzer.java
index 665ff717d..0bb802e65 100644
--- a/teavm-core/src/main/java/org/teavm/model/util/LivenessAnalyzer.java
+++ b/teavm-core/src/main/java/org/teavm/model/util/LivenessAnalyzer.java
@@ -35,7 +35,7 @@ public class LivenessAnalyzer {
     }
 
     public BitSet liveIn(int block) {
-        return (BitSet)liveVars[block].clone();
+        return (BitSet) liveVars[block].clone();
     }
 
     public void analyze(Program program) {
diff --git a/teavm-core/src/main/java/org/teavm/model/util/MissingItemsProcessor.java b/teavm-core/src/main/java/org/teavm/model/util/MissingItemsProcessor.java
index 6d09daf75..e811ced8b 100644
--- a/teavm-core/src/main/java/org/teavm/model/util/MissingItemsProcessor.java
+++ b/teavm-core/src/main/java/org/teavm/model/util/MissingItemsProcessor.java
@@ -137,10 +137,10 @@ public class MissingItemsProcessor {
 
     private boolean checkClass(InstructionLocation location, ValueType type) {
         while (type instanceof ValueType.Array) {
-            type = ((ValueType.Array)type).getItemType();
+            type = ((ValueType.Array) type).getItemType();
         }
         if (type instanceof ValueType.Object) {
-            return checkClass(location, ((ValueType.Object)type).getClassName());
+            return checkClass(location, ((ValueType.Object) type).getClassName());
         }
         return true;
     }
diff --git a/teavm-core/src/main/java/org/teavm/model/util/RegisterAllocator.java b/teavm-core/src/main/java/org/teavm/model/util/RegisterAllocator.java
index 9cf08eb82..59b9b8604 100644
--- a/teavm-core/src/main/java/org/teavm/model/util/RegisterAllocator.java
+++ b/teavm-core/src/main/java/org/teavm/model/util/RegisterAllocator.java
@@ -171,7 +171,7 @@ public class RegisterAllocator {
                 if (!(insn instanceof AssignInstruction)) {
                     continue;
                 }
-                AssignInstruction assignment = (AssignInstruction)insn;
+                AssignInstruction assignment = (AssignInstruction) insn;
                 boolean interfere = false;
                 int copyClass = congruenceClasses.find(assignment.getReceiver().getIndex());
                 int origClass = congruenceClasses.find(assignment.getAssignee().getIndex());
diff --git a/teavm-core/src/main/java/org/teavm/model/util/TypeInferer.java b/teavm-core/src/main/java/org/teavm/model/util/TypeInferer.java
index 860b00f8e..b8d026518 100644
--- a/teavm-core/src/main/java/org/teavm/model/util/TypeInferer.java
+++ b/teavm-core/src/main/java/org/teavm/model/util/TypeInferer.java
@@ -62,8 +62,8 @@ public class TypeInferer {
         Graph graph = builder.build();
         Graph arrayElemGraph = builder.build();
         for (int i = 0; i < sz; ++i) {
-            if ((i >= graph.size() || graph.incomingEdgesCount(i) == 0) &&
-                    (i >= arrayElemGraph.size() || arrayElemGraph.incomingEdgesCount(i) == 0)) {
+            if ((i >= graph.size() || graph.incomingEdgesCount(i) == 0)
+                    && (i >= arrayElemGraph.size() || arrayElemGraph.incomingEdgesCount(i) == 0)) {
                 stack.push(i);
             }
         }
@@ -110,7 +110,7 @@ public class TypeInferer {
 
     VariableType convert(ValueType type) {
         if (type instanceof ValueType.Primitive) {
-            switch (((ValueType.Primitive)type).getKind()) {
+            switch (((ValueType.Primitive) type).getKind()) {
                 case BOOLEAN:
                 case BYTE:
                 case SHORT:
@@ -125,7 +125,7 @@ public class TypeInferer {
                     return VariableType.LONG;
             }
         } else if (type instanceof ValueType.Array) {
-            ValueType item = ((ValueType.Array)type).getItemType();
+            ValueType item = ((ValueType.Array) type).getItemType();
             return convertArray(item);
         }
         return VariableType.OBJECT;
@@ -189,7 +189,7 @@ public class TypeInferer {
 
     VariableType convertArray(ValueType type) {
         if (type instanceof ValueType.Primitive) {
-            switch (((ValueType.Primitive)type).getKind()) {
+            switch (((ValueType.Primitive) type).getKind()) {
                 case BOOLEAN:
                 case BYTE:
                     return VariableType.BYTE_ARRAY;
diff --git a/teavm-core/src/main/java/org/teavm/model/util/UsageExtractor.java b/teavm-core/src/main/java/org/teavm/model/util/UsageExtractor.java
index ac794867b..c3c607bbf 100644
--- a/teavm-core/src/main/java/org/teavm/model/util/UsageExtractor.java
+++ b/teavm-core/src/main/java/org/teavm/model/util/UsageExtractor.java
@@ -151,8 +151,8 @@ public class UsageExtractor implements InstructionVisitor {
 
     @Override
     public void visit(PutFieldInstruction insn) {
-        usedVariables = insn.getInstance() != null ? new Variable[] { insn.getInstance(), insn.getValue() } :
-                new Variable[] { insn.getValue() };
+        usedVariables = insn.getInstance() != null ? new Variable[] { insn.getInstance(), insn.getValue() }
+                : new Variable[] { insn.getValue() };
     }
 
     @Override
diff --git a/teavm-core/src/main/java/org/teavm/optimization/ArrayUnwrapMotion.java b/teavm-core/src/main/java/org/teavm/optimization/ArrayUnwrapMotion.java
index ed8b79a0f..e2c1a28b4 100644
--- a/teavm-core/src/main/java/org/teavm/optimization/ArrayUnwrapMotion.java
+++ b/teavm-core/src/main/java/org/teavm/optimization/ArrayUnwrapMotion.java
@@ -40,7 +40,7 @@ public class ArrayUnwrapMotion implements MethodOptimization {
         for (int i = 0; i < instructions.size(); ++i) {
             Instruction insn = instructions.get(i);
             if (insn instanceof UnwrapArrayInstruction) {
-                UnwrapArrayInstruction unwrap = (UnwrapArrayInstruction)insn;
+                UnwrapArrayInstruction unwrap = (UnwrapArrayInstruction) insn;
                 instructions.set(i, new EmptyInstruction());
                 int def = whereDefined(instructions, i, unwrap.getArray());
                 if (def < 0) {
diff --git a/teavm-core/src/main/java/org/teavm/optimization/Devirtualization.java b/teavm-core/src/main/java/org/teavm/optimization/Devirtualization.java
index 9f2c1646d..eb32ec9ed 100644
--- a/teavm-core/src/main/java/org/teavm/optimization/Devirtualization.java
+++ b/teavm-core/src/main/java/org/teavm/optimization/Devirtualization.java
@@ -49,7 +49,7 @@ public class Devirtualization {
                 if (!(insn instanceof InvokeInstruction)) {
                     continue;
                 }
-                InvokeInstruction invoke = (InvokeInstruction)insn;
+                InvokeInstruction invoke = (InvokeInstruction) insn;
                 if (invoke.getType() != InvocationType.VIRTUAL) {
                     continue;
                 }
diff --git a/teavm-core/src/main/java/org/teavm/optimization/EmptyBlockElimination.java b/teavm-core/src/main/java/org/teavm/optimization/EmptyBlockElimination.java
index cfc616bb1..49ade6611 100644
--- a/teavm-core/src/main/java/org/teavm/optimization/EmptyBlockElimination.java
+++ b/teavm-core/src/main/java/org/teavm/optimization/EmptyBlockElimination.java
@@ -35,9 +35,9 @@ public class EmptyBlockElimination implements MethodOptimization {
         int lastNonEmpty = program.basicBlockCount() - 1;
         for (int i = program.basicBlockCount() - 2; i > 0; --i) {
             BasicBlock block = program.basicBlockAt(i);
-            if (block.getPhis().isEmpty() && block.getInstructions().size() == 1 &&
-                    block.getLastInstruction() instanceof JumpInstruction) {
-                JumpInstruction insn = (JumpInstruction)block.getLastInstruction();
+            if (block.getPhis().isEmpty() && block.getInstructions().size() == 1
+                    && block.getLastInstruction() instanceof JumpInstruction) {
+                JumpInstruction insn = (JumpInstruction) block.getLastInstruction();
                 if (insn.getTarget().getIndex() == i + 1) {
                     blockMapping[i] = lastNonEmpty;
                 }
diff --git a/teavm-core/src/main/java/org/teavm/parsing/ClassRefsRenamer.java b/teavm-core/src/main/java/org/teavm/parsing/ClassRefsRenamer.java
index 078066b2b..02faae7cf 100644
--- a/teavm-core/src/main/java/org/teavm/parsing/ClassRefsRenamer.java
+++ b/teavm-core/src/main/java/org/teavm/parsing/ClassRefsRenamer.java
@@ -91,10 +91,10 @@ public class ClassRefsRenamer implements InstructionVisitor {
 
     private ValueType rename(ValueType type) {
         if (type instanceof ValueType.Array) {
-            ValueType itemType = ((ValueType.Array)type).getItemType();
+            ValueType itemType = ((ValueType.Array) type).getItemType();
             return ValueType.arrayOf(rename(itemType));
         } else if (type instanceof ValueType.Object) {
-            String className = ((ValueType.Object)type).getClassName();
+            String className = ((ValueType.Object) type).getClassName();
             return ValueType.object(classNameMapper.map(className));
         } else {
             return type;
@@ -103,8 +103,8 @@ public class ClassRefsRenamer implements InstructionVisitor {
 
     private void rename(AnnotationContainer source, AnnotationContainer target) {
         for (AnnotationHolder annot : source.all()) {
-            if (!annot.getType().equals(Rename.class.getName()) &&
-                    !annot.getType().equals(Superclass.class.getName())) {
+            if (!annot.getType().equals(Rename.class.getName())
+                    && !annot.getType().equals(Superclass.class.getName())) {
                 target.add(rename(annot));
             }
         }
@@ -287,11 +287,9 @@ public class ClassRefsRenamer implements InstructionVisitor {
 
     @Override
     public void visit(MonitorEnterInstruction insn) {
-        
     }
 
     @Override
     public void visit(MonitorExitInstruction insn) {
-        
     }
 }
diff --git a/teavm-core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java b/teavm-core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java
index 23b07a077..48134ce0e 100644
--- a/teavm-core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java
+++ b/teavm-core/src/main/java/org/teavm/parsing/ClasspathResourceMapper.java
@@ -99,8 +99,8 @@ public class ClasspathResourceMapper implements Mapper<String, ClassHolder>, Cla
                 int index = name.lastIndexOf('.');
                 String className = name.substring(index + 1);
                 String packageName = index > 0 ? name.substring(0, index) : "";
-                ClassHolder classHolder = innerMapper.map(transformation.packagePrefix + packageName +
-                        "." + transformation.classPrefix + className);
+                ClassHolder classHolder = innerMapper.map(transformation.packagePrefix + packageName
+                        + "." + transformation.classPrefix + className);
                 if (classHolder != null) {
                     classHolder = renamer.rename(classHolder);
                 }
@@ -117,8 +117,8 @@ public class ClasspathResourceMapper implements Mapper<String, ClassHolder>, Cla
                 String className = name.substring(index + 1);
                 String packageName = name.substring(0, index);
                 if (className.startsWith(transformation.classPrefix)) {
-                    return packageName.substring(transformation.packagePrefix.length()) + "." +
-                            className.substring(transformation.classPrefix.length());
+                    return packageName.substring(transformation.packagePrefix.length()) + "."
+                            + className.substring(transformation.classPrefix.length());
                 }
             }
         }
diff --git a/teavm-core/src/main/java/org/teavm/parsing/Parser.java b/teavm-core/src/main/java/org/teavm/parsing/Parser.java
index 4a876d1f5..70df7b2ee 100644
--- a/teavm-core/src/main/java/org/teavm/parsing/Parser.java
+++ b/teavm-core/src/main/java/org/teavm/parsing/Parser.java
@@ -75,7 +75,7 @@ public final class Parser {
             }
         }
         for (Object obj : node.fields) {
-            FieldNode fieldNode = (FieldNode)obj;
+            FieldNode fieldNode = (FieldNode) obj;
             cls.addField(parseField(fieldNode));
         }
         String fullFileName = node.name.substring(0, node.name.lastIndexOf('/') + 1) + node.sourceFile;
@@ -172,7 +172,7 @@ public final class Parser {
             annotNodes.addAll(invisibleAnnotations);
         }
         for (Object obj : annotNodes) {
-            AnnotationNode annotNode = (AnnotationNode)obj;
+            AnnotationNode annotNode = (AnnotationNode) obj;
             String desc = annotNode.desc;
             if (desc.startsWith("L") && desc.endsWith(";")) {
                 desc = desc.substring(1, desc.length() - 1);
@@ -189,7 +189,7 @@ public final class Parser {
             return;
         }
         for (int i = 0; i < values.size(); i += 2) {
-            String key = (String)values.get(i);
+            String key = (String) values.get(i);
             Object value = values.get(i + 1);
             annot.getValues().put(key, parseAnnotationValue(value));
         }
@@ -197,41 +197,41 @@ public final class Parser {
 
     private static AnnotationValue parseAnnotationValue(Object value) {
         if (value instanceof String[]) {
-            String[] enumInfo = (String[])value;
-            ValueType.Object object = (ValueType.Object)ValueType.parse(enumInfo[0]);
+            String[] enumInfo = (String[]) value;
+            ValueType.Object object = (ValueType.Object) ValueType.parse(enumInfo[0]);
             return new AnnotationValue(new FieldReference(object.getClassName(), enumInfo[1]));
         } else if (value instanceof Type) {
-            Type cls = (Type)value;
+            Type cls = (Type) value;
             return new AnnotationValue(ValueType.parse(cls.getDescriptor()));
         } else if (value instanceof List<?>) {
-            List<?> originalList = (List<?>)value;
+            List<?> originalList = (List<?>) value;
             List<AnnotationValue> resultList = new ArrayList<>();
             for (Object item : originalList) {
                 resultList.add(parseAnnotationValue(item));
             }
             return new AnnotationValue(resultList);
         } else if (value instanceof AnnotationNode) {
-            AnnotationNode annotNode = (AnnotationNode)value;
-            ValueType.Object object = (ValueType.Object)ValueType.parse(annotNode.desc);
+            AnnotationNode annotNode = (AnnotationNode) value;
+            ValueType.Object object = (ValueType.Object) ValueType.parse(annotNode.desc);
             AnnotationHolder annotation = new AnnotationHolder(object.getClassName());
             parseAnnotationValues(annotation, annotNode.values);
             return new AnnotationValue(annotation);
         } else if (value instanceof String) {
-            return new AnnotationValue((String)value);
+            return new AnnotationValue((String) value);
         } else if (value instanceof Boolean) {
-            return new AnnotationValue((Boolean)value);
+            return new AnnotationValue((Boolean) value);
         } else if (value instanceof Byte) {
-            return new AnnotationValue((Byte)value);
+            return new AnnotationValue((Byte) value);
         } else if (value instanceof Short) {
-            return new AnnotationValue((Short)value);
+            return new AnnotationValue((Short) value);
         } else if (value instanceof Integer) {
-            return new AnnotationValue((Integer)value);
+            return new AnnotationValue((Integer) value);
         } else if (value instanceof Long) {
-            return new AnnotationValue((Long)value);
+            return new AnnotationValue((Long) value);
         } else if (value instanceof Float) {
-            return new AnnotationValue((Float)value);
+            return new AnnotationValue((Float) value);
         } else if (value instanceof Double) {
-            return new AnnotationValue((Double)value);
+            return new AnnotationValue((Double) value);
         } else if (value.getClass().isArray()) {
             List<AnnotationValue> resultList = new ArrayList<>();
             int size = Array.getLength(value);
diff --git a/teavm-core/src/main/java/org/teavm/parsing/ProgramParser.java b/teavm-core/src/main/java/org/teavm/parsing/ProgramParser.java
index c4205da2d..a9d7d9350 100644
--- a/teavm-core/src/main/java/org/teavm/parsing/ProgramParser.java
+++ b/teavm-core/src/main/java/org/teavm/parsing/ProgramParser.java
@@ -176,10 +176,10 @@ public class ProgramParser implements VariableDebugInformation {
         for (int i = 0; i < instructions.size(); ++i) {
             AbstractInsnNode node = instructions.get(i);
             if (node instanceof LabelNode) {
-                labelIndexes.put(((LabelNode)node).getLabel(), i);
+                labelIndexes.put(((LabelNode) node).getLabel(), i);
             }
             if (node instanceof LineNumberNode) {
-                LineNumberNode lineNumberNode = (LineNumberNode)node;
+                LineNumberNode lineNumberNode = (LineNumberNode) node;
                 lineNumbers.put(lineNumberNode.start.getLabel(), lineNumberNode.line);
             }
         }
@@ -203,7 +203,7 @@ public class ProgramParser implements VariableDebugInformation {
         InsnList instructions = method.instructions;
         Deque<Step> workStack = new ArrayDeque<>();
         for (Object obj : method.tryCatchBlocks) {
-            TryCatchBlockNode tryCatchNode = (TryCatchBlockNode)obj;
+            TryCatchBlockNode tryCatchNode = (TryCatchBlockNode) obj;
             if (tryCatchNode.start == tryCatchNode.handler) {
                 continue;
             }
@@ -241,7 +241,7 @@ public class ProgramParser implements VariableDebugInformation {
             }
         }
         for (Object obj : method.tryCatchBlocks) {
-            TryCatchBlockNode tryCatchNode = (TryCatchBlockNode)obj;
+            TryCatchBlockNode tryCatchNode = (TryCatchBlockNode) obj;
             if (tryCatchNode.start == tryCatchNode.handler) {
                 continue;
             }
@@ -298,7 +298,7 @@ public class ProgramParser implements VariableDebugInformation {
             }
             AbstractInsnNode insnNode = methodNode.instructions.get(i);
             if (insnNode instanceof LabelNode) {
-                Label label = ((LabelNode)insnNode).getLabel();
+                Label label = ((LabelNode) insnNode).getLabel();
                 Integer lineNumber = lineNumbers.get(label);
                 if (lineNumber != null && !lineNumber.equals(lastLineNumber)) {
                     lastLineNumber = lineNumber;
@@ -340,7 +340,7 @@ public class ProgramParser implements VariableDebugInformation {
 
     private void emitNextBasicBlock() {
         if (index + 1 < basicBlocks.size()) {
-            getBasicBlock(index+ 1);
+            getBasicBlock(index + 1);
         }
     }
 
@@ -591,21 +591,21 @@ public class ProgramParser implements VariableDebugInformation {
         @Override
         public void visitLdcInsn(Object cst) {
             if (cst instanceof Integer) {
-                pushConstant((Integer)cst);
+                pushConstant((Integer) cst);
             } else if (cst instanceof Float) {
-                pushConstant((Float)cst);
+                pushConstant((Float) cst);
             } else if (cst instanceof Long) {
-                pushConstant((Long)cst);
+                pushConstant((Long) cst);
             } else if (cst instanceof Double) {
-                pushConstant((Double)cst);
+                pushConstant((Double) cst);
             } else if (cst instanceof String) {
                 StringConstantInstruction insn = new StringConstantInstruction();
-                insn.setConstant((String)cst);
+                insn.setConstant((String) cst);
                 insn.setReceiver(getVariable(pushSingle()));
                 addInstruction(insn);
             } else if (cst instanceof Type) {
                 ClassConstantInstruction insn = new ClassConstantInstruction();
-                insn.setConstant(ValueType.parse(((Type)cst).getDescriptor()));
+                insn.setConstant(ValueType.parse(((Type) cst).getDescriptor()));
                 insn.setReceiver(getVariable(pushSingle()));
                 addInstruction(insn);
             } else {
@@ -1055,7 +1055,7 @@ public class ProgramParser implements VariableDebugInformation {
                     }
                     break;
                 }
-                case Opcodes.DUP2_X1:{
+                case Opcodes.DUP2_X1: {
                     if (stack.type == SINGLE) {
                         popSingle();
                         popSingle();
diff --git a/teavm-core/src/main/java/org/teavm/parsing/SSATransformer.java b/teavm-core/src/main/java/org/teavm/parsing/SSATransformer.java
index d1f2f5cf4..8cf41beec 100644
--- a/teavm-core/src/main/java/org/teavm/parsing/SSATransformer.java
+++ b/teavm-core/src/main/java/org/teavm/parsing/SSATransformer.java
@@ -77,7 +77,7 @@ public class SSATransformer {
             ++index;
             ValueType arg = arguments[i];
             if (arg instanceof ValueType.Primitive) {
-                PrimitiveType kind = ((ValueType.Primitive)arg).getKind();
+                PrimitiveType kind = ((ValueType.Primitive) arg).getKind();
                 if (kind == PrimitiveType.LONG || kind == PrimitiveType.DOUBLE) {
                     variableMap[index] = variableMap[index - 1];
                     ++index;
diff --git a/teavm-core/src/main/java/org/teavm/testing/JUnitTestAdapter.java b/teavm-core/src/main/java/org/teavm/testing/JUnitTestAdapter.java
index 8f99a42dc..465ba54d3 100644
--- a/teavm-core/src/main/java/org/teavm/testing/JUnitTestAdapter.java
+++ b/teavm-core/src/main/java/org/teavm/testing/JUnitTestAdapter.java
@@ -51,7 +51,7 @@ public class JUnitTestAdapter implements TestAdapter {
         AnnotationReader annot = method.getAnnotations().get(Test.class.getName());
         AnnotationValue expectedAnnot = annot.getValue("expected");
         if (expectedAnnot != null) {
-            String className = ((ValueType.Object)expectedAnnot.getJavaClass()).getClassName();
+            String className = ((ValueType.Object) expectedAnnot.getJavaClass()).getClassName();
             return Collections.singletonList(className);
         }
         return Collections.emptyList();
diff --git a/teavm-core/src/main/java/org/teavm/tooling/TeaVMTestTool.java b/teavm-core/src/main/java/org/teavm/tooling/TeaVMTestTool.java
index 4b0045418..a2895b0eb 100644
--- a/teavm-core/src/main/java/org/teavm/tooling/TeaVMTestTool.java
+++ b/teavm-core/src/main/java/org/teavm/tooling/TeaVMTestTool.java
@@ -221,8 +221,8 @@ public class TeaVMTestTool {
                             allTestsWriter.append(",");
                         }
                         firstMethod = false;
-                        allTestsWriter.append("\n            { name : \"" + methodRef.getName() + "\", script : \"" +
-                                scriptName + "\", expected : [");
+                        allTestsWriter.append("\n            { name : \"" + methodRef.getName() + "\", script : \""
+                                + scriptName + "\", expected : [");
                         MethodHolder methodHolder = classSource.get(testClass).getMethod(
                                 methodRef.getDescriptor());
                         boolean firstException = true;
@@ -322,7 +322,7 @@ public class TeaVMTestTool {
                 if (!file.exists()) {
                     file.createNewFile();
                 }
-                try(OutputStream out = new FileOutputStream(file)) {
+                try (OutputStream out = new FileOutputStream(file)) {
                     IOUtils.copy(in, out);
                 }
             } catch (IOException e) {
@@ -348,8 +348,8 @@ public class TeaVMTestTool {
             vm.add(transformer);
         }
         File file = new File(outputDir, targetName);
-        DebugInformationBuilder debugInfoBuilder = sourceMapsGenerated || debugInformationGenerated ?
-                new DebugInformationBuilder() : null;
+        DebugInformationBuilder debugInfoBuilder = sourceMapsGenerated || debugInformationGenerated
+                ? new DebugInformationBuilder() : null;
         try (Writer innerWriter = new OutputStreamWriter(new FileOutputStream(file), "UTF-8")) {
             MethodReference cons = new MethodReference(methodRef.getClassName(), "<init>", ValueType.VOID);
             MethodReference exceptionMsg = new MethodReference(ExceptionHelper.class, "showException",
diff --git a/teavm-core/src/main/java/org/teavm/tooling/TeaVMTool.java b/teavm-core/src/main/java/org/teavm/tooling/TeaVMTool.java
index ff4c0bfbe..ae767fb16 100644
--- a/teavm-core/src/main/java/org/teavm/tooling/TeaVMTool.java
+++ b/teavm-core/src/main/java/org/teavm/tooling/TeaVMTool.java
@@ -282,8 +282,8 @@ public class TeaVMTool {
             vm.setMinifying(minifying);
             vm.setBytecodeLogging(bytecodeLogging);
             vm.setProperties(properties);
-            DebugInformationBuilder debugEmitter = debugInformationGenerated || sourceMapsFileGenerated ?
-                    new DebugInformationBuilder() : null;
+            DebugInformationBuilder debugEmitter = debugInformationGenerated || sourceMapsFileGenerated
+                    ? new DebugInformationBuilder() : null;
             vm.setDebugEmitter(debugEmitter);
             vm.setIncremental(incremental);
             if (incremental) {
diff --git a/teavm-core/src/main/java/org/teavm/vm/TeaVM.java b/teavm-core/src/main/java/org/teavm/vm/TeaVM.java
index 6d33edbaf..e60a8378f 100644
--- a/teavm-core/src/main/java/org/teavm/vm/TeaVM.java
+++ b/teavm-core/src/main/java/org/teavm/vm/TeaVM.java
@@ -240,8 +240,8 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
     public TeaVMEntryPoint entryPoint(String name, MethodReference ref) {
         if (name != null) {
             if (entryPoints.containsKey(name)) {
-                throw new IllegalArgumentException("Entry point with public name `" + name + "' already defined " +
-                        "for method " + ref);
+                throw new IllegalArgumentException("Entry point with public name `" + name + "' already defined "
+                        + "for method " + ref);
             }
         }
         TeaVMEntryPoint entryPoint = new TeaVMEntryPoint(name, ref, dependencyChecker.linkMethod(ref, null));
@@ -276,8 +276,8 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
 
     public void exportType(String name, String className) {
         if (exportedClasses.containsKey(name)) {
-            throw new IllegalArgumentException("Class with public name `" + name + "' already defined for class " +
-                    className);
+            throw new IllegalArgumentException("Class with public name `" + name + "' already defined for class "
+                    + className);
         }
         dependencyChecker.linkClass(className, null).initClass(null);
         exportedClasses.put(name, className);
@@ -562,8 +562,8 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
         List<String> classOrder = decompiler.getClassOrdering(classes.getClassNames());
         List<ClassNode> classNodes = new ArrayList<>();
         int index = 0;
-        try (PrintWriter bytecodeLogger = bytecodeLogging ?
-                new PrintWriter(new OutputStreamWriter(logStream, "UTF-8")) : null) {
+        try (PrintWriter bytecodeLogger = bytecodeLogging
+                ? new PrintWriter(new OutputStreamWriter(logStream, "UTF-8")) : null) {
             for (String className : classOrder) {
                 ClassHolder cls = classes.get(className);
                 for (MethodHolder method : cls.getMethods()) {
@@ -583,11 +583,11 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
     }
 
     private void preprocessNativeMethod(MethodHolder method) {
-        if (!method.getModifiers().contains(ElementModifier.NATIVE) ||
-                methodGenerators.get(method.getReference()) != null ||
-                methodInjectors.get(method.getReference()) != null ||
-                method.getAnnotations().get(GeneratedBy.class.getName()) != null ||
-                method.getAnnotations().get(InjectedBy.class.getName()) != null) {
+        if (!method.getModifiers().contains(ElementModifier.NATIVE)
+                || methodGenerators.get(method.getReference()) != null
+                || methodInjectors.get(method.getReference()) != null
+                || method.getAnnotations().get(GeneratedBy.class.getName()) != null
+                || method.getAnnotations().get(InjectedBy.class.getName()) != null) {
             return;
         }
         method.getModifiers().remove(ElementModifier.NATIVE);
@@ -628,8 +628,8 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
         }
 
         boolean noCache = method.getAnnotations().get(NoCache.class.getName()) != null;
-        Program optimizedProgram = incremental && !noCache && programCache != null ?
-                programCache.get(method.getReference()) : null;
+        Program optimizedProgram = incremental && !noCache && programCache != null
+                ? programCache.get(method.getReference()) : null;
         if (optimizedProgram == null) {
             optimizedProgram = ProgramUtils.copy(method.getProgram());
             if (optimizedProgram.basicBlockCount() > 0) {
@@ -681,12 +681,12 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
 
     private void printType(PrintWriter writer, ValueType type) {
         if (type instanceof ValueType.Object) {
-            writer.print(((ValueType.Object)type).getClassName());
+            writer.print(((ValueType.Object) type).getClassName());
         } else if (type instanceof ValueType.Array) {
-            printType(writer, ((ValueType.Array)type).getItemType());
+            printType(writer, ((ValueType.Array) type).getItemType());
             writer.print("[]");
         } else if (type instanceof ValueType.Primitive) {
-            switch (((ValueType.Primitive)type).getKind()) {
+            switch (((ValueType.Primitive) type).getKind()) {
                 case BOOLEAN:
                     writer.print("boolean");
                     break;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBFactory.java b/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBFactory.java
index b8e5199d4..359522035 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBFactory.java
+++ b/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBFactory.java
@@ -36,8 +36,8 @@ public abstract class IDBFactory implements JSObject {
         return factory;
     }
 
-    @JSBody(params = {}, script = "return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || " +
-            "window.msIndexedDB;")
+    @JSBody(params = {}, script = "return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || "
+            + "window.msIndexedDB;")
     static native IDBFactory getInstanceImpl();
 
     public abstract IDBOpenDBRequest open(String name, int version);
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBIndex.java b/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBIndex.java
index e568074a5..fd6561067 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBIndex.java
+++ b/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBIndex.java
@@ -37,7 +37,7 @@ public abstract class IDBIndex implements JSObject, IDBCursorSource {
         if (JS.getType(result) == JSType.STRING) {
             return new String[] { JS.unwrapString(result) };
         } else {
-            return JS.unwrapStringArray((JSStringArray)result);
+            return JS.unwrapStringArray((JSStringArray) result);
         }
     }
 
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBObjectStore.java b/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBObjectStore.java
index 8d6549fce..9c9e30c0e 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBObjectStore.java
+++ b/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBObjectStore.java
@@ -33,7 +33,7 @@ public abstract class IDBObjectStore implements JSObject, IDBCursorSource {
         if (JS.getType(result) == JSType.STRING) {
             return new String[] { JS.unwrapString(result) };
         } else {
-            return JS.unwrapStringArray((JSStringArray)result);
+            return JS.unwrapStringArray((JSStringArray) result);
         }
     }
 
diff --git a/teavm-html4j/src/main/java/org/teavm/html4j/HTML4JPlugin.java b/teavm-html4j/src/main/java/org/teavm/html4j/HTML4JPlugin.java
index fd04ae7bc..6a6dad24d 100644
--- a/teavm-html4j/src/main/java/org/teavm/html4j/HTML4JPlugin.java
+++ b/teavm-html4j/src/main/java/org/teavm/html4j/HTML4JPlugin.java
@@ -33,7 +33,7 @@ public class HTML4JPlugin implements TeaVMPlugin {
         host.add(new JavaScriptResourceInterceptor());
         EntryPointGenerator entryPointGen = new EntryPointGenerator(host.getProperties()
                 .getProperty("html4j.entryPoints", ""));
-        host.add((DependencyListener)entryPointGen);
-        host.add((RendererListener)entryPointGen);
+        host.add((DependencyListener) entryPointGen);
+        host.add((RendererListener) entryPointGen);
     }
 }
diff --git a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyDependency.java b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyDependency.java
index 081ab3822..ceae44dca 100644
--- a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyDependency.java
+++ b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyDependency.java
@@ -63,8 +63,8 @@ public class JavaScriptBodyDependency extends AbstractDependencyListener {
     @Override
     public void classReached(DependencyAgent agent, String className, CallLocation location) {
         ClassReader cls = agent.getClassSource().get(className);
-        if (cls != null && !cls.hasModifier(ElementModifier.ABSTRACT) &&
-                !cls.hasModifier(ElementModifier.INTERFACE)) {
+        if (cls != null && !cls.hasModifier(ElementModifier.ABSTRACT)
+                && !cls.hasModifier(ElementModifier.INTERFACE)) {
             allClassesNode.propagate(agent.getType(className));
         }
     }
diff --git a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyGenerator.java b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyGenerator.java
index 9d22c3cd8..16d612d95 100644
--- a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyGenerator.java
+++ b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptBodyGenerator.java
@@ -51,8 +51,8 @@ public class JavaScriptBodyGenerator implements Generator {
         }
         writer.append(")").ws().append("{").indent().softNewLine();
         writer.append(body).softNewLine();
-        writer.outdent().append("}).call(").append(!method.hasModifier(ElementModifier.STATIC) ?
-                context.getParameterName(0) : "null");
+        writer.outdent().append("}).call(").append(!method.hasModifier(ElementModifier.STATIC)
+                ? context.getParameterName(0) : "null");
         for (int i = 0; i < args.size(); ++i) {
             writer.append(",").ws();
             wrapParameter(writer, context.getParameterName(i + 1));
@@ -121,7 +121,7 @@ public class JavaScriptBodyGenerator implements Generator {
             if (type instanceof ValueType.Object) {
                 return ValueType.object("java.lang.Object");
             } else if (type instanceof ValueType.Array) {
-                ValueType.Array array = (ValueType.Array)type;
+                ValueType.Array array = (ValueType.Array) type;
                 return ValueType.arrayOf(simplifyParamType(array.getItemType()));
             } else {
                 return type;
diff --git a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConvGenerator.java b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConvGenerator.java
index 0776dcf78..d3d462bda 100644
--- a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConvGenerator.java
+++ b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptConvGenerator.java
@@ -116,14 +116,14 @@ public class JavaScriptConvGenerator implements Generator {
     private void generateFromJavaScript(GeneratorContext context, SourceWriter writer) throws IOException {
         String obj = context.getParameterName(1);
         String type = context.getParameterName(2);
-        writer.append("if (" + obj +" === null || " + obj + " === undefined)").ws().append("{")
+        writer.append("if (" + obj + " === null || " + obj + " === undefined)").ws().append("{")
                 .softNewLine().indent();
-        writer.append("return " + obj +";").softNewLine();
+        writer.append("return " + obj + ";").softNewLine();
         writer.outdent().append("} else if (" + type + ".$meta.item) {").indent().softNewLine();
         writer.append("var arr = $rt_createArray(" + type + ".$meta.item, " + obj + ".length);").softNewLine();
         writer.append("for (var i = 0; i < arr.data.length; ++i) {").indent().softNewLine();
-        writer.append("arr.data[i] = ").appendMethodBody(fromJsMethod).append("(" + obj + "[i], " +
-                type + ".$meta.item);").softNewLine();
+        writer.append("arr.data[i] = ").appendMethodBody(fromJsMethod).append("(" + obj + "[i], "
+                + type + ".$meta.item);").softNewLine();
         writer.outdent().append("}").softNewLine();
         writer.append("return arr;").softNewLine();
 
@@ -137,8 +137,8 @@ public class JavaScriptConvGenerator implements Generator {
 
         writer.outdent().append("} else if (" + type + " === ").appendClass("java.lang.Character")
                 .append(") {").indent().softNewLine();
-        writer.append("return ").appendMethodBody(valueOfCharMethod).append("(typeof " + obj + " === 'number' ? " +
-                obj + "0xFFFF : " + obj + ".charCodeAt(0));").softNewLine();
+        writer.append("return ").appendMethodBody(valueOfCharMethod).append("(typeof " + obj + " === 'number' ? "
+                + obj + "0xFFFF : " + obj + ".charCodeAt(0));").softNewLine();
 
         writer.outdent().append("} else if (" + type + " === ").appendClass("java.lang.Byte")
                 .append(") {").indent().softNewLine();
@@ -161,8 +161,8 @@ public class JavaScriptConvGenerator implements Generator {
                 .append(") {").indent().softNewLine();
         writer.append("return ").appendMethodBody(valueOfDoubleMethod).append("(" + obj + ");").softNewLine();
 
-        writer.outdent().append("} else if (" + type + " === $rt_intcls() || " + type + " === $rt_bytecls() || " +
-                type + " === $rt_shortcls() ||" + type + " == $rt_charcls()) {").indent().softNewLine();
+        writer.outdent().append("} else if (" + type + " === $rt_intcls() || " + type + " === $rt_bytecls() || "
+                + type + " === $rt_shortcls() ||" + type + " == $rt_charcls()) {").indent().softNewLine();
         writer.append("return " + obj + "|0;").softNewLine();
 
         writer.outdent().append("} else if (" + type + " === $rt_longcls()) {").indent().softNewLine();
diff --git a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptResourceInterceptor.java b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptResourceInterceptor.java
index cf6b7dfbc..15953bc74 100644
--- a/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptResourceInterceptor.java
+++ b/teavm-html4j/src/main/java/org/teavm/html4j/JavaScriptResourceInterceptor.java
@@ -46,8 +46,8 @@ public class JavaScriptResourceInterceptor extends AbstractRendererListener {
             String resourceName = packageName.replace('.', '/') + "/" + path;
             try (InputStream input = context.getClassLoader().getResourceAsStream(resourceName)) {
                 if (input == null) {
-                    throw new RenderingException("Error processing JavaScriptResource annotation on class " +
-                            className + ". Resource not found: " + resourceName);
+                    throw new RenderingException("Error processing JavaScriptResource annotation on class "
+                            + className + ". Resource not found: " + resourceName);
                 }
                 StringWriter writer = new StringWriter();
                 IOUtils.copy(input, writer);
diff --git a/teavm-html4j/src/main/java/org/teavm/html4j/JsCallback.java b/teavm-html4j/src/main/java/org/teavm/html4j/JsCallback.java
index 6266a132a..24963866d 100644
--- a/teavm-html4j/src/main/java/org/teavm/html4j/JsCallback.java
+++ b/teavm-html4j/src/main/java/org/teavm/html4j/JsCallback.java
@@ -87,8 +87,8 @@ abstract class JsCallback {
            int sigEnd = body.indexOf(')', sigBeg);
            int colon4 = body.indexOf("::", next);
            if (sigBeg == -1 || sigEnd == -1 || colon4 == -1) {
-               throw new IllegalStateException("Wrong format of instance callback. Should be: " +
-                       "'inst.@pkg.Class::method(Ljava/lang/Object;)(param)':\n" + body);
+               throw new IllegalStateException("Wrong format of instance callback. Should be: "
+                       + "'inst.@pkg.Class::method(Ljava/lang/Object;)(param)':\n" + body);
            }
            String fqn = body.substring(next + 2, colon4);
            String method = body.substring(colon4 + 2, sigBeg);
@@ -96,8 +96,8 @@ abstract class JsCallback {
 
            int paramBeg = body.indexOf('(', sigEnd + 1);
            if (paramBeg == -1) {
-               throw new IllegalStateException("Wrong format of instance callback. " +
-                   "Should be: 'inst.@pkg.Class::method(Ljava/lang/Object;)(param)':\n" + body);
+               throw new IllegalStateException("Wrong format of instance callback. "
+                   + "Should be: 'inst.@pkg.Class::method(Ljava/lang/Object;)(param)':\n" + body);
            }
 
            sb.append(callMethod(refId, fqn, method, params));
@@ -127,8 +127,8 @@ abstract class JsCallback {
            int sigEnd = body.indexOf(')', sigBeg);
            int colon4 = body.indexOf("::", next);
            if (sigBeg == -1 || sigEnd == -1 || colon4 == -1) {
-               throw new IllegalStateException("Wrong format of static callback. Should be: " +
-                       "'@pkg.Class::staticMethod(Ljava/lang/Object;)(param)':\n" + body);
+               throw new IllegalStateException("Wrong format of static callback. Should be: "
+                       + "'@pkg.Class::staticMethod(Ljava/lang/Object;)(param)':\n" + body);
            }
            String fqn = body.substring(next + 1, colon4);
            String method = body.substring(colon4 + 2, sigBeg);
diff --git a/teavm-jso/src/main/java/org/teavm/jso/JS.java b/teavm-jso/src/main/java/org/teavm/jso/JS.java
index d76f1f34f..1fd5b647b 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/JS.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/JS.java
@@ -50,23 +50,23 @@ public final class JS {
     }
 
     public static <T extends JSObject> JSArray<T> createArray(int size) {
-        return ((JSGlobal)JS.getGlobal()).newArray(size);
+        return ((JSGlobal) JS.getGlobal()).newArray(size);
     }
 
     public static JSIntArray createIntArray(int size) {
-        return ((JSGlobal)JS.getGlobal()).newIntArray(size);
+        return ((JSGlobal) JS.getGlobal()).newIntArray(size);
     }
 
     public static JSStringArray createStringArray(int size) {
-        return ((JSGlobal)JS.getGlobal()).newStringArray(size);
+        return ((JSGlobal) JS.getGlobal()).newStringArray(size);
     }
 
     public static JSBooleanArray createBooleanArray(int size) {
-        return ((JSGlobal)JS.getGlobal()).newBooleanArray(size);
+        return ((JSGlobal) JS.getGlobal()).newBooleanArray(size);
     }
 
     public static JSDoubleArray createDoubleArray(int size) {
-        return ((JSGlobal)JS.getGlobal()).newDoubleArray(size);
+        return ((JSGlobal) JS.getGlobal()).newDoubleArray(size);
     }
 
     @InjectedBy(JSNativeGenerator.class)
@@ -326,11 +326,11 @@ public final class JS {
     public static native boolean unwrapBoolean(JSObject obj);
 
     public static byte unwrapByte(JSObject obj) {
-        return (byte)unwrapInt(obj);
+        return (byte) unwrapInt(obj);
     }
 
     public static short unwrapShort(JSObject obj) {
-        return (short)unwrapInt(obj);
+        return (short) unwrapInt(obj);
     }
 
     @InjectedBy(JSNativeGenerator.class)
@@ -351,7 +351,7 @@ public final class JS {
 
     public static <T extends JSObject> T[] unwrapArray(Class<T> type, JSArray<T> array) {
         @SuppressWarnings("unchecked")
-        T[] result = (T[])Array.newInstance(type, array.getLength());
+        T[] result = (T[]) Array.newInstance(type, array.getLength());
         for (int i = 0; i < result.length; ++i) {
             result[i] = array.get(i);
         }
@@ -360,7 +360,7 @@ public final class JS {
 
     public static <T extends JSObject> T[][] unwrapArray2(Class<T> type, JSArray<JSArray<T>> array) {
         @SuppressWarnings("unchecked")
-        T[][] result = (T[][])Array.newInstance(Array.newInstance(type, 0).getClass(), array.getLength());
+        T[][] result = (T[][]) Array.newInstance(Array.newInstance(type, 0).getClass(), array.getLength());
         for (int i = 0; i < result.length; ++i) {
             result[i] = unwrapArray(type, array.get(i));
         }
@@ -370,7 +370,7 @@ public final class JS {
     public static <T extends JSObject> T[][][] unwrapArray3(Class<T> type, JSArray<JSArray<JSArray<T>>> array) {
         Class<?> baseType = Array.newInstance(type, 0).getClass();
         @SuppressWarnings("unchecked")
-        T[][][] result = (T[][][])Array.newInstance(Array.newInstance(baseType, 0).getClass(), array.getLength());
+        T[][][] result = (T[][][]) Array.newInstance(Array.newInstance(baseType, 0).getClass(), array.getLength());
         for (int i = 0; i < result.length; ++i) {
             result[i] = unwrapArray2(type, array.get(i));
         }
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java b/teavm-jso/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java
index 01a71db0a..f9ba0dcc5 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java
@@ -129,9 +129,9 @@ public class JSNativeGenerator implements Injector, DependencyPlugin, Generator
             case "wrap":
                 if (methodRef.getDescriptor().parameterType(0).isObject("java.lang.String")) {
                     if (context.getArgument(0) instanceof ConstantExpr) {
-                        ConstantExpr constant = (ConstantExpr)context.getArgument(0);
+                        ConstantExpr constant = (ConstantExpr) context.getArgument(0);
                         if (constant.getValue() instanceof String) {
-                            writer.append('"').append(Renderer.escapeString((String)constant.getValue())).append('"');
+                            writer.append('"').append(Renderer.escapeString((String) constant.getValue())).append('"');
                             break;
                         }
                     }
@@ -219,20 +219,20 @@ public class JSNativeGenerator implements Injector, DependencyPlugin, Generator
         if (!(propertyName instanceof InvocationExpr)) {
             return null;
         }
-        InvocationExpr invoke = (InvocationExpr)propertyName;
+        InvocationExpr invoke = (InvocationExpr) propertyName;
         if (!invoke.getMethod().getClassName().equals(JS.class.getName())) {
             return null;
         }
-        if (!invoke.getMethod().getName().equals("wrap") ||
-                !invoke.getMethod().getDescriptor().parameterType(0).isObject("java.lang.String")) {
+        if (!invoke.getMethod().getName().equals("wrap")
+                || !invoke.getMethod().getDescriptor().parameterType(0).isObject("java.lang.String")) {
             return null;
         }
         Expr arg = invoke.getArguments().get(0);
         if (!(arg instanceof ConstantExpr)) {
             return null;
         }
-        ConstantExpr constant = (ConstantExpr)arg;
-        return constant.getValue() instanceof String ? (String)constant.getValue() : null;
+        ConstantExpr constant = (ConstantExpr) arg;
+        return constant.getValue() instanceof String ? (String) constant.getValue() : null;
     }
 
     private boolean isIdentifier(String name) {
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSODependencyListener.java b/teavm-jso/src/main/java/org/teavm/jso/plugin/JSODependencyListener.java
index e88b53db2..253540b1c 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSODependencyListener.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/plugin/JSODependencyListener.java
@@ -94,8 +94,8 @@ class JSODependencyListener extends AbstractDependencyListener {
         }
         addInterfaces(exposedCls, cls);
         for (MethodReader method : cls.getMethods()) {
-            if (exposedCls.inheritedMethods.containsKey(method.getDescriptor()) ||
-                    exposedCls.methods.containsKey(method.getDescriptor())) {
+            if (exposedCls.inheritedMethods.containsKey(method.getDescriptor())
+                    || exposedCls.methods.containsKey(method.getDescriptor())) {
                 MethodDependency methodDep = agent.linkMethod(method.getReference(), null);
                 methodDep.getVariable(0).propagate(agent.getType(name));
                 methodDep.use();
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSObjectClassTransformer.java b/teavm-jso/src/main/java/org/teavm/jso/plugin/JSObjectClassTransformer.java
index cef81ecf4..bb7c92be1 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSObjectClassTransformer.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/plugin/JSObjectClassTransformer.java
@@ -48,8 +48,8 @@ public class JSObjectClassTransformer implements ClassHolderTransformer {
         for (MethodHolder method : cls.getMethods().toArray(new MethodHolder[0])) {
             if (method.getAnnotations().get(JSBody.class.getName()) != null) {
                 processor.processJSBody(cls, method);
-            } else if (method.getProgram() != null &&
-                    method.getAnnotations().get(JSBodyImpl.class.getName()) == null) {
+            } else if (method.getProgram() != null
+                    && method.getAnnotations().get(JSBodyImpl.class.getName()) == null) {
                 processor.processProgram(method);
             }
         }
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java b/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java
index 951107d38..719fe156f 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java
@@ -172,8 +172,8 @@ class JavascriptNativeProcessor {
             if (method.hasModifier(ElementModifier.STATIC)) {
                 continue;
             }
-            if (method.hasModifier(ElementModifier.FINAL) && method.getProgram() != null &&
-                    method.getProgram().basicBlockCount() > 0) {
+            if (method.hasModifier(ElementModifier.FINAL) && method.getProgram() != null
+                    && method.getProgram().basicBlockCount() > 0) {
                 ValueType[] staticSignature = getStaticSignature(method.getReference());
                 MethodHolder callerMethod = new MethodHolder(new MethodDescriptor(method.getName() + "$static",
                         staticSignature));
@@ -282,8 +282,8 @@ class JavascriptNativeProcessor {
         }
         if (isNative(cls.getName())) {
             for (MethodReader method : cls.getMethods()) {
-                if (!method.hasModifier(ElementModifier.STATIC) && !method.hasModifier(ElementModifier.FINAL) &&
-                        method.getLevel() != AccessLevel.PRIVATE) {
+                if (!method.hasModifier(ElementModifier.STATIC) && !method.hasModifier(ElementModifier.FINAL)
+                        && method.getLevel() != AccessLevel.PRIVATE) {
                     methods.add(method.getDescriptor());
                 }
             }
@@ -323,7 +323,7 @@ class JavascriptNativeProcessor {
                 if (!(insn instanceof InvokeInstruction)) {
                     continue;
                 }
-                InvokeInstruction invoke = (InvokeInstruction)insn;
+                InvokeInstruction invoke = (InvokeInstruction) insn;
                 if (!nativeRepos.isJavaScriptClass(invoke.getMethod().getClassName())) {
                     continue;
                 }
@@ -339,8 +339,8 @@ class JavascriptNativeProcessor {
                     if (overriden != null) {
                         CallLocation callLocation = new CallLocation(methodToProcess.getReference(),
                                 insn.getLocation());
-                        diagnostics.error(callLocation, "JS final method {{m0}} overrides {{M1}}. " +
-                                "Overriding final method of overlay types is prohibited.",
+                        diagnostics.error(callLocation, "JS final method {{m0}} overrides {{M1}}. "
+                                + "Overriding final method of overlay types is prohibited.",
                                 method.getReference(), overriden.getReference());
                     }
                     if (method.getProgram() != null && method.getProgram().basicBlockCount() > 0) {
@@ -361,8 +361,8 @@ class JavascriptNativeProcessor {
                         if (annot.getValue("value") != null) {
                             propertyName = annot.getValue("value").getString();
                         } else {
-                            propertyName = method.getName().charAt(0) == 'i' ? cutPrefix(method.getName(), 2) :
-                                cutPrefix(method.getName(), 3);
+                            propertyName = method.getName().charAt(0) == 'i' ? cutPrefix(method.getName(), 2)
+                                    : cutPrefix(method.getName(), 3);
                         }
                         Variable result = invoke.getReceiver() != null ? program.createVariable() : null;
                         addPropertyGet(propertyName, invoke.getInstance(), result, invoke.getLocation());
@@ -382,8 +382,8 @@ class JavascriptNativeProcessor {
                                 method.parameterType(0));
                         addPropertySet(propertyName, invoke.getInstance(), wrapped, invoke.getLocation());
                     } else {
-                        diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript property " +
-                                "declaration", invoke.getMethod());
+                        diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript property "
+                                + "declaration", invoke.getMethod());
                         continue;
                     }
                 } else if (method.getAnnotations().get(JSIndexer.class.getName()) != null) {
@@ -402,8 +402,8 @@ class JavascriptNativeProcessor {
                                 invoke.getLocation());
                         addIndexerSet(invoke.getInstance(), index, value, invoke.getLocation());
                     } else {
-                        diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript indexer " +
-                                "declaration", invoke.getMethod());
+                        diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript indexer "
+                                + "declaration", invoke.getMethod());
                         continue;
                     }
                 } else {
@@ -412,16 +412,16 @@ class JavascriptNativeProcessor {
                     boolean isConstructor = false;
                     if (constructorAnnot != null) {
                         if (!isSupportedType(method.getResultType())) {
-                            diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript " +
-                                    "constructor declaration", invoke.getMethod());
+                            diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript "
+                                    + "constructor declaration", invoke.getMethod());
                             continue;
                         }
                         AnnotationValue nameVal = constructorAnnot.getValue("value");
                         name = nameVal != null ? constructorAnnot.getValue("value").getString() : "";
                         if (name.isEmpty()) {
                             if (!method.getName().startsWith("new") || method.getName().length() == 3) {
-                                diagnostics.error(callLocation, "Method {{m0}} is not declared as a native " +
-                                        "JavaScript constructor, but its name does not satisfy conventions",
+                                diagnostics.error(callLocation, "Method {{m0}} is not declared as a native "
+                                        + "JavaScript constructor, but its name does not satisfy conventions",
                                         invoke.getMethod());
                                 continue;
                             }
@@ -437,15 +437,15 @@ class JavascriptNativeProcessor {
                             }
                         }
                         if (method.getResultType() != ValueType.VOID && !isSupportedType(method.getResultType())) {
-                            diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method " +
-                                    "declaration", invoke.getMethod());
+                            diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method "
+                                    + "declaration", invoke.getMethod());
                             continue;
                         }
                     }
                     for (ValueType arg : method.getParameterTypes()) {
                         if (!isSupportedType(arg)) {
-                            diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method " +
-                                    "or constructor declaration", invoke.getMethod());
+                            diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method "
+                                    + "or constructor declaration", invoke.getMethod());
                             continue;
                         }
                     }
@@ -487,8 +487,8 @@ class JavascriptNativeProcessor {
         AnnotationHolder bodyAnnot = methodToProcess.getAnnotations().get(JSBody.class.getName());
         int jsParamCount = bodyAnnot.getValue("params").getList().size();
         if (methodToProcess.parameterCount() != jsParamCount) {
-            diagnostics.error(location, "JSBody method {{m0}} declares " + methodToProcess.parameterCount() +
-                    " parameters, but annotation specifies " + jsParamCount, methodToProcess);
+            diagnostics.error(location, "JSBody method {{m0}} declares " + methodToProcess.parameterCount()
+                    + " parameters, but annotation specifies " + jsParamCount, methodToProcess);
             return;
         }
 
@@ -524,8 +524,9 @@ class JavascriptNativeProcessor {
         for (int i = 0; i < paramCount; ++i) {
             proxyParamTypes[i] = ValueType.parse(JSObject.class);
         }
-        proxyParamTypes[paramCount] = methodToProcess.getResultType() == ValueType.VOID ? ValueType.VOID :
-                ValueType.parse(JSObject.class);
+        proxyParamTypes[paramCount] = methodToProcess.getResultType() == ValueType.VOID
+                ? ValueType.VOID
+                : ValueType.parse(JSObject.class);
 
         // create proxy method
         MethodHolder proxyMethod = new MethodHolder("$js_body$_" + methodIndexGenerator++, proxyParamTypes);
@@ -649,7 +650,7 @@ class JavascriptNativeProcessor {
 
     private Variable unwrap(CallLocation location, Variable var, ValueType type) {
         if (type instanceof ValueType.Primitive) {
-            switch (((ValueType.Primitive)type).getKind()) {
+            switch (((ValueType.Primitive) type).getKind()) {
                 case BOOLEAN:
                     return unwrap(var, "unwrapBoolean", ValueType.parse(JSObject.class), ValueType.BOOLEAN,
                             location.getSourceLocation());
@@ -675,7 +676,7 @@ class JavascriptNativeProcessor {
                     break;
             }
         } else if (type instanceof ValueType.Object) {
-            String className = ((ValueType.Object)type).getClassName();
+            String className = ((ValueType.Object) type).getClassName();
             if (className.equals(JSObject.class.getName())) {
                 return var;
             } else if (className.equals("java.lang.String")) {
@@ -692,7 +693,7 @@ class JavascriptNativeProcessor {
                 return result;
             }
         } else if (type instanceof ValueType.Array) {
-            return unwrapArray(location, var, (ValueType.Array)type);
+            return unwrapArray(location, var, (ValueType.Array) type);
         }
         diagnostics.error(location, "Unsupported type: {{t0}}", type);
         return var;
@@ -703,7 +704,7 @@ class JavascriptNativeProcessor {
         int degree = 0;
         while (itemType instanceof ValueType.Array) {
             ++degree;
-            itemType = ((ValueType.Array)itemType).getItemType();
+            itemType = ((ValueType.Array) itemType).getItemType();
         }
         if (degree > 3) {
             diagnostics.error(location, "Unsupported type: {{t0}}", type);
@@ -711,14 +712,15 @@ class JavascriptNativeProcessor {
         }
 
         if (itemType instanceof ValueType.Object) {
-            String className = ((ValueType.Object)itemType).getClassName();
+            String className = ((ValueType.Object) itemType).getClassName();
             if (className.equals("java.lang.String")) {
                 String methodName = "unwrapStringArray";
                 if (degree > 1) {
                     methodName += degree;
                 }
-                ValueType argType = degree == 1 ? ValueType.parse(JSStringArray.class) :
-                        ValueType.parse(JSArray.class);
+                ValueType argType = degree == 1
+                        ? ValueType.parse(JSStringArray.class)
+                        : ValueType.parse(JSArray.class);
                 return unwrap(var, methodName, argType, type, location.getSourceLocation());
             } else if (isNative(className)) {
                 return unwrapObjectArray(location, var, degree, itemType, type);
@@ -804,7 +806,7 @@ class JavascriptNativeProcessor {
 
     private Variable wrapArgument(CallLocation location, Variable var, ValueType type) {
         if (type instanceof ValueType.Object) {
-            String className = ((ValueType.Object)type).getClassName();
+            String className = ((ValueType.Object) type).getClassName();
             ClassReader cls = classSource.get(className);
             if (cls.getAnnotations().get(JSFunctor.class.getName()) != null) {
                 return wrapFunctor(location, var, cls);
@@ -838,7 +840,7 @@ class JavascriptNativeProcessor {
 
     private Variable wrap(Variable var, ValueType type, InstructionLocation location) {
         if (type instanceof ValueType.Object) {
-            String className = ((ValueType.Object)type).getClassName();
+            String className = ((ValueType.Object) type).getClassName();
             if (!className.equals("java.lang.String")) {
                 return var;
             }
@@ -856,7 +858,7 @@ class JavascriptNativeProcessor {
 
     private ValueType getWrappedType(ValueType type) {
         if (type instanceof ValueType.Array) {
-            ValueType itemType = ((ValueType.Array)type).getItemType();
+            ValueType itemType = ((ValueType.Array) type).getItemType();
             return ValueType.arrayOf(getWrappedType(itemType));
         } else if (type instanceof ValueType.Object) {
             if (type.isObject("java.lang.String")) {
@@ -871,9 +873,9 @@ class JavascriptNativeProcessor {
 
     private ValueType getWrapperType(ValueType type) {
         if (type instanceof ValueType.Array) {
-            ValueType itemType = ((ValueType.Array)type).getItemType();
+            ValueType itemType = ((ValueType.Array) type).getItemType();
             if (itemType instanceof ValueType.Primitive) {
-                switch (((ValueType.Primitive)itemType).getKind()) {
+                switch (((ValueType.Primitive) itemType).getKind()) {
                     case BOOLEAN:
                         return ValueType.parse(JSBooleanArray.class);
                     case BYTE:
@@ -926,8 +928,8 @@ class JavascriptNativeProcessor {
     }
 
     private boolean isProperSetter(MethodDescriptor desc) {
-        if (desc.parameterCount() != 1 || !isSupportedType(desc.parameterType(0)) ||
-                desc.getResultType() != ValueType.VOID) {
+        if (desc.parameterCount() != 1 || !isSupportedType(desc.parameterType(0))
+                || desc.getResultType() != ValueType.VOID) {
             return false;
         }
         return isProperPrefix(desc.getName(), "set");
@@ -942,13 +944,13 @@ class JavascriptNativeProcessor {
     }
 
     private boolean isProperGetIndexer(MethodDescriptor desc) {
-        return desc.parameterCount() == 1 && isSupportedType(desc.parameterType(0)) &&
-                isSupportedType(desc.getResultType());
+        return desc.parameterCount() == 1 && isSupportedType(desc.parameterType(0))
+                && isSupportedType(desc.getResultType());
     }
 
     private boolean isProperSetIndexer(MethodDescriptor desc) {
-        return desc.parameterCount() == 2 && isSupportedType(desc.parameterType(0)) &&
-                isSupportedType(desc.parameterType(0)) && desc.getResultType() == ValueType.VOID;
+        return desc.parameterCount() == 2 && isSupportedType(desc.parameterType(0))
+                && isSupportedType(desc.parameterType(0)) && desc.getResultType() == ValueType.VOID;
     }
 
     private String cutPrefix(String name, int prefixLength) {
@@ -967,16 +969,16 @@ class JavascriptNativeProcessor {
             return false;
         }
         if (type instanceof ValueType.Primitive) {
-            switch (((ValueType.Primitive)type).getKind()) {
+            switch (((ValueType.Primitive) type).getKind()) {
                 case LONG:
                     return false;
                 default:
                     return true;
             }
         } else if (type instanceof ValueType.Array) {
-            return isSupportedType(((ValueType.Array)type).getItemType());
+            return isSupportedType(((ValueType.Array) type).getItemType());
         } else if (type instanceof ValueType.Object) {
-            String typeName = ((ValueType.Object)type).getClassName();
+            String typeName = ((ValueType.Object) type).getClassName();
             return typeName.equals("java.lang.String") || nativeRepos.isJavaScriptClass(typeName);
         } else {
             return false;
diff --git a/teavm-platform/src/main/java/org/teavm/platform/Platform.java b/teavm-platform/src/main/java/org/teavm/platform/Platform.java
index 653a53035..b7c051be6 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/Platform.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/Platform.java
@@ -33,7 +33,7 @@ public final class Platform {
     }
 
     public static PlatformObject getPlatformObject(Object obj) {
-        return (PlatformObject)JS.marshall(obj);
+        return (PlatformObject) JS.marshall(obj);
     }
 
     @GeneratedBy(PlatformGenerator.class)
@@ -41,8 +41,8 @@ public final class Platform {
     public static native Object clone(Object obj);
 
     public static boolean isInstance(PlatformObject obj, PlatformClass cls) {
-        return obj != null && !JS.isUndefined(obj.getPlatformClass().getMetadata()) &&
-                isAssignable(obj.getPlatformClass(), cls);
+        return obj != null && !JS.isUndefined(obj.getPlatformClass().getMetadata())
+                && isAssignable(obj.getPlatformClass(), cls);
     }
 
     public static boolean isAssignable(PlatformClass from, PlatformClass to) {
@@ -63,15 +63,15 @@ public final class Platform {
     public static native Class<?> asJavaClass(PlatformObject obj);
 
     public static PlatformPrimitives getPrimitives() {
-        return (PlatformPrimitives)JS.getGlobal();
+        return (PlatformPrimitives) JS.getGlobal();
     }
 
     public static PlatformConsole getConsole() {
-        return (PlatformConsole)JS.getGlobal();
+        return (PlatformConsole) JS.getGlobal();
     }
 
     public static int nextObjectId() {
-        return ((PlatformHelper)JS.getGlobal()).nextId();
+        return ((PlatformHelper) JS.getGlobal()).nextId();
     }
 
     public static <T> T newInstance(PlatformClass cls) {
@@ -127,14 +127,14 @@ public final class Platform {
     public static native int schedule(PlatformRunnable runnable, int timeout);
 
     public static void killSchedule(int id) {
-        ((PlatformHelper)JS.getGlobal()).killSchedule(id);
+        ((PlatformHelper) JS.getGlobal()).killSchedule(id);
     }
 
     public static <T> PlatformQueue<T> createQueue() {
-        return ((PlatformHelper)JS.getGlobal()).newQueue();
+        return ((PlatformHelper) JS.getGlobal()).newQueue();
     }
 
     public static PlatformString stringFromCharCode(int charCode) {
-        return ((PlatformHelper)JS.getGlobal()).getStringClass().fromCharCode(charCode);
+        return ((PlatformHelper) JS.getGlobal()).getStringClass().fromCharCode(charCode);
     }
 }
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/AnnotationDependencySupport.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/AnnotationDependencySupport.java
index 2f190d94e..c975a8f27 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/AnnotationDependencySupport.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/AnnotationDependencySupport.java
@@ -45,8 +45,8 @@ public class AnnotationDependencySupport extends AbstractDependencyListener {
 
     @Override
     public void methodReached(DependencyAgent agent, MethodDependency method, CallLocation location) {
-        if (method.getReference().getClassName().equals(Platform.class.getName()) &&
-                method.getReference().getName().equals("getAnnotations")) {
+        if (method.getReference().getClassName().equals(Platform.class.getName())
+                && method.getReference().getName().equals("getAnnotations")) {
             method.getResult().propagate(agent.getType("[" + Annotation.class.getName()));
             agent.linkMethod(new MethodReference(PlatformAnnotationProvider.class, "getAnnotations",
                     Annotation[].class), location);
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodGenerator.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodGenerator.java
index f9a7daccd..4ef89d46f 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodGenerator.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodGenerator.java
@@ -133,7 +133,7 @@ public class AsyncMethodGenerator implements Generator, DependencyPlugin {
         } else if (returnType instanceof ValueType.Array) {
             return className.startsWith("[");
         } else {
-            return isSubclass(classSource, className, ((ValueType.Object)returnType).getClassName());
+            return isSubclass(classSource, className, ((ValueType.Object) returnType).getClassName());
         }
     }
 
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodProcessor.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodProcessor.java
index cae65fd91..e0ab8290e 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodProcessor.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/AsyncMethodProcessor.java
@@ -31,9 +31,9 @@ public class AsyncMethodProcessor implements ClassHolderTransformer {
     @Override
     public void transformClass(ClassHolder cls, ClassReaderSource innerSource, Diagnostics diagnostics) {
         for (MethodHolder method : cls.getMethods()) {
-            if (method.hasModifier(ElementModifier.NATIVE) &&
-                    method.getAnnotations().get(Async.class.getName()) != null &&
-                    method.getAnnotations().get(GeneratedBy.class.getName()) == null) {
+            if (method.hasModifier(ElementModifier.NATIVE)
+                    && method.getAnnotations().get(Async.class.getName()) != null
+                    && method.getAnnotations().get(GeneratedBy.class.getName()) == null) {
                 ValueType[] signature = new ValueType[method.parameterCount() + 2];
                 for (int i = 0; i < method.parameterCount(); ++i) {
                     signature[i] = method.parameterType(i);
@@ -43,10 +43,10 @@ public class AsyncMethodProcessor implements ClassHolderTransformer {
                 MethodDescriptor asyncDesc = new MethodDescriptor(method.getName(), signature);
                 MethodHolder asyncMethod = cls.getMethod(asyncDesc);
                 if (asyncMethod != null) {
-                    if (asyncMethod.hasModifier(ElementModifier.STATIC) !=
-                            method.hasModifier(ElementModifier.STATIC)) {
-                        diagnostics.error(new CallLocation(method.getReference()), "Methods {{m0}} and {{m1}} must " +
-                                "both be either static or non-static",
+                    if (asyncMethod.hasModifier(ElementModifier.STATIC)
+                            != method.hasModifier(ElementModifier.STATIC)) {
+                        diagnostics.error(new CallLocation(method.getReference()), "Methods {{m0}} and {{m1}} must "
+                                + "both be either static or non-static",
                                 method.getReference(), asyncMethod.getReference());
                     }
                     AnnotationHolder annot = new AnnotationHolder(GeneratedBy.class.getName());
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/BuildTimeResourceProxyBuilder.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/BuildTimeResourceProxyBuilder.java
index a1cda00fd..5cb56e944 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/BuildTimeResourceProxyBuilder.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/BuildTimeResourceProxyBuilder.java
@@ -35,8 +35,8 @@ class BuildTimeResourceProxyBuilder {
 
     static {
         defaultValues.put(boolean.class, false);
-        defaultValues.put(byte.class, (byte)0);
-        defaultValues.put(short.class, (short)0);
+        defaultValues.put(byte.class, (byte) 0);
+        defaultValues.put(short.class, (short) 0);
         defaultValues.put(int.class, 0);
         defaultValues.put(float.class, 0F);
         defaultValues.put(double.class, 0.0);
@@ -70,8 +70,8 @@ class BuildTimeResourceProxyBuilder {
 
         BuildTimeResourceProxyFactory create() {
             if (!rootIface.isInterface()) {
-                throw new IllegalArgumentException("Error creating a new resource of type " + rootIface.getName() +
-                        " that is not an interface");
+                throw new IllegalArgumentException("Error creating a new resource of type " + rootIface.getName()
+                        + " that is not an interface");
             }
             scanIface(rootIface);
 
@@ -102,8 +102,8 @@ class BuildTimeResourceProxyBuilder {
 
         private void scanIface(Class<?> iface) {
             if (!Resource.class.isAssignableFrom(iface)) {
-                throw new IllegalArgumentException("Error creating a new resource of type " + iface.getName() + "." +
-                        " This type does not implement the " + Resource.class.getName() + " interface");
+                throw new IllegalArgumentException("Error creating a new resource of type " + iface.getName() + "."
+                        + " This type does not implement the " + Resource.class.getName() + " interface");
             }
 
             // Scan methods
@@ -127,18 +127,18 @@ class BuildTimeResourceProxyBuilder {
                 Class<?> getterType = property.getValue();
                 Class<?> setterType = setters.get(propertyName);
                 if (setterType == null) {
-                    throw new IllegalArgumentException("Property " + iface.getName() + "." + propertyName +
-                            " has a getter, but does not have a setter");
+                    throw new IllegalArgumentException("Property " + iface.getName() + "." + propertyName
+                            + " has a getter, but does not have a setter");
                 }
                 if (!setterType.equals(getterType)) {
-                    throw new IllegalArgumentException("Property " + iface.getName() + "." + propertyName +
-                            " has a getter and a setter of different types");
+                    throw new IllegalArgumentException("Property " + iface.getName() + "." + propertyName
+                            + " has a getter and a setter of different types");
                 }
             }
             for (String propertyName : setters.keySet()) {
                 if (!getters.containsKey(propertyName)) {
-                    throw new IllegalArgumentException("Property " + iface.getName() + "." + propertyName +
-                            " has a setter, but does not have a getter");
+                    throw new IllegalArgumentException("Property " + iface.getName() + "." + propertyName
+                            + " has a setter, but does not have a getter");
                 }
             }
 
@@ -148,8 +148,8 @@ class BuildTimeResourceProxyBuilder {
                 Class<?> propertyType = property.getValue();
                 if (!allowedPropertyTypes.contains(propertyType)) {
                     if (!propertyType.isInterface() || !Resource.class.isAssignableFrom(propertyType)) {
-                        throw new IllegalArgumentException("Property " + rootIface.getName() + "." + propertyName +
-                                " has an illegal type " + propertyType.getName());
+                        throw new IllegalArgumentException("Property " + rootIface.getName() + "." + propertyName
+                                + " has an illegal type " + propertyType.getName());
                     }
                 }
                 if (!propertyTypes.containsKey(propertyName)) {
@@ -164,45 +164,45 @@ class BuildTimeResourceProxyBuilder {
         }
 
         private void throwInvalidMethod(Method method) {
-            throw new IllegalArgumentException("Method " + method.getDeclaringClass().getName() + "." +
-                    method.getName() + " is not likely to be either getter or setter");
+            throw new IllegalArgumentException("Method " + method.getDeclaringClass().getName() + "."
+                    + method.getName() + " is not likely to be either getter or setter");
         }
 
         private void scanGetter(Method method) {
             String propertyName = extractPropertyName(method.getName().substring(3));
-            if (propertyName == null || method.getReturnType().equals(void.class) ||
-                    method.getParameterTypes().length > 0) {
+            if (propertyName == null || method.getReturnType().equals(void.class)
+                    || method.getParameterTypes().length > 0) {
                 throwInvalidMethod(method);
             }
             if (getters.put(propertyName, method.getReturnType()) != null) {
-                throw new IllegalArgumentException("Method " + method.getDeclaringClass().getName() + "." +
-                        method.getName() + " is a duplicate getter for property " + propertyName);
+                throw new IllegalArgumentException("Method " + method.getDeclaringClass().getName() + "."
+                        + method.getName() + " is a duplicate getter for property " + propertyName);
             }
             methods.put(method, new BuildTimeResourceGetter(getPropertyIndex(propertyName)));
         }
 
         private void scanBooleanGetter(Method method) {
             String propertyName = extractPropertyName(method.getName().substring(2));
-            if (propertyName == null || !method.getReturnType().equals(boolean.class) ||
-                    method.getParameterTypes().length > 0) {
+            if (propertyName == null || !method.getReturnType().equals(boolean.class)
+                    || method.getParameterTypes().length > 0) {
                 throwInvalidMethod(method);
             }
             if (getters.put(propertyName, method.getReturnType()) != null) {
-                throw new IllegalArgumentException("Method " + method.getDeclaringClass().getName() + "." +
-                        method.getName() + " is a duplicate getter for property " + propertyName);
+                throw new IllegalArgumentException("Method " + method.getDeclaringClass().getName() + "."
+                        + method.getName() + " is a duplicate getter for property " + propertyName);
             }
             methods.put(method, new BuildTimeResourceGetter(getPropertyIndex(propertyName)));
         }
 
         private void scanSetter(Method method) {
             String propertyName = extractPropertyName(method.getName().substring(3));
-            if (propertyName == null || !method.getReturnType().equals(void.class) ||
-                    method.getParameterTypes().length != 1) {
+            if (propertyName == null || !method.getReturnType().equals(void.class)
+                    || method.getParameterTypes().length != 1) {
                 throwInvalidMethod(method);
             }
             if (setters.put(propertyName, method.getParameterTypes()[0]) != null) {
-                throw new IllegalArgumentException("Method " + method.getDeclaringClass().getName() + "." +
-                        method.getName() + " is a duplicate setter for property " + propertyName);
+                throw new IllegalArgumentException("Method " + method.getDeclaringClass().getName() + "."
+                        + method.getName() + " is a duplicate setter for property " + propertyName);
             }
             methods.put(method, new BuildTimeResourceSetter(getPropertyIndex(propertyName)));
         }
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/BuildTimeResourceWriterMethod.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/BuildTimeResourceWriterMethod.java
index b24c0547d..0a30410db 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/BuildTimeResourceWriterMethod.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/BuildTimeResourceWriterMethod.java
@@ -30,7 +30,7 @@ class BuildTimeResourceWriterMethod implements BuildTimeResourceMethod {
 
     @Override
     public Object invoke(BuildTimeResourceProxy proxy, Object[] args) throws Throwable {
-        SourceWriter writer = (SourceWriter)args[0];
+        SourceWriter writer = (SourceWriter) args[0];
         writer.append('{');
         for (int i = 0; i < propertyNames.length; ++i) {
             if (i > 0) {
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/ClassScopedMetadataProviderNativeGenerator.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/ClassScopedMetadataProviderNativeGenerator.java
index 377a887e9..4a455d8c6 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/ClassScopedMetadataProviderNativeGenerator.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/ClassScopedMetadataProviderNativeGenerator.java
@@ -43,14 +43,15 @@ public class ClassScopedMetadataProviderNativeGenerator implements Generator {
             return;
         }
         if (!method.hasModifier(ElementModifier.NATIVE)) {
-            context.getDiagnostics().error(new CallLocation(methodRef), "Method {{m0}} is marked with " +
-                    "{{c1}} annotation, but it is not native", methodRef, ClassScopedMetadataProvider.class.getName());
+            context.getDiagnostics().error(new CallLocation(methodRef), "Method {{m0}} is marked with "
+                    + "{{c1}} annotation, but it is not native", methodRef,
+                    ClassScopedMetadataProvider.class.getName());
             return;
         }
 
         // Find and instantiate metadata generator
         ValueType generatorType = providerAnnot.getValue("value").getJavaClass();
-        String generatorClassName = ((ValueType.Object)generatorType).getClassName();
+        String generatorClassName = ((ValueType.Object) generatorType).getClassName();
         Class<?> generatorClass;
         try {
             generatorClass = Class.forName(generatorClassName, true, context.getClassLoader());
@@ -63,24 +64,24 @@ public class ClassScopedMetadataProviderNativeGenerator implements Generator {
         try {
             cons = generatorClass.getConstructor();
         } catch (NoSuchMethodException e) {
-            context.getDiagnostics().error(new CallLocation(methodRef), "Metadata generator {{c0}} does not have " +
-                    "a public no-arg constructor", generatorClassName);
+            context.getDiagnostics().error(new CallLocation(methodRef), "Metadata generator {{c0}} does not have "
+                    + "a public no-arg constructor", generatorClassName);
             return;
         }
         ClassScopedMetadataGenerator generator;
         try {
-            generator = (ClassScopedMetadataGenerator)cons.newInstance();
+            generator = (ClassScopedMetadataGenerator) cons.newInstance();
         } catch (IllegalAccessException | InstantiationException | InvocationTargetException e) {
-            context.getDiagnostics().error(new CallLocation(methodRef), "Error instantiating metadata " +
-                    "generator {{c0}}", generatorClassName);
+            context.getDiagnostics().error(new CallLocation(methodRef), "Error instantiating metadata "
+                    + "generator {{c0}}", generatorClassName);
             return;
         }
         DefaultMetadataGeneratorContext metadataContext = new DefaultMetadataGeneratorContext(context.getClassSource(),
                 context.getClassLoader(), context.getProperties(), context);
 
         Map<String, Resource> resourceMap = generator.generateMetadata(metadataContext, methodRef);
-        writer.append("var p").ws().append("=").ws().append("\"" + Renderer.escapeString("$$res_" +
-                writer.getNaming().getFullNameFor(methodRef)) + "\"").append(";").softNewLine();
+        writer.append("var p").ws().append("=").ws().append("\"" + Renderer.escapeString("$$res_"
+                + writer.getNaming().getFullNameFor(methodRef)) + "\"").append(";").softNewLine();
         for (Map.Entry<String, Resource> entry : resourceMap.entrySet()) {
             writer.appendClass(entry.getKey()).append("[p]").ws().append("=").ws();
             ResourceWriterHelper.write(writer, entry.getValue());
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/EnumDependencySupport.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/EnumDependencySupport.java
index 784958e4d..a9ee997fd 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/EnumDependencySupport.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/EnumDependencySupport.java
@@ -50,8 +50,8 @@ public class EnumDependencySupport extends AbstractDependencyListener {
 
     @Override
     public void methodReached(DependencyAgent agent, MethodDependency method, CallLocation location) {
-        if (method.getReference().getClassName().equals(Platform.class.getName()) &&
-                method.getReference().getName().equals("getEnumConstants")) {
+        if (method.getReference().getClassName().equals(Platform.class.getName())
+                && method.getReference().getName().equals("getEnumConstants")) {
             allEnums.connect(method.getResult().getArrayItem());
             final MethodReference ref = method.getReference();
             allEnums.addConsumer(type -> {
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderNativeGenerator.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderNativeGenerator.java
index ded5eff87..7886e13db 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderNativeGenerator.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderNativeGenerator.java
@@ -42,7 +42,7 @@ public class MetadataProviderNativeGenerator implements Generator {
 
         // Find and instantiate metadata generator
         ValueType generatorType = providerAnnot.getValue("value").getJavaClass();
-        String generatorClassName = ((ValueType.Object)generatorType).getClassName();
+        String generatorClassName = ((ValueType.Object) generatorType).getClassName();
         Class<?> generatorClass;
         try {
             generatorClass = Class.forName(generatorClassName, true, context.getClassLoader());
@@ -55,16 +55,16 @@ public class MetadataProviderNativeGenerator implements Generator {
         try {
             cons = generatorClass.getConstructor();
         } catch (NoSuchMethodException e) {
-            context.getDiagnostics().error(new CallLocation(methodRef), "Metadata generator {{c0}} does not have " +
-                    "a public no-arg constructor", generatorClassName);
+            context.getDiagnostics().error(new CallLocation(methodRef), "Metadata generator {{c0}} does not have "
+                    + "a public no-arg constructor", generatorClassName);
             return;
         }
         MetadataGenerator generator;
         try {
-            generator = (MetadataGenerator)cons.newInstance();
+            generator = (MetadataGenerator) cons.newInstance();
         } catch (IllegalAccessException | InstantiationException | InvocationTargetException e) {
-            context.getDiagnostics().error(new CallLocation(methodRef), "Error instantiating metadata " +
-                    "generator {{c0}}", generatorClassName);
+            context.getDiagnostics().error(new CallLocation(methodRef), "Error instantiating metadata "
+                    + "generator {{c0}}", generatorClassName);
             return;
         }
         DefaultMetadataGeneratorContext metadataContext = new DefaultMetadataGeneratorContext(context.getClassSource(),
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderTransformer.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderTransformer.java
index 65e4235c7..a411d3dd0 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderTransformer.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/MetadataProviderTransformer.java
@@ -45,8 +45,8 @@ class MetadataProviderTransformer implements ClassHolderTransformer {
             if (providerAnnot != null) {
                 ValueType[] params = method.getParameterTypes();
                 if (params.length != 1 && params[0].isObject(PlatformClass.class.getName())) {
-                    diagnostics.error(new CallLocation(method.getReference()), "Method {{m0}} marked with {{c1}} " +
-                            "must take exactly one parameter of type {{c2}}",
+                    diagnostics.error(new CallLocation(method.getReference()), "Method {{m0}} marked with {{c1}} "
+                            + "must take exactly one parameter of type {{c2}}",
                             method.getReference(), ClassScopedMetadataProvider.class.getName(),
                             PlatformClass.class.getName());
                 }
@@ -111,8 +111,8 @@ class MetadataProviderTransformer implements ClassHolderTransformer {
             return false;
         }
         if (!method.hasModifier(ElementModifier.NATIVE)) {
-            diagnostics.error(new CallLocation(method.getReference()), "Method {{m0}} is marked with " +
-                    "{{c1}} annotation, but it is not native", method.getReference(),
+            diagnostics.error(new CallLocation(method.getReference()), "Method {{m0}} is marked with "
+                    + "{{c1}} annotation, but it is not native", method.getReference(),
                     MetadataProvider.class.getName());
             return false;
         }
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceAccessorInjector.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceAccessorInjector.java
index 9fa80935d..5bee5d121 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceAccessorInjector.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceAccessorInjector.java
@@ -108,7 +108,7 @@ class ResourceAccessorInjector implements Injector {
 
     private void writePropertyAccessor(InjectorContext context, Expr property) throws IOException {
         if (property instanceof ConstantExpr) {
-            String str = (String)((ConstantExpr)property).getValue();
+            String str = (String) ((ConstantExpr) property).getValue();
             if (str.isEmpty()) {
                 context.getWriter().append("[\"\"]");
                 return;
@@ -125,7 +125,7 @@ class ResourceAccessorInjector implements Injector {
 
     private void writeStringExpr(InjectorContext context, Expr expr) throws IOException {
         if (expr instanceof ConstantExpr) {
-            String str = (String)((ConstantExpr)expr).getValue();
+            String str = (String) ((ConstantExpr) expr).getValue();
             context.getWriter().append('"');
             context.writeEscaped(str);
             context.getWriter().append('"');
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceProgramTransformer.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceProgramTransformer.java
index 71c4a92af..d723bd195 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceProgramTransformer.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceProgramTransformer.java
@@ -46,7 +46,7 @@ class ResourceProgramTransformer {
         for (int i = 0; i < instructions.size(); ++i) {
             Instruction insn = instructions.get(i);
             if (insn instanceof InvokeInstruction) {
-                InvokeInstruction invoke = (InvokeInstruction)insn;
+                InvokeInstruction invoke = (InvokeInstruction) insn;
                 List<Instruction> replacement = transformInvoke(invoke);
                 if (replacement != null) {
                     instructions.set(i, new EmptyInstruction());
@@ -62,8 +62,8 @@ class ResourceProgramTransformer {
             return null;
         }
         MethodReference method = insn.getMethod();
-        if (method.getClassName().equals(ResourceArray.class.getName()) ||
-                method.getClassName().equals(ResourceMap.class.getName())) {
+        if (method.getClassName().equals(ResourceArray.class.getName())
+                || method.getClassName().equals(ResourceMap.class.getName())) {
             if (method.getName().equals("keys")) {
                 return transformKeys(insn);
             }
@@ -142,7 +142,7 @@ class ResourceProgramTransformer {
         ValueType type = insn.getMethod().getDescriptor().getResultType();
         List<Instruction> instructions = new ArrayList<>();
         if (type instanceof ValueType.Primitive) {
-            switch (((ValueType.Primitive)type).getKind()) {
+            switch (((ValueType.Primitive) type).getKind()) {
                 case BOOLEAN:
                     getAndCastProperty(insn, property, instructions, boolean.class);
                     return instructions;
@@ -166,7 +166,7 @@ class ResourceProgramTransformer {
                     break;
             }
         } else if (type instanceof ValueType.Object) {
-            switch (((ValueType.Object)type).getClassName()) {
+            switch (((ValueType.Object) type).getClassName()) {
                 case "java.lang.String": {
                     Variable resultVar = insn.getProgram().createVariable();
                     getProperty(insn, property, instructions, resultVar);
@@ -218,8 +218,8 @@ class ResourceProgramTransformer {
         InvokeInstruction castInvoke = new InvokeInstruction();
         castInvoke.setType(InvocationType.SPECIAL);
         String primitiveCapitalized = primitive.getName();
-        primitiveCapitalized = Character.toUpperCase(primitiveCapitalized.charAt(0)) +
-                primitiveCapitalized.substring(1);
+        primitiveCapitalized = Character.toUpperCase(primitiveCapitalized.charAt(0))
+                + primitiveCapitalized.substring(1);
         castInvoke.setMethod(new MethodReference(ResourceAccessor.class, "castTo" + primitiveCapitalized,
                 Object.class, primitive));
         castInvoke.getArguments().add(resultVar);
@@ -231,7 +231,7 @@ class ResourceProgramTransformer {
         ValueType type = insn.getMethod().getDescriptor().parameterType(0);
         List<Instruction> instructions = new ArrayList<>();
         if (type instanceof ValueType.Primitive) {
-            switch (((ValueType.Primitive)type).getKind()) {
+            switch (((ValueType.Primitive) type).getKind()) {
                 case BOOLEAN:
                     castAndSetProperty(insn, property, instructions, boolean.class);
                     return instructions;
@@ -255,7 +255,7 @@ class ResourceProgramTransformer {
                     break;
             }
         } else if (type instanceof ValueType.Object) {
-            switch (((ValueType.Object)type).getClassName()) {
+            switch (((ValueType.Object) type).getClassName()) {
                 case "java.lang.String": {
                     Variable castVar = insn.getProgram().createVariable();
                     InvokeInstruction castInvoke = new InvokeInstruction();
@@ -300,8 +300,8 @@ class ResourceProgramTransformer {
         InvokeInstruction castInvoke = new InvokeInstruction();
         castInvoke.setType(InvocationType.SPECIAL);
         String primitiveCapitalized = primitive.getName();
-        primitiveCapitalized = Character.toUpperCase(primitiveCapitalized.charAt(0)) +
-                primitiveCapitalized.substring(1);
+        primitiveCapitalized = Character.toUpperCase(primitiveCapitalized.charAt(0))
+                + primitiveCapitalized.substring(1);
         castInvoke.setMethod(new MethodReference(ResourceAccessor.class, "castFrom" + primitiveCapitalized,
                 primitive, Object.class));
         castInvoke.getArguments().add(insn.getArguments().get(0));
diff --git a/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceWriterHelper.java b/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceWriterHelper.java
index 715d248ba..bb1e622f6 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceWriterHelper.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/plugin/ResourceWriterHelper.java
@@ -31,16 +31,16 @@ final class ResourceWriterHelper {
             writer.append("null");
         } else {
             if (resource instanceof ResourceWriter) {
-                ((ResourceWriter)resource).write(writer);
+                ((ResourceWriter) resource).write(writer);
             } else if (resource instanceof Number) {
                 writer.append(resource);
             } else if (resource instanceof Boolean) {
                 writer.append(resource == Boolean.TRUE ? "true" : "false");
             } else if (resource instanceof String) {
-                writeString(writer, (String)resource);
+                writeString(writer, (String) resource);
             } else {
-                throw new RuntimeException("Error compiling resources. Value of illegal type found: " +
-                        resource.getClass());
+                throw new RuntimeException("Error compiling resources. Value of illegal type found: "
+                        + resource.getClass());
             }
         }
     }
diff --git a/teavm-samples/teavm-samples-async/src/main/java/org/teavm/samples/async/AsyncProgram.java b/teavm-samples/teavm-samples-async/src/main/java/org/teavm/samples/async/AsyncProgram.java
index a7b116ab1..c6890005d 100644
--- a/teavm-samples/teavm-samples-async/src/main/java/org/teavm/samples/async/AsyncProgram.java
+++ b/teavm-samples/teavm-samples-async/src/main/java/org/teavm/samples/async/AsyncProgram.java
@@ -77,7 +77,7 @@ public final class AsyncProgram {
         prime[2] = true;
         prime[3] = true;
         nextPrime: for (int i = 5; i < prime.length; i += 2) {
-            int maxPrime = (int)Math.sqrt(i);
+            int maxPrime = (int) Math.sqrt(i);
             for (int j = 3; j <= maxPrime; j += 2) {
                 Thread.yield();
                 if (prime[j] && i % j == 0) {
diff --git a/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/Scene.java b/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/Scene.java
index 8b99f31a1..19df6f9b5 100644
--- a/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/Scene.java
+++ b/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/Scene.java
@@ -71,18 +71,18 @@ public class Scene {
         int parts = 30;
         for (int i = 0; i < parts; ++i) {
             PolygonShape shape = new PolygonShape();
-            double angle1 = i / (double)parts * 2 * Math.PI;
+            double angle1 = i / (double) parts * 2 * Math.PI;
             double x1 = 2.7 * Math.cos(angle1);
             double y1 = 2.7 * Math.sin(angle1);
-            double angle2 = (i + 1) / (double)parts * 2 * Math.PI;
+            double angle2 = (i + 1) / (double) parts * 2 * Math.PI;
             double x2 = 2.7 * Math.cos(angle2);
             double y2 = 2.7 * Math.sin(angle2);
             double angle = (angle1 + angle2) / 2;
             double x = 0.01 * Math.cos(angle);
             double y = 0.01 * Math.sin(angle);
 
-            shape.set(new Vec2[] { new Vec2((float)x1, (float)y1), new Vec2((float)x2, (float)y2),
-                    new Vec2((float)(x2 - x), (float)(y2 - y)), new Vec2((float)(x1 - x), (float)(y1 - y)) }, 4);
+            shape.set(new Vec2[] { new Vec2((float) x1, (float) y1), new Vec2((float) x2, (float) y2),
+                    new Vec2((float) (x2 - x), (float) (y2 - y)), new Vec2((float) (x1 - x), (float) (y1 - y)) }, 4);
             fixture.shape = shape;
             reel.createFixture(fixture);
         }
@@ -137,10 +137,10 @@ public class Scene {
 
     public void calculate() {
         long currentTime = System.currentTimeMillis();
-        int timeToCalculate = (int)(currentTime - lastCalculated);
+        int timeToCalculate = (int) (currentTime - lastCalculated);
         long relativeTime = currentTime - startTime;
         while (timeToCalculate > 10) {
-            int period = (int)((relativeTime + 5000) / 10000);
+            int period = (int) ((relativeTime + 5000) / 10000);
             reel.applyTorque(period % 2 == 0 ? 8f : -8f);
             world.step(0.01f, 20, 40);
             lastCalculated += 10;
@@ -149,7 +149,7 @@ public class Scene {
     }
 
     public int timeUntilNextStep() {
-        return (int)Math.max(0, lastCalculated + 10 - System.currentTimeMillis());
+        return (int) Math.max(0, lastCalculated + 10 - System.currentTimeMillis());
     }
 
     public World getWorld() {
diff --git a/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/gwt/BenchmarkStarter.java b/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/gwt/BenchmarkStarter.java
index 1c18065c4..dfb1e89a3 100644
--- a/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/gwt/BenchmarkStarter.java
+++ b/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/gwt/BenchmarkStarter.java
@@ -43,7 +43,7 @@ public class BenchmarkStarter implements EntryPoint {
     @Override
     public void onModuleLoad() {
         document = RootPanel.getBodyElement().getOwnerDocument();
-        canvas = (CanvasElement)document.getElementById("benchmark-canvas");
+        canvas = (CanvasElement) document.getElementById("benchmark-canvas");
         resultTableBody = document.getElementById("result-table-body");
         startMillisecond = System.currentTimeMillis();
         makeStep();
@@ -53,7 +53,7 @@ public class BenchmarkStarter implements EntryPoint {
         double start = Performance.now();
         scene.calculate();
         double end = Performance.now();
-        int second = (int)((System.currentTimeMillis() - startMillisecond) / 1000);
+        int second = (int) ((System.currentTimeMillis() - startMillisecond) / 1000);
         if (second > currentSecond) {
             Element row = document.createElement("tr");
             resultTableBody.appendChild(row);
@@ -94,13 +94,13 @@ public class BenchmarkStarter implements EntryPoint {
             for (Fixture fixture = body.getFixtureList(); fixture != null; fixture = fixture.getNext()) {
                 Shape shape = fixture.getShape();
                 if (shape.getType() == ShapeType.CIRCLE) {
-                    CircleShape circle = (CircleShape)shape;
+                    CircleShape circle = (CircleShape) shape;
                     context.beginPath();
                     context.arc(circle.m_p.x, circle.m_p.y, circle.getRadius(), 0, Math.PI * 2, true);
                     context.closePath();
                     context.stroke();
                 } else if (shape.getType() == ShapeType.POLYGON) {
-                    PolygonShape poly = (PolygonShape)shape;
+                    PolygonShape poly = (PolygonShape) shape;
                     Vec2[] vertices = poly.getVertices();
                     context.beginPath();
                     context.moveTo(vertices[0].x, vertices[0].y);
diff --git a/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/htmljava/BenchmarkStarter.java b/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/htmljava/BenchmarkStarter.java
index a949a7d8a..1d4837261 100644
--- a/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/htmljava/BenchmarkStarter.java
+++ b/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/htmljava/BenchmarkStarter.java
@@ -34,20 +34,20 @@ import org.teavm.samples.benchmark.Scene;
 public final class BenchmarkStarter {
     private BenchmarkStarter() {
     }
-    
+
     private static final Timer TIMER = new Timer("Make Step");
     private static final Scene scene = new Scene();
     private static double startMillisecond;
     private static int currentSecond;
     private static double timeSpentCalculating;
     private static BrwsrCtx ctx;
-    
+
     public static void main(String[] args) {
         startMillisecond = System.currentTimeMillis();
         ctx = BrwsrCtx.findDefault(BenchmarkStarter.class);
         makeStep();
     }
-    
+
     static void makeStep() {
         ctx.execute(new Runnable() {
             @Override
@@ -61,7 +61,7 @@ public final class BenchmarkStarter {
         double start = System.currentTimeMillis();
         scene.calculate();
         double end = System.currentTimeMillis();
-        int second = (int)((System.currentTimeMillis() - startMillisecond) / 1000);
+        int second = (int) ((System.currentTimeMillis() - startMillisecond) / 1000);
         if (second > currentSecond) {
             publishResults(second, timeSpentCalculating);
             timeSpentCalculating = 0;
@@ -95,13 +95,13 @@ public final class BenchmarkStarter {
             for (Fixture fixture = body.getFixtureList(); fixture != null; fixture = fixture.getNext()) {
                 Shape shape = fixture.getShape();
                 if (shape.getType() == ShapeType.CIRCLE) {
-                    CircleShape circle = (CircleShape)shape;
+                    CircleShape circle = (CircleShape) shape;
                     context.beginPath();
                     context.arc(circle.m_p.x, circle.m_p.y, circle.getRadius(), 0, Math.PI * 2, true);
                     context.closePath();
                     context.stroke();
                 } else if (shape.getType() == ShapeType.POLYGON) {
-                    PolygonShape poly = (PolygonShape)shape;
+                    PolygonShape poly = (PolygonShape) shape;
                     Vec2[] vertices = poly.getVertices();
                     context.beginPath();
                     context.moveTo(vertices[0].x, vertices[0].y);
@@ -116,17 +116,17 @@ public final class BenchmarkStarter {
         }
         context.restore();
     }
-    
-    @JavaScriptBody(args = { "second", "timeSpentCalculating" }, body = 
-        "var resultTableBody = document.getElementById('result-table-body');\n" +
-        "var row = document.createElement(\"tr\");\n" +
-        "resultTableBody.appendChild(row);\n" +
-        "var secondCell = document.createElement(\"td\");\n" +
-        "row.appendChild(secondCell);\n" +
-        "secondCell.appendChild(document.createTextNode(second));\n" +
-        "var timeCell = document.createElement(\"td\");\n" +
-        "row.appendChild(timeCell);\n" +
-        "timeCell.appendChild(document.createTextNode(timeSpentCalculating));\n"
+
+    @JavaScriptBody(args = { "second", "timeSpentCalculating" }, body = ""
+        + "var resultTableBody = document.getElementById('result-table-body');\n"
+        + "var row = document.createElement(\"tr\");\n"
+        + "resultTableBody.appendChild(row);\n"
+        + "var secondCell = document.createElement(\"td\");\n"
+        + "row.appendChild(secondCell);\n"
+        + "secondCell.appendChild(document.createTextNode(second));\n"
+        + "var timeCell = document.createElement(\"td\");\n"
+        + "row.appendChild(timeCell);\n"
+        + "timeCell.appendChild(document.createTextNode(timeSpentCalculating));\n"
     )
     private static native void publishResults(int second, double time);
 }
diff --git a/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/teavm/BenchmarkStarter.java b/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/teavm/BenchmarkStarter.java
index a795c9727..d98815b97 100644
--- a/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/teavm/BenchmarkStarter.java
+++ b/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/teavm/BenchmarkStarter.java
@@ -36,11 +36,11 @@ import org.teavm.samples.benchmark.Scene;
  * @author Alexey Andreev
  */
 public final class BenchmarkStarter {
-    private static Window window = (Window)JS.getGlobal();
+    private static Window window = (Window) JS.getGlobal();
     private static HTMLDocument document = window.getDocument();
-    private static HTMLCanvasElement canvas = (HTMLCanvasElement)document.getElementById("benchmark-canvas");
+    private static HTMLCanvasElement canvas = (HTMLCanvasElement) document.getElementById("benchmark-canvas");
     private static HTMLElement resultTableBody = document.getElementById("result-table-body");
-    private static Performance performance = (Performance)JS.get(window, JS.wrap("performance"));
+    private static Performance performance = (Performance) JS.get(window, JS.wrap("performance"));
     private static Scene scene = new Scene();
     private static int currentSecond;
     private static long startMillisecond;
@@ -58,7 +58,7 @@ public final class BenchmarkStarter {
         double start = performance.now();
         scene.calculate();
         double end = performance.now();
-        int second = (int)((System.currentTimeMillis() - startMillisecond) / 1000);
+        int second = (int) ((System.currentTimeMillis() - startMillisecond) / 1000);
         if (second > currentSecond) {
             HTMLElement row = document.createElement("tr");
             resultTableBody.appendChild(row);
@@ -82,7 +82,7 @@ public final class BenchmarkStarter {
     }
 
     private static void render() {
-        CanvasRenderingContext2D context = (CanvasRenderingContext2D)canvas.getContext("2d");
+        CanvasRenderingContext2D context = (CanvasRenderingContext2D) canvas.getContext("2d");
         context.setFillStyle("white");
         context.setStrokeStyle("grey");
         context.fillRect(0, 0, 600, 600);
@@ -99,13 +99,13 @@ public final class BenchmarkStarter {
             for (Fixture fixture = body.getFixtureList(); fixture != null; fixture = fixture.getNext()) {
                 Shape shape = fixture.getShape();
                 if (shape.getType() == ShapeType.CIRCLE) {
-                    CircleShape circle = (CircleShape)shape;
+                    CircleShape circle = (CircleShape) shape;
                     context.beginPath();
                     context.arc(circle.m_p.x, circle.m_p.y, circle.getRadius(), 0, Math.PI * 2, true);
                     context.closePath();
                     context.stroke();
                 } else if (shape.getType() == ShapeType.POLYGON) {
-                    PolygonShape poly = (PolygonShape)shape;
+                    PolygonShape poly = (PolygonShape) shape;
                     Vec2[] vertices = poly.getVertices();
                     context.beginPath();
                     context.moveTo(vertices[0].x, vertices[0].y);
diff --git a/teavm-samples/teavm-samples-hello/src/main/java/org/teavm/samples/hello/Client.java b/teavm-samples/teavm-samples-hello/src/main/java/org/teavm/samples/hello/Client.java
index 304d31e50..4d8368ccb 100644
--- a/teavm-samples/teavm-samples-hello/src/main/java/org/teavm/samples/hello/Client.java
+++ b/teavm-samples/teavm-samples-hello/src/main/java/org/teavm/samples/hello/Client.java
@@ -26,9 +26,9 @@ import org.teavm.dom.html.HTMLElement;
 import org.teavm.jso.JS;
 
 public final class Client {
-    private static Window window = (Window)JS.getGlobal();
+    private static Window window = (Window) JS.getGlobal();
     private static HTMLDocument document = window.getDocument();
-    private static HTMLButtonElement helloButton = (HTMLButtonElement)document.getElementById("hello-button");
+    private static HTMLButtonElement helloButton = (HTMLButtonElement) document.getElementById("hello-button");
     private static HTMLElement responsePanel = document.getElementById("response-panel");
     private static HTMLElement thinkingPanel = document.getElementById("thinking-panel");
 
diff --git a/teavm-samples/teavm-samples-storage/src/main/java/org/teavm/samples/storage/Application.java b/teavm-samples/teavm-samples-storage/src/main/java/org/teavm/samples/storage/Application.java
index 376758e3e..e523bbedc 100644
--- a/teavm-samples/teavm-samples-storage/src/main/java/org/teavm/samples/storage/Application.java
+++ b/teavm-samples/teavm-samples-storage/src/main/java/org/teavm/samples/storage/Application.java
@@ -29,7 +29,7 @@ import org.teavm.jso.JS;
 */
 public final class Application {
 
-    private static Window window = (Window)JS.getGlobal();
+    private static Window window = (Window) JS.getGlobal();
     private static HTMLDocument document = window.getDocument();
     private static Storage storage = window.getSessionStorage();
 
@@ -41,26 +41,25 @@ public final class Application {
             window.alert("storage is not supported.");
         }
 
-        HTMLButtonElement saveButton = (HTMLButtonElement)document.getElementById("save-button");
+        HTMLButtonElement saveButton = (HTMLButtonElement) document.getElementById("save-button");
         saveButton.addEventListener("click", e -> {
-            String key = ((HTMLInputElement)document.getElementById("key")).getValue();
-            String value = ((HTMLInputElement)document.getElementById("value")).getValue();
+            String key = ((HTMLInputElement) document.getElementById("key")).getValue();
+            String value = ((HTMLInputElement) document.getElementById("value")).getValue();
 
             if (key != null && key.length() > 0 && value != null && value.length() > 0) {
                 storage.setItem(key, value);
                 draw();
             }
         });
-        HTMLButtonElement deleteButton = (HTMLButtonElement)document.getElementById("delete-button");
+        HTMLButtonElement deleteButton = (HTMLButtonElement) document.getElementById("delete-button");
         deleteButton.addEventListener("click", e -> {
-            String key = ((HTMLInputElement)document.getElementById("key")).getValue();
-
+            String key = ((HTMLInputElement) document.getElementById("key")).getValue();
             if (key != null && key.length() > 0) {
                 storage.removeItem(key);
                 draw();
             }
         });
-        HTMLButtonElement deleteAllButton = (HTMLButtonElement)document.getElementById("delete-all-button");
+        HTMLButtonElement deleteAllButton = (HTMLButtonElement) document.getElementById("delete-all-button");
         deleteAllButton.addEventListener("click", e -> {
             storage.clear();
             draw();
diff --git a/teavm-samples/teavm-samples-video/src/main/java/org/teavm/samples/video/Player.java b/teavm-samples/teavm-samples-video/src/main/java/org/teavm/samples/video/Player.java
index f7ad15f0c..5c2de45bf 100644
--- a/teavm-samples/teavm-samples-video/src/main/java/org/teavm/samples/video/Player.java
+++ b/teavm-samples/teavm-samples-video/src/main/java/org/teavm/samples/video/Player.java
@@ -26,24 +26,24 @@ import org.teavm.jso.JS;
 
 public final class Player {
 
-    private static Window window = (Window)JS.getGlobal();
+    private static Window window = (Window) JS.getGlobal();
     private static HTMLDocument document = window.getDocument();
 
     private Player() {
     }
 
     public static void main(String[] args) {
-        HTMLSourceElement sourceMp4 = (HTMLSourceElement)document.createElement("source");
+        HTMLSourceElement sourceMp4 = (HTMLSourceElement) document.createElement("source");
         sourceMp4.setAttribute("id", "mp4");
         sourceMp4.setSrc("http://media.w3.org/2010/05/sintel/trailer.mp4");
         sourceMp4.setAttribute("type", "video/mp4");
 
-        HTMLSourceElement sourceWebm = (HTMLSourceElement)document.createElement("source");
+        HTMLSourceElement sourceWebm = (HTMLSourceElement) document.createElement("source");
         sourceWebm.setAttribute("id", "webm");
         sourceWebm.setSrc("http://media.w3.org/2010/05/sintel/trailer.webm");
         sourceWebm.setAttribute("type", "video/webm");
 
-        HTMLSourceElement sourceOgv = (HTMLSourceElement)document.createElement("source");
+        HTMLSourceElement sourceOgv = (HTMLSourceElement) document.createElement("source");
         sourceOgv.setAttribute("id", "ogv");
         sourceOgv.setSrc("http://media.w3.org/2010/05/sintel/trailer.ogv");
         sourceOgv.setAttribute("type", "video/ogg");
@@ -51,7 +51,7 @@ public final class Player {
         HTMLElement p = document.createElement("p");
         p.appendChild(document.createTextNode("Your user agent does not support the HTML5 Video element."));
 
-        HTMLVideoElement video = (HTMLVideoElement)document.createElement("video");
+        HTMLVideoElement video = (HTMLVideoElement) document.createElement("video");
         video.setAttribute("id", "video");
         video.setControls(true);
         video.setPreload("none");
@@ -65,61 +65,61 @@ public final class Player {
         HTMLElement divVideo = document.createElement("div");
         divVideo.appendChild(video);
 
-        HTMLButtonElement loadButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement loadButton = (HTMLButtonElement) document.createElement("button");
         loadButton.appendChild(document.createTextNode("load()"));
         loadButton.addEventListener("click", evt -> video.load());
 
-        HTMLButtonElement playButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement playButton = (HTMLButtonElement) document.createElement("button");
         playButton.appendChild(document.createTextNode("play()"));
         playButton.addEventListener("click", evt -> video.play());
 
-        HTMLButtonElement pauseButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement pauseButton = (HTMLButtonElement) document.createElement("button");
         pauseButton.appendChild(document.createTextNode("pause()"));
         pauseButton.addEventListener("click", evt -> video.pause());
 
-        HTMLButtonElement currentTimePlusButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement currentTimePlusButton = (HTMLButtonElement) document.createElement("button");
         currentTimePlusButton.appendChild(document.createTextNode("currentTime+=10"));
         currentTimePlusButton.addEventListener("click", evt -> video.setCurrentTime(video.getCurrentTime() + 10));
 
-        HTMLButtonElement currentTimeMinusButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement currentTimeMinusButton = (HTMLButtonElement) document.createElement("button");
         currentTimeMinusButton.appendChild(document.createTextNode("currentTime-=10"));
         currentTimeMinusButton.addEventListener("click", evt -> video.setCurrentTime(video.getCurrentTime() - 10));
 
-        HTMLButtonElement currentTime50Button = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement currentTime50Button = (HTMLButtonElement) document.createElement("button");
         currentTime50Button.appendChild(document.createTextNode("currentTime=50"));
         currentTime50Button.addEventListener("click", evt -> video.setCurrentTime(50));
 
-        HTMLButtonElement playbackRateIncrementButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement playbackRateIncrementButton = (HTMLButtonElement) document.createElement("button");
         playbackRateIncrementButton.appendChild(document.createTextNode("playbackRate++"));
         playbackRateIncrementButton.addEventListener("click", evt -> video.setPlaybackRate(
                 video.getPlaybackRate() + 1));
 
-        HTMLButtonElement playbackRateDecrementButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement playbackRateDecrementButton = (HTMLButtonElement) document.createElement("button");
         playbackRateDecrementButton.appendChild(document.createTextNode("playbackRate--"));
         playbackRateDecrementButton.addEventListener("click", evt -> video.setPlaybackRate(
                 video.getPlaybackRate() - 1));
 
-        HTMLButtonElement playbackRatePlusButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement playbackRatePlusButton = (HTMLButtonElement) document.createElement("button");
         playbackRatePlusButton.appendChild(document.createTextNode("playbackRate+=0.1"));
         playbackRatePlusButton.addEventListener("click", evt -> video.setPlaybackRate(video.getPlaybackRate() + 0.1));
 
-        HTMLButtonElement playbackRateMinusButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement playbackRateMinusButton = (HTMLButtonElement) document.createElement("button");
         playbackRateMinusButton.appendChild(document.createTextNode("playbackRate-=0.1"));
         playbackRateMinusButton.addEventListener("click", evt -> video.setPlaybackRate(video.getPlaybackRate() - 0.1));
 
-        HTMLButtonElement volumePlusButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement volumePlusButton = (HTMLButtonElement) document.createElement("button");
         volumePlusButton.appendChild(document.createTextNode("volume+=0.1"));
         volumePlusButton.addEventListener("click", evt -> video.setVolume(video.getVolume() + 0.1f));
 
-        HTMLButtonElement volumeMinusButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement volumeMinusButton = (HTMLButtonElement) document.createElement("button");
         volumeMinusButton.appendChild(document.createTextNode("volume-=0.1"));
         volumeMinusButton.addEventListener("click", evt -> video.setVolume(video.getVolume() - 0.1f));
 
-        HTMLButtonElement muteButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement muteButton = (HTMLButtonElement) document.createElement("button");
         muteButton.appendChild(document.createTextNode("muted=true"));
         muteButton.addEventListener("click", evt -> video.setMuted(true));
 
-        HTMLButtonElement unmuteButton = (HTMLButtonElement)document.createElement("button");
+        HTMLButtonElement unmuteButton = (HTMLButtonElement) document.createElement("button");
         unmuteButton.appendChild(document.createTextNode("muted=false"));
         unmuteButton.addEventListener("click", evt -> video.setMuted(false));