- Revision
- 1333
- Author
- rfscholte
- Date
- 2011-09-21 15:27:08 -0500 (Wed, 21 Sep 2011)
Log Message
prepare refactoring Type.resolve() to expose it as a utility method
Modified Paths
- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaMethodDelegate.java
- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java
Diff
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaMethodDelegate.java (1332 => 1333)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaMethodDelegate.java 2011-09-21 20:15:42 UTC (rev 1332) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/JavaMethodDelegate.java 2011-09-21 20:27:08 UTC (rev 1333) @@ -46,7 +46,7 @@ Type result = originalMethod.getReturnType( resolve ); if (result != null) { - result = result.resolve( originalMethod.getParentClass(), callingClass ); + result = Type.resolve( result, originalMethod.getParentClass(), callingClass ); //According to java-specs, if it could be resolved the upper boundary, so Object, should be returned if ( !resolve && !this.getReturns().getFullyQualifiedName().equals( result.getFullyQualifiedName() ) ) @@ -63,7 +63,7 @@ List<Type> result = new LinkedList<Type>(); for (Type type: originalMethod.getParameterTypes( resolve ) ) { - Type curType = type.resolve( originalMethod.getParentClass(), callingClass ); + Type curType = Type.resolve( type, originalMethod.getParentClass(), callingClass ); //According to java-specs, if it could be resolved the upper boundary, so Object, should be returned if ( !resolve && !type.getFullyQualifiedName().equals( curType.getFullyQualifiedName() ) ) {
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java (1332 => 1333)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java 2011-09-21 20:15:42 UTC (rev 1332) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/Type.java 2011-09-21 20:27:08 UTC (rev 1333) @@ -420,11 +420,11 @@ * @param callingClass * @return */ - protected Type resolve( JavaClass declaringClass, JavaClass callingClass ) + protected static Type resolve( Type base, JavaClass declaringClass, JavaClass callingClass ) { - Type result = this; + Type result = base; - int typeIndex = getTypeVariableIndex( declaringClass, this.getFullyQualifiedName() ); + int typeIndex = getTypeVariableIndex( declaringClass, base.getFullyQualifiedName() ); if ( typeIndex >= 0 ) { @@ -440,7 +440,7 @@ { if ( fqn.equals( implement.getFullyQualifiedName() ) ) { - result = implement.getActualTypeArguments().get( typeIndex ).resolve( implement, implement ); + result = resolve( implement.getActualTypeArguments().get( typeIndex ), implement, implement ); break; } } @@ -448,16 +448,16 @@ } } - if ( !this.getActualTypeArguments().isEmpty() ) + if ( !base.getActualTypeArguments().isEmpty() ) { result = - new Type( this.getFullyQualifiedName(), this.getValue(), this.getDimensions(), - this.getJavaClassParent() ); + new Type( base.getFullyQualifiedName(), base.getValue(), base.getDimensions(), + base.getJavaClassParent() ); List<Type> actualTypes = new LinkedList<Type>(); - for ( Type actualArgType : getActualTypeArguments() ) + for ( Type actualArgType : base.getActualTypeArguments() ) { - actualTypes.add( actualArgType.resolve( declaringClass, callingClass ) ); + actualTypes.add( resolve( actualArgType, declaringClass, callingClass ) ); } result.setActualArgumentTypes( actualTypes ); }
To unsubscribe from this list please visit:
