net.sf.clirr.core.internal.checks
Class ClassScopeCheck

java.lang.Object
  extended by net.sf.clirr.core.internal.AbstractDiffReporter
      extended by net.sf.clirr.core.internal.checks.ClassScopeCheck
All Implemented Interfaces:
ClassChangeCheck

public final class ClassScopeCheck
extends AbstractDiffReporter
implements ClassChangeCheck

Detects changes in class access declaration, for both "top-level" classes, and nested classes.

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.

Author:
Simon Kitching

Constructor Summary
ClassScopeCheck(ApiDiffDispatcher dispatcher, ScopeSelector scopeSelector)
          Create a new instance of this check.
 
Method Summary
 boolean check(JavaType compatBaseline, JavaType currentVersion)
          
 
Methods inherited from class net.sf.clirr.core.internal.AbstractDiffReporter
getApiDiffDispatcher, getSeverity, getSeverity, getSeverity, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassScopeCheck

public ClassScopeCheck(ApiDiffDispatcher dispatcher,
                       ScopeSelector scopeSelector)
Create a new instance of this check.

Parameters:
dispatcher - the diff dispatcher that distributes the detected changes to the listeners.
Method Detail

check

public boolean check(JavaType compatBaseline,
                     JavaType currentVersion)

Specified by:
check in interface ClassChangeCheck


Copyright © 2003-2005 Lars Kühne. All Rights Reserved.