Skip to content

Conversation

@jlahoda
Copy link
Owner

@jlahoda jlahoda commented Jun 2, 2019

No description provided.

final Document doc = getDocument(testSourceFO);
final List<HighlightImpl> highlights = new ArrayList<HighlightImpl>();

JavaSource source = JavaSource.forFileObject(testSourceFO);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: This anonymous inner class creation can be turned into a lambda expression.

.map(h -> h.getHighlightTestData())
.collect(Collectors.toList()));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Can use functional operations


FileObject srcRoot = FileUtil.toFileObject(testSource.getParentFile());
SourceUtilsTestUtil.prepareTest(srcRoot,FileUtil.toFileObject(testBuildTo), cache);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Redundant type arguments in new expression (use diamond operator instead).

try {
parameter.toPhase(Phase.UP_TO_DATE);

ErrorDescriptionSetterImpl setter = new ErrorDescriptionSetterImpl();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Print Stack Trace

final Document doc = getDocument(testSourceFO);
final List<HighlightImpl> highlights = new ArrayList<HighlightImpl>();

JavaSource source = JavaSource.forFileObject(testSourceFO);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Dereferencing possible null pointer

}
});
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: This anonymous inner class creation can be turned into a lambda expression.

" line\\n3\"\"\";\n" +
"}\n";
JavaSource testSource = JavaSource.forFileObject(FileUtil.toFileObject(testFile));
Task<WorkingCopy> task = new Task<WorkingCopy>() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: This anonymous inner class creation can be turned into a lambda expression.

" \"\"\";\n" +
"}\n";
JavaSource testSource = JavaSource.forFileObject(FileUtil.toFileObject(testFile));
Task<WorkingCopy> task = new Task<WorkingCopy>() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: This anonymous inner class creation can be turned into a lambda expression.

public void setHighlights(final Document doc, final Collection<int[]> highlights) {
public void setHighlights(final Document doc, final Collection<Pair<int[], Coloring>> highlights) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Can use functional operations

import org.netbeans.api.lexer.TokenHierarchy;
import org.netbeans.api.lexer.TokenSequence;
import org.netbeans.editor.BaseDocument;
import org.netbeans.modules.editor.NbEditorUtilities;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Unused Import

import org.netbeans.api.lexer.TokenSequence;
import org.netbeans.editor.BaseDocument;
import org.netbeans.modules.editor.NbEditorUtilities;
import org.netbeans.modules.editor.indent.api.Indent;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Unused Import

if (id == JavaTokenId.STRING_LITERAL || id == JavaTokenId.CHAR_LITERAL) {
if (id == JavaTokenId.STRING_LITERAL || id == JavaTokenId.CHAR_LITERAL || id == JavaTokenId.MULTILINE_STRING_LITERAL) {
context.setText("", 0); // NOI18N
return context.getOffset() + 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Thread Dump Stack

if (context.getText().equals("\"") && context.getOffset() >= 2 && context.getDocument().getText(context.getOffset() - 2, 2).equals("\"\"")) {
context.setText("\"\n\"\"\"", 2); // NOI18N
Thread.dumpStack();
} else {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Field STRING_AND_COMMENT_TOKENS can be final

import org.netbeans.modules.parsing.spi.Parser.Result;
import org.netbeans.modules.parsing.spi.Scheduler;
import org.netbeans.modules.parsing.spi.SchedulerEvent;
import org.netbeans.modules.parsing.spi.TaskIndexingMode;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Unused Import


public Token currentToken() {
Token[] res = new Token[1];
doc.render(new Runnable() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: This anonymous inner class creation can be turned into a lambda expression.

import org.netbeans.api.java.source.CompilationInfo;
import org.netbeans.spi.editor.hints.ErrorDescription;
import org.netbeans.spi.editor.hints.Fix;
import org.netbeans.spi.java.hints.ConstraintVariableType;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Unused Import

import org.netbeans.spi.java.hints.Hint;
import org.netbeans.spi.java.hints.HintContext;
import org.netbeans.spi.java.hints.JavaFix;
import org.netbeans.spi.java.hints.TriggerPattern;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Unused Import

import com.sun.source.tree.Tree;
import com.sun.source.tree.Tree.Kind;
import com.sun.source.util.TreePath;
import java.util.List;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Unused Import

import com.sun.source.tree.Tree;
import com.sun.source.tree.Tree.Kind;
import com.sun.source.util.TreePath;
import java.util.List;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Unused Import

import org.netbeans.api.java.source.CompilationInfo;
import org.netbeans.spi.editor.hints.ErrorDescription;
import org.netbeans.spi.editor.hints.Fix;
import org.netbeans.spi.java.hints.ConstraintVariableType;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Unused Import

import org.netbeans.spi.java.hints.Hint;
import org.netbeans.spi.java.hints.HintContext;
import org.netbeans.spi.java.hints.JavaFix;
import org.netbeans.spi.java.hints.TriggerPattern;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Unused Import


public Token currentToken() {
Token[] res = new Token[1];
doc.render(new Runnable() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: This anonymous inner class creation can be turned into a lambda expression.

import org.netbeans.modules.parsing.spi.Parser.Result;
import org.netbeans.modules.parsing.spi.Scheduler;
import org.netbeans.modules.parsing.spi.SchedulerEvent;
import org.netbeans.modules.parsing.spi.TaskIndexingMode;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Unused Import

import org.netbeans.api.lexer.TokenHierarchy;
import org.netbeans.api.lexer.TokenSequence;
import org.netbeans.editor.BaseDocument;
import org.netbeans.modules.editor.NbEditorUtilities;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Unused Import

import org.netbeans.api.lexer.TokenSequence;
import org.netbeans.editor.BaseDocument;
import org.netbeans.modules.editor.NbEditorUtilities;
import org.netbeans.modules.editor.indent.api.Indent;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Unused Import

if (id == JavaTokenId.STRING_LITERAL || id == JavaTokenId.CHAR_LITERAL) {
if (id == JavaTokenId.STRING_LITERAL || id == JavaTokenId.CHAR_LITERAL || id == JavaTokenId.MULTILINE_STRING_LITERAL) {
context.setText("", 0); // NOI18N
return context.getOffset() + 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Thread Dump Stack

if (context.getText().equals("\"") && context.getOffset() >= 2 && context.getDocument().getText(context.getOffset() - 2, 2).equals("\"\"")) {
context.setText("\"\n\"\"\"", 2); // NOI18N
Thread.dumpStack();
} else {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Field STRING_AND_COMMENT_TOKENS can be final

public void setHighlights(final Document doc, final Collection<int[]> highlights) {
public void setHighlights(final Document doc, final Collection<Pair<int[], Coloring>> highlights) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Can use functional operations

.map(h -> h.getHighlightTestData())
.collect(Collectors.toList()));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Can use functional operations

try {
parameter.toPhase(Phase.UP_TO_DATE);

ErrorDescriptionSetterImpl setter = new ErrorDescriptionSetterImpl();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jackpot:
warning: Print Stack Trace

jlahoda pushed a commit that referenced this pull request Aug 7, 2022
The relevant stacktraces for the affected threads are saved below.

As there is also a warning logged with a clear indication:

  WARNING [org.netbeans.modules.parsing.impl.TaskProcessor]: ParserManager.parse called in AWT event thread by:
  org.netbeans.modules.micronaut.hyperlink.MicronautJavaHyperlinkProvider.getPropertyName(MicronautJavaHyperlinkProvider.java:151)

Stacktraces:

"AWT-EventQueue-0" #24 prio=6 os_prio=0 cpu=69156.33ms elapsed=76496.39s tid=0x00007feca4122b90 nid=0x106e2a waiting on condition  [0x00007fec9756e000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@17.0.3/Native Method)
	- parking to wait for  <0x00000006d7905fd0> (a java.util.concurrent.locks.ReentrantLock$FairSync)
	at java.util.concurrent.locks.LockSupport.park(java.base@17.0.3/LockSupport.java:211)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(java.base@17.0.3/AbstractQueuedSynchronizer.java:715)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(java.base@17.0.3/AbstractQueuedSynchronizer.java:938)
	at java.util.concurrent.locks.ReentrantLock$Sync.lock(java.base@17.0.3/ReentrantLock.java:153)
	at java.util.concurrent.locks.ReentrantLock.lock(java.base@17.0.3/ReentrantLock.java:322)
	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:170)
	at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:83)
	at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:454)
	at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:425)
	at org.netbeans.modules.micronaut.hyperlink.MicronautJavaHyperlinkProvider.getPropertyName(MicronautJavaHyperlinkProvider.java:151)
	at org.netbeans.modules.micronaut.hyperlink.MicronautJavaHyperlinkProvider.resolve(MicronautJavaHyperlinkProvider.java:122)
	at org.netbeans.modules.micronaut.hyperlink.MicronautJavaHyperlinkProvider.getHyperlinkSpan(MicronautJavaHyperlinkProvider.java:85)


"Editor Parsing Loop (14-c4f2d87113e1a2d2d4e21e8952e1f99612d5b3fd)" #28 daemon prio=1 os_prio=0 cpu=65769.71ms elapsed=76494.46s tid=0x00007feca4401250 nid=0x106e35 in Object.wait()  [0x00007fec957fe000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@17.0.3/Native Method)
	- waiting on <no object reference available>
	at java.lang.Object.wait(java.base@17.0.3/Object.java:338)
	at org.netbeans.modules.parsing.impl.TaskProcessor$CurrentRequestReference.setCurrentTask(TaskProcessor.java:1128)
	- locked <0x00000006d75591d8> (a org.netbeans.modules.parsing.impl.TaskProcessor$CurrentRequestReference$CRRLock)
	at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:842)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
	at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
	at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)

"Module-Actions" apache#163 daemon prio=1 os_prio=0 cpu=2546.95ms elapsed=253.00s tid=0x00007fec806c9c90 nid=0x1abee2 in Object.wait()  [0x00007fec951fa000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@17.0.3/Native Method)
	- waiting on <no object reference available>
	at java.lang.Object.wait(java.base@17.0.3/Object.java:338)
	at javax.swing.text.AbstractDocument.writeLock(java.desktop@17.0.3/AbstractDocument.java:1378)
	- locked <0x0000000718f28200> (a org.netbeans.modules.editor.NbEditorDocument)
	at org.netbeans.editor.BaseDocument.extWriteLock(BaseDocument.java:1696)
	at org.netbeans.editor.BaseDocument.atomicLockImpl(BaseDocument.java:1744)
	- locked <0x0000000718f28200> (a org.netbeans.modules.editor.NbEditorDocument)
	- locked <0x0000000718f28200> (a org.netbeans.modules.editor.NbEditorDocument)
	at org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:329)
	at org.netbeans.modules.editor.lib.BeforeSaveTasks$TaskRunnable.run(BeforeSaveTasks.java:131)
	at org.netbeans.modules.editor.lib.TrailingWhitespaceRemove.runLocked(TrailingWhitespaceRemove.java:77)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants