Björn Kautler created GROOVY-12310:
--------------------------------------
Summary: Accessing enum constant of package-private enum under
static compile fails at runtime
Key: GROOVY-12310
URL: https://issues.apache.org/jira/browse/GROOVY-12310
Project: Groovy
Issue Type: Bug
Affects Versions: 4.0.31, 5.0.3, 6.0.0-alpha-1
Reporter: Björn Kautler
Given this snippet:
{code:java}
@Grab('jakarta.faces:jakarta.faces-api:4.0.1')
import [email protected]
class Foo {
def foo() {
println(UIInput.PropertyKeys)
println(UIInput.PropertyKeys.localValueSet)
}
}
new Foo().foo() {code}
The {{PropertyKeys}} enum is package-private.
The whole script successfully runs through STC and static-compilation.
At runtime the first {{println}} is successful, while the second one fails with
{code:java}
java.lang.IllegalAccessError: failed to access class
jakarta.faces.component.UIInput$PropertyKeys from class Foo {code}
at runtime.
The STC should probably already recognize this and complain.
What I also wonder is, that the class-access worked at runtime while the
constant access failed, shouldn't the class access fail already?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)