Bug 577399 - Mixed 11/1.8 compiler options generate IllegalAccessError in generated SWITCH_TABLE for switch(enum)
Summary: Mixed 11/1.8 compiler options generate IllegalAccessError in generated SWITCH...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.20   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2021-11-22 15:10 EST by Patrick Plenefisch CLA
Modified: 2024-02-02 00:23 EST (History)
1 user (show)

See Also:


Attachments
Maven project that reproduces the bug (1.11 KB, application/zip)
2021-11-22 15:10 EST, Patrick Plenefisch CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Plenefisch CLA 2021-11-22 15:10:42 EST
Created attachment 287555 [details]
Maven project that reproduces the bug

Probably related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=533475 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=526911

The attached maven project configures a mixed 11/8 build. In these settings, not settable from outside maven with a normal eclipse project (build config dialog has errors), the generated code outputs:

Exception in thread "main" java.lang.IllegalAccessError: Update to static final field BugRepro$MyInterface.$SWITCH_TABLE$BugRepro$MyEnum attempted from a different method ($SWITCH_TABLE$BugRepro$MyEnum) than the initializer method <clinit> 
	at BugRepro$MyInterface.$SWITCH_TABLE$BugRepro$MyEnum(BugRepro.java:9)
	at BugRepro$MyInterface.theMethod(BugRepro.java:14)
	at BugRepro.main(BugRepro.java:6)



This is part of the codegen for a switch over an enum, when inside a default method in an interface with mixed 11/8 settings.
Comment 1 Sravan Kumar Lakkimsetti CLA 2022-02-11 08:19:33 EST
I tried the following 
1. Ran the attached project with Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537), Java version: 11.0.7. I could not get this problem reproduced
2. Created similar project in eclipse with source level 1.8 and target to 11. Still I could not get this problem reproduced.

Since the maven project attached uses default maven-compiler-plugin not eclipse compiler I am wondering whether this is related to eclipse.
Comment 2 Eclipse Genie CLA 2024-02-02 00:23:30 EST
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.