Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SI-8442 Ignore stub annotation symbols in
AnnotationInfo#matches
And update the java `ClassFileParser` to create distinguished `StubClassSymbol`s, rather that a regular `ClassSymbol`s, when encountering a deficient classpath. This brings it into line with `Unpickler`, which has done as much since a55788e. This stops the enclosed test case from crashing when determining if the absent symbol, `A_1`, is a subclass of `@deprecated`. This is ostensibly fixes a regression, although it only worked in `2.10.[0-3]` by a fluke: the class file parser's promiscious exception handling caught and recovered from the NPE introduced in SI-7439! % javac -d /tmp test/files/run/t8442/{A,B}_1.java && qbin/scalac -classpath /tmp -d /tmp test/files/run/t8442/C_2.scala && (rm /tmp/A_1.class; true) && scalac-hash v2.10.0 -classpath /tmp -d /tmp test/files/run/t8442/C_2.scala warning: Class A_1 not found - continuing with a stub. warning: Caught: java.lang.NullPointerException while parsing annotations in /tmp/B_1.class two warnings found
- Loading branch information
Showing
7 changed files
with
50 additions
and
4 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
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 @@ | ||
pos: NoPosition Class A_1 not found - continuing with a stub. WARNING |
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,4 @@ | ||
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) | ||
public @interface A_1 { | ||
|
||
} |
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,3 @@ | ||
public class B_1 { | ||
@A_1 public String get() { return ""; } | ||
} |
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,5 @@ | ||
class C_2 { | ||
def foo(b: B_1) { | ||
b.get() | ||
} | ||
} |
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,29 @@ | ||
import scala.tools.partest._ | ||
import java.io.File | ||
|
||
object Test extends StoreReporterDirectTest { | ||
def code = ??? | ||
|
||
def compileCode(code: String) = { | ||
val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") | ||
compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code) | ||
} | ||
|
||
def app = """ | ||
class C_2 { | ||
def foo(b: B_1) { | ||
b.get() | ||
} | ||
} | ||
""" | ||
|
||
def show(): Unit = { | ||
val tClass = new File(testOutput.path, "A_1.class") | ||
assert(tClass.exists) | ||
assert(tClass.delete()) | ||
|
||
// Expecting stub symbol warning, but no stack trace! | ||
compileCode(app) | ||
println(filteredInfos.mkString("\n")) | ||
} | ||
} |