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

Exceptions not reported as API, exceptions missing in ABI dump #395

Closed
loetifuss opened this issue May 6, 2021 · 4 comments
Closed

Exceptions not reported as API, exceptions missing in ABI dump #395

loetifuss opened this issue May 6, 2021 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@loetifuss
Copy link

Plugin version
0.71.0

Gradle version
6.5.1

Describe the bug
The following method signature
public void delete(InteressentenNr interessentenNr) throws InteressentException

yields the following ABI dump:

public class de/foo/builder/TestBuilder {
	public fun delete (Lde/foo/type/InteressentenNr;)V
}

If the "buildHealth" task is run the following advice is created:

   "dependency": {
        "identifier": ":interessent.module",  --> module containing the exception type 'InteressentException'
        "configurationName": "compile"
      },
      "usedTransitiveDependencies": [],
      "fromConfiguration": "compile",
      "toConfiguration": "implementation"  --> expect this to be "api" instead
    }

To Reproduce
Steps to reproduce the behavior:

  1. create method in "moduleX" which throws exception type from a different module e.g. "moduleY"
  2. verify moduleX has advice set to "implementation" for moduleY instead of "api"

Expected behavior
Exceptions thrown in method signatures should be considered in the ABI. If a method refers to an exception type from a different module, this module should be advised to have "api" configuration.

Context

Classes compiled using ECJ on Java 1.8

@autonomousapps
Copy link
Owner

I'm not an expert on the Java specification. I just did some cursory searching online and found this, which doesn't list exceptions as part of the definition of method signatures. Can you point me to anything discussing the relationship between exceptions and ABI?

I do understand what you're saying here, but I want to make sure we come to the right resolution here, not just the one that feels right.

@autonomousapps autonomousapps added the question Further information is requested label May 11, 2021
@loetifuss
Copy link
Author

Sorry for the late reply, after some research I'd agree that exceptions aren't part of the ABI. I found the following sections in the JLS:

Nevertheless, I think that dependencies from "throws"-clauses should be regarded in the dependency analysis plugin, since following the advice in the current output of the "buildHealth" task will result in code that won't compile.

@autonomousapps autonomousapps added enhancement New feature or request and removed question Further information is requested labels May 27, 2021
@autonomousapps autonomousapps added this to the 1.0 milestone May 27, 2021
@autonomousapps
Copy link
Owner

Thank you. I'll be taking a look at resolving this for the 1.0 release.

@autonomousapps
Copy link
Owner

Resolved via #459

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

No branches or pull requests

2 participants