public final class ClassScopeCheck extends AbstractDiffReporter implements ClassChangeCheck
Java class files only ever contain scope specifiers of "public" or "package". For top-level classes, this is expected: it is not possible to have a top-level protected or private class.
However nested classes can be declared as protected or private. The way to tell the real scope of a nested class is to ignore the scope in the actual class file itself, and instead look in the "InnerClasses" attribute stored on the enclosing class. This is exactly what the java compiler does when compiling, and what the jvm does when verifying class linkage at runtime.
Constructor and Description |
---|
ClassScopeCheck(ApiDiffDispatcher dispatcher,
ScopeSelector scopeSelector)
Create a new instance of this check.
|
Modifier and Type | Method and Description |
---|---|
boolean |
check(JavaType compatBaseline,
JavaType currentVersion) |
getApiDiffDispatcher, getSeverity, getSeverity, getSeverity, log
public ClassScopeCheck(ApiDiffDispatcher dispatcher, ScopeSelector scopeSelector)
dispatcher
- the diff dispatcher that distributes the detected changes to the listeners.public boolean check(JavaType compatBaseline, JavaType currentVersion)
check
in interface ClassChangeCheck
Copyright © 2003-2012 Lars K??hne. All Rights Reserved.