matthiasblaesing commented on PR #5641:
URL: https://github.com/apache/netbeans/pull/5641#issuecomment-1465185882
@junichi11 yes, it turns out, that this is indeed a race condition. I
updated the golden file again and now in about 50% of all cases the test
succeeds. The github actions run failed the first time around and succeeded on
the second round.
<details>
<summary>I sprinkled some `System.out.println` into the affected indenters
and then compared the output (Expand this section to see them)</summary>
```diff
diff --git
a/ide/html.editor/src/org/netbeans/modules/html/editor/indent/HtmlIndentTask.java
b/ide/html.editor/src/org/netbeans/modules/html/editor/indent/HtmlIndentTask.java
index 2b2427176d99..0f482dad7fb6 100644
---
a/ide/html.editor/src/org/netbeans/modules/html/editor/indent/HtmlIndentTask.java
+++
b/ide/html.editor/src/org/netbeans/modules/html/editor/indent/HtmlIndentTask.java
@@ -42,6 +42,7 @@ public class HtmlIndentTask implements IndentTask,
Lookup.Provider {
}
public void reindent() throws BadLocationException {
+ System.out.println("HtmlIndentTask#reindent");
// long st = System.currentTimeMillis();
// getFormatter().process(context);
// Logger.getLogger("TIMER").log(Level.FINE, "HTML Reindent",
diff --git
a/ide/web.indent/src/org/netbeans/modules/web/indent/api/support/AbstractIndenter.java
b/ide/web.indent/src/org/netbeans/modules/web/indent/api/support/AbstractIndenter.java
index 9a41f0c28014..ddc4a0feb8ad 100644
---
a/ide/web.indent/src/org/netbeans/modules/web/indent/api/support/AbstractIndenter.java
+++
b/ide/web.indent/src/org/netbeans/modules/web/indent/api/support/AbstractIndenter.java
@@ -187,6 +187,8 @@ public abstract class AbstractIndenter<T1 extends
TokenId> {
private boolean used = false;
public final void reindent() {
+ System.out.println(getClass().getSimpleName() + "#reindent");
+
if (used && DEBUG) {
System.err.println("WARNING: indentation task cannot be reused!
is this ok?");
//IllegalStateException x = new
IllegalStateException("indentation task cannot be reused");
diff --git
a/php/php.editor/src/org/netbeans/modules/php/editor/indent/PHPFormatter.java
b/php/php.editor/src/org/netbeans/modules/php/editor/indent/PHPFormatter.java
index 82c9712875f6..a8d8b13ec10a 100644
---
a/php/php.editor/src/org/netbeans/modules/php/editor/indent/PHPFormatter.java
+++
b/php/php.editor/src/org/netbeans/modules/php/editor/indent/PHPFormatter.java
@@ -52,6 +52,7 @@ public class PHPFormatter implements Formatter {
@Override
public void reindent(final Context context) {
+ System.out.println("PHPFormatter#reindent");
String mimeType = getMimeTypeAtOffset(context.document(),
context.startOffset());
String mimePath = context.mimePath(); // avoid to call twice
if (FileUtils.PHP_MIME_TYPE.equals(mimeType) &&
FileUtils.PHP_MIME_TYPE.equals(mimePath)) {
@@ -62,6 +63,7 @@ public class PHPFormatter implements Formatter {
@Override
public void reformat(Context context, ParserResult info) {
+ System.out.println("PHPFormatter#reformat");
long start = System.currentTimeMillis();
(new TokenFormatter()).reformat(context, info);
diff --git
a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/formatter/JsFormatter.java
b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/formatter/JsFormatter.java
index 4cc67d995447..0464a7932be2 100644
---
a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/formatter/JsFormatter.java
+++
b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/formatter/JsFormatter.java
@@ -101,6 +101,7 @@ public class JsFormatter implements Formatter {
@Override
public void reformat(final Context context, final ParserResult
compilationInfo) {
+ System.out.println("JsFormatter#reformat");
processed.clear();
lastOffsetDiff = 0;
final Document doc = context.document();
@@ -1909,6 +1910,8 @@ public class JsFormatter implements Formatter {
@Override
public void reindent(final Context context) {
+ System.out.println("JsFormatter#reindent");
+
Document document = context.document();
int startOffset = context.startOffset();
int endOffset = context.endOffset();
```
</details>
With that I get:
```
Fail:
[junit] HtmlIndentTask#reindent
[junit] HtmlIndenter#reindent
[junit] CssIndenter#reindent
[junit] JsFormatter#reformat
[junit] PHPFormatter#reformat
Ok:
[junit] HtmlIndentTask#reindent
[junit] HtmlIndenter#reindent
[junit] JsFormatter#reformat
[junit] CssIndenter#reindent
[junit] PHPFormatter#reformat
```
So indeed the order of `CssIndenter` and `JsFormatter` is different. Next
step is to see how the order of identers is determined.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
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