Bug 571596 - Errors running builder 'Java Builder' on project
Summary: Errors running builder 'Java Builder' on project
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.19   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2021-03-01 10:32 EST by Missing name CLA
Modified: 2023-04-07 00:25 EDT (History)
2 users (show)

See Also:


Attachments
Sample project (1.93 KB, application/zip)
2021-03-02 00:50 EST, Missing name CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Missing name CLA 2021-03-01 10:32:20 EST
java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at org.eclipse.jdt.internal.compiler.codegen.CodeStream.lookupswitch(CodeStream.java:6330)
	at org.eclipse.jdt.internal.compiler.ast.SwitchStatement.generateCode(SwitchStatement.java:529)
	at org.eclipse.jdt.internal.compiler.ast.Block.generateCode(Block.java:88)
	at org.eclipse.jdt.internal.compiler.ast.ForStatement.generateCode(ForStatement.java:325)
	at org.eclipse.jdt.internal.compiler.ast.Block.generateCode(Block.java:88)
	at org.eclipse.jdt.internal.compiler.ast.IfStatement.generateCode(IfStatement.java:205)
	at org.eclipse.jdt.internal.compiler.ast.Block.generateCode(Block.java:88)
	at org.eclipse.jdt.internal.compiler.ast.TryStatement.generateCode(TryStatement.java:586)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:354)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:291)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:742)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:812)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:408)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:913)
	at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:145)
	at java.base/java.lang.Thread.run(Thread.java:832)
Comment 1 Missing name CLA 2021-03-01 10:34:01 EST
Hello,
I have installed Eclipse 4.19m3 & rc1 and receive
compile errors ...
It seems JDT is not able to compile switch anymore.

I run Eclipse with OpenJDK 15.0.2

Thanks!

Regards
Alex
Comment 2 Manoj N Palat CLA 2021-03-01 10:50:28 EST
Can you please post a sample code to reproduce this error?
Comment 3 Missing name CLA 2021-03-01 11:33:17 EST
Hi,
it happens in all my Workspace where there is switch statement ...


here a sample ..

public class Test {
	
	public static void main(String[] args) {
		
		String value = "A";
		
		switch (value) {
		case "A":
			System.out.println("Test");
			break;
		}
		
		
	}
	
}
Comment 4 Andrey Loskutov CLA 2021-03-01 11:52:09 EST
Are you sure you *really* use 4.19 Eclipse? That bug was fixed and should be only there if you still using 4.18 JDT.
Comment 5 Missing name CLA 2021-03-01 15:00:30 EST
Yes, here the build information

Eclipse SDK
Version: 2021-03 (4.19)
Build id: I20210224-1800
OS: Linux, v.5.8.0-44-generic, x86_64 / gtk 3.24.20
Java version: 15.0.2

I received these errors 4.19m1 (on Windows) and now with 4.19rc1 on my
Linux PC.
Comment 6 Manoj N Palat CLA 2021-03-01 19:13:38 EST
I am not able to reproduce this error using the given test case.
@Andrey: can you?

@Alex: Can you please create a small test project and attach - to check whether any compiler options has any effect?
Comment 7 Missing name CLA 2021-03-02 00:38:28 EST
Yesterday I changed some compile options in order to trigger 
a rebuild process and it worked.

Now I am also not able to reproduce the errors ...
Comment 8 Missing name CLA 2021-03-02 00:50:10 EST
Created attachment 285698 [details]
Sample project
Comment 9 Missing name CLA 2021-03-02 00:53:34 EST
Errors again after checking out some other projects from my SVN.
When I created a new project, it seems Eclipse thinks I using an old
compile level (eg. 1.4)
I use workspace compile options: 15 with Enabled preview features for Java 15.

I seems to work after a full build.
Comment 10 Manoj N Palat CLA 2021-03-02 06:10:57 EST
(In reply to Missing name from comment #8)
> Created attachment 285698 [details]
> Sample project

Thanks Alex for Sample Project - However, I don't get this error with Eclipse 
Version: 2021-03 (4.19)
Build id: I20210209-1800

and Java 15 as the compiler that gets used with 1.7 

What I have done is to use File->Import -> Existing Projects in Workspace -> <Zip>
and I don't see the error.

Should I be following a different set of steps for reproducing the issue with the Zip file?
Comment 11 Eclipse Genie CLA 2023-04-07 00:25:16 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.