Declaration class can be weaker for Exception class

Answered

Hi everyone,

I faced a problem with Inspect Code for public exceptions. Let's say, we have PublicException class from package1 and Class2 from package2 which uses PublicException.

package package1;

public class PublicException extends Exception {
}
package package2;

import package1.Class1;
import package1.PublicException;

class Class2 {
private Class1 class1;

void method() {
try {
class1.method();
} catch (PublicException e) {
System.out.println("Exception");
}
}
}

 

However, Inspection shows PublicException can be package-private warning which is obviously wrong.

Has anyone faced such an issue?

 

Thanks,

Dmitry

 

0
2 comments

Hello Dmitry,

I reported issue on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-209050

Please follow it for updates.

0
Avatar
Permanently deleted user

Nice, thank you!

0

Please sign in to leave a comment.