Skip to content
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

Port types #10

Open
kasperdokter opened this issue Feb 12, 2019 · 0 comments
Open

Port types #10

kasperdokter opened this issue Feb 12, 2019 · 0 comments
Labels

Comments

@kasperdokter
Copy link
Collaborator

To implement a primitive component in Treo, the user may use a static Java method, such as

public static void f(Output<String> p) {
   ...
}

The compiler uses this static method by producing a wrapper component that makes a call to the static method f. In this call, the wrapper component passes an instance of a node to the port parameter of f. However, it is not checked whether f is indeed of the above form. A malicious user could have provided the following static function:

public static void g(Port<String> p) {
   \\ Use both p.put() and p.get().
}

The compiler would not complain, and even the generated code would not give a runtime error. This is not desired.

The compiler should be changed such that the wrapper component upcasts the Port passed to the static function to an Output. In this way, function g would give a type error.

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

No branches or pull requests

1 participant