Skip to content

Port types #10

@kasperdokter

Description

@kasperdokter

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions