-
-
Notifications
You must be signed in to change notification settings - Fork 365
review: Fix: bug related with TypeReference generics in noclasspath #1609
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a4d7f41
Reproduce issue #1607
surli 05b69fd
Bug fix
surli 7fed851
Another bug fix
surli 530e447
Provide another more explicit test and change the bug fix
surli ab6e5cd
Use the typename instead of the parameterizedTypeName
surli d76d7ef
Add contract 1
surli fecee9c
Contract 2
surli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1230,4 +1230,25 @@ public void testImportStarredPackageWithNonVisibleClass() throws IOException { | |
|
||
assertEquals(3, cu.getImports().size()); | ||
} | ||
|
||
@Test | ||
public void testImportWithGenerics() throws IOException { | ||
final Launcher launcher = new Launcher(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. contract line: |
||
launcher.addInputResource("./src/test/resources/import-with-generics/TestWithGenerics.java"); | ||
launcher.getEnvironment().setAutoImports(true); | ||
launcher.getEnvironment().setShouldCompile(true); | ||
launcher.getEnvironment().setNoClasspath(true); | ||
launcher.setSourceOutputDirectory("./target/import-with-generics"); | ||
launcher.run(); | ||
|
||
PrettyPrinter prettyPrinter = launcher.createPrettyPrinter(); | ||
CtType element = launcher.getFactory().Class().get("spoon.test.imports.testclasses.TestWithGenerics"); | ||
List<CtType<?>> toPrint = new ArrayList<>(); | ||
toPrint.add(element); | ||
|
||
prettyPrinter.calculate(element.getPosition().getCompilationUnit(), toPrint); | ||
String output = prettyPrinter.getResult(); | ||
|
||
assertTrue(output.contains("import spoon.test.imports.testclasses.withgenerics.Target;")); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/test/resources/import-with-generics/TestWithGenerics.java
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package spoon.test.imports.testclasses; | ||
/** | ||
* Created by urli on 16/10/2017. | ||
*/ | ||
public class TestWithGenerics { | ||
public spoon.test.imports.testclasses.withgenerics.Target<Object, Object> myfields; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tdurieux could you review this piece of code: you introduce the condition in #1480 to fix another bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your patch is invalid, it brokes my test (and my test is good)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the bug is in getQualifiedName of jdt in my testcase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I saw that. Still working on it, I come back to you when tests are passing, I was a bit too confident on the first trial ;)