You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ma...@apache.org on 2022/04/02 07:46:13 UTC

[netbeans] branch master updated: [#3728] Only enable VerifyPartialReparse if assertions are enabled

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

matthiasblaesing 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 d029a01  [#3728] Only enable VerifyPartialReparse if assertions are enabled
     new b855a82  Merge pull request #3850 from matthiasblaesing/vanilla_reparser_assertions
d029a01 is described below

commit d029a01097cf8c3f8c3da838319c4bcc3c813050
Author: Matthias Bläsing <mb...@doppel-helix.eu>
AuthorDate: Thu Mar 24 16:57:29 2022 +0100

    [#3728] Only enable VerifyPartialReparse if assertions are enabled
    
    It was observed, that NetBeans can create an excessive number of source
    dump files in situations, where the partial reparse verifier bails out.
    
    The VanillaPartialReparser already suppresses dumping of source files
    in case of exceptions if assertions are not enabled. The same logic is
    now applied to the activation of VerifyPartialReparse.
    VerifyPartialReparse has no side effects and thus can be disabled if
    dumping should be turned off.
---
 .../java/source/parsing/VanillaPartialReparser.java      | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/java/java.source.base/src/org/netbeans/modules/java/source/parsing/VanillaPartialReparser.java b/java/java.source.base/src/org/netbeans/modules/java/source/parsing/VanillaPartialReparser.java
index e4f7c0f..3c3f1e6 100644
--- a/java/java.source.base/src/org/netbeans/modules/java/source/parsing/VanillaPartialReparser.java
+++ b/java/java.source.base/src/org/netbeans/modules/java/source/parsing/VanillaPartialReparser.java
@@ -163,6 +163,7 @@ public class VanillaPartialReparser implements PartialReparser {
     }
 
     @Override
+    @SuppressWarnings({"AssertWithSideEffects", "NestedAssignment"})
     public boolean reparseMethod (final CompilationInfoImpl ci,
             final Snapshot snapshot,
             final MethodTree orig,
@@ -328,9 +329,9 @@ public class VanillaPartialReparser implements PartialReparser {
             if (t instanceof ThreadDeath) {
                 throw (ThreadDeath) t;
             }
-            boolean a = false;
-            assert a = true;
-            if (a) {
+            boolean enableDumpSource = false;
+            assert enableDumpSource = true; // Only dump sources with assertions enabled
+            if (enableDumpSource) {
                 JavacParser.dumpSource(ci, t);
             }
             t.printStackTrace();
@@ -607,8 +608,15 @@ public class VanillaPartialReparser implements PartialReparser {
         public static final class FactoryImpl extends TaskFactory {
 
             @Override
+            @SuppressWarnings({"AssertWithSideEffects", "NestedAssignment"})
             public Collection<? extends SchedulerTask> create(Snapshot snapshot) {
-                return Collections.singletonList(new VerifyPartialReparse());
+                boolean enableVerifier = false;
+                assert enableVerifier = true;  // Only enable verifier if assertions are enabled
+                if (enableVerifier) {
+                    return Collections.singletonList(new VerifyPartialReparse());
+                } else {
+                    return Collections.emptyList();
+                }
             }
 
         }

---------------------------------------------------------------------
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