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

The type X from the descriptor computed for the target context is not visible here #530

Open
DougTea opened this issue Dec 21, 2020 · 5 comments
Assignees
Labels
bug

Comments

@DougTea
Copy link

@DougTea DougTea commented Dec 21, 2020

Environment:

  • VS Code Version: 1.52.1
  • Extension Version: v0.12.1
  • JDK Type & Version: openjdk-11
  • OS Type & Version: linux

Step to Reproduce:
open a maven java project with vscode.The project comtains some lambda expression.
Expected Behavior:
build project without compile error
Actual Behavior:
Project is failed to build with all lambda expression come with an error:
The type [MyType] from the descriptor computed for the target context is not visible here.
Related Issues:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=478533

@akaroml
Copy link
Member

@akaroml akaroml commented Dec 23, 2020

Thanks for reaching out @MrTinyK

Could you please provide a sample project to help us reproduce this issue?

@DougTea
Copy link
Author

@DougTea DougTea commented Dec 29, 2020

https://github.com/DougTea/test
link above is a sample project that can reproduce this issue.Line 16 in App.java come with a problem:The type HttpSecurity from the descriptor computed for the target context is not visible here.
@akaroml

@no-response no-response bot removed the needs more info label Dec 29, 2020
@testforstephen
Copy link
Contributor

@testforstephen testforstephen commented Jan 4, 2021

@DougTea i tried the sample project in macOS, there are no compilation errors.

image

Could you share the server logs?

F1 -> Java: Open Java Language Server Log File

@DougTea
Copy link
Author

@DougTea DougTea commented Jan 4, 2021

When I reopen this project,the problem I have seen before is gone.
After several trial,I found that if I change the lambda expression,the problem will go back.Specifically,rename "authorization".
image

And the lsp log file got this error:

`!ENTRY org.eclipse.jdt.ls.core 1 0 2021-01-04 14:12:10.495
!MESSAGE >> workspace/executeCommand java.resolvePath

!ENTRY org.eclipse.jdt.ls.core 4 2 2021-01-04 14:12:10.500
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ls.core".
!STACK 0
java.lang.NullPointerException
at com.microsoft.jdtls.ext.core.model.PackageNode.createNodeForProject(PackageNode.java:154)
at com.microsoft.jdtls.ext.core.PackageCommand.resolvePath(PackageCommand.java:205)
at com.microsoft.jdtls.ext.core.CommandHandler.executeCommand(CommandHandler.java:33)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:215)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:205)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$3(JDTLanguageServer.java:497)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

!ENTRY org.eclipse.jdt.ls.core 4 0 2021-01-04 14:12:10.504
!MESSAGE Error in calling delegate command handler
!STACK 0
java.lang.NullPointerException
at com.microsoft.jdtls.ext.core.model.PackageNode.createNodeForProject(PackageNode.java:154)
at com.microsoft.jdtls.ext.core.PackageCommand.resolvePath(PackageCommand.java:205)
at com.microsoft.jdtls.ext.core.CommandHandler.executeCommand(CommandHandler.java:33)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:215)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:205)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$3(JDTLanguageServer.java:497)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)`

@testforstephen

@no-response no-response bot removed the needs more info label Jan 4, 2021
@testforstephen testforstephen changed the title Bug The type X from the descriptor computed for the target context is not visible here Jan 4, 2021
@testforstephen
Copy link
Contributor

@testforstephen testforstephen commented Jan 4, 2021

I can reproduce it too. This seems related with the generic type because your original configure parameter used a generic type . Declare the parameter type explicitly in the lambda can fix the error.

    public static AuthorizeConfigurer predicate(){
        //lamda expression got problem:The type HttpSecurity from the descriptor computed for the target context is not visible here.  
        return (ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry authorization) -> authorization.anyRequest().permitAll();
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants