Check html4j with checkstyle

This commit is contained in:
alexey-andreev 2015-01-18 13:15:11 +04:00
parent 792dd6618d
commit d185ee79a3
5 changed files with 49 additions and 67 deletions

View File

@ -101,9 +101,6 @@
<debugInformationGenerated>true</debugInformationGenerated>
<sourceMapsGenerated>true</sourceMapsGenerated>
<sourceFilesCopied>true</sourceFilesCopied>
<additionalScripts>
</additionalScripts>
</configuration>
</execution>
</executions>
@ -116,6 +113,13 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>../checkstyle.xml</configLocation>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>

View File

@ -87,11 +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);
@ -99,11 +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));
@ -133,11 +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);

View File

@ -1,3 +1,18 @@
/*
* Copyright 2014 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.html4j.test;
import java.util.Calendar;

View File

@ -1,44 +1,17 @@
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
/*
* Copyright 2014 Alexey Andreev.
*
* Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
* http://www.apache.org/licenses/LICENSE-2.0
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common
* Development and Distribution License("CDDL") (collectively, the
* "License"). You may not use this file except in compliance with the
* License. You can obtain a copy of the License at
* http://www.netbeans.org/cddl-gplv2.html
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
* specific language governing permissions and limitations under the
* License. When distributing the software, include this License Header
* Notice in each file and include the License file at
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the
* License Header, with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* Contributor(s):
*
* The Original Software is NetBeans. The Initial Developer of the Original
* Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
*
* If you wish your version of this file to be governed by only the CDDL
* or only the GPL Version 2, indicate your decision by adding
* "[Contributor] elects to include this software in this distribution
* under the [CDDL or GPL Version 2] license." If you do not indicate a
* single choice of license, a recipient has the option to distribute
* your version of this file under either the CDDL, the GPL Version 2 or
* to extend the choice of license to its licensees as provided above.
* However, if you add GPL Version 2 code and therefore, elected the GPL
* Version 2 license, then the option applies only if the new code is
* made subject to such option by the copyright holder.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.html4j.test;
@ -120,20 +93,19 @@ public final class KnockoutFXTest extends KnockoutTCK implements Transfer {
private static native void setProperty(Object json, String key, Object value);
@Override
@JavaScriptBody(args = { "s", "args" }, body = ""
+ "var f = new Function(s); "
+ "return f.apply(null, args);"
@JavaScriptBody(args = { "s", "args" }, body =
"var f = new Function(s); " +
"return f.apply(null, args);"
)
public native Object executeScript(String script, Object[] arguments);
@JavaScriptBody(args = { }, body =
"var h;"
+ "if (!!window && !!window.location && !!window.location.href)\n"
+ " h = window.location.href;\n"
+ "else "
+ " h = null;"
+ "return h;\n"
)
"var h;" +
"if (!!window && !!window.location && !!window.location.href)\n" +
" h = window.location.href;\n" +
"else " +
" h = null;" +
"return h;\n")
private static native String findBaseURL();
@Override