You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "matthiasblaesing (via GitHub)" <gi...@apache.org> on 2023/04/06 19:22:53 UTC

[GitHub] [netbeans] matthiasblaesing opened a new pull request, #5786: JS: Improve stability of JS model building (prevent cycles)

matthiasblaesing opened a new pull request, #5786:
URL: https://github.com/apache/netbeans/pull/5786

   As analyzed by @akronenw certain JS files can lead the JS model generator of NetBeans
   to create a cyclic structure. The structure looks like this:
   
   ```javascript
   var Base = new function() {
        // a lot of code
   
       function Base() {
           // some code
       }
   
       // more code
   }
   ```
   
   This is turn is at least partially responsible for seemingly endless scanning.
   
   The implemented fix added an assert that detects cycles in the generated model and fixes the
   one detected when the `paper-full.js` file is parsed.
   
   In addition a wrong assertion in the GraalJS fork is disabled, that triggered on angular projects
   and prevented usage of NetBeans with activated assertions there.
   
   This is not a full fix, but should improve the situation and make it easier to find other
   problems in that area by just using NetBeans with assertions enabled (for example by running
   a nightly build).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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


[GitHub] [netbeans] junichi11 commented on pull request #5786: JS: Improve stability of JS model building (prevent cycles)

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #5786:
URL: https://github.com/apache/netbeans/pull/5786#issuecomment-1501879680

   Perfect!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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


[GitHub] [netbeans] matthiasblaesing commented on pull request #5786: JS: Improve stability of JS model building (prevent cycles)

Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #5786:
URL: https://github.com/apache/netbeans/pull/5786#issuecomment-1501929026

   @junichi11 thank you for review,  @akronenw thank you for testing. I'll merge with all test runs being green.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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


[GitHub] [netbeans] matthiasblaesing merged pull request #5786: JS: Improve stability of JS model building (prevent cycles)

Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing merged PR #5786:
URL: https://github.com/apache/netbeans/pull/5786


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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


[GitHub] [netbeans] matthiasblaesing commented on pull request #5786: JS: Improve stability of JS model building (prevent cycles)

Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #5786:
URL: https://github.com/apache/netbeans/pull/5786#issuecomment-1499513560

   This is build on top of #5765, which has to be merged first.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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


[GitHub] [netbeans] junichi11 commented on a diff in pull request #5786: JS: Improve stability of JS model building (prevent cycles)

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on code in PR #5786:
URL: https://github.com/apache/netbeans/pull/5786#discussion_r1161351167


##########
webcommon/javascript2.model/src/org/netbeans/modules/javascript2/model/JsObjectImpl.java:
##########
@@ -192,7 +191,17 @@ public JsObject getParent() {
         return parent;
     }
 
+    @SuppressWarnings({"NestedAssignment", "AssertWithSideEffects"})
     public void setParent(JsObject newParent) {
+        boolean assertionsEnabled = false;
+        assert assertionsEnabled = true;
+        if (assertionsEnabled) {
+            for(JsObject checkParent = newParent; checkParent != null; checkParent = checkParent.getParent()) {
+                if(checkParent == this) {
+                    throw new AssertionError("Cycle detected in " + getFileObject().getPath());
+                }
+            }

Review Comment:
   Nitpick: formatting



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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


[GitHub] [netbeans] matthiasblaesing commented on pull request #5786: JS: Improve stability of JS model building (prevent cycles)

Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #5786:
URL: https://github.com/apache/netbeans/pull/5786#issuecomment-1501810813

   @junichi11 thank you for the review. You are right in both points and I updated this PR in place. The formatting as updated using NetBeans formatter and I added a test, that tests the detected structure. This adds a second perspective to the one already checked via `ModelTest#testObjectNameMatchingNestedFunction`, which might be helpful later, when updates are necessary.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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