Skip to content

Fix method checks to also look into superclasses if method was overridden #100

Closed
@uschindler

Description

@uschindler

While testing Java 9, I found the following bug:

The tests for AccessibleObject#setAccessible() were not finding violations on Java 9 anymore. The reason is that Jigsaw overrides AccessibleObject#setAccessible() in the Executable subclass. Because of that the signature was already seen before and forbiddenapis did not look into superclasses. So the violation was not found (1 test failed).

This is a general bug of forbiddenapis, the old checks were easily able to break if a forbidden method was overridden by a subclass!

This fix removes the check that prevented looking into superclasses. Fields are not affected, because fields are never "virtual", so the "optimization" can stay.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions