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

skygo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new bf47a2f  [NETBEANS-4159] Switch to ElementKindVisitor8 as base class 
(min runtime JDK) and add noop logger for unknown elements
     new e24181e  Merge pull request #2074 from graben/NETBEANS-4159
bf47a2f is described below

commit bf47a2f0f5d0859cacf470127098e5dae4e76c74
Author: Benjamin Graf <[email protected]>
AuthorDate: Sun Apr 12 17:44:57 2020 +0200

    [NETBEANS-4159] Switch to ElementKindVisitor8 as base class (min runtime 
JDK) and add noop logger for unknown elements
---
 .travis.yml                                                  |  1 +
 enterprise/websvc.editor.hints/nbproject/project.properties  |  4 ++--
 enterprise/websvc.editor.hints/nbproject/project.xml         |  7 +++++++
 .../modules/websvc/editor/hints/common/RulesEngine.java      | 11 +++++++++--
 .../test/unit/data/InvalidExcludeAttributeTest.java          |  2 +-
 ...alidExcludeAttributeTest.java => UnknownElementTest.java} | 12 +++---------
 .../netbeans/modules/websvc/editor/hints/WSHintsTest.java    |  6 ++++++
 7 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 261f5b7..0f9d92d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -598,6 +598,7 @@ matrix:
             - ant $OPTS build
           script:
             - ant $OPTS -f enterprise/spring.webmvc test
+            - ant $OPTS -f enterprise/websvc.editor.hints test
             - ant $OPTS -f enterprise/websvc.websvcapi test
             - ant $OPTS -f enterprise/websvc.wsstackapi test
             
diff --git a/enterprise/websvc.editor.hints/nbproject/project.properties 
b/enterprise/websvc.editor.hints/nbproject/project.properties
index 0c362d3..d4880d5 100644
--- a/enterprise/websvc.editor.hints/nbproject/project.properties
+++ b/enterprise/websvc.editor.hints/nbproject/project.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 javac.compilerargs=-Xlint:unchecked
-javac.source=1.6
-test-unit-sys-prop.java.endorsed.dirs=${websvc/jaxws20.dir}/modules/ext/jaxws21/api
+javac.source=1.8
+requires.nb.javac=true
diff --git a/enterprise/websvc.editor.hints/nbproject/project.xml 
b/enterprise/websvc.editor.hints/nbproject/project.xml
index eebd40b..1aac5c2 100644
--- a/enterprise/websvc.editor.hints/nbproject/project.xml
+++ b/enterprise/websvc.editor.hints/nbproject/project.xml
@@ -225,6 +225,10 @@
                         <compile-dependency/>
                     </test-dependency>
                     <test-dependency>
+                        
<code-name-base>org.netbeans.modules.java.source.base</code-name-base>
+                        <test/>
+                    </test-dependency>
+                    <test-dependency>
                         
<code-name-base>org.netbeans.modules.masterfs</code-name-base>
                     </test-dependency>
                     <test-dependency>
@@ -233,6 +237,9 @@
                         <compile-dependency/>
                     </test-dependency>
                     <test-dependency>
+                        
<code-name-base>org.netbeans.modules.parsing.nb</code-name-base>
+                    </test-dependency>
+                    <test-dependency>
                         
<code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
                     </test-dependency>
                 </test-type>
diff --git 
a/enterprise/websvc.editor.hints/src/org/netbeans/modules/websvc/editor/hints/common/RulesEngine.java
 
b/enterprise/websvc.editor.hints/src/org/netbeans/modules/websvc/editor/hints/common/RulesEngine.java
index 94cd4fa..bc67a88 100644
--- 
a/enterprise/websvc.editor.hints/src/org/netbeans/modules/websvc/editor/hints/common/RulesEngine.java
+++ 
b/enterprise/websvc.editor.hints/src/org/netbeans/modules/websvc/editor/hints/common/RulesEngine.java
@@ -22,11 +22,13 @@ package org.netbeans.modules.websvc.editor.hints.common;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.VariableElement;
-import javax.lang.model.util.ElementKindVisitor6;
+import javax.lang.model.util.ElementKindVisitor8;
 import org.netbeans.spi.editor.hints.ErrorDescription;
 
 /**
@@ -34,7 +36,7 @@ import org.netbeans.spi.editor.hints.ErrorDescription;
  * @author [email protected]
  * @author [email protected]
  */
-public abstract class RulesEngine extends ElementKindVisitor6<Void, 
ProblemContext> {
+public abstract class RulesEngine extends ElementKindVisitor8<Void, 
ProblemContext> {
     //private ProblemContext ctx;
     private List<ErrorDescription> problemsFound = new 
ArrayList<ErrorDescription>();
     
@@ -115,6 +117,11 @@ public abstract class RulesEngine extends 
ElementKindVisitor6<Void, ProblemConte
         return null;
     }
     
+    @Override public Void visitUnknown(Element e, ProblemContext p) {
+        Logger.getLogger(getClass().getName()).log(Level.INFO, "Unknow element 
type: {0}.", e.getKind());
+        return null;
+    }
+    
     public List<ErrorDescription> getProblemsFound(){
         return problemsFound;
     }
diff --git 
a/enterprise/websvc.editor.hints/test/unit/data/InvalidExcludeAttributeTest.java
 
b/enterprise/websvc.editor.hints/test/unit/data/InvalidExcludeAttributeTest.java
index dea6d70..877ffcc 100644
--- 
a/enterprise/websvc.editor.hints/test/unit/data/InvalidExcludeAttributeTest.java
+++ 
b/enterprise/websvc.editor.hints/test/unit/data/InvalidExcludeAttributeTest.java
@@ -26,7 +26,7 @@ import javax.jws.WebService;
  */
 @WebService
 public class InvalidExcludeAttributeTest {
-    @WebMethod(exclude=true)
+    @WebMethod(operationName = "", exclude=true)
     public void getNamespace(){
     }
 }
diff --git 
a/enterprise/websvc.editor.hints/test/unit/data/InvalidExcludeAttributeTest.java
 b/enterprise/websvc.editor.hints/test/unit/data/UnknownElementTest.java
similarity index 84%
copy from 
enterprise/websvc.editor.hints/test/unit/data/InvalidExcludeAttributeTest.java
copy to enterprise/websvc.editor.hints/test/unit/data/UnknownElementTest.java
index dea6d70..18fff92 100644
--- 
a/enterprise/websvc.editor.hints/test/unit/data/InvalidExcludeAttributeTest.java
+++ b/enterprise/websvc.editor.hints/test/unit/data/UnknownElementTest.java
@@ -16,17 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
-import javax.jws.WebMethod;
 import javax.jws.WebService;
 
-/**
- *
- * @author Ajit
- */
 @WebService
-public class InvalidExcludeAttributeTest {
-    @WebMethod(exclude=true)
-    public void getNamespace(){
+public class UnknownElementTest {
+
+    record Point(int x, int y) {
     }
 }
diff --git 
a/enterprise/websvc.editor.hints/test/unit/src/org/netbeans/modules/websvc/editor/hints/WSHintsTest.java
 
b/enterprise/websvc.editor.hints/test/unit/src/org/netbeans/modules/websvc/editor/hints/WSHintsTest.java
index 16650c8..92cc18e 100644
--- 
a/enterprise/websvc.editor.hints/test/unit/src/org/netbeans/modules/websvc/editor/hints/WSHintsTest.java
+++ 
b/enterprise/websvc.editor.hints/test/unit/src/org/netbeans/modules/websvc/editor/hints/WSHintsTest.java
@@ -118,4 +118,10 @@ public class WSHintsTest extends WSHintsTestBase {
         getRulesEngine().getParameterRules().add(instance);
         
testRule(instance,instance.getClass().getSimpleName().concat("Test.java"));
     }
+
+    public final void testUnknownElement() throws IOException {
+        Rule<TypeElement> instance = new DefaultPackage();
+        getRulesEngine().getClassRules().add(instance);
+        testRule(instance,"UnknownElementTest.java");
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to