Logpoints can't be evaluated
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Estagnada
- Stack de tecnologia
- java, typescript, vscode
- Domínio
- devtools
Direção de pesquisa
Comece rastreando JdtEvaluationProvider.evaluateForBreakpoint e o caminho de SetBreakpointsRequestHandler mostrado no stack trace. Reproduza o logpoint em sun.awt.X11.XDragSourcePeer e investigue por que a avaliação informa que sun.awt.X11.XMotionEvent não pode ser resolvido. Está concluído quando o mesmo logpoint produzir sua mensagem sem o erro de compilação.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
When adding logpoints to sun.awt.X11.XDragSourcePeer, I often get errors.
Environment
- Operating System: Ubuntu 22.04.4 LTS
- JDK version: OpenJDK Runtime Environment Temurin-17.0.11+9 (build 17.0.11+9)
- Visual Studio Code version: 1.91.1
- Java extension version: v1.32.0
- Java Debugger extension version: v0.58.0
Steps To Reproduce
- Use attached source file
- Extract jdk src.zip and add to classpath (I forget how I did this)
- Open "Java Projects" > java.desktop > sun.awt.X11 > XDragSourceContextPeer, add "Hello world" logpoint to line 483 (which is
doUpdateTargetWindow(subwindow, time);. - Get error
[Logpoint] Log message 'Hello world' error: Cannot evaluate because of compilation error(s): Evaluations must contain either an expression or block of well-formed statements - Observe
> [Warn - 3:19:18 PM] Jul 23, 2024, 3:19:18 PM Compile error during code evaluation: sun.awt.X11.XMotionEvent cannot be resolved to a typein the Language Support for Java log.
Sample program:
import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.*;
import java.awt.dnd.*;
import java.awt.event.*;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
public class DragAndDropExample extends JFrame {
public DragAndDropExample() {
setTitle("Drag and Drop Example");
setSize(400, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
JTextArea sourceTextArea = new JTextArea("Drag this text");
sourceTextArea.setDragEnabled(true);
sourceTextArea.setLineWrap(true);
sourceTextArea.setWrapStyleWord(true);
JScrollPane sourceScrollPane = new JScrollPane(sourceTextArea);
JTextArea targetTextArea = new JTextArea("Drop here");
targetTextArea.setLineWrap(true);
targetTextArea.setWrapStyleWord(true);
JScrollPane targetScrollPane = new JScrollPane(targetTextArea);
new DropTarget(targetTextArea, new DropTargetListener() {
@Override
public void dragEnter(DropTargetDragEvent dtde) {
if (dtde.isDataFlavorSupported(DataFlavor.stringFlavor)) {
dtde.acceptDrag(DnDConstants.ACTION_COPY);
System.out.println("Drag Enter: Data flavor supported");
} else {
dtde.rejectDrag();
System.out.println("Drag Enter: Data flavor not supported");
}
}
@Override
public void dragOver(DropTargetDragEvent dtde) {
// No action needed here
}
@Override
public void dropActionChanged(DropTargetDragEvent dtde) {
// No action needed here
}
@Override
public void dragExit(DropTargetEvent dte) {
System.out.println("Drag Exit");
}
@Override
public void drop(DropTargetDropEvent dtde) {
try {
if (dtde.isDataFlavorSupported(DataFlavor.stringFlavor)) {
dtde.acceptDrop(DnDConstants.ACTION_COPY);
String droppedText = (String) dtde.getTransferable().getTransferData(DataFlavor.stringFlavor);
targetTextArea.append(droppedText);
dtde.dropComplete(true);
System.out.println("Drop: Success");
} else {
dtde.rejectDrop();
System.out.println("Drop: Data flavor not supported");
}
} catch (Exception ex) {
ex.printStackTrace();
dtde.dropComplete(false);
System.out.println("Drop: Exception occurred");
}
}
});
setLayout(new GridLayout(2, 1));
add(sourceScrollPane);
add(targetScrollPane);
}
public static void main(String[] args) {
Logger platformLogger = Logger.getLogger("sun.awt.X11.xembed.xdnd.XDnDDropSourceProtocol");
platformLogger.setLevel(Level.ALL);
ConsoleHandler consoleHandler = new ConsoleHandler();
consoleHandler.setLevel(Level.ALL);
platformLogger.addHandler(consoleHandler);
SwingUtilities.invokeLater(() -> {
new DragAndDropExample().setVisible(true);
});
}
}
Language support for Java logs:
Jul 23, 2024 3:18:58 PM org.apache.aries.spifly.BaseActivator log
INFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic
Jul 23, 2024 3:18:58 PM org.apache.aries.spifly.BaseActivator log
INFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic
Jul 23, 2024 3:19:01 PM com.microsoft.java.debug.plugin.internal.JavaDebuggerServerPlugin start
INFO: Starting com.microsoft.java.debug.plugin
Jul 23, 2024 3:19:13 PM com.microsoft.java.debug.core.UsageDataSession recordInfo
INFO: launch debug info
Jul 23, 2024 3:19:14 PM com.microsoft.java.debug.core.UsageDataSession recordResponse
WARNING: abnormal response
[Warn - 3:19:18 PM] Jul 23, 2024, 3:19:18 PM Compile error during code evaluation: sun.awt.X11.XMotionEvent cannot be resolved to a type
[Error - 3:19:18 PM] Jul 23, 2024, 3:19:18 PM [Logpoint]: Cannot evaluate because of compilation error(s): Evaluations must contain either an expression or a block of well-formed statements.
Cannot evaluate because of compilation error(s): Evaluations must contain either an expression or a block of well-formed statements.
com.microsoft.java.debug.core.DebugException: Cannot evaluate because of compilation error(s): Evaluations must contain either an expression or a block of well-formed statements.
at com.microsoft.java.debug.core.adapter.AdapterUtils.createUserErrorDebugException(AdapterUtils.java:274)
at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.evaluate(JdtEvaluationProvider.java:176)
at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.evaluateForBreakpoint(JdtEvaluationProvider.java:108)
at com.microsoft.java.debug.core.adapter.handler.SetBreakpointsRequestHandler.lambda$registerBreakpointHandler$7(SetBreakpointsRequestHandler.java:206)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Jul 23, 2024 3:19:18 PM com.microsoft.java.debug.core.adapter.handler.SetBreakpointsRequestHandler handleEvaluationResult
SEVERE: [Logpoint]: Cannot evaluate because of compilation error(s): Evaluations must contain either an expression or a block of well-formed statements.
com.microsoft.java.debug.core.DebugException: Cannot evaluate because of compilation error(s): Evaluations must contain either an expression or a block of well-formed statements.
at com.microsoft.java.debug.core.adapter.AdapterUtils.createUserErrorDebugException(AdapterUtils.java:274)
at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.evaluate(JdtEvaluationProvider.java:176)
at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.evaluateForBreakpoint(JdtEvaluationProvider.java:108)
at com.microsoft.java.debug.core.adapter.handler.SetBreakpointsRequestHandler.lambda$registerBreakpointHandler$7(SetBreakpointsRequestHandler.java:206)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Current Result
Error message is shown instead of log messages.
Expected Result
Log messages are logged.
Additional Informations
This seems to be the relevant error:
[Warn - 3:19:18 PM] Jul 23, 2024, 3:19:18 PM Compile error during code evaluation: sun.awt.X11.XMotionEvent cannot be resolved to a type
- Linguagem predominante
- TypeScript
- Estrelas
- 591
- Forks
- 429
- Merge médio
- 1d 3h
- PRs com merge (30d)
- 19
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de microsoft/vscode-java-debug
-
ai-triaged bug
microsoft/vscode-java-debug#1703 · 1 comentário · 1 reação · 1 responsável ·
-
ai-triaged enhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
microsoft/vscode-java-debug#1689 · 2 comentários ·
-
ai-triaged bug
microsoft/vscode-java-debug#1666 · 1 comentário · 1 responsável ·
-
ai-triaged bug
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 48/100
microsoft/vscode-java-debug#1658 · 1 comentário ·
-
ai-triaged enhancement
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
microsoft/vscode-java-debug#1628 · 3 comentários ·
Todas as issues de microsoft/vscode-java-debug
Issues semelhantes
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
-
Mend: dependency security vulnerability untriaged
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100