Scott Murphy Heiberg created GROOVY-12719:
---------------------------------------------
Summary: A dynamic new of a constructor the JVM refuses fails with
GroovyBugError under invokedynamic
Key: GROOVY-12719
URL: https://issues.apache.org/jira/browse/GROOVY-12719
Project: Groovy
Issue Type: Bug
Affects Versions: 5.0.8, 6.0.0
Reporter: Scott Murphy Heiberg
{code:groovy}
class C extends ObjectInputStream {
static ObjectInputStream make() {
new ObjectInputStream()
}
}
C.make()
{code}
*Actual:* {{org.codehaus.groovy.GroovyBugError: BUG! UNCAUGHT EXCEPTION: member
is protected: java.io.ObjectInputStream.<init>}}
*Expected:* {{GroovyRuntimeException: could not access constructor: protected
java.io.ObjectInputStream()}}, as without invokedynamic.
Cause: the constructor selector in {{Selector}} unreflects the selected
constructor with the lookup of the calling class and turns an
{{IllegalAccessException}} into {{GroovyBugError}}. The property selectors
treat that as an access-control outcome since GROOVY-12314.
Verified on 5.0.8, 6.0.0 and master, on JDK 21.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)