Last active
April 7, 2016 11:21
-
-
Save Wavefarer42/7cf48cc68cfe95c360efdf7604bf0411 to your computer and use it in GitHub Desktop.
Minimal Example of #572
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... imports ... | |
public class Issue572 { | |
@Test(expectedExceptions = SpoonClassNotFoundException.class) | |
public void GivenSubclassWithParentNotInClasspath_WhenSuperclass_ThenException() throws URISyntaxException { | |
final URL url = Issue572.class.getClassLoader().getResource("issue572"); | |
assert url != null; | |
SpoonAPI launcher = new Launcher(); | |
launcher.getEnvironment().setNoClasspath(true); | |
launcher.addInputResource(Paths.get(url.toURI()).toString()); | |
launcher.buildModel(); | |
TypeFactory factory = launcher.getFactory().Type(); | |
final CtType<?> subclass = factory.get("issue572.Subclass"); // returns Subclass | |
final CtTypeReference<?> superclass = subclass.getSuperclass(); // returns Superclass as TypeReference | |
final CtTypeReference<?> superSuperclass = superclass.getSuperclass(); // throws SpoonClassNotFoundException | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package issue572; | |
import other.pack.NoClasspathSuperclass; | |
class Subclass extends NoClasspathSuperclass{} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment