Skip to content

ClassNotFoundException and other unexpected errors should come with a trail allowing the user to figure out where they came from #142

Closed
@hakanai

Description

@hakanai

I have a problem where I am getting ClassNotFoundException from forbidden-apis where it is trying to find up a class which was apparently referred to from some other class.

[linux: MinimalTestingBuild] 2018-06-26 09:53:19 > de.thetaphi.forbiddenapis.ForbiddenApiException: Check for forbidden API calls failed: java.lang.ClassNotFoundException: com.acme.elasticsearch.HasElasticSearchId

Problem is, there are no references to that class in the module where the error occurred. So it's referred to be some class in another module which is then indirectly referred to from the module I'm building, and the project is way too big to figure out where it might be.

  • The java compiler, and even error-prone, can't see the problem at all.
  • FindBugs has similar problems, but it isn't telling me either, and we're abandoning it for other reasons.
  • IDEA doesn't appear to have any tools to tell me all the classes which indirectly depend on another class, though I initially thought that analysing backwards dependencies might work.

It would be nice if the error would be caught and rethrown with additional context about which class/method/parameter is being processed when it occurs. That would point directly at the problem.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions