Issue Details (XML | Word | Printable)

Key: JANINO-110
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Arno Unkrig
Reporter: Matt Fowles
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Janino

Fully Qualified .class access fails to compile

Created: 01/May/08 11:16 PM   Updated: 16/Jun/08 09:29 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Text File classnames.patch (25 kB)


Testcase included: yes


 Description  « Hide
The following unit test will fail to compile. If the return value is changed to simply "SelfRef.class" everything works fine.

public void testAccessingCompilingClass() throws Exception {
SimpleCompiler sc = new SimpleCompiler();
sc.cook("package test.simple;" +
"public class SelfRef {" +
" public Class getSelf() {" + " return test.simple.SelfRef.class;" + " }" +
"}"
);
Class self = sc.getClassLoader().loadClass("test.simple.SelfRef");
Method m = self.getDeclaredMethod("getSelf", null);

Object inst = self.newInstance();
Class res = (Class)m.invoke(inst, null);
assertEquals(self, res);
}



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Matt Fowles added a comment - 02/May/08 11:03 PM
This patch fixes the issue and adds a test for it to EvaluatorTest.java

It also factors some of the duplicated code in UnitCompiler.java into helper methods, which I did while coming to understand the code and the problem better.


Arno Unkrig added a comment - 15/May/08 02:46 PM
That patch will go into the next release of JANINO.

Matt Fowles added a comment - 16/Jun/08 09:29 AM
Arno, I do not have the ability to close this issue. I think my login to Jira does not have the power. You can consider this closed.