marcosamba Posted May 19, 2008 Share Posted May 19, 2008 Trying to compile a jrxml file I'm having the following exception: TheÂnestedÂtype org.example.ClassA$ClassB cannot be referencedÂusingÂitsÂbinaryÂname Class B is a static inner class of Class A and I want to access to a (non static) property of type ClassB present in ClassA using a (non static) getter method: public ClassA { private ClassA.ClassB propB; public ClassA.ClassB getPropB() { return propB; } public static class ClassB { ... } } Why do I get the excpetion? What can I do to avoid it? Thanks. Marco. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted May 20, 2008 Share Posted May 20, 2008 Hi, What version of JR are you using? Thank you,Teodor Link to comment Share on other sites More sharing options...
marcosamba Posted May 20, 2008 Author Share Posted May 20, 2008 The last one, well until a few hours ago, 2.0.5. Do you think the brand new version will not have this kind of issue? Thanks,Marco Link to comment Share on other sites More sharing options...
Teodor Danciu Posted May 20, 2008 Share Posted May 20, 2008 Hi, I thought you use an older version because I remember fixing something similar to this in the past.Can you attach the JRXML file, and maybe some sample classes that you have so we can quickly reproduce the problem? Thank you,Teodor Link to comment Share on other sites More sharing options...
marcosamba Posted May 20, 2008 Author Share Posted May 20, 2008 I've prepared a basic example because the real case is quite complex. Consider to use a JRBeanCollectionDataSource as Datasource for the report. The Beans are of type ChildB, you can use IReportBeansFactory as factory class to use in iReport (method getChildB) and the provided jrxml to test. What I get is the following exception trying to compile the jrxml: TheÂnestedÂtypeÂorg.example.beans.ChildB$InnerChildÂcannotÂbeÂreferencedÂusingÂitsÂbinaryÂname valueÂ=Â(java.lang.String)(""+((org.example.beans.ChildB$InnerChild)field_inner.getValue()).getDesc());//$JR_EXPR_ID=10$ Thanks, Marco [file name=InnerClassTest.zip size=2086] Link to comment Share on other sites More sharing options...
lucianc Posted May 20, 2008 Share Posted May 20, 2008 Try to set the "inner" field type to "org.example.beans.ChildB.InnerChild" (instead of org.example.beans.ChildB$InnerChild). Regards,Lucian Link to comment Share on other sites More sharing options...
marcosamba Posted May 20, 2008 Author Share Posted May 20, 2008 You got it :) Thanks a lot!Marco Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now