- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Error: An external class following 'a/an' must have an accessible default constructo r.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-13-2012 05:04 PM
I am using Blaze Advisor 7.0. I am trying to create an object and declare values in it so that I can test my rules. This is the code that I have:
recAccountData = a RecAccountData initially { accountData = a AccountData initially {
creditScore = 100.
originalTransactionAmount =100 as a BigDecimal.
}}
The AccountData class above is declared as an abstract class in the Object model. I am getting the following error when I compile.
Error: An external class following 'a/an' must have an accessible default constructor.
Kindly advise.
Thanks,
Shubham
Solved! Go to Solution.
Re: Error: An external class following 'a/an' must have an accessible default constructo r.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Not the Solution
- Email to a Friend
- Report Inappropriate Content
03-22-2012 03:37 PM
The error message tells you what the problem is; The class you try to instantiate must have an accessible constructor. If you are unable to instantiate the class in Java, say in a unit test, you will not be able to instantiate it in SRL either.
Make sure you have a public no-argument constructor if you want to use the "initially a ClassName" syntax. If you have constructors that take arguments, they are exposed as static methods on the form ClassName.newClassName(args...) in SRL.
Also, if your class is abstract, you can not instantiate it. Not in Java, and not in SRL. Rules are great, but there really is no magic :-)
Regards,
Jostein

