ballerina-lang icon indicating copy to clipboard operation
ballerina-lang copied to clipboard

Add ExternalDependency annotation

Open Thushara-Piyasekara opened this issue 1 year ago • 3 comments

Purpose

$subject With this PR, a new annotation is introduced to annotate ballerina type definitions which are accessed through external Java dependencies.

Fixes #42205

Approach

This new annotation was added to jballerina.java lang library. It can be accessed by importing jballerina.java in any ballerina module.

Samples

import ballerina/jballerina.java;

@java:ExternalDependency
function foo(int x) returns int {
    return x * 2;
}

Remarks

List any other known issues, related PRs, TODO items, or any other notes related to the PR.

Check List

  • [x] Read the Contributing Guide
  • [ ] Updated Change Log
  • [ ] Checked Tooling Support (#<Issue Number>)
  • [x] Added necessary tests
    • [x] Unit Tests
    • [ ] Spec Conformance Tests
    • [ ] Integration Tests
    • [ ] Ballerina By Example Tests
  • [ ] Increased Test Coverage
  • [ ] Added necessary documentation
    • [ ] API documentation
    • [ ] Module documentation in Module.md files
    • [ ] Ballerina By Examples

Thushara-Piyasekara avatar Feb 21 '24 09:02 Thushara-Piyasekara

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 76.71%. Comparing base (3c8ebcd) to head (bfe9d02). Report is 120 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #42207   +/-   ##
=========================================
  Coverage     76.70%   76.71%           
- Complexity    53086    53098   +12     
=========================================
  Files          2882     2882           
  Lines        200044   200108   +64     
  Branches      26050    26062   +12     
=========================================
+ Hits         153449   153505   +56     
- Misses        38145    38151    +6     
- Partials       8450     8452    +2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 21 '24 14:02 codecov[bot]

In some ways, the tests look like we are trying to validate the correctness of the compiler, rather than the annotation itself. We only need to validate that it's public, const, and the three (source) attachment points? And if we are using tests like these to assert them, we should cover all cases.

IMO, a better test would be to validate the annotation/symbol itself, with maybe one test like the current tests.

Thank you for pointing this out. I reduced the number of test cases and added a test for the annotation symbol in 13d72cd2d546cc92e7d6247b667e38bcdd718914. Could you please verify it?

Thushara-Piyasekara avatar Feb 26 '24 09:02 Thushara-Piyasekara

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

github-actions[bot] avatar Mar 20 '24 19:03 github-actions[bot]

After discussion with @hasithaa, we decided to merge this PR for 2201.10.0 release. Therefore this PR was reverted with https://github.com/ballerina-platform/ballerina-lang/pull/42484.

Thushara-Piyasekara avatar Apr 08 '24 04:04 Thushara-Piyasekara