You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jt...@apache.org on 2018/08/14 09:16:38 UTC

[incubator-netbeans-html4j] branch master updated (ff995ac -> 84bdb6b)

This is an automated email from the ASF dual-hosted git repository.

jtulach pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans-html4j.git.


    from ff995ac  Human readable toString() for processed class files
     new a919929  #621: Cast arrays to (Object) to be treated as a single argument
     new 84bdb6b  Moving the script file to resources subdirectory

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../netbeans/html/json/impl/ModelProcessor.java    |  7 +++++-
 .../html/json/{AdressTest.java => VarArgTest.java} | 25 ++++++++++++++--------
 src/main/javadoc/overview.html                     |  4 +++-
 src/main/javadoc/{ => resources}/teavm.js          |  0
 4 files changed, 25 insertions(+), 11 deletions(-)
 copy json/src/test/java/net/java/html/json/{AdressTest.java => VarArgTest.java} (64%)
 rename src/main/javadoc/{ => resources}/teavm.js (100%)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[incubator-netbeans-html4j] 02/02: Moving the script file to resources subdirectory

Posted by jt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jtulach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans-html4j.git

commit 84bdb6be5da390a6b66a4fc1003bc458b8b72773
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Tue Aug 14 11:16:13 2018 +0200

    Moving the script file to resources subdirectory
---
 src/main/javadoc/overview.html            | 2 +-
 src/main/javadoc/{ => resources}/teavm.js | 0
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/javadoc/overview.html b/src/main/javadoc/overview.html
index 8a94392..36e47f0 100644
--- a/src/main/javadoc/overview.html
+++ b/src/main/javadoc/overview.html
@@ -156,7 +156,7 @@ $ mvn -f client/pom.xml process-classes exec:exec
         </center>
 
         <!-- boot bck2brwsr -->
-        <script src="teavm.js" type="text/javascript"></script>
+        <script src="resources/teavm.js" type="text/javascript"></script>
         <script>
             var vm = new VM();
             vm.loadClass('org.apidesign.demo.minesweeper.MainBrwsr');
diff --git a/src/main/javadoc/teavm.js b/src/main/javadoc/resources/teavm.js
similarity index 100%
rename from src/main/javadoc/teavm.js
rename to src/main/javadoc/resources/teavm.js


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[incubator-netbeans-html4j] 01/02: #621: Cast arrays to (Object) to be treated as a single argument

Posted by jt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jtulach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans-html4j.git

commit a91992961d7c5751c40b7359b49ff1dc4b4bd569
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Tue Aug 14 11:13:57 2018 +0200

    #621: Cast arrays to (Object) to be treated as a single argument
---
 .../netbeans/html/json/impl/ModelProcessor.java    |  7 +++-
 .../test/java/net/java/html/json/VarArgTest.java   | 42 ++++++++++++++++++++++
 src/main/javadoc/overview.html                     |  2 ++
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/json/src/main/java/org/netbeans/html/json/impl/ModelProcessor.java b/json/src/main/java/org/netbeans/html/json/impl/ModelProcessor.java
index 9886955..d43eded 100644
--- a/json/src/main/java/org/netbeans/html/json/impl/ModelProcessor.java
+++ b/json/src/main/java/org/netbeans/html/json/impl/ModelProcessor.java
@@ -1115,6 +1115,7 @@ public final class ModelProcessor extends AbstractProcessor {
         List<? extends Element> enclosedElements,
         List<Object> functions
     ) {
+        final Types tu = processingEnv.getTypeUtils();
         boolean instance = clazz.getAnnotation(Model.class).instance();
         for (Element m : enclosedElements) {
             if (m.getKind() != ElementKind.METHOD) {
@@ -1158,7 +1159,11 @@ public final class ModelProcessor extends AbstractProcessor {
                             error("First parameter of @ModelOperation method must be " + className, m);
                             return false;
                         }
-                        args.add(ve.getSimpleName().toString());
+                        if (ve.asType().getKind() == TypeKind.ARRAY) {
+                            args.add("(Object) " + ve.getSimpleName().toString());
+                        } else {
+                            args.add(ve.getSimpleName().toString());
+                        }
                         body.append(sep).append("final ");
                         body.append(ve.asType().toString()).append(" ");
                         body.append(ve.toString());
diff --git a/json/src/test/java/net/java/html/json/VarArgTest.java b/json/src/test/java/net/java/html/json/VarArgTest.java
new file mode 100644
index 0000000..dcedb5b
--- /dev/null
+++ b/json/src/test/java/net/java/html/json/VarArgTest.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 net.java.html.json;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+@Model(className = "VarArg", instance = true, properties = {
+})
+public class VarArgTest {
+    @ModelOperation
+    void read(VarArg square, VarArgTest[] arr) {
+        Assert.assertNotNull(arr, "Array passed in");
+        Assert.assertEquals(arr.length, 1, "One slot ready");
+        arr[0] = this;
+    }
+
+    @Test
+    public void canReadThis() {
+        VarArgTest[] arr = { null };
+        VarArg model = new VarArg();
+        model.read(arr);
+        Assert.assertNotNull(arr[0]);
+    }
+}
diff --git a/src/main/javadoc/overview.html b/src/main/javadoc/overview.html
index fc858d0..8a94392 100644
--- a/src/main/javadoc/overview.html
+++ b/src/main/javadoc/overview.html
@@ -171,6 +171,8 @@ $ mvn -f client/pom.xml process-classes exec:exec
             {@link net.java.html.js.JavaScriptResource} annotation has been
             made repeatable -
             <a target="_blank" href="https://github.com/apache/incubator-netbeans-html4j/pull/4">PR #4</a>.
+            <code>@Model</code> annotation processor bugfix 
+            <a target="_blank" href="https://issues.apache.org/jira/browse/NETBEANS-621">#621</a>.
         </p>
 
         <h3>New in version 1.5.1</h3>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists