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

[Sealed types] Completion fails within the body of a permitted class #2540

Closed
rgrunber opened this issue Jun 7, 2024 · 5 comments · Fixed by #2568
Closed

[Sealed types] Completion fails within the body of a permitted class #2540

rgrunber opened this issue Jun 7, 2024 · 5 comments · Fixed by #2568
Assignees
Labels
regression Something was broken by a previous change
Milestone

Comments

@rgrunber
Copy link
Contributor

rgrunber commented Jun 7, 2024

Version: 2024-06 (4.32)
Build id: I20240505-1800

Simply trigger completion within the body of SqlStorage.

Storage.java

package org.example;

public sealed class Storage permits SqlStorage {
}

SqlStorage.java

package org.example;

public final class SqlStorage extends Storage {

}

!ENTRY org.eclipse.jdt.ui 4 0 2024-06-07 11:58:01.714
!MESSAGE RuntimeException computing completion proposal for SqlStorage.java at offset 70 line 4 :
package org.example;

public final class SqlStorage extends Storage {
|
!STACK 0
java.lang.NullPointerException: Cannot read the array length because "superPermittedTypes" is null
	at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.checkPermitsAndAdd(SourceTypeBinding.java:1345)
	at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.checkPermitsInType(SourceTypeBinding.java:1201)
	at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:1116)
	at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:608)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:2329)
	at org.eclipse.jdt.internal.core.Openable.codeComplete(Openable.java:135)
	at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:360)
	at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:350)
	at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.internalComputeCompletionProposals(JavaCompletionProposalComputer.java:256)
	at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.computeCompletionProposals(JavaCompletionProposalComputer.java:218)
	at org.eclipse.jdt.internal.ui.text.java.JavaTypeCompletionProposalComputer.computeCompletionProposals(JavaTypeCompletionProposalComputer.java:65)
	at org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:354)
	at org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:340)
	at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:332)
	at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:288)
	at org.eclipse.jface.text.contentassist.AsyncCompletionProposalPopup.lambda$10(AsyncCompletionProposalPopup.java:378)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.jface.text.contentassist.AsyncCompletionProposalPopup.lambda$9(AsyncCompletionProposalPopup.java:377)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

This worked in 4.31, and the superPermittedTypes list did in fact contain the reference to Storage.

See redhat-developer/vscode-java#3636 for original bug. A similar stacktrace at #1641 (comment) .

@rgrunber rgrunber added the regression Something was broken by a previous change label Jun 7, 2024
@srikanth-sankaran srikanth-sankaran self-assigned this Jun 13, 2024
@srikanth-sankaran srikanth-sankaran added this to the 4.33 M1 milestone Jun 13, 2024
@srikanth-sankaran
Copy link
Contributor

This appears fixed by #2093 - I'll add a regression test and close this

@srikanth-sankaran srikanth-sankaran changed the title Completion fails within the body of a permitted class [Sealed types] Completion fails within the body of a permitted class Jun 14, 2024
srikanth-sankaran added a commit to srikanth-sankaran/eclipse.jdt.core that referenced this issue Jun 14, 2024
@Vale68
Copy link

Vale68 commented Jun 26, 2024

This is a big issue with eclipse 2024-06 (4.32), do you plan to deliver a fix for it ?

@srikanth-sankaran
Copy link
Contributor

This is a big issue with eclipse 2024-06 (4.32), do you plan to deliver a fix for it ?

My understanding (@mpalat or @jarthana may correct me) is that with the frequent releases brought about by the 3 month cadence used by Eclipse lately, we will not have maintenance releases of past versions. So please consider upgrading to 4.33 versions when they available,

@Vale68
Copy link

Vale68 commented Jun 26, 2024

Sure but, at least in my opinion, this issue prevents the usage of sealed classes/interfaces with eclipse so I hope you will give priority to its resolution.
Probably I can try to downgrade to the 4.31 version.

@srikanth-sankaran
Copy link
Contributor

Sure but, at least in my opinion, this issue prevents the usage of sealed classes/interfaces with eclipse so I hope you will give priority to its resolution. Probably I can try to downgrade to the 4.31 version.

Hello! The issue is resolved already and fix is pushed to master HEAD. You can grab a suitable I build or 4.33 M1 when it is declared. Thanks

robstryker pushed a commit to robstryker/eclipse.jdt.core that referenced this issue Jul 18, 2024
gayanper pushed a commit to gayanper/eclipse.jdt.core that referenced this issue Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Something was broken by a previous change
Projects
None yet
3 participants