New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

class cast exception after introduction of list & sets #121

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

Comments

Projects
None yet
2 participants
@reteprelief
Contributor

reteprelief commented Apr 13, 2018

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

This comment has been minimized.

Contributor

kfhoech commented Apr 13, 2018

Duplicated in 6d5a4e1. Thanks!

@kfhoech

This comment has been minimized.

Contributor

kfhoech commented Apr 16, 2018

Resolved by Pull Request 123.

Thanks @reteprelief for reporting this!

@kfhoech kfhoech closed this Apr 16, 2018

@kfhoech kfhoech added the v2.3.3 label Jul 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment