You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2007/10/13 01:38:58 UTC
svn commit: r584326 [4/7] - in
/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java:
doc/ src/ src/symtab/ src/util/ src/xref/
Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/ClassDef.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/ClassDef.java?rev=584326&r1=584325&r2=584326&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/ClassDef.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/ClassDef.java Fri Oct 12 16:37:59 2007
@@ -1,3 +1,5 @@
+package org.apache.maven.jxr.java.src.symtab;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.maven.jxr.java.src.symtab;
import org.apache.log4j.Logger;
@@ -37,7 +38,10 @@
*
* @version $Id: $
*/
-public class ClassDef extends HasImports implements Externalizable {
+public class ClassDef
+ extends HasImports
+ implements Externalizable
+{
/** Logger for this class */
private static final Logger log = Logger.getLogger( ClassDef.class );
@@ -107,27 +111,30 @@
* @param name
* @return
*/
- protected static ClassDef findLoadedClass(String packageName, String name) {
+ protected static ClassDef findLoadedClass( String packageName, String name )
+ {
String qualifiedName = packageName + "." + name;
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("findLoadedClass(String, String) - String qualifiedName=" + qualifiedName);
+ log.debug( "findLoadedClass(String, String) - String qualifiedName=" + qualifiedName );
Enumeration keys = allClassDefs.keys();
- StringBuffer sb = new StringBuffer("allClassDefs={");
- while (keys.hasMoreElements()) {
- sb.append( ((String)keys.nextElement())+", ");
+ StringBuffer sb = new StringBuffer( "allClassDefs={" );
+ while ( keys.hasMoreElements() )
+ {
+ sb.append( ( (String) keys.nextElement() ) + ", " );
}
- log.debug("findLoadedClass(String, String) - " + sb.toString());
+ log.debug( "findLoadedClass(String, String) - " + sb.toString() );
}
- return (ClassDef) allClassDefs.get(qualifiedName);
+ return (ClassDef) allClassDefs.get( qualifiedName );
}
/**
* Default constructor needs to be public for deserialization.
*/
- public ClassDef() {
+ public ClassDef()
+ {
}
/**
@@ -139,16 +146,18 @@
* @param interfaces
* @param parentScope
*/
- ClassDef(String name, // thhe name of the class
- Occurrence occ, // where it was defined
- ClassDef superClass, // its superclass (if applicable)
- JavaVector interfaces, // interfaces that it implements
- ScopedDef parentScope) { // which scope owns it
+ ClassDef( String name, // thhe name of the class
+ Occurrence occ, // where it was defined
+ ClassDef superClass, // its superclass (if applicable)
+ JavaVector interfaces, // interfaces that it implements
+ ScopedDef parentScope )
+ { // which scope owns it
- super(name, occ, parentScope);
+ super( name, occ, parentScope );
// if a superclass was specified, set it
- if (superClass != null) {
+ if ( superClass != null )
+ {
this.superClass = superClass;
}
@@ -161,11 +170,12 @@
*
* @param def
*/
- void addImplementer(ClassDef def) {
+ void addImplementer( ClassDef def )
+ {
- getImplementers().addElement(def);
- setType(INTERFACE);
- def.setType(CLASS);
+ getImplementers().addElement( def );
+ setType( INTERFACE );
+ def.setType( CLASS );
}
/**
@@ -174,8 +184,9 @@
*
* @param subclass
*/
- void addSubclass(ClassDef subclass) {
- getSubClasses().addElement(subclass);
+ void addSubclass( ClassDef subclass )
+ {
+ getSubClasses().addElement( subclass );
}
/**
@@ -183,9 +194,11 @@
*
* @return
*/
- JavaVector getImplementers() {
+ JavaVector getImplementers()
+ {
- if (implementers == null) { // lazy instantiation
+ if ( implementers == null )
+ { // lazy instantiation
implementers = new JavaVector();
}
@@ -198,7 +211,8 @@
*
* @return
*/
- public JavaVector getInterfaces() {
+ public JavaVector getInterfaces()
+ {
return interfaces;
}
@@ -207,9 +221,11 @@
*
* @return
*/
- JavaVector getSubClasses() {
+ JavaVector getSubClasses()
+ {
- if (subClasses == null) {
+ if ( subClasses == null )
+ {
subClasses = new JavaVector();
}
@@ -221,7 +237,8 @@
*
* @return
*/
- public ClassDef getSuperClass() {
+ public ClassDef getSuperClass()
+ {
return superClass;
}
@@ -230,7 +247,8 @@
*
* @return
*/
- public boolean isClass() {
+ public boolean isClass()
+ {
return classOrInterface == CLASS;
}
@@ -239,7 +257,8 @@
*
* @return
*/
- public boolean isInterface() {
+ public boolean isInterface()
+ {
return classOrInterface == INTERFACE;
}
@@ -251,46 +270,52 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.ScopedDef#lookup(java.lang.String, int, java.lang.Class)
*/
- Definition lookup(String name, int numParams, Class type) {
+ Definition lookup( String name, int numParams, Class type )
+ {
- String goal = name + "|" + getQualifiedName() + "|" + numParams + "|"
- + type;
+ String goal = name + "|" + getQualifiedName() + "|" + numParams + "|" + type;
- if (goals.contains(goal)) {
- log.error( "detected infinite loop: " + goal, new Exception("infinite loop") );
+ if ( goals.contains( goal ) )
+ {
+ log.error( "detected infinite loop: " + goal, new Exception( "infinite loop" ) );
return null;
}
- goals.add(goal);
+ goals.add( goal );
// try to look it up in our scope
- Definition d = super.lookup(name, numParams, type);
+ Definition d = super.lookup( name, numParams, type );
// if not found, look it up in our superclass (if we have one)
- if (d == null) {
- if (getSuperClass() != null) {
- setType(CLASS);
- getSuperClass().setType(CLASS);
+ if ( d == null )
+ {
+ if ( getSuperClass() != null )
+ {
+ setType( CLASS );
+ getSuperClass().setType( CLASS );
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("lookup(String, int, Class) - " + getName()+" looking for name="+name+" numParams="+numParams+" type="+type);
+ log.debug( "lookup(String, int, Class) - " + getName() + " looking for name=" + name
+ + " numParams=" + numParams + " type=" + type );
}
- d = getSuperClass().lookup(name, numParams, type);
+ d = getSuperClass().lookup( name, numParams, type );
}
}
// if still not found, look for it in any of our implemented interfaces
- if ((d == null) && (interfaces != null)) {
+ if ( ( d == null ) && ( interfaces != null ) )
+ {
Enumeration e = interfaces.elements();
- while ((d == null) && e.hasMoreElements()) {
- d = ((ClassDef) e.nextElement()).lookup(name, numParams, type);
+ while ( ( d == null ) && e.hasMoreElements() )
+ {
+ d = ( (ClassDef) e.nextElement() ).lookup( name, numParams, type );
}
}
- goals.remove(goal);
+ goals.remove( goal );
return d;
}
@@ -298,42 +323,40 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#generateReferences(java.io.FileWriter)
*/
- public void generateReferences(FileWriter output) {
- if (log.isDebugEnabled())
+ public void generateReferences( FileWriter output )
+ {
+ if ( log.isDebugEnabled() )
{
- log.debug("generateReferences(FileWriter) - FileWriter output=" + output);
- log.debug("generateReferences(FileWriter) - Generating references for:"+getName());
+ log.debug( "generateReferences(FileWriter) - FileWriter output=" + output );
+ log.debug( "generateReferences(FileWriter) - Generating references for:" + getName() );
}
- try {
- output.write("<p class=\"classReflist\">");
+ try
+ {
+ output.write( "<p class=\"classReflist\">" );
- String nameString =
- "<p class=\"classReflistHeader\">Class: <a name=" + getName()
- + " href=" + getSourceName() + "#" + getClassScopeName() + ">"
- + getScopedClassName() + "</a></p>";
+ String nameString = "<p class=\"classReflistHeader\">Class: <a name=" + getName() + " href="
+ + getSourceName() + "#" + getClassScopeName() + ">" + getScopedClassName() + "</a></p>";
String linkFileName;
String linkString;
- output.write(nameString);
+ output.write( nameString );
JavaVector v = getReferences();
Enumeration e = v.elements();
- while (e.hasMoreElements()) {
+ while ( e.hasMoreElements() )
+ {
Occurrence o = (Occurrence) e.nextElement();
- if (o != null) {
- linkFileName = getOccurrencePath(o) + o.getLinkReference();
- linkString = "<p class=\"classRefItem\"><a href="
- + linkFileName + ">" + getName() + " in "
- + o.getPackageName() + "."
- + o.getClassName() + "." + o.getMethodName()
- + " (" + o.getFile().getName() + ":"
- + Integer.toString(o.getLine())
- + ")</a></p>\n";
+ if ( o != null )
+ {
+ linkFileName = getOccurrencePath( o ) + o.getLinkReference();
+ linkString = "<p class=\"classRefItem\"><a href=" + linkFileName + ">" + getName() + " in "
+ + o.getPackageName() + "." + o.getClassName() + "." + o.getMethodName() + " ("
+ + o.getFile().getName() + ":" + Integer.toString( o.getLine() ) + ")</a></p>\n";
- output.write(linkString);
+ output.write( linkString );
}
}
@@ -342,38 +365,46 @@
// Variables
Enumeration el = ht.elements();
- while (el.hasMoreElements()) {
+ while ( el.hasMoreElements() )
+ {
Object d = el.nextElement();
- if (d instanceof VariableDef) {
- ((Definition) d).generateReferences(output);
+ if ( d instanceof VariableDef )
+ {
+ ( (Definition) d ).generateReferences( output );
}
}
// Methods
el = ht.elements();
- while (el.hasMoreElements()) {
+ while ( el.hasMoreElements() )
+ {
Object d = el.nextElement();
- if ((d instanceof MethodDef) || (d instanceof MultiDef)) {
- ((Definition) d).generateReferences(output);
+ if ( ( d instanceof MethodDef ) || ( d instanceof MultiDef ) )
+ {
+ ( (Definition) d ).generateReferences( output );
}
}
- output.write("</p>\n");
+ output.write( "</p>\n" );
// Now inner classes
el = ht.elements();
- while (el.hasMoreElements()) {
+ while ( el.hasMoreElements() )
+ {
Object d = el.nextElement();
- if (d instanceof ClassDef) {
- ((Definition) d).generateReferences(output);
+ if ( d instanceof ClassDef )
+ {
+ ( (Definition) d ).generateReferences( output );
}
}
- } catch (Exception ex) {
+ }
+ catch ( Exception ex )
+ {
log.error( "Exception: " + ex.getMessage(), ex );
return;
@@ -383,37 +414,40 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#generateTags(org.apache.maven.jxr.java.src.symtab.HTMLTagContainer)
*/
- public void generateTags(HTMLTagContainer tagList) {
+ public void generateTags( HTMLTagContainer tagList )
+ {
- String nameString = "<a class=\"classDef\" name=" + getClassScopeName()
- + " href=" + getRefName() + "#"
- + getClassScopeName() + ">" + getName() + "</a>";
+ String nameString = "<a class=\"classDef\" name=" + getClassScopeName() + " href=" + getRefName() + "#"
+ + getClassScopeName() + ">" + getName() + "</a>";
// generate tag for this class
- if (getOccurrence() != null) {
- HTMLTag t = new HTMLTag(getOccurrence(), getName(), nameString);
+ if ( getOccurrence() != null )
+ {
+ HTMLTag t = new HTMLTag( getOccurrence(), getName(), nameString );
- tagList.addElement(t);
+ tagList.addElement( t );
}
- tagElements(tagList);
+ tagElements( tagList );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ScopedDef#getOccurrenceTag(org.apache.maven.jxr.java.src.symtab.Occurrence)
*/
- public HTMLTag getOccurrenceTag(Occurrence occ) {
+ public HTMLTag getOccurrenceTag( Occurrence occ )
+ {
String linkString;
String linkFileName;
HTMLTag t = null;
- if(getSourceName() != null){
- linkFileName = getRelativePath(occ) + getSourceName();
- linkString = "<a class=\"classRef\" href=" + linkFileName + "#"
- + getClassScopeName() + ">" + getName() + "</a>";
+ if ( getSourceName() != null )
+ {
+ linkFileName = getRelativePath( occ ) + getSourceName();
+ linkString = "<a class=\"classRef\" href=" + linkFileName + "#" + getClassScopeName() + ">" + getName()
+ + "</a>";
- t = new HTMLTag(occ, getName(), linkString);
+ t = new HTMLTag( occ, getName(), linkString );
}
return t;
}
@@ -421,82 +455,91 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.HasImports#resolveTypes(org.apache.maven.jxr.java.src.symtab.SymbolTable)
*/
- void resolveTypes(SymbolTable symbolTable) {
- if (log.isDebugEnabled())
+ void resolveTypes( SymbolTable symbolTable )
+ {
+ if ( log.isDebugEnabled() )
{
- log.debug("resolveTypes(SymbolTable) - SymbolTable symbolTable=" + symbolTable);
- log.debug("resolveTypes(SymbolTable) - resolving: "+getQualifiedName());
+ log.debug( "resolveTypes(SymbolTable) - SymbolTable symbolTable=" + symbolTable );
+ log.debug( "resolveTypes(SymbolTable) - resolving: " + getQualifiedName() );
}
// resolve superclass laundry
- super.resolveTypes(symbolTable);
+ super.resolveTypes( symbolTable );
// if we have subclasses, resolve them to their symbols
- if (subClasses != null) {
- subClasses.resolveTypes(symbolTable);
+ if ( subClasses != null )
+ {
+ subClasses.resolveTypes( symbolTable );
// Make sure we re-open imports
- openImports(symbolTable);
+ openImports( symbolTable );
}
ClassDef newSuperClass = getSuperClass();
- if ((newSuperClass != null) && (newSuperClass instanceof DummyClass)) {
+ if ( ( newSuperClass != null ) && ( newSuperClass instanceof DummyClass ) )
+ {
// get its package name and look up the class/interace
- String pkg = ((DummyClass) newSuperClass).getPackage();
+ String pkg = ( (DummyClass) newSuperClass ).getPackage();
- newSuperClass = symbolTable.lookupDummy(newSuperClass);
+ newSuperClass = symbolTable.lookupDummy( newSuperClass );
- if (newSuperClass == null) {
- newSuperClass = new DummyClass(
- symbolTable.getUniqueName(getSuperClass().getName()), null,
- symbolTable.getUniqueName(pkg));
+ if ( newSuperClass == null )
+ {
+ newSuperClass = new DummyClass( symbolTable.getUniqueName( getSuperClass().getName() ), null,
+ symbolTable.getUniqueName( pkg ) );
}
// if we were able to resolve the superclass, add the reference
// to its reference list and make it this class' superclass
- if (newSuperClass != null) {
- newSuperClass.addReference(getSuperClass().getOccurrence());
- setSuperClass(newSuperClass);
- newSuperClass.addSubclass(this);
- newSuperClass.setType(ClassDef.CLASS);
+ if ( newSuperClass != null )
+ {
+ newSuperClass.addReference( getSuperClass().getOccurrence() );
+ setSuperClass( newSuperClass );
+ newSuperClass.addSubclass( this );
+ newSuperClass.setType( ClassDef.CLASS );
}
- setType(CLASS);
+ setType( CLASS );
}
- if (interfaces != null) {
- interfaces.resolveTypes(symbolTable);
+ if ( interfaces != null )
+ {
+ interfaces.resolveTypes( symbolTable );
// add this class to the list of implementers for each interface
Enumeration e = interfaces.elements();
- while (e.hasMoreElements()) {
- ((ClassDef) e.nextElement()).addImplementer(this);
+ while ( e.hasMoreElements() )
+ {
+ ( (ClassDef) e.nextElement() ).addImplementer( this );
}
}
// we're done, so toss the packages (only for top-level classes)
- if (isTopLevel()) {
- closeImports(symbolTable);
+ if ( isTopLevel() )
+ {
+ closeImports( symbolTable );
}
}
/**
* @see org.apache.maven.jxr.java.src.symtab.HasImports#resolveRefs(org.apache.maven.jxr.java.src.symtab.SymbolTable)
*/
- void resolveRefs(SymbolTable symbolTable) {
+ void resolveRefs( SymbolTable symbolTable )
+ {
JavaHashtable oldImports = symbolTable.getImports();
JavaVector oldDemand = symbolTable.getDemand();
- super.resolveRefs(symbolTable);
+ super.resolveRefs( symbolTable );
- if (isTopLevel()) {
- closeImports(symbolTable);
- symbolTable.setImports(oldImports);
- symbolTable.setDemand(oldDemand);
+ if ( isTopLevel() )
+ {
+ closeImports( symbolTable );
+ symbolTable.setImports( oldImports );
+ symbolTable.setDemand( oldDemand );
}
}
@@ -505,7 +548,8 @@
*
* @param tagList
*/
- public void generateClassList(Vector tagList) {
+ public void generateClassList( Vector tagList )
+ {
Enumeration e;
Definition d;
@@ -514,7 +558,8 @@
String tagText;
// List all classes in this class
- if (hasElements()) {
+ if ( hasElements() )
+ {
JavaHashtable ht = getElements();
e = ht.elements();
@@ -522,26 +567,28 @@
String baseName;
String link;
- while (e.hasMoreElements()) {
+ while ( e.hasMoreElements() )
+ {
d = (Definition) e.nextElement();
- if (d instanceof ClassDef) {
+ if ( d instanceof ClassDef )
+ {
o = d.getOccurrence();
baseName = o.getFile().getName();
- baseName = baseName.substring(0, baseName.lastIndexOf("."));
+ baseName = baseName.substring( 0, baseName.lastIndexOf( "." ) );
link = baseName + "_java.html";
- if (!baseName.equals(d.getName())) {
+ if ( !baseName.equals( d.getName() ) )
+ {
link += "#" + o.getLine();
}
- tagText = "<p class=\"classListItem\"><a href=\"" + link
- + "\"" + "TARGET=\"classFrame\">"
- + d.getScopedClassName() + "</a></p>";
- tag = new ClassTag(d.getScopedClassName(), tagText);
+ tagText = "<p class=\"classListItem\"><a href=\"" + link + "\"" + "TARGET=\"classFrame\">"
+ + d.getScopedClassName() + "</a></p>";
+ tag = new ClassTag( d.getScopedClassName(), tagText );
- tagList.addElement(tag);
- ((ClassDef) d).generateClassList(tagList);
+ tagList.addElement( tag );
+ ( (ClassDef) d ).generateClassList( tagList );
}
}
}
@@ -552,7 +599,8 @@
*
* @param interfaces
*/
- void setInterfaces(JavaVector interfaces) {
+ void setInterfaces( JavaVector interfaces )
+ {
this.interfaces = interfaces;
}
@@ -561,12 +609,13 @@
*
* @param superClass
*/
- void setSuperClass(ClassDef superClass) {
+ void setSuperClass( ClassDef superClass )
+ {
this.superClass = superClass;
- setType(CLASS);
- superClass.setType(CLASS);
+ setType( CLASS );
+ superClass.setType( CLASS );
}
/**
@@ -574,21 +623,25 @@
*
* @param type
*/
- void setType(int type) {
+ void setType( int type )
+ {
classOrInterface = type;
}
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#getClassScopeName()
*/
- String getClassScopeName() {
+ String getClassScopeName()
+ {
String result;
- if (getParentScope() instanceof ClassDef) // inner class
+ if ( getParentScope() instanceof ClassDef ) // inner class
{
result = getParentScope().getName() + "." + getName();
- } else {
+ }
+ else
+ {
result = getName();
}
@@ -598,59 +651,66 @@
/**
* @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
*/
- public void writeExternal(ObjectOutput out) throws java.io.IOException {
+ public void writeExternal( ObjectOutput out )
+ throws java.io.IOException
+ {
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("writeExternal(ObjectOutput) - externalizing "+getName());
+ log.debug( "writeExternal(ObjectOutput) - externalizing " + getName() );
}
- out.writeObject(getName());
- out.writeObject(getPackageName());
- out.writeObject(getOccurrence());
+ out.writeObject( getName() );
+ out.writeObject( getPackageName() );
+ out.writeObject( getOccurrence() );
ScopedDef parentScopeOut = getParentScope();
- if (parentScopeOut instanceof PackageDef) {
+ if ( parentScopeOut instanceof PackageDef )
+ {
parentScopeOut = null;
}
- if ((parentScopeOut == null) && (getPackageName() == null)) {
- if (log.isDebugEnabled())
+ if ( ( parentScopeOut == null ) && ( getPackageName() == null ) )
+ {
+ if ( log.isDebugEnabled() )
{
- log.debug("writeExternal(ObjectOutput) - parentScopeOut and getPackageName() are null");
+ log.debug( "writeExternal(ObjectOutput) - parentScopeOut and getPackageName() are null" );
}
}
- out.writeObject(parentScopeOut);
- out.writeObject(elements);
+ out.writeObject( parentScopeOut );
+ out.writeObject( elements );
ClassDef superClassOut;
- if ((superClass instanceof ClassDef)
- && !(superClass instanceof ClassDefProxy)
- && !(superClass instanceof DummyClass)) {
- superClassOut = new ClassDefProxy(superClass);
- } else {
+ if ( ( superClass instanceof ClassDef ) && !( superClass instanceof ClassDefProxy )
+ && !( superClass instanceof DummyClass ) )
+ {
+ superClassOut = new ClassDefProxy( superClass );
+ }
+ else
+ {
superClassOut = superClass;
}
- out.writeObject(superClassOut);
- out.writeObject(interfaces);
+ out.writeObject( superClassOut );
+ out.writeObject( interfaces );
}
/**
* @see java.io.Externalizable#readExternal(java.io.ObjectInput)
*/
- public void readExternal(ObjectInput in)
- throws IOException, ClassNotFoundException {
+ public void readExternal( ObjectInput in )
+ throws IOException, ClassNotFoundException
+ {
- setName((String) in.readObject());
- SymbolTable.startReadExternal("ClassDef " + getName());
+ setName( (String) in.readObject() );
+ SymbolTable.startReadExternal( "ClassDef " + getName() );
packageName = (String) in.readObject();
- setOccurrence((Occurrence) (in.readObject()));
+ setOccurrence( (Occurrence) ( in.readObject() ) );
ScopedDef parentScopeIn = (ScopedDef) in.readObject();
@@ -658,44 +718,47 @@
superClass = (ClassDef) in.readObject();
interfaces = (JavaVector) in.readObject();
- if (parentScopeIn == null) {
- parentScopeIn =
- (ScopedDef) SymbolTable.getSymbolTable().findPackage(
- packageName);
+ if ( parentScopeIn == null )
+ {
+ parentScopeIn = (ScopedDef) SymbolTable.getSymbolTable().findPackage( packageName );
}
- setParentScope(parentScopeIn);
+ setParentScope( parentScopeIn );
setupFileNames();
String qualifiedName = packageName + "." + getName();
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("readExternal(ObjectInput) - String qualifiedName=" + qualifiedName);
+ log.debug( "readExternal(ObjectInput) - String qualifiedName=" + qualifiedName );
}
- allClassDefs.put(qualifiedName, this);
+ allClassDefs.put( qualifiedName, this );
SymbolTable.endReadExternal();
}
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#accept(org.apache.maven.jxr.java.src.symtab.Visitor)
*/
- public void accept(Visitor visitor) {
- visitor.visit(this);
- elements.accept(visitor);
+ public void accept( Visitor visitor )
+ {
+ visitor.visit( this );
+ elements.accept( visitor );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#toString()
*/
- public String toString() {
+ public String toString()
+ {
String str = " " + super.toString() + "\n";
- if (interfaces != null) {
+ if ( interfaces != null )
+ {
Enumeration e = interfaces.elements();
- while (e.hasMoreElements()) {
+ while ( e.hasMoreElements() )
+ {
Definition d = (Definition) e.nextElement();
str += " " + d + "\n";
@@ -705,7 +768,8 @@
JavaHashtable ht = getElements();
Enumeration e = ht.elements();
- while (e.hasMoreElements()) {
+ while ( e.hasMoreElements() )
+ {
Definition d = (Definition) e.nextElement();
str += " " + d + "\n";
Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/ClassDefProxy.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/ClassDefProxy.java?rev=584326&r1=584325&r2=584326&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/ClassDefProxy.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/ClassDefProxy.java Fri Oct 12 16:37:59 2007
@@ -1,3 +1,5 @@
+package org.apache.maven.jxr.java.src.symtab;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.maven.jxr.java.src.symtab;
import org.apache.log4j.Logger;
@@ -30,7 +31,10 @@
*
* @version $Id: $
*/
-public class ClassDefProxy extends ClassDef implements Externalizable {
+public class ClassDefProxy
+ extends ClassDef
+ implements Externalizable
+{
/** Logger for this class */
private static final Logger log = Logger.getLogger( ClassDefProxy.class );
@@ -38,7 +42,8 @@
/**
* Default constructor is public for deserialization.
*/
- public ClassDefProxy() {
+ public ClassDefProxy()
+ {
}
/**
@@ -46,17 +51,19 @@
*
* @param ref
*/
- public ClassDefProxy(ClassDef ref) {
+ public ClassDefProxy( ClassDef ref )
+ {
- if (ref.getName().equals("RuntimeException")) {
+ if ( ref.getName().equals( "RuntimeException" ) )
+ {
log.error( "ClassDefProxy(ClassDef) - what's up with this: " + ref );
}
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("ClassDefProxy(ClassDef) - ClassDef ref=" + ref);
+ log.debug( "ClassDefProxy(ClassDef) - ClassDef ref=" + ref );
}
- setName(ref.getName());
+ setName( ref.getName() );
this.packageName = ref.getPackageName();
}
@@ -64,7 +71,8 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#getSuperClass()
*/
- public ClassDef getSuperClass() {
+ public ClassDef getSuperClass()
+ {
load();
@@ -74,7 +82,8 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#isClass()
*/
- public boolean isClass() {
+ public boolean isClass()
+ {
load();
@@ -84,7 +93,8 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#isInterface()
*/
- public boolean isInterface() {
+ public boolean isInterface()
+ {
load();
@@ -97,17 +107,19 @@
* @param occ
* @return
*/
- public HTMLTag getOccurenceTag(Occurrence occ) {
+ public HTMLTag getOccurenceTag( Occurrence occ )
+ {
load();
- return ref.getOccurrenceTag(occ);
+ return ref.getOccurrenceTag( occ );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#getSourceName()
*/
- public String getSourceName() {
+ public String getSourceName()
+ {
load();
@@ -117,7 +129,8 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#getRefName()
*/
- public String getRefName() {
+ public String getRefName()
+ {
load();
@@ -127,17 +140,19 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#getRelativePath(org.apache.maven.jxr.java.src.symtab.Occurrence)
*/
- String getRelativePath(Occurrence occ) {
+ String getRelativePath( Occurrence occ )
+ {
load();
- return ref.getRelativePath(occ);
+ return ref.getRelativePath( occ );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#getOccurrence()
*/
- public Occurrence getOccurrence() {
+ public Occurrence getOccurrence()
+ {
load();
@@ -147,7 +162,8 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#getParentScope()
*/
- public ScopedDef getParentScope() {
+ public ScopedDef getParentScope()
+ {
load();
@@ -157,7 +173,8 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#getPackagePath()
*/
- public String getPackagePath() {
+ public String getPackagePath()
+ {
load();
@@ -167,7 +184,8 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#getReferences()
*/
- public JavaVector getReferences() {
+ public JavaVector getReferences()
+ {
load();
@@ -177,29 +195,33 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#lookup(java.lang.String, int, java.lang.Class)
*/
- Definition lookup(String name, int numParams, Class type) {
+ Definition lookup( String name, int numParams, Class type )
+ {
load();
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("lookup(String, int, Class) - " + getName()+" lookup name="+name+" numParams="+numParams+" type="+type);
+ log.debug( "lookup(String, int, Class) - " + getName() + " lookup name=" + name + " numParams=" + numParams
+ + " type=" + type );
}
- return ref.lookup(name, numParams, type);
+ return ref.lookup( name, numParams, type );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ScopedDef#getSymbols()
*/
- public Hashtable getSymbols() {
+ public Hashtable getSymbols()
+ {
return null;
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ScopedDef#getElements()
*/
- public JavaHashtable getElements() {
+ public JavaHashtable getElements()
+ {
load();
@@ -209,7 +231,8 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.ScopedDef#hasElements()
*/
- boolean hasElements() {
+ boolean hasElements()
+ {
load();
@@ -219,7 +242,8 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.ScopedDef#isDefaultOrBaseScope()
*/
- public boolean isDefaultOrBaseScope() {
+ public boolean isDefaultOrBaseScope()
+ {
load();
@@ -229,44 +253,50 @@
/**
* Method resolveTypes
*/
- void resolveTypes() {
+ void resolveTypes()
+ {
}
/**
* Method resolveRefs
*/
- void resolveRefs() {
+ void resolveRefs()
+ {
}
/**
* Method closeImports
*/
- void closeImports() {
- if (log.isDebugEnabled())
+ void closeImports()
+ {
+ if ( log.isDebugEnabled() )
{
- log.debug("closeImports() - closed");
+ log.debug( "closeImports() - closed" );
}
}
/**
* @see org.apache.maven.jxr.java.src.symtab.HasImports#isTopLevel()
*/
- boolean isTopLevel() {
+ boolean isTopLevel()
+ {
return packageName != null;
}
/**
* @see org.apache.maven.jxr.java.src.symtab.HasImports#setImports(org.apache.maven.jxr.java.src.symtab.JavaHashtable)
*/
- void setImports(JavaHashtable imports) {
+ void setImports( JavaHashtable imports )
+ {
load();
- ref.setImports(imports);
+ ref.setImports( imports );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#addImplementer(org.apache.maven.jxr.java.src.symtab.ClassDef)
*/
- void addImplementer(ClassDef def) {
+ void addImplementer( ClassDef def )
+ {
// load();
// ref.addImplementer(def);
@@ -275,7 +305,8 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#addSubclass(org.apache.maven.jxr.java.src.symtab.ClassDef)
*/
- void addSubclass(ClassDef subclass) {
+ void addSubclass( ClassDef subclass )
+ {
// load();
// ref.addSubclass(subclass);
@@ -284,103 +315,117 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#getImplementers()
*/
- public JavaVector getImplementers() {
+ public JavaVector getImplementers()
+ {
return null;
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#getSubClasses()
*/
- JavaVector getSubClasses() {
+ JavaVector getSubClasses()
+ {
return null;
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#generateReferences(java.io.FileWriter)
*/
- public void generateReferences(FileWriter output) {
+ public void generateReferences( FileWriter output )
+ {
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#generateTags(org.apache.maven.jxr.java.src.symtab.HTMLTagContainer)
*/
- public void generateTags(HTMLTagContainer tagList) {
+ public void generateTags( HTMLTagContainer tagList )
+ {
load();
- ref.generateTags(tagList);
+ ref.generateTags( tagList );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.Definition#addReference(org.apache.maven.jxr.java.src.symtab.Occurrence)
*/
- public void addReference(Occurrence occ) {
+ public void addReference( Occurrence occ )
+ {
load();
- ref.addReference(occ);
+ ref.addReference( occ );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#accept(org.apache.maven.jxr.java.src.symtab.Visitor)
*/
- public void accept(Visitor visitor) {
+ public void accept( Visitor visitor )
+ {
load();
- ref.accept(visitor);
+ ref.accept( visitor );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#writeExternal(java.io.ObjectOutput)
*/
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal( ObjectOutput out )
+ throws IOException
+ {
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("writeExternal(ObjectOutput) - getName()=" + getName());
+ log.debug( "writeExternal(ObjectOutput) - getName()=" + getName() );
}
- out.writeObject(getName());
- out.writeObject(packageName);
+ out.writeObject( getName() );
+ out.writeObject( packageName );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#readExternal(java.io.ObjectInput)
*/
- public void readExternal(ObjectInput in)
- throws IOException, ClassNotFoundException {
+ public void readExternal( ObjectInput in )
+ throws IOException, ClassNotFoundException
+ {
- setName((String) in.readObject());
+ setName( (String) in.readObject() );
packageName = (String) in.readObject();
- if (packageName == null) {
- throw new IOException("null packagename: " + getName());
+ if ( packageName == null )
+ {
+ throw new IOException( "null packagename: " + getName() );
}
}
/**
* load the class definition
*/
- private void load() {
+ private void load()
+ {
- if (packageName == null) {
- log.error( "null packageName, name=" + getName());
+ if ( packageName == null )
+ {
+ log.error( "null packageName, name=" + getName() );
}
- if (ref == null) {
- ref = ClassDef.findLoadedClass(packageName, getName());
+ if ( ref == null )
+ {
+ ref = ClassDef.findLoadedClass( packageName, getName() );
- if (ref == null) {
+ if ( ref == null )
+ {
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("load() - apparently not yet loaded: "+packageName+"."+getName());
+ log.debug( "load() - apparently not yet loaded: " + packageName + "." + getName() );
}
- PackageDef packageDef =
- SymbolTable.getSymbolTable().lookupPackage(packageName);
+ PackageDef packageDef = SymbolTable.getSymbolTable().lookupPackage( packageName );
- ref = packageDef.loadClassDef(getName());
+ ref = packageDef.loadClassDef( getName() );
}
}
- if (ref == null) {
- log.error("cannot load ClassDef for " + getName());
+ if ( ref == null )
+ {
+ log.error( "cannot load ClassDef for " + getName() );
}
}
Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/ClassTag.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/ClassTag.java?rev=584326&r1=584325&r2=584326&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/ClassTag.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/ClassTag.java Fri Oct 12 16:37:59 2007
@@ -1,3 +1,5 @@
+package org.apache.maven.jxr.java.src.symtab;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.maven.jxr.java.src.symtab;
import org.apache.maven.jxr.java.src.util.JSComparable;
@@ -23,7 +24,9 @@
*
* @version $Id: $
*/
-public class ClassTag implements JSComparable {
+public class ClassTag
+ implements JSComparable
+{
// ==========================================================================
// == Class Variables
@@ -44,7 +47,8 @@
*
* @return
*/
- public String getKey() {
+ public String getKey()
+ {
return _key;
}
@@ -53,7 +57,8 @@
*
* @return
*/
- public String getTag() {
+ public String getTag()
+ {
return _tag;
}
@@ -63,7 +68,8 @@
* @param key
* @param tag
*/
- ClassTag(String key, String tag) {
+ ClassTag( String key, String tag )
+ {
_key = key;
_tag = tag;
@@ -72,17 +78,19 @@
/**
* @see java.lang.Object#toString()
*/
- public String toString() {
+ public String toString()
+ {
return _tag;
}
/**
* @see org.apache.maven.jxr.java.src.util.JSComparable#compareTo(java.lang.Object)
*/
- public int compareTo(Object o) {
+ public int compareTo( Object o )
+ {
ClassTag t = (ClassTag) o;
- return _key.compareTo(t.getKey());
+ return _key.compareTo( t.getKey() );
}
}
Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/Definition.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/Definition.java?rev=584326&r1=584325&r2=584326&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/Definition.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/Definition.java Fri Oct 12 16:37:59 2007
@@ -1,3 +1,5 @@
+package org.apache.maven.jxr.java.src.symtab;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.maven.jxr.java.src.symtab;
import org.apache.log4j.Logger;
@@ -28,7 +29,9 @@
*
* @version $Id: $
*/
-public abstract class Definition implements Taggable, java.io.Serializable {
+public abstract class Definition
+ implements Taggable, java.io.Serializable
+{
/** Logger for this class */
private static final Logger log = Logger.getLogger( Definition.class );
@@ -60,7 +63,8 @@
*
* @return
*/
- public String getSourceName() {
+ public String getSourceName()
+ {
return _sourceName;
}
@@ -69,7 +73,8 @@
*
* @return
*/
- public String getRefName() {
+ public String getRefName()
+ {
return _refName;
}
@@ -80,7 +85,8 @@
/**
* Default constructor is public for deserialization.
*/
- public Definition() {
+ public Definition()
+ {
// create a new vector to keep track of references to this symbol
this.references = new JavaVector();
@@ -93,29 +99,34 @@
* @param occ
* @param parentScope
*/
- Definition(String name, // the symbol name
- Occurrence occ, // the location of its definition
- ScopedDef parentScope) { // scope containing the def
+ Definition( String name, // the symbol name
+ Occurrence occ, // the location of its definition
+ ScopedDef parentScope )
+ { // scope containing the def
this();
this.definition = occ;
this.parentScope = parentScope;
- if (name != null) {
+ if ( name != null )
+ {
this.name = name.intern();
- } else {
+ }
+ else
+ {
this.name = name;
}
- setupFileNames(occ);
+ setupFileNames( occ );
}
/**
* Method setupFileNames
*/
- protected void setupFileNames() {
- setupFileNames(definition);
+ protected void setupFileNames()
+ {
+ setupFileNames( definition );
}
/**
@@ -123,15 +134,15 @@
*
* @param occ
*/
- private void setupFileNames(Occurrence occ) {
+ private void setupFileNames( Occurrence occ )
+ {
- if ((occ != null) && (occ.getFile() != null)) {
+ if ( ( occ != null ) && ( occ.getFile() != null ) )
+ {
String fileName = occ.getFile().toString();
- String baseName =
- fileName.substring(fileName.lastIndexOf(File.separatorChar)
- + 1, fileName.length());
+ String baseName = fileName.substring( fileName.lastIndexOf( File.separatorChar ) + 1, fileName.length() );
- baseName = baseName.replace('.', '_');
+ baseName = baseName.replace( '.', '_' );
_refName = baseName + "_ref.html";
_sourceName = baseName + ".html";
@@ -146,17 +157,19 @@
*
* @param occ
*/
- void addReference(Occurrence occ) {
+ void addReference( Occurrence occ )
+ {
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("addReference(Occurrence) - Adding reference in:"+occ.getFile()+" to "+getQualifiedName());
+ log.debug( "addReference(Occurrence) - Adding reference in:" + occ.getFile() + " to " + getQualifiedName() );
}
- if (occ != null) {
- occ.setDefinition(this);
- references.addElement(occ);
- SymbolTable.addFileReference(occ);
+ if ( occ != null )
+ {
+ occ.setDefinition( this );
+ references.addElement( occ );
+ SymbolTable.addFileReference( occ );
}
}
@@ -166,7 +179,7 @@
* @param occ
* @return
*/
- public abstract HTMLTag getOccurrenceTag(Occurrence occ);
+ public abstract HTMLTag getOccurrenceTag( Occurrence occ );
/**
* Get a String representation of the location where this symbol
@@ -174,9 +187,11 @@
*
* @return
*/
- String getDef() {
+ String getDef()
+ {
- if (definition != null) {
+ if ( definition != null )
+ {
return definition.getLocation();
}
@@ -188,7 +203,8 @@
*
* @param name
*/
- protected void setName(String name) {
+ protected void setName( String name )
+ {
this.name = name;
}
@@ -197,9 +213,11 @@
*
* @return
*/
- public String getName() {
+ public String getName()
+ {
- if (name == null) {
+ if ( name == null )
+ {
return "~NO NAME~";
}
@@ -211,10 +229,12 @@
*
* @return
*/
- public Occurrence getOccurrence() {
+ public Occurrence getOccurrence()
+ {
- if ((definition != null) && (definition.getPackageName() == null)) {
- definition.setPackageName(getPackageName());
+ if ( ( definition != null ) && ( definition.getPackageName() == null ) )
+ {
+ definition.setPackageName( getPackageName() );
}
return definition;
@@ -225,7 +245,8 @@
*
* @param definition
*/
- protected void setOccurrence(Occurrence definition) {
+ protected void setOccurrence( Occurrence definition )
+ {
this.definition = definition;
}
@@ -234,7 +255,8 @@
*
* @return
*/
- public ScopedDef getParentScope() {
+ public ScopedDef getParentScope()
+ {
return parentScope;
}
@@ -245,16 +267,18 @@
*
* @return
*/
- public String getQualifiedName() {
+ public String getQualifiedName()
+ {
String nameToUse = name;
- if (name == null) {
+ if ( name == null )
+ {
nameToUse = "~NO NAME~";
}
- if ((getParentScope() != null)
- && !getParentScope().isDefaultOrBaseScope()) {
+ if ( ( getParentScope() != null ) && !getParentScope().isDefaultOrBaseScope() )
+ {
return getParentScope().getQualifiedName() + "." + nameToUse;
}
@@ -266,19 +290,22 @@
*
* @return
*/
- String getPackageName() {
+ String getPackageName()
+ {
ScopedDef d = getParentScope();
- if (d == null) {
+ if ( d == null )
+ {
return null;
}
- while (!(d instanceof PackageDef) && (d.getParentScope() != null)) {
+ while ( !( d instanceof PackageDef ) && ( d.getParentScope() != null ) )
+ {
d = d.getParentScope();
}
- return (d.getName());
+ return ( d.getName() );
}
/**
@@ -286,18 +313,20 @@
*
* @return
*/
- String getScopedClassName() {
+ String getScopedClassName()
+ {
String name;
ScopedDef d = getParentScope();
- if (!(d instanceof ClassDef)) {
+ if ( !( d instanceof ClassDef ) )
+ {
return getName();
}
name = d.getScopedClassName() + "." + getName();
- return (name);
+ return ( name );
}
/**
@@ -305,12 +334,14 @@
*
* @return
*/
- public String getPackagePath() {
+ public String getPackagePath()
+ {
String packageName = getPackageName();
- if (packageName != null) {
- packageName = packageName.replace('.', File.separatorChar);
+ if ( packageName != null )
+ {
+ packageName = packageName.replace( '.', File.separatorChar );
}
return packageName;
@@ -322,45 +353,51 @@
* @param o
* @return
*/
- String getRelativePath(Occurrence o) {
+ String getRelativePath( Occurrence o )
+ {
String newPath = "";
String packageName = null;
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("getRelativePath(Occurrence) - Package Name for "+getName()+"="+getPackageName());
- log.debug("getRelativePath(Occurrence) - Package Name for occurrence in "+o.getFile()+"="+o.getPackageName());
+ log.debug( "getRelativePath(Occurrence) - Package Name for " + getName() + "=" + getPackageName() );
+ log.debug( "getRelativePath(Occurrence) - Package Name for occurrence in " + o.getFile() + "="
+ + o.getPackageName() );
}
- if (o != null) {
+ if ( o != null )
+ {
packageName = o.getPackageName();
}
- if ((getPackageName() != null) && (packageName != null)
- && !getPackageName().equals(packageName)) {
+ if ( ( getPackageName() != null ) && ( packageName != null ) && !getPackageName().equals( packageName ) )
+ {
String pathName = getPackagePath();
- StringTokenizer st = new StringTokenizer(packageName, ".");
+ StringTokenizer st = new StringTokenizer( packageName, "." );
String backup = "";
int dirs = 0;
dirs = st.countTokens();
- for (int j = 0; j < dirs; j++) {
- backup = backup + "../" ;
+ for ( int j = 0; j < dirs; j++ )
+ {
+ backup = backup + "../";
}
newPath = backup + pathName + '/';
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("getRelativePath(Occurrence) - Packagename for ["+getName()+"]=["+getPackageName()+"]");
- log.debug("getRelativePath(Occurrence) - Occurrence in ["+o.getClassName()+"."+o.getMethodName()+"] in File ["+o.getFile()+"]=["+o.getPackageName()+"]");
- log.debug("getRelativePath(Occurrence) - NewPath ["+newPath+"]");
+ log.debug( "getRelativePath(Occurrence) - Packagename for [" + getName() + "]=[" + getPackageName()
+ + "]" );
+ log.debug( "getRelativePath(Occurrence) - Occurrence in [" + o.getClassName() + "."
+ + o.getMethodName() + "] in File [" + o.getFile() + "]=[" + o.getPackageName() + "]" );
+ log.debug( "getRelativePath(Occurrence) - NewPath [" + newPath + "]" );
}
}
- return (newPath);
+ return ( newPath );
}
/**
@@ -369,46 +406,49 @@
* @param o
* @return
*/
- String getOccurrencePath(Occurrence o) {
+ String getOccurrencePath( Occurrence o )
+ {
String occurrencePackageName = o.getPackageName();
String newPath = "";
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("getOccurrencePath(Occurrence) - Package Name for "+getName()+"="+getPackageName());
- log.debug("getOccurrencePath(Occurrence) - Package Name for occurrence in "+o.getFile()+"="+o.getPackageName());
+ log.debug( "getOccurrencePath(Occurrence) - Package Name for " + getName() + "=" + getPackageName() );
+ log.debug( "getOccurrencePath(Occurrence) - Package Name for occurrence in " + o.getFile() + "="
+ + o.getPackageName() );
}
- if ((getPackageName() != null) && (occurrencePackageName != null)
- && !getPackageName().equals(occurrencePackageName)) {
+ if ( ( getPackageName() != null ) && ( occurrencePackageName != null )
+ && !getPackageName().equals( occurrencePackageName ) )
+ {
// String occurrancePathName = o.getPackageName().replace('.',_separatorChar);
// StringTokenizer st = new StringTokenizer(occurrencePackageName,".");
- String occurrancePathName = o.getPackageName().replace('.',
- File.separatorChar);
+ String occurrancePathName = o.getPackageName().replace( '.', File.separatorChar );
String mePackageName = getPackageName();
- StringTokenizer st =
- new StringTokenizer(mePackageName, ".");
+ StringTokenizer st = new StringTokenizer( mePackageName, "." );
String backup = "";
int dirs = 0;
dirs = st.countTokens();
- for (int j = 0; j < dirs; j++) {
+ for ( int j = 0; j < dirs; j++ )
+ {
backup = backup + ".." + File.separatorChar;
}
newPath = backup + occurrancePathName + File.separatorChar;
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("getOccurrencePath(Occurrence) - Occurrence["+occurrencePackageName+"] me["+getPackageName()+"]");
- log.debug("getOccurrencePath(Occurrence) - newPath "+newPath);
+ log.debug( "getOccurrencePath(Occurrence) - Occurrence[" + occurrencePackageName + "] me["
+ + getPackageName() + "]" );
+ log.debug( "getOccurrencePath(Occurrence) - newPath " + newPath );
}
}
- return (newPath);
+ return ( newPath );
}
/**
@@ -420,7 +460,8 @@
* @param def
* @return
*/
- boolean isSuperClassOf(Definition def) {
+ boolean isSuperClassOf( Definition def )
+ {
return false;
}
@@ -429,7 +470,8 @@
*
* @return
*/
- public JavaVector getReferences() {
+ public JavaVector getReferences()
+ {
return references;
}
@@ -443,8 +485,9 @@
* @param type
* @return
*/
- Definition lookup(String name, Class type) {
- return lookup(name, -1, type);
+ Definition lookup( String name, Class type )
+ {
+ return lookup( name, -1, type );
}
/**
@@ -457,21 +500,23 @@
* @param type
* @return
*/
- Definition lookup(String name, int numParams, Class type) {
- throw new IllegalArgumentException("Can't lookup in a " + getClass());
+ Definition lookup( String name, int numParams, Class type )
+ {
+ throw new IllegalArgumentException( "Can't lookup in a " + getClass() );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.Taggable#generateTags(org.apache.maven.jxr.java.src.symtab.HTMLTagContainer)
*/
- public abstract void generateTags(HTMLTagContainer tagList);
+ public abstract void generateTags( HTMLTagContainer tagList );
/**
* Default implementation of accept method (Visitor design pattern).
*
* @param visitor
*/
- public void accept(Visitor visitor) {
+ public void accept( Visitor visitor )
+ {
}
/**
@@ -479,7 +524,8 @@
*
* @param output
*/
- public void generateReferences(FileWriter output) {
+ public void generateReferences( FileWriter output )
+ {
// Subclasses should override
}
@@ -490,7 +536,8 @@
*
* @param symbolTable
*/
- void resolveTypes(SymbolTable symbolTable) {
+ void resolveTypes( SymbolTable symbolTable )
+ {
}
/**
@@ -499,7 +546,8 @@
*
* @param symbolTable
*/
- void resolveRefs(SymbolTable symbolTable) {
+ void resolveRefs( SymbolTable symbolTable )
+ {
}
/**
@@ -508,7 +556,8 @@
*
* @param parentScope
*/
- void setParentScope(ScopedDef parentScope) {
+ void setParentScope( ScopedDef parentScope )
+ {
this.parentScope = parentScope;
}
@@ -517,7 +566,8 @@
*
* @return
*/
- String getClassScopeName() {
+ String getClassScopeName()
+ {
return getName();
}
@@ -528,9 +578,11 @@
* @param c a Class object or null. If null, always returns true.
* @return
*/
- protected boolean isA(Class c) {
+ protected boolean isA( Class c )
+ {
- if (c == null) {
+ if ( c == null )
+ {
return true;
}
@@ -543,8 +595,9 @@
* @param out
* @throws java.io.IOException
*/
- private void writeObject(java.io.ObjectOutputStream out)
- throws java.io.IOException {
+ private void writeObject( java.io.ObjectOutputStream out )
+ throws java.io.IOException
+ {
JavaVector saveRefs = references;
@@ -558,7 +611,8 @@
/**
* @see java.lang.Object#toString()
*/
- public String toString() {
+ public String toString()
+ {
return getClass().getName() + " [" + getQualifiedName() + "]";
}
}
Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/DummyClass.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/DummyClass.java?rev=584326&r1=584325&r2=584326&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/DummyClass.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/DummyClass.java Fri Oct 12 16:37:59 2007
@@ -1,3 +1,5 @@
+package org.apache.maven.jxr.java.src.symtab;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.maven.jxr.java.src.symtab;
import org.apache.log4j.Logger;
@@ -29,7 +30,10 @@
*
* @version $Id: $
*/
-public class DummyClass extends ClassDef implements Externalizable {
+public class DummyClass
+ extends ClassDef
+ implements Externalizable
+{
/** Logger for this class */
private static final Logger log = Logger.getLogger( DummyClass.class );
@@ -46,7 +50,8 @@
* Constructor to create a placeholder class object
* This version provides a means to set the package containing the class
*/
- public DummyClass() {
+ public DummyClass()
+ {
super();
@@ -59,8 +64,9 @@
* @param name
* @param occ
*/
- public DummyClass(String name, Occurrence occ) {
- super(name, occ, null, null, null);
+ public DummyClass( String name, Occurrence occ )
+ {
+ super( name, occ, null, null, null );
}
/**
@@ -71,9 +77,10 @@
* @param occ
* @param packageName
*/
- public DummyClass(String name, Occurrence occ, String packageName) {
+ public DummyClass( String name, Occurrence occ, String packageName )
+ {
- super(name, occ, null, null, null);
+ super( name, occ, null, null, null );
this.packageName = packageName;
}
@@ -83,42 +90,47 @@
*
* @return
*/
- public String getPackage() {
+ public String getPackage()
+ {
return packageName;
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#generateTags(org.apache.maven.jxr.java.src.symtab.HTMLTagContainer)
*/
- public void generateTags(HTMLTagContainer tagList) {
+ public void generateTags( HTMLTagContainer tagList )
+ {
if ( log.isInfoEnabled() )
{
- log.info( getQualifiedName() + " (Undefined Class/Interface)");
- log.info( getReferences());
+ log.info( getQualifiedName() + " (Undefined Class/Interface)" );
+ log.info( getReferences() );
}
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#writeExternal(java.io.ObjectOutput)
*/
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal( ObjectOutput out )
+ throws IOException
+ {
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("writeExternal(ObjectOutput) - getName()" + getName());
+ log.debug( "writeExternal(ObjectOutput) - getName()" + getName() );
}
- out.writeObject(getName());
- out.writeObject(packageName);
+ out.writeObject( getName() );
+ out.writeObject( packageName );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ClassDef#readExternal(java.io.ObjectInput)
*/
- public void readExternal(ObjectInput in)
- throws IOException, ClassNotFoundException {
+ public void readExternal( ObjectInput in )
+ throws IOException, ClassNotFoundException
+ {
- setName((String) in.readObject());
+ setName( (String) in.readObject() );
packageName = (String) in.readObject();
}
Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/HTMLTag.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/HTMLTag.java?rev=584326&r1=584325&r2=584326&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/HTMLTag.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/HTMLTag.java Fri Oct 12 16:37:59 2007
@@ -1,3 +1,5 @@
+package org.apache.maven.jxr.java.src.symtab;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.maven.jxr.java.src.symtab;
import java.io.File;
import java.util.StringTokenizer;
@@ -26,7 +27,9 @@
*
* @version $Id: $
*/
-public class HTMLTag implements JSComparable {
+public class HTMLTag
+ implements JSComparable
+{
// ==========================================================================
// == Class Variables
@@ -54,9 +57,13 @@
private int length;
public static int TYPE_NONE = 0;
+
public static int TYPE_COMMENT = 1;
+
public static int TYPE_LITERAL = 2;
+
public static int TYPE_KEYWORD = 3;
+
private int type = TYPE_NONE;
/** Field numBreaks */
@@ -74,7 +81,8 @@
*
* @return
*/
- public int getLine() {
+ public int getLine()
+ {
return line;
}
@@ -83,7 +91,8 @@
*
* @return
*/
- public int getStartColumn() {
+ public int getStartColumn()
+ {
return startColumn;
}
@@ -92,7 +101,8 @@
*
* @return
*/
- public int getEndColumn() {
+ public int getEndColumn()
+ {
return endColumn;
}
@@ -101,7 +111,8 @@
*
* @return
*/
- public File getFile() {
+ public File getFile()
+ {
return file;
}
@@ -110,7 +121,8 @@
*
* @return
*/
- public String getText() {
+ public String getText()
+ {
return replaceText;
}
@@ -119,7 +131,8 @@
*
* @return
*/
- public String getPackageName() {
+ public String getPackageName()
+ {
return packageName;
}
@@ -128,7 +141,8 @@
*
* @return
*/
- public int getLength() {
+ public int getLength()
+ {
return length;
}
@@ -137,8 +151,9 @@
*
* @return
*/
- public boolean isComment() {
- return (type == TYPE_COMMENT);
+ public boolean isComment()
+ {
+ return ( type == TYPE_COMMENT );
}
/**
@@ -146,8 +161,9 @@
*
* @return
*/
- public boolean isLiteral() {
- return (type == TYPE_LITERAL);
+ public boolean isLiteral()
+ {
+ return ( type == TYPE_LITERAL );
}
/**
@@ -155,8 +171,9 @@
*
* @return
*/
- public boolean isKeyword() {
- return (type == TYPE_KEYWORD);
+ public boolean isKeyword()
+ {
+ return ( type == TYPE_KEYWORD );
}
/**
@@ -164,7 +181,8 @@
*
* @return
*/
- public int getNumBreaks() {
+ public int getNumBreaks()
+ {
return numBreaks;
}
@@ -173,7 +191,8 @@
*
* @return
*/
- public int getOrigLength() {
+ public int getOrigLength()
+ {
return origLength;
}
@@ -184,7 +203,8 @@
* @param origText
* @param replaceText
*/
- HTMLTag(Occurrence o, String origText, String replaceText) {
+ HTMLTag( Occurrence o, String origText, String replaceText )
+ {
this.file = o.getFile();
this.line = o.getLine();
@@ -194,10 +214,11 @@
this.packageName = o.getPackageName();
this.numBreaks = 0;
- if (origText.indexOf("\r\n") > 0) {
- StringTokenizer st = new StringTokenizer(origText, "\r\n");
+ if ( origText.indexOf( "\r\n" ) > 0 )
+ {
+ StringTokenizer st = new StringTokenizer( origText, "\r\n" );
- numBreaks = Math.max(st.countTokens() - 1, 1);
+ numBreaks = Math.max( st.countTokens() - 1, 1 );
}
this.origLength = origText.length();
@@ -213,8 +234,8 @@
* @param origText
* @param replaceText
*/
- HTMLTag(File f, int l, int c, String packageName, String origText,
- String replaceText) {
+ HTMLTag( File f, int l, int c, String packageName, String origText, String replaceText )
+ {
this.file = f;
this.line = l;
@@ -224,10 +245,11 @@
this.packageName = packageName;
this.numBreaks = 0;
- if (origText.indexOf("\r\n") > 0) {
- StringTokenizer st = new StringTokenizer(origText, "\r\n");
+ if ( origText.indexOf( "\r\n" ) > 0 )
+ {
+ StringTokenizer st = new StringTokenizer( origText, "\r\n" );
- numBreaks = Math.max(st.countTokens() - 1, 1);
+ numBreaks = Math.max( st.countTokens() - 1, 1 );
}
this.origLength = origText.length();
@@ -242,7 +264,8 @@
* @param packageName
* @param length
*/
- HTMLTag(File f, int l, int c, String packageName, int length) {
+ HTMLTag( File f, int l, int c, String packageName, int length )
+ {
this.file = f;
this.line = l;
@@ -261,7 +284,8 @@
* @param packageName
* @param length
*/
- HTMLTag(File f, int l, int c, String packageName, int length, int type) {
+ HTMLTag( File f, int l, int c, String packageName, int length, int type )
+ {
this.file = f;
this.line = l;
@@ -274,27 +298,34 @@
/**
* @see java.lang.Object#toString()
*/
- public String toString() {
- return "HTMLTag [" + file + "," + line + "," + startColumn + "-"
- + endColumn + "," + replaceText + "]";
+ public String toString()
+ {
+ return "HTMLTag [" + file + "," + line + "," + startColumn + "-" + endColumn + "," + replaceText + "]";
}
/**
* @see org.apache.maven.jxr.java.src.util.JSComparable#compareTo(java.lang.Object)
*/
- public int compareTo(Object o) {
+ public int compareTo( Object o )
+ {
HTMLTag t = (HTMLTag) o;
- if (getLine() < t.getLine()) {
+ if ( getLine() < t.getLine() )
+ {
return -1;
- } else if (getLine() > t.getLine()) {
+ }
+ else if ( getLine() > t.getLine() )
+ {
return 1;
}
- if (getStartColumn() < t.getStartColumn()) {
+ if ( getStartColumn() < t.getStartColumn() )
+ {
return -1;
- } else if (getStartColumn() > t.getStartColumn()) {
+ }
+ else if ( getStartColumn() > t.getStartColumn() )
+ {
return 1;
}
Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/HTMLTagContainer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/HTMLTagContainer.java?rev=584326&r1=584325&r2=584326&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/HTMLTagContainer.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/HTMLTagContainer.java Fri Oct 12 16:37:59 2007
@@ -1,3 +1,5 @@
+package org.apache.maven.jxr.java.src.symtab;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.maven.jxr.java.src.symtab;
import java.io.File;
import java.util.Enumeration;
@@ -26,13 +27,15 @@
*
* @version $Id: $
*/
-public class HTMLTagContainer {
+public class HTMLTagContainer
+{
/**
* Constructor HTMLTagContainer
*/
- public HTMLTagContainer() {
- _fileTable = new Hashtable(10);
+ public HTMLTagContainer()
+ {
+ _fileTable = new Hashtable( 10 );
}
/**
@@ -40,7 +43,8 @@
*
* @return
*/
- public Hashtable getFileTable() {
+ public Hashtable getFileTable()
+ {
return _fileTable;
}
@@ -49,8 +53,9 @@
*
* @return
*/
- public Enumeration elements() {
- return (_fileTable.elements());
+ public Enumeration elements()
+ {
+ return ( _fileTable.elements() );
}
/**
@@ -58,18 +63,20 @@
*
* @param t
*/
- public void addElement(HTMLTag t) {
+ public void addElement( HTMLTag t )
+ {
File f = t.getFile();
- Vector tagList = (Vector) _fileTable.get(f);
+ Vector tagList = (Vector) _fileTable.get( f );
- if (tagList == null) {
- tagList = new Vector(20);
+ if ( tagList == null )
+ {
+ tagList = new Vector( 20 );
- _fileTable.put(f, tagList);
+ _fileTable.put( f, tagList );
}
- tagList.addElement(t);
+ tagList.addElement( t );
}
/** Field _fileTable */
Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/HasImports.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/HasImports.java?rev=584326&r1=584325&r2=584326&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/HasImports.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/HasImports.java Fri Oct 12 16:37:59 2007
@@ -1,3 +1,5 @@
+package org.apache.maven.jxr.java.src.symtab;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.maven.jxr.java.src.symtab;
import org.apache.log4j.Logger;
@@ -23,7 +24,9 @@
*
* @version $Id: $
*/
-abstract class HasImports extends ScopedDef {
+abstract class HasImports
+ extends ScopedDef
+{
/**
* Logger for this class
*/
@@ -43,7 +46,8 @@
/**
* Default constructor is public for deserialization.
*/
- public HasImports() {
+ public HasImports()
+ {
}
/**
@@ -53,10 +57,11 @@
* @param occ
* @param parentScope
*/
- HasImports(String name, // name of the symbol
- Occurrence occ, // where it's defined
- ScopedDef parentScope) { // which scope owns it
- super(name, occ, parentScope);
+ HasImports( String name, // name of the symbol
+ Occurrence occ, // where it's defined
+ ScopedDef parentScope )
+ { // which scope owns it
+ super( name, occ, parentScope );
}
/**
@@ -64,11 +69,12 @@
*
* @param symbolTable
*/
- void closeImports(SymbolTable symbolTable) {
+ void closeImports( SymbolTable symbolTable )
+ {
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("closeImports(SymbolTable) - SymbolTable symbolTable=" + symbolTable);
+ log.debug( "closeImports(SymbolTable) - SymbolTable symbolTable=" + symbolTable );
}
symbolTable.closeImports();
@@ -80,8 +86,9 @@
*
* @return
*/
- boolean isTopLevel() {
- return (getParentScope() instanceof PackageDef);
+ boolean isTopLevel()
+ {
+ return ( getParentScope() instanceof PackageDef );
}
/**
@@ -89,34 +96,37 @@
*
* @param symbolTable
*/
- void openImports(SymbolTable symbolTable) {
+ void openImports( SymbolTable symbolTable )
+ {
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("openImports(SymbolTable) - SymbolTable symbolTable=" + symbolTable);
+ log.debug( "openImports(SymbolTable) - SymbolTable symbolTable=" + symbolTable );
}
- symbolTable.openImports(imports);
+ symbolTable.openImports( imports );
}
/**
* @see org.apache.maven.jxr.java.src.symtab.ScopedDef#resolveTypes(org.apache.maven.jxr.java.src.symtab.SymbolTable)
*/
- void resolveTypes(SymbolTable symbolTable) {
+ void resolveTypes( SymbolTable symbolTable )
+ {
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("resolveTypes(SymbolTable) - SymbolTable symbolTable=" + symbolTable);
+ log.debug( "resolveTypes(SymbolTable) - SymbolTable symbolTable=" + symbolTable );
}
// this was commented out. Why?
// if (imports != null) // resolve imported classes/packages
// imports.resolveTypes(symbolTable);
- if (isTopLevel()) {
- openImports(symbolTable); // make them available for lookup
+ if ( isTopLevel() )
+ {
+ openImports( symbolTable ); // make them available for lookup
}
- super.resolveTypes(symbolTable); // resolve class/interface contents
+ super.resolveTypes( symbolTable ); // resolve class/interface contents
// closeImports() is done in class resolution
}
@@ -124,21 +134,23 @@
/**
* @see org.apache.maven.jxr.java.src.symtab.ScopedDef#resolveRefs(org.apache.maven.jxr.java.src.symtab.SymbolTable)
*/
- void resolveRefs(SymbolTable symbolTable) {
+ void resolveRefs( SymbolTable symbolTable )
+ {
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("resolveRefs(SymbolTable) - SymbolTable symbolTable=" + symbolTable);
+ log.debug( "resolveRefs(SymbolTable) - SymbolTable symbolTable=" + symbolTable );
}
// this was commented out. Why?
// if (imports != null) // resolve imported classes/packages
// imports.resolveRefs(symbolTable);
- if (isTopLevel()) {
- openImports(symbolTable); // make them available for lookup
+ if ( isTopLevel() )
+ {
+ openImports( symbolTable ); // make them available for lookup
}
- super.resolveRefs(symbolTable); // resolve class/interface contents
+ super.resolveRefs( symbolTable ); // resolve class/interface contents
// closeImports() is done in class resolution
}
@@ -148,7 +160,8 @@
*
* @param imports
*/
- void setImports(JavaHashtable imports) {
+ void setImports( JavaHashtable imports )
+ {
this.imports = imports;
}
}
Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/JavaHashtable.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/JavaHashtable.java?rev=584326&r1=584325&r2=584326&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/JavaHashtable.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/symtab/JavaHashtable.java Fri Oct 12 16:37:59 2007
@@ -1,3 +1,5 @@
+package org.apache.maven.jxr.java.src.symtab;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.maven.jxr.java.src.symtab;
import org.apache.log4j.Logger;
@@ -26,7 +27,9 @@
*
* @version $Id: $
*/
-class JavaHashtable extends java.util.Hashtable {
+class JavaHashtable
+ extends java.util.Hashtable
+{
private static final long serialVersionUID = 3317424596680650586L;
@@ -50,7 +53,8 @@
/**
* Constructor to create a new java hash table
*/
- JavaHashtable() {
+ JavaHashtable()
+ {
super();
}
@@ -59,12 +63,14 @@
*
* @param tagList
*/
- void tagElements(HTMLTagContainer tagList) {
+ void tagElements( HTMLTagContainer tagList )
+ {
Enumeration e = elements();
- while (e.hasMoreElements()) {
- ((Taggable) e.nextElement()).generateTags(tagList);
+ while ( e.hasMoreElements() )
+ {
+ ( (Taggable) e.nextElement() ).generateTags( tagList );
}
}
@@ -73,67 +79,73 @@
*
* @param symbolTable
*/
- void resolveTypes(SymbolTable symbolTable) {
+ void resolveTypes( SymbolTable symbolTable )
+ {
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("resolveTypes(SymbolTable) - SymbolTable symbolTable=" + symbolTable);
+ log.debug( "resolveTypes(SymbolTable) - SymbolTable symbolTable=" + symbolTable );
}
- if (!resolving) {
+ if ( !resolving )
+ {
resolving = true;
// walk through each element in the hash table
Enumeration e = elements();
- while (e.hasMoreElements()) {
+ while ( e.hasMoreElements() )
+ {
Definition d = (Definition) e.nextElement();
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("resolveTypes(SymbolTable) - resolving "+d.getName());
- log.debug("resolveTypes(SymbolTable) - className="+d.getClass().getName());
+ log.debug( "resolveTypes(SymbolTable) - resolving " + d.getName() );
+ log.debug( "resolveTypes(SymbolTable) - className=" + d.getClass().getName() );
}
// if the element is a Dummy class or dummy interface, we
// will replace it with the real definition
- if (d instanceof DummyClass) {
+ if ( d instanceof DummyClass )
+ {
if ( log.isInfoEnabled() )
{
- log.info( "Resolving DummyClass:" + d.getName());
+ log.info( "Resolving DummyClass:" + d.getName() );
}
Definition newD;
// get its package name and look up the class/interace
- String pkg = ((DummyClass) d).getPackage();
+ String pkg = ( (DummyClass) d ).getPackage();
if ( log.isInfoEnabled() )
{
- log.info( "pkg " + pkg);
+ log.info( "pkg " + pkg );
}
- newD = symbolTable.lookupDummy(d);
+ newD = symbolTable.lookupDummy( d );
if ( log.isInfoEnabled() )
{
- log.info( "newD = " + newD);
+ log.info( "newD = " + newD );
}
// if we found the class/interface,
// add a reference to it, and replace the current def
// with the one we found
- if (newD != null) {
- newD.addReference(d.getOccurrence());
- remove(d.getName());
- put(d.getName(), newD);
+ if ( newD != null )
+ {
+ newD.addReference( d.getOccurrence() );
+ remove( d.getName() );
+ put( d.getName(), newD );
}
}
// otherwise, ask it if it needs resolution
- else {
- d.resolveTypes(symbolTable);
+ else
+ {
+ d.resolveTypes( symbolTable );
}
}
}
@@ -144,23 +156,26 @@
*
* @param symbolTable
*/
- void resolveRefs(SymbolTable symbolTable) {
+ void resolveRefs( SymbolTable symbolTable )
+ {
- if (log.isDebugEnabled())
+ if ( log.isDebugEnabled() )
{
- log.debug("resolveRefs(SymbolTable) - SymbolTable symbolTable=" + symbolTable);
+ log.debug( "resolveRefs(SymbolTable) - SymbolTable symbolTable=" + symbolTable );
}
- if (!resolvingRefs) {
+ if ( !resolvingRefs )
+ {
resolvingRefs = true;
// walk through each element in the hash table
Enumeration e = elements();
- while (e.hasMoreElements()) {
+ while ( e.hasMoreElements() )
+ {
Definition d = (Definition) e.nextElement();
- d.resolveRefs(symbolTable);
+ d.resolveRefs( symbolTable );
}
}
}
@@ -171,14 +186,16 @@
*
* @param visitor
*/
- public void accept(Visitor visitor) {
+ public void accept( Visitor visitor )
+ {
Enumeration e = elements();
- while (e.hasMoreElements()) {
+ while ( e.hasMoreElements() )
+ {
Definition d = (Definition) e.nextElement();
- d.accept(visitor);
+ d.accept( visitor );
}
}
}