Giter Site home page Giter Site logo

Comments (7)

Kademlia avatar Kademlia commented on July 17, 2024

Confirmed for 2023-06 (Win 10 & Win 11). Now the Task will never stop and consume ~1 CPU-Core forever. Even after the affected file is deleted from workspace. Only fix is to reboot the whole IDE.

from eclipse.jdt.core.

iloveeclipse avatar iloveeclipse commented on July 17, 2024

switch (opt) { // <- Write 'boolean test' here and press CTRL+Space

Here the snippet I've used and it is reproducible at current master in plain SDK

package gg;
import java.lang.StackWalker.Option;
public class PlanetTravelActionLagTest {
	private void test() {
		Option opt = Option.RETAIN_CLASS_REFERENCE;
		boolean test|switch (opt) { // <- remove pipe and press CTRL+Space
			case RETAIN_CLASS_REFERENCE -> {
			}
			case SHOW_HIDDEN_FRAMES -> {
			}
			case SHOW_REFLECT_FRAMES -> throw new UnsupportedOperationException("Unimplemented case: ");
		}
	}
}

Thread below will run in endless loop:

Daemon Thread [ForkJoinPool.commonPool-worker-5] (Suspended)	
	CompletionParser(AssistParser).copyState(Parser) line: 161	
	CompletionParser.copyState(Parser) line: 5612	
	CompletionParser(AssistParser).commit() line: 2348	
	CompletionParser(AssistParser).triggerRecoveryUponLambdaClosure(Statement, boolean) line: 627	
	CompletionParser(AssistParser).consumeBlockStatements() line: 748	
	CompletionParser(Parser).consumeRule(int) line: 7554	
	CompletionParser(Parser).parse() line: 13183	
	CompletionParser.parseSomeStatements(int, int, int, CompilationUnitDeclaration) line: 5895	
	UnresolvedReferenceNameFinder.findAfter(char[], Scope, int, int, int, boolean, char[][], UnresolvedReferenceNameFinder$UnresolvedReferenceNameRequestor) line: 155	
	UnresolvedReferenceNameFinder.find(char[], AbstractMethodDeclaration, int, char[][], UnresolvedReferenceNameFinder$UnresolvedReferenceNameRequestor) line: 101	
	CompletionEngine.findVariableFromUnresolvedReference(LocalDeclaration, BlockScope, char[][]) line: 13005	
	CompletionEngine.completionOnLocalOrArgumentName(ASTNode, Scope) line: 3062	
	CompletionEngine.complete(ASTNode, ASTNode, ASTNode, CompilationUnitDeclaration, Binding, Scope, boolean) line: 2057	
	CompletionEngine.complete(ICompilationUnit, int, int, ITypeRoot) line: 2356	
	CompilationUnit(Openable).codeComplete(ICompilationUnit, ICompilationUnit, int, CompletionRequestor, WorkingCopyOwner, ITypeRoot, IProgressMonitor) line: 136	
	CompilationUnit.codeComplete(int, CompletionRequestor, WorkingCopyOwner, IProgressMonitor) line: 367	
	CompilationUnit.codeComplete(int, CompletionRequestor, IProgressMonitor) line: 357	
	JavaAllCompletionProposalComputer(JavaCompletionProposalComputer).internalComputeCompletionProposals(int, JavaContentAssistInvocationContext) line: 256	
	JavaAllCompletionProposalComputer(JavaCompletionProposalComputer).computeCompletionProposals(ContentAssistInvocationContext, IProgressMonitor) line: 218	
	JavaAllCompletionProposalComputer(JavaTypeCompletionProposalComputer).computeCompletionProposals(ContentAssistInvocationContext, IProgressMonitor) line: 65	
	CompletionProposalComputerDescriptor.computeCompletionProposals(ContentAssistInvocationContext, IProgressMonitor) line: 348	
	CompletionProposalCategory.computeCompletionProposals(ContentAssistInvocationContext, String, SubProgressMonitor) line: 340	
	JavaCompletionProcessor(ContentAssistProcessor).collectProposals(ITextViewer, int, IProgressMonitor, ContentAssistInvocationContext) line: 333	
	JavaCompletionProcessor(ContentAssistProcessor).computeCompletionProposals(ITextViewer, int) line: 289	
	AsyncCompletionProposalPopup.lambda$10(IContentAssistProcessor, int, AtomicReference) line: 378	
	0x0000000801727a40.run() line: not available	
	SafeRunner.run(ISafeRunnable) line: 45	
	AsyncCompletionProposalPopup.lambda$9(IContentAssistProcessor, int) line: 377	
	0x00000008017275d0.get() line: not available	
	CompletableFuture$AsyncSupply<T>.run() line: 1768	
	CompletableFuture$AsyncSupply<T>.exec() line: 1760	
	CompletableFuture$AsyncSupply<T>(ForkJoinTask<V>).doExec() line: 373	
	ForkJoinPool$WorkQueue.topLevelExec(ForkJoinTask<?>, WorkQueue) line: 1182	
	ForkJoinPool.scan(ForkJoinPool$WorkQueue, int, int) line: 1655	
	ForkJoinPool.runWorker(ForkJoinPool$WorkQueue) line: 1622	
	ForkJoinWorkerThread.run() line: 165	

@Kademlia : I'm not sure how your snippet should finally look like, and why do you have such strange code (it doesn't compile).

Is it supposed to look like this below may be? Just trying to understand your use case, hanging thread is without doubt not OK.

package gg;
import java.lang.StackWalker.Option;
public class X {
	public void test() {
		Option opt = Option.RETAIN_CLASS_REFERENCE;
		boolean test = switch (opt) {
			case RETAIN_CLASS_REFERENCE -> true;
			case SHOW_HIDDEN_FRAMES -> false;
			default -> throw new IllegalArgumentException("Unexpected value: " + opt);
		};
		System.out.println(test);
	}
}

from eclipse.jdt.core.

Kademlia avatar Kademlia commented on July 17, 2024

@iloveeclipse
You can see my use case in the linked video in the first post. I just tried to create a minified version of the code for the example.

from eclipse.jdt.core.

iloveeclipse avatar iloveeclipse commented on July 17, 2024

OK, I see it now. So you've tried to refactor the code basically to something like in my smaller snippet, and during this you've opened content assist on "unfinished" code.

@srikanth-sankaran: are you familiar with the code in question (see stack in comment above)?
IDE shouldn't hang just because of an incomplete code state.

from eclipse.jdt.core.

srikanth-sankaran avatar srikanth-sankaran commented on July 17, 2024

OK, I see it now. So you've tried to refactor the code basically to something like in my smaller snippet, and during this you've opened content assist on "unfinished" code.

@srikanth-sankaran: are you familiar with the code in question (see stack in comment above)? IDE shouldn't hang just because of an incomplete code state.

I was familiar long ago. I will add this to my queue.

from eclipse.jdt.core.

srikanth-sankaran avatar srikanth-sankaran commented on July 17, 2024

Hmm. A very interesting bug! The CompletionParser sees a lambda expression in the code while the normal parser (correctly) sees none! Looking into it ...

from eclipse.jdt.core.

srikanth-sankaran avatar srikanth-sankaran commented on July 17, 2024

See also #968 and
#708

#708 is basically a case where the -> of a switch expression was confused for a lambda and its fix brings about #968

from eclipse.jdt.core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.