Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

can't refer to java.lang static methods in expression

Open
#1,425 3 comments 0 reactions 1 assignee View on GitHub

@testforstephen is already working on this.

Since Jan 9, 2024.

Assessment

This issue has not been assessed yet.

Description

ai-triaged bug

Add breakpoint in a constructor (such as NoSuchMethodError) with this log expression:

new StringBuilder().append(s).append("->").append(java.util.Arrays.stream(Thread.currentThread().getStackTrace()).map(StackTraceElement::toString).collect(java.util.stream.Collectors.joining("\n"))).toString()

This works in intellij but in vscode I get:

[Logpoint] Log message '{new StringBuilder().append(s).append("->").append(java.util.Arrays.stream(Thread.currentThread().getStackTrace()).map(StackTraceElement::toString).collect(java.util.stream.Collectors.joining("\n"))).toString()}' error: Cannot evaluate because of compilation error(s): [The package java.lang collides with a type, The package java.lang conflicts with a package accessible from another module: java.base].

When works it should print the message + stacktrace.

I expect the error has something to do with the static java.lang.Thread implicit reference for Thread.currentThread() call. I also added explicit java.lang.Thread but same error.

Environment
  • Operating System: osx
  • JDK version: temurin java 21
  • Visual Studio Code version: 1.84.2
  • Java extension version: "v1.25.1"
  • Java Debugger extension version: "v0.55.0"
Dominant language
TypeScript
Stars
591
Forks
429
Avg merge
1d 9h
Merged PRs (30d)
19

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode-java-debug

All issues in microsoft/vscode-java-debug

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.