Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.StackOverflowError during hover #46

Open
nocquidant opened this issue Oct 11, 2024 · 3 comments
Open

java.lang.StackOverflowError during hover #46

nocquidant opened this issue Oct 11, 2024 · 3 comments

Comments

@nocquidant
Copy link

nocquidant commented Oct 11, 2024

Hi, just installed the last extension version 0.18.0.
Thank you, but java exceptions appear a lot the console...

Oct 11, 2024 3:34:28 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
SEVERE: Internal error: java.lang.StackOverflowError
java.util.concurrent.CompletionException: java.lang.StackOverflowError
	at java.base/java.util.concurrent.CompletableFuture.wrapInCompletionException(CompletableFuture.java:323)
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:359)
	at java.base/java.util.concurrent.CompletableFuture.uniApplyNow(CompletableFuture.java:731)
	at java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:706)
	at java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2244)
	at org.pkl.lsp.features.HoverFeature.onHover(HoverFeature.kt:46)
	at org.pkl.lsp.PklTextDocumentService.hover(PklTextDocumentService.kt:85)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$recursiveFindRpcMethods$0(GenericEndpoint.java:65)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:128)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:271)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:201)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:185)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:97)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:114)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1575)
Caused by: java.lang.StackOverflowError
	at org.pkl.lsp.type.Type$Module.<init>(Types.kt:396)
	at org.pkl.lsp.type.Type$Module.<init>(Types.kt)
@bioball
Copy link
Contributor

bioball commented Oct 11, 2024

Are you able to share the file you're opening that's causing this error?

@bioball
Copy link
Contributor

bioball commented Oct 11, 2024

I can reproduce the error with this snippet:

import "pkl:reflect"

class Foo {}
local classes = new Listing {
    Foo
}.toList()

function isClassOrSubclass(value: Any, clazz: Class?) =
  if (clazz == null) false
  else if (value.getClass() == clazz) true
  else
    isClassOrSubclass(value, reflect.Class(value).superclass?.reflectee)

function check(a: Any) = classes.any((it) -> isClassOrSubclass(a, it))

Trigger hover on isClassOrSubclass on the last line.

@bioball bioball transferred this issue from apple/pkl-vscode Oct 11, 2024
@bioball bioball changed the title java.lang.StackOverflowError for extension 0.18.0 java.lang.StackOverflowError during hover Oct 11, 2024
@nocquidant
Copy link
Author

nocquidant commented Oct 13, 2024

I think this is the file:

// Template to produce _backend.conf file for terraform
backend {
	profile = "_"
	bucket = "_"
	region = "\"eu-west-3\""
	dynamodb_table = "_"
	workspace_key_prefix = "_"
	key = "\"terraform.tfstate\""
}

// Template to produce _variables.tf.json file for terraform
variables {
	variable {
		application_id {
			description = "The application id (a short name)"
			type        = "string"
			nullable    = false
		}
		application_name {
			description = "The application name"
			type        = "string"
			nullable    = false
		}
		environment {
			description = "The environment name"
			type        = "string"
			nullable    = false
		}
	}
}

output {
  files {
    [".pkl/_backend.conf"] {
      value = backend
      renderer = new PropertiesRenderer {}
    }
    [".pkl/_variables.tf.json"] {
      value = variables
      renderer = new JsonRenderer {}
    }
  }
}

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

No branches or pull requests

2 participants