-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling deeply nested java classes.
Without fix it reports dependencies to jar/classes produced by same project.
- Loading branch information
1 parent
8c4b996
commit e792676
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class NestedJavaClasses { | ||
public NestedJavaClasses nest() { | ||
return new NestedJavaClasses() { | ||
@Override | ||
public NestedJavaClasses nest() { | ||
return new NestedJavaClasses() { | ||
@Override | ||
public NestedJavaClasses nest() { | ||
throw new RuntimeException("Way too deep!"); | ||
} | ||
}; | ||
} | ||
}; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package sbt.inc | ||
|
||
import sbt.internal.inc.Analysis | ||
import sbt.io.IO | ||
|
||
class NestedJavaClassSpec extends BaseCompilerSpec { | ||
it should "handle nested Java classes" in { | ||
IO.withTemporaryDirectory { tempDir => | ||
val projectSetup = | ||
ProjectSetup.simple(tempDir.toPath, Seq("NestedJavaClasses.java")) | ||
|
||
val result = projectSetup.createCompiler().doCompile() | ||
result.analysis() match { | ||
case analysis: Analysis => | ||
analysis.relations.libraryDep._2s | ||
.filter(_.toPath.startsWith(tempDir.toPath)) shouldBe 'empty | ||
} | ||
} | ||
} | ||
} |