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 2021/04/02 13:01:58 UTC
[netbeans-html4j] branch master updated: onError= works in inner
classes
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/netbeans-html4j.git
The following commit(s) were added to refs/heads/master by this push:
new 702c277 onError= works in inner classes
new 551d9c3 Merge branch 'master' of https://gitbox.apache.org/repos/asf/netbeans-html4j
702c277 is described below
commit 702c2777d21b1b6ac26531cf1afe2f794a810dec
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Fri Apr 2 14:58:35 2021 +0200
onError= works in inner classes
---
.../netbeans/html/json/impl/ModelProcessor.java | 16 ++++++----
.../org/netbeans/html/json/impl/InnerTest.java | 35 ++++++++++++++++++++++
2 files changed, 45 insertions(+), 6 deletions(-)
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 80ad12f..27accd0 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
@@ -81,7 +81,6 @@ import org.openide.util.lookup.ServiceProvider;
* @author Jaroslav Tulach
*/
@ServiceProvider(service=Processor.class)
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
@SupportedAnnotationTypes({
"net.java.html.json.Model",
"net.java.html.json.ModelOperation",
@@ -174,10 +173,10 @@ public final class ModelProcessor extends AbstractProcessor {
try {
StringWriter body = new StringWriter();
StringBuilder onReceiveType = new StringBuilder();
- List<GetSet> propsGetSet = new ArrayList<GetSet>();
- List<Object> functions = new ArrayList<Object>();
- Map<String, Collection<String[]>> propsDeps = new HashMap<String, Collection<String[]>>();
- Map<String, Collection<String>> functionDeps = new HashMap<String, Collection<String>>();
+ List<GetSet> propsGetSet = new ArrayList<>();
+ List<Object> functions = new ArrayList<>();
+ Map<String, Collection<String[]>> propsDeps = new HashMap<>();
+ Map<String, Collection<String>> functionDeps = new HashMap<>();
Prprt[] props = createProps(e, m.properties());
final String builderPrefix = findBuilderPrefix(e, m);
@@ -1457,7 +1456,7 @@ public final class ModelProcessor extends AbstractProcessor {
} else {
int errorParamsLength = findOnError(e, ((TypeElement)clazz), onR.onError(), className);
error = errorParamsLength < 0;
- body.append(" ").append(clazz.getSimpleName()).append(".").append(onR.onError()).append("(");
+ body.append(" ").append(inPckName(clazz, false)).append(".").append(onR.onError()).append("(");
body.append("model, ex");
for (int i = 2; i < errorParamsLength; i++) {
String arg = args.get(i);
@@ -2341,4 +2340,9 @@ public final class ModelProcessor extends AbstractProcessor {
return null;
}
+ @Override
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latest();
+ }
+
}
diff --git a/json/src/test/java/org/netbeans/html/json/impl/InnerTest.java b/json/src/test/java/org/netbeans/html/json/impl/InnerTest.java
new file mode 100644
index 0000000..a615fd7
--- /dev/null
+++ b/json/src/test/java/org/netbeans/html/json/impl/InnerTest.java
@@ -0,0 +1,35 @@
+/**
+ * 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 org.netbeans.html.json.impl;
+
+import net.java.html.json.Model;
+import net.java.html.json.OnReceive;
+
+public class InnerTest {
+ @Model(className = "InnerModel", properties = {
+ })
+ public final static class Inner {
+ @OnReceive(url = "http://github.com/api", onError = "apiError")
+ static void apiCall(InnerModel model, String data) {
+ }
+
+ static void apiError(InnerModel model, Exception err) {
+ }
+ }
+}
---------------------------------------------------------------------
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