Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: clarify the contract of get(String) #3045

Merged
merged 6 commits into from
Jul 12, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/main/java/spoon/reflect/factory/TypeFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,13 @@ public <T> CtTypeReference<T> createReference(String qualifiedName) {
}

/**
* Gets a created type from its qualified name.
* Gets a created type from its qualified name if source in the source classpath.
monperrus marked this conversation as resolved.
Show resolved Hide resolved
*
* @return a found type or null if does not exist
* `TypeFactory#get(String)` returns null if the class is not in the source classpath (even if it is in the binary classpath).
* `TypeFactory#get(Class)` returns null if the class is neither in the source classpath nor in the binary classpath,
monperrus marked this conversation as resolved.
Show resolved Hide resolved
* and returns a [shadow class](http://spoon.gforge.inria.fr/reflection.html) if it is only in the binary classpath.
monperrus marked this conversation as resolved.
Show resolved Hide resolved
* Note that a shadow class has an empty method body, if you need a shadow class with method body, see [spoon-decompiler](https://github.com/INRIA/spoon/tree/master/spoon-decompiler))
nharrand marked this conversation as resolved.
Show resolved Hide resolved
* @return a type if source in the source classpath or null if does not exist
*/
@SuppressWarnings("unchecked")
public <T> CtType<T> get(final String qualifiedName) {
Expand Down