Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

class cast exception after introduction of list & sets #121

Closed
reteprelief opened this issue Apr 13, 2018 · 2 comments
Closed

class cast exception after introduction of list & sets #121

reteprelief opened this issue Apr 13, 2018 · 2 comments

Comments

@reteprelief
Copy link
Contributor

I have an example where I apply a set operation to property values that are lists and then calculate the length of the result. I use as_set to convert from the list to the set.
Resolute gets a class cast exception,when I do a clean build. You can find it in the Errorlog (stack trace is also shown below).
The attached example has 'let set1 ..' with the error, while the second line 'let list2 ..' works fine.

Peter

Example:
property set SecurityProps is

security_levels : list of aadlinteger => (100) applies to (all);

end SecurityProps;
and in a separate file:
package myresolutelib
public
annex Resolute {**
same_security (comp1 : aadl, comp2 : aadl) <=
** "Element " comp1 " and " comp2 " have the same security level(s)" **
let set1 : {int}= as_set(property (comp1, SecurityProps::security_levels)); -- class cast exception in validation of as_set
-- com.rockwellcollins.atc.resolute.validation.BaseType cannot be cast to com.rockwellcollins.atc.resolute.validation.ListType
let list2 :[int]= property (comp2, SecurityProps::security_levels); let set2: {int}=as_set(list2); -- validation works fine
length(intersect (set1,set2)) = 1
**};
end myresolutelib;

!STACK 0
java.lang.ClassCastException: com.rockwellcollins.atc.resolute.validation.BaseType cannot be cast to com.rockwellcollins.atc.resolute.validation.ListType
at com.rockwellcollins.atc.resolute.validation.ResoluteJavaValidator.getListFnElementType(ResoluteJavaValidator.java:1356)
at com.rockwellcollins.atc.resolute.validation.ResoluteJavaValidator.getBuiltInFnCallType(ResoluteJavaValidator.java:1257)
at com.rockwellcollins.atc.resolute.validation.ResoluteJavaValidator.getExprType(ResoluteJavaValidator.java:1025)
at com.rockwellcollins.atc.resolute.validation.ResoluteJavaValidator.checkLetExpr(ResoluteJavaValidator.java:255)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

@kfhoech
Copy link
Contributor

kfhoech commented Apr 13, 2018

Duplicated in 6d5a4e1. Thanks!

@kfhoech
Copy link
Contributor

kfhoech commented Apr 16, 2018

Resolved by Pull Request 123.

Thanks @reteprelief for reporting this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants