java.lang.IllegalAccessError when trying to use function from package-protected superclass.
-------------------------------------------------------------------------------------------
Key: JANINO-128
URL:
http://jira.codehaus.org/browse/JANINO-128 Project: Janino
Issue Type: Bug
Affects Versions: 2.5.15
Environment: JDK 1.6 update 10, Windows XP SP3.
Reporter: Mr Glee
Assignee: Arno Unkrig
Using janino 2.5.15 (not currently unreleased as the 'affects versions' box suggests), trying to access a public member function of a superclass that is package-protected results in an IllegalAccessException.
For example, trying to use java.lang.StringBuilder's length() method (which is defined in package-protected java.lang.AbstractStringBuilder):
<code>
public static final void main(String[] args)
{
try
{
ScriptEvaluator se = new ScriptEvaluator(
"StringBuilder sb = new StringBuilder(); return sb.length();",
Integer.class,
new String[0],
new Class[0]);
Object res = se.evaluate(new Object[0]);
System.out.println(res.toString());
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
</code>
Using this code results in the following:
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at Main.main(Main.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.janino.ScriptEvaluator.evaluate(ScriptEvaluator.java)
at org.codehaus.janino.ScriptEvaluator.evaluate(ScriptEvaluator.java)
at Main.main(Main.java:18)
... 5 more
Caused by: java.lang.IllegalAccessError: tried to access class java.lang.AbstractStringBuilder from class SC
at SC.eval0(SC.java:1)
... 12 more
This isssue seems to be the same (or a very similar) issue raised in JANINO-42 (
http://jira.codehaus.org/browse/JANINO-42), which is marked as fixed 2.3.18.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email