Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Having a consistent and functional API is critical in a software component.  There is a famous saying: "API is forever".  This is true.  Once a class, interface or method is public or protected, it cannot be deleted and is expected to function until the end of time, even when deprecated.In OpenJFX, due to package visibility or other reasons, sometimes a method needs to be public or protected so that it can be called as part of the implementation of the toolkit.  Such methods have the "imp_" prefix.  These methods are not API and can be deleted or changed at any time (the JavaDoc clearly states thisunless deprecated for-removal in one release and then removed in a later release (which is a very rare process).

Steps for API Review

Because API is so important, there are a few more restrictions additional requirements  over and above the normal what is needed for a bug fix. The process is described on the code review process:

  • Ensure that there is a JIRA that covers the work
  • Add the label 'api' to the JIRA
  • Ensure there is a pre-commit review of the code in the JIRA
  • Send an email to openjfx@java.net with the title: "[<release>] API Review for <bug-id>: <summary>"
  • In addition to the normal reviewers, a +1 is required from the Team Lead or an Architect before the code is committed

Behavioural Changes

page.

Config Files, CSS, Properties and More are API

Usually we think of API in terms of classes and methods, however, things like config files and CSS are also API.  Essentially, any set of characters or keywords that are documented to cause a well-specified behavior can be considered to be API.  When in doubt, it is best to ask.

Behavioral Changes are API

Changes in behavior Changes in behaviour can break the users of the toolkit.  Major Major changes in behaviour behavior such as threading should be treated like API and require the same steps as an API review.  It It is critical that the Team Lead Project Leads and Architects Reviewers are aware of how the toolkit behaves and understand how it can be is used.

While API is some API changes such as new classes and methods are easy to definesee, behavioural behavioral changes can be fuzzy.  When in doubt, ask, asking for clarification is the best policy here.

FXML Considerations

When defining API, it's often easy to forget to take into account how the API will be accessed from FXML.  New events and properties are easily consumed by FXML.  In constructors, use of @NamedArg() allows FXML to construct objects, often to be assigned to properties.

When defining an API, if applicable, ensure that the API can be consumed from FXML and provide test cases that show how it is done.